libubox
C utility functions for OpenWrt.
blob.h File Reference
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include "utils.h"

Go to the source code of this file.

Data Structures

struct  blob_attr
 
struct  blob_attr_info
 
struct  blob_buf
 

Macros

#define BLOB_COOKIE   0x01234567
 
#define BLOB_ATTR_ID_MASK   0x7f000000
 
#define BLOB_ATTR_ID_SHIFT   24
 
#define BLOB_ATTR_LEN_MASK   0x00ffffff
 
#define BLOB_ATTR_ALIGN   4
 
#define BLOB_ATTR_EXTENDED   0x80000000
 
#define blob_put_int8   blob_put_u8
 
#define blob_put_int16   blob_put_u16
 
#define blob_put_int32   blob_put_u32
 
#define blob_put_int64   blob_put_u64
 
#define __blob_for_each_attr(pos, attr, rem)
 
#define blob_for_each_attr(pos, attr, rem)
 
#define blob_for_each_attr_len(pos, attr, attr_len, rem)
 

Enumerations

enum  {
  BLOB_ATTR_UNSPEC , BLOB_ATTR_NESTED , BLOB_ATTR_BINARY , BLOB_ATTR_STRING ,
  BLOB_ATTR_INT8 , BLOB_ATTR_INT16 , BLOB_ATTR_INT32 , BLOB_ATTR_INT64 ,
  BLOB_ATTR_DOUBLE , BLOB_ATTR_LAST
}
 

Functions

struct blob_attr __attribute__ ((packed))
 
static void * blob_data (const struct blob_attr *attr)
 
static unsigned int blob_id (const struct blob_attr *attr)
 
static bool blob_is_extended (const struct blob_attr *attr)
 
static size_t blob_len (const struct blob_attr *attr)
 
static size_t blob_raw_len (const struct blob_attr *attr)
 
static size_t blob_pad_len (const struct blob_attr *attr)
 
static uint8_t blob_get_u8 (const struct blob_attr *attr)
 
static uint16_t blob_get_u16 (const struct blob_attr *attr)
 
static uint32_t blob_get_u32 (const struct blob_attr *attr)
 
static uint64_t blob_get_u64 (const struct blob_attr *attr)
 
static int8_t blob_get_int8 (const struct blob_attr *attr)
 
static int16_t blob_get_int16 (const struct blob_attr *attr)
 
static int32_t blob_get_int32 (const struct blob_attr *attr)
 
static int64_t blob_get_int64 (const struct blob_attr *attr)
 
static const char * blob_get_string (const struct blob_attr *attr)
 
static struct blob_attrblob_next (const struct blob_attr *attr)
 
void blob_fill_pad (struct blob_attr *attr)
 
void blob_set_raw_len (struct blob_attr *attr, unsigned int len)
 
bool blob_attr_equal (const struct blob_attr *a1, const struct blob_attr *a2)
 
int blob_buf_init (struct blob_buf *buf, int id)
 
void blob_buf_free (struct blob_buf *buf)
 
bool blob_buf_grow (struct blob_buf *buf, int required)
 
struct blob_attrblob_new (struct blob_buf *buf, int id, int payload)
 
void * blob_nest_start (struct blob_buf *buf, int id)
 
void blob_nest_end (struct blob_buf *buf, void *cookie)
 
struct blob_attrblob_put (struct blob_buf *buf, int id, const void *ptr, unsigned int len)
 
bool blob_check_type (const void *ptr, unsigned int len, int type)
 
int blob_parse (struct blob_attr *attr, struct blob_attr **data, const struct blob_attr_info *info, int max)
 
int blob_parse_untrusted (struct blob_attr *attr, size_t attr_len, struct blob_attr **data, const struct blob_attr_info *info, int max)
 
struct blob_attrblob_memdup (struct blob_attr *attr)
 
struct blob_attrblob_put_raw (struct blob_buf *buf, const void *ptr, unsigned int len)
 
static struct blob_attrblob_put_string (struct blob_buf *buf, int id, const char *str)
 
static struct blob_attrblob_put_u8 (struct blob_buf *buf, int id, uint8_t val)
 
static struct blob_attrblob_put_u16 (struct blob_buf *buf, int id, uint16_t val)
 
static struct blob_attrblob_put_u32 (struct blob_buf *buf, int id, uint32_t val)
 
static struct blob_attrblob_put_u64 (struct blob_buf *buf, int id, uint64_t val)
 

Variables

uint32_t id_len
 
char data []
 
struct blob_attr_info __attribute__
 

Macro Definition Documentation

◆ __blob_for_each_attr

#define __blob_for_each_attr (   pos,
  attr,
  rem 
)
Value:
for (pos = (struct blob_attr *) attr; \
rem >= sizeof(struct blob_attr) && (blob_pad_len(pos) <= rem) && \
(blob_pad_len(pos) >= sizeof(struct blob_attr)); \
rem -= blob_pad_len(pos), pos = blob_next(pos))
static size_t blob_pad_len(const struct blob_attr *attr)
Definition: blob.h:118
static struct blob_attr * blob_next(const struct blob_attr *attr)
Definition: blob.h:185
Definition: blob.h:52

Definition at line 244 of file blob.h.

◆ BLOB_ATTR_ALIGN

#define BLOB_ATTR_ALIGN   4

Definition at line 49 of file blob.h.

◆ BLOB_ATTR_EXTENDED

#define BLOB_ATTR_EXTENDED   0x80000000

Definition at line 50 of file blob.h.

◆ BLOB_ATTR_ID_MASK

#define BLOB_ATTR_ID_MASK   0x7f000000

Definition at line 46 of file blob.h.

◆ BLOB_ATTR_ID_SHIFT

#define BLOB_ATTR_ID_SHIFT   24

Definition at line 47 of file blob.h.

◆ BLOB_ATTR_LEN_MASK

#define BLOB_ATTR_LEN_MASK   0x00ffffff

Definition at line 48 of file blob.h.

◆ BLOB_COOKIE

#define BLOB_COOKIE   0x01234567

Definition at line 31 of file blob.h.

◆ blob_for_each_attr

#define blob_for_each_attr (   pos,
  attr,
  rem 
)
Value:
for (rem = attr ? blob_len(attr) : 0, \
pos = (struct blob_attr *) (attr ? blob_data(attr) : NULL); \
rem >= sizeof(struct blob_attr) && (blob_pad_len(pos) <= rem) && \
(blob_pad_len(pos) >= sizeof(struct blob_attr)); \
rem -= blob_pad_len(pos), pos = blob_next(pos))
static size_t blob_len(const struct blob_attr *attr)
Definition: blob.h:100
static void * blob_data(const struct blob_attr *attr)
Definition: blob.h:75

Definition at line 251 of file blob.h.

◆ blob_for_each_attr_len

#define blob_for_each_attr_len (   pos,
  attr,
  attr_len,
  rem 
)
Value:
for (rem = attr ? blob_len(attr) : 0, \
pos = (struct blob_attr *) (attr ? blob_data(attr) : NULL); \
rem >= sizeof(struct blob_attr) && rem < attr_len && (blob_pad_len(pos) <= rem) && \
(blob_pad_len(pos) >= sizeof(struct blob_attr)); \
rem -= blob_pad_len(pos), pos = blob_next(pos))

Definition at line 258 of file blob.h.

◆ blob_put_int16

#define blob_put_int16   blob_put_u16

Definition at line 240 of file blob.h.

◆ blob_put_int32

#define blob_put_int32   blob_put_u32

Definition at line 241 of file blob.h.

◆ blob_put_int64

#define blob_put_int64   blob_put_u64

Definition at line 242 of file blob.h.

◆ blob_put_int8

#define blob_put_int8   blob_put_u8

Definition at line 239 of file blob.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
BLOB_ATTR_UNSPEC 
BLOB_ATTR_NESTED 
BLOB_ATTR_BINARY 
BLOB_ATTR_STRING 
BLOB_ATTR_INT8 
BLOB_ATTR_INT16 
BLOB_ATTR_INT32 
BLOB_ATTR_INT64 
BLOB_ATTR_DOUBLE 
BLOB_ATTR_LAST 

Definition at line 33 of file blob.h.

33  {
44 };
@ BLOB_ATTR_INT16
Definition: blob.h:39
@ BLOB_ATTR_STRING
Definition: blob.h:37
@ BLOB_ATTR_UNSPEC
Definition: blob.h:34
@ BLOB_ATTR_LAST
Definition: blob.h:43
@ BLOB_ATTR_INT64
Definition: blob.h:41
@ BLOB_ATTR_DOUBLE
Definition: blob.h:42
@ BLOB_ATTR_BINARY
Definition: blob.h:36
@ BLOB_ATTR_NESTED
Definition: blob.h:35
@ BLOB_ATTR_INT32
Definition: blob.h:40
@ BLOB_ATTR_INT8
Definition: blob.h:38

Function Documentation

◆ __attribute__()

struct blob_attr __attribute__ ( (packed)  )

◆ blob_attr_equal()

bool blob_attr_equal ( const struct blob_attr a1,
const struct blob_attr a2 
)

Definition at line 311 of file blob.c.

312 {
313  if (!a1 && !a2)
314  return true;
315 
316  if (!a1 || !a2)
317  return false;
318 
319  if (blob_pad_len(a1) != blob_pad_len(a2))
320  return false;
321 
322  return !memcmp(a1, a2, blob_pad_len(a1));
323 }
Here is the call graph for this function:

◆ blob_buf_free()

void blob_buf_free ( struct blob_buf buf)

Definition at line 104 of file blob.c.

105 {
106  free(buf->buf);
107  buf->buf = NULL;
108  buf->head = NULL;
109  buf->buflen = 0;
110 }
void * buf
Definition: blob.h:68
int buflen
Definition: blob.h:67
struct blob_attr * head
Definition: blob.h:65
Here is the caller graph for this function:

◆ blob_buf_grow()

bool blob_buf_grow ( struct blob_buf buf,
int  required 
)

Definition at line 57 of file blob.c.

58 {
59  int offset_head = attr_to_offset(buf, buf->head);
60 
61  if ((buf->buflen + required) > BLOB_ATTR_LEN_MASK)
62  return false;
63  if (!buf->grow || !buf->grow(buf, required))
64  return false;
65 
66  buf->head = offset_to_attr(buf, offset_head);
67  return true;
68 }
static int attr_to_offset(struct blob_buf *buf, struct blob_attr *attr)
Definition: blob.c:51
static struct blob_attr * offset_to_attr(struct blob_buf *buf, int offset)
Definition: blob.c:44
#define BLOB_ATTR_LEN_MASK
Definition: blob.h:48
bool(* grow)(struct blob_buf *buf, int minlen)
Definition: blob.h:66
Here is the call graph for this function:
Here is the caller graph for this function:

◆ blob_buf_init()

int blob_buf_init ( struct blob_buf buf,
int  id 
)

Definition at line 91 of file blob.c.

92 {
93  if (!buf->grow)
94  buf->grow = blob_buffer_grow;
95 
96  buf->head = buf->buf;
97  if (blob_add(buf, buf->buf, id, 0) == NULL)
98  return -ENOMEM;
99 
100  return 0;
101 }
static bool blob_buffer_grow(struct blob_buf *buf, int minlen)
Definition: blob.c:22
static struct blob_attr * blob_add(struct blob_buf *buf, struct blob_attr *pos, int id, int payload)
Definition: blob.c:71
Here is the call graph for this function:
Here is the caller graph for this function:

◆ blob_check_type()

bool blob_check_type ( const void *  ptr,
unsigned int  len,
int  type 
)

Definition at line 202 of file blob.c.

203 {
204  const char *data = ptr;
205 
206  if (type >= BLOB_ATTR_LAST)
207  return false;
208 
209  if (type >= BLOB_ATTR_INT8 && type <= BLOB_ATTR_INT64) {
210  if (len != blob_type_minlen[type])
211  return false;
212  } else {
213  if (len < blob_type_minlen[type])
214  return false;
215  }
216 
217  if (type == BLOB_ATTR_STRING && data[len - 1] != 0)
218  return false;
219 
220  return true;
221 }
static const size_t blob_type_minlen[BLOB_ATTR_LAST]
Definition: blob.c:192
char data[]
Definition: blob.h:1
uint8_t type
Definition: udebug-proto.h:0
Here is the caller graph for this function:

◆ blob_data()

static void* blob_data ( const struct blob_attr attr)
inlinestatic

Definition at line 75 of file blob.h.

76 {
77  return (void *) attr->data;
78 }
char data[]
Definition: blob.h:54
Here is the caller graph for this function:

◆ blob_fill_pad()

void blob_fill_pad ( struct blob_attr attr)

Definition at line 113 of file blob.c.

114 {
115  char *buf = (char *) attr;
116  int len = blob_pad_len(attr);
117  int delta = len - blob_raw_len(attr);
118 
119  if (delta > 0)
120  memset(buf + len - delta, 0, delta);
121 }
static size_t blob_raw_len(const struct blob_attr *attr)
Definition: blob.h:109
Here is the call graph for this function:
Here is the caller graph for this function:

◆ blob_get_int16()

static int16_t blob_get_int16 ( const struct blob_attr attr)
inlinestatic

Definition at line 161 of file blob.h.

162 {
163  return blob_get_u16(attr);
164 }
static uint16_t blob_get_u16(const struct blob_attr *attr)
Definition: blob.h:132
Here is the call graph for this function:

◆ blob_get_int32()

static int32_t blob_get_int32 ( const struct blob_attr attr)
inlinestatic

Definition at line 167 of file blob.h.

168 {
169  return blob_get_u32(attr);
170 }
static uint32_t blob_get_u32(const struct blob_attr *attr)
Definition: blob.h:139
Here is the call graph for this function:

◆ blob_get_int64()

static int64_t blob_get_int64 ( const struct blob_attr attr)
inlinestatic

Definition at line 173 of file blob.h.

174 {
175  return blob_get_u64(attr);
176 }
static uint64_t blob_get_u64(const struct blob_attr *attr)
Definition: blob.h:146
Here is the call graph for this function:

◆ blob_get_int8()

static int8_t blob_get_int8 ( const struct blob_attr attr)
inlinestatic

Definition at line 155 of file blob.h.

156 {
157  return blob_get_u8(attr);
158 }
static uint8_t blob_get_u8(const struct blob_attr *attr)
Definition: blob.h:126
Here is the call graph for this function:

◆ blob_get_string()

static const char* blob_get_string ( const struct blob_attr attr)
inlinestatic

Definition at line 179 of file blob.h.

180 {
181  return attr->data;
182 }

◆ blob_get_u16()

static uint16_t blob_get_u16 ( const struct blob_attr attr)
inlinestatic

Definition at line 132 of file blob.h.

133 {
134  uint16_t *tmp = (uint16_t*)attr->data;
135  return be16_to_cpu(*tmp);
136 }
#define be16_to_cpu(x)
Definition: utils.h:168
Here is the caller graph for this function:

◆ blob_get_u32()

static uint32_t blob_get_u32 ( const struct blob_attr attr)
inlinestatic

Definition at line 139 of file blob.h.

140 {
141  uint32_t *tmp = (uint32_t*)attr->data;
142  return be32_to_cpu(*tmp);
143 }
#define be32_to_cpu(x)
Definition: utils.h:167
Here is the caller graph for this function:

◆ blob_get_u64()

static uint64_t blob_get_u64 ( const struct blob_attr attr)
inlinestatic

Definition at line 146 of file blob.h.

147 {
148  uint32_t *ptr = (uint32_t *) blob_data(attr);
149  uint64_t tmp = ((uint64_t) be32_to_cpu(ptr[0])) << 32;
150  tmp |= be32_to_cpu(ptr[1]);
151  return tmp;
152 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ blob_get_u8()

static uint8_t blob_get_u8 ( const struct blob_attr attr)
inlinestatic

Definition at line 126 of file blob.h.

127 {
128  return *((uint8_t *) attr->data);
129 }
Here is the caller graph for this function:

◆ blob_id()

static unsigned int blob_id ( const struct blob_attr attr)
inlinestatic

Definition at line 84 of file blob.h.

85 {
87  return id;
88 }
#define BLOB_ATTR_ID_MASK
Definition: blob.h:46
#define BLOB_ATTR_ID_SHIFT
Definition: blob.h:47
uint32_t id_len
Definition: blob.h:53
uint32_t id
Definition: udebug-proto.h:2
Here is the caller graph for this function:

◆ blob_is_extended()

static bool blob_is_extended ( const struct blob_attr attr)
inlinestatic

Definition at line 91 of file blob.h.

92 {
93  return !!(attr->id_len & cpu_to_be32(BLOB_ATTR_EXTENDED));
94 }
#define BLOB_ATTR_EXTENDED
Definition: blob.h:50
#define cpu_to_be32(x)
Definition: utils.h:163
Here is the caller graph for this function:

◆ blob_len()

static size_t blob_len ( const struct blob_attr attr)
inlinestatic

Definition at line 100 of file blob.h.

101 {
102  return (be32_to_cpu(attr->id_len) & BLOB_ATTR_LEN_MASK) - sizeof(struct blob_attr);
103 }
Here is the caller graph for this function:

◆ blob_memdup()

struct blob_attr* blob_memdup ( struct blob_attr attr)

Definition at line 326 of file blob.c.

327 {
328  struct blob_attr *ret;
329  int size = blob_pad_len(attr);
330 
331  ret = malloc(size);
332  if (!ret)
333  return NULL;
334 
335  memcpy(ret, attr, size);
336  return ret;
337 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ blob_nest_end()

void blob_nest_end ( struct blob_buf buf,
void *  cookie 
)

Definition at line 185 of file blob.c.

186 {
187  struct blob_attr *attr = offset_to_attr(buf, (unsigned long) cookie);
188  blob_set_raw_len(attr, blob_pad_len(attr) + blob_len(buf->head));
189  buf->head = attr;
190 }
void blob_set_raw_len(struct blob_attr *attr, unsigned int len)
Definition: blob.c:124
Here is the call graph for this function:
Here is the caller graph for this function:

◆ blob_nest_start()

void* blob_nest_start ( struct blob_buf buf,
int  id 
)

Definition at line 175 of file blob.c.

176 {
177  unsigned long offset = attr_to_offset(buf, buf->head);
178  buf->head = blob_new(buf, id, 0);
179  if (!buf->head)
180  return NULL;
181  return (void *) offset;
182 }
struct blob_attr * blob_new(struct blob_buf *buf, int id, int payload)
Definition: blob.c:132
Here is the call graph for this function:

◆ blob_new()

struct blob_attr* blob_new ( struct blob_buf buf,
int  id,
int  payload 
)

Definition at line 132 of file blob.c.

133 {
134  struct blob_attr *attr;
135 
136  attr = blob_add(buf, blob_next(buf->head), id, payload);
137  if (!attr)
138  return NULL;
139 
140  blob_set_raw_len(buf->head, blob_pad_len(buf->head) + blob_pad_len(attr));
141  return attr;
142 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ blob_next()

static struct blob_attr* blob_next ( const struct blob_attr attr)
inlinestatic

Definition at line 185 of file blob.h.

186 {
187  return (struct blob_attr *) ((char *) attr + blob_pad_len(attr));
188 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ blob_pad_len()

static size_t blob_pad_len ( const struct blob_attr attr)
inlinestatic

Definition at line 118 of file blob.h.

119 {
120  unsigned int len = blob_raw_len(attr);
121  len = (len + BLOB_ATTR_ALIGN - 1) & ~(BLOB_ATTR_ALIGN - 1);
122  return len;
123 }
#define BLOB_ATTR_ALIGN
Definition: blob.h:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ blob_parse()

int blob_parse ( struct blob_attr attr,
struct blob_attr **  data,
const struct blob_attr_info info,
int  max 
)

Definition at line 296 of file blob.c.

297 {
298  struct blob_attr *pos;
299  int found = 0;
300  size_t rem;
301 
302  memset(data, 0, sizeof(struct blob_attr *) * max);
303  blob_for_each_attr(pos, attr, rem) {
304  found += blob_parse_attr(pos, rem, data, info, max);
305  }
306 
307  return found;
308 }
static int blob_parse_attr(struct blob_attr *attr, size_t attr_len, struct blob_attr **data, const struct blob_attr_info *info, int max)
Definition: blob.c:224
#define blob_for_each_attr(pos, attr, rem)
Definition: blob.h:251
Here is the call graph for this function:

◆ blob_parse_untrusted()

int blob_parse_untrusted ( struct blob_attr attr,
size_t  attr_len,
struct blob_attr **  data,
const struct blob_attr_info info,
int  max 
)

Definition at line 272 of file blob.c.

273 {
274  struct blob_attr *pos;
275  size_t len = 0;
276  int found = 0;
277  size_t rem;
278 
279  if (!attr || attr_len < sizeof(struct blob_attr))
280  return 0;
281 
282  len = blob_raw_len(attr);
283  if (attr_len < len)
284  return 0;
285 
286  memset(data, 0, sizeof(struct blob_attr *) * max);
287  blob_for_each_attr_len(pos, attr, len, rem) {
288  found += blob_parse_attr(pos, rem, data, info, max);
289  }
290 
291  return found;
292 }
#define blob_for_each_attr_len(pos, attr, attr_len, rem)
Definition: blob.h:258
Here is the call graph for this function:
Here is the caller graph for this function:

◆ blob_put()

struct blob_attr* blob_put ( struct blob_buf buf,
int  id,
const void *  ptr,
unsigned int  len 
)

Definition at line 161 of file blob.c.

162 {
163  struct blob_attr *attr;
164 
165  attr = blob_new(buf, id, len);
166  if (!attr)
167  return NULL;
168 
169  if (ptr)
170  memcpy(blob_data(attr), ptr, len);
171  return attr;
172 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ blob_put_raw()

struct blob_attr* blob_put_raw ( struct blob_buf buf,
const void *  ptr,
unsigned int  len 
)

Definition at line 145 of file blob.c.

146 {
147  struct blob_attr *attr;
148 
149  if (len < sizeof(struct blob_attr) || !ptr)
150  return NULL;
151 
152  attr = blob_add(buf, blob_next(buf->head), 0, len - sizeof(struct blob_attr));
153  if (!attr)
154  return NULL;
155  blob_set_raw_len(buf->head, blob_pad_len(buf->head) + len);
156  memcpy(attr, ptr, len);
157  return attr;
158 }
Here is the call graph for this function:

◆ blob_put_string()

static struct blob_attr* blob_put_string ( struct blob_buf buf,
int  id,
const char *  str 
)
inlinestatic

Definition at line 207 of file blob.h.

208 {
209  return blob_put(buf, id, str, strlen(str) + 1);
210 }
struct blob_attr * blob_put(struct blob_buf *buf, int id, const void *ptr, unsigned int len)
Definition: blob.c:161
Here is the call graph for this function:

◆ blob_put_u16()

static struct blob_attr* blob_put_u16 ( struct blob_buf buf,
int  id,
uint16_t  val 
)
inlinestatic

Definition at line 219 of file blob.h.

220 {
221  val = cpu_to_be16(val);
222  return blob_put(buf, id, &val, sizeof(val));
223 }
#define cpu_to_be16(x)
Definition: utils.h:164
Here is the call graph for this function:

◆ blob_put_u32()

static struct blob_attr* blob_put_u32 ( struct blob_buf buf,
int  id,
uint32_t  val 
)
inlinestatic

Definition at line 226 of file blob.h.

227 {
228  val = cpu_to_be32(val);
229  return blob_put(buf, id, &val, sizeof(val));
230 }
Here is the call graph for this function:

◆ blob_put_u64()

static struct blob_attr* blob_put_u64 ( struct blob_buf buf,
int  id,
uint64_t  val 
)
inlinestatic

Definition at line 233 of file blob.h.

234 {
235  val = cpu_to_be64(val);
236  return blob_put(buf, id, &val, sizeof(val));
237 }
#define cpu_to_be64(x)
Definition: utils.h:162
Here is the call graph for this function:

◆ blob_put_u8()

static struct blob_attr* blob_put_u8 ( struct blob_buf buf,
int  id,
uint8_t  val 
)
inlinestatic

Definition at line 213 of file blob.h.

214 {
215  return blob_put(buf, id, &val, sizeof(val));
216 }
Here is the call graph for this function:

◆ blob_raw_len()

static size_t blob_raw_len ( const struct blob_attr attr)
inlinestatic

Definition at line 109 of file blob.h.

110 {
111  return blob_len(attr) + sizeof(struct blob_attr);
112 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ blob_set_raw_len()

void blob_set_raw_len ( struct blob_attr attr,
unsigned int  len 
)

Definition at line 124 of file blob.c.

125 {
126  len &= BLOB_ATTR_LEN_MASK;
128  attr->id_len |= cpu_to_be32(len);
129 }
Here is the caller graph for this function:

Variable Documentation

◆ __attribute__

__attribute__

Definition at line 107 of file ulog.c.

109 {
110  FILE *out = stderr;
111 
112  if (_ulog_ident)
113  fprintf(out, "%s: ", _ulog_ident);
114 
115  vfprintf(out, fmt, ap);
116 }
FILE(GLOB test_cases "test-*.c") MACRO(ADD_FUZZER_TEST name) ADD_EXECUTABLE($
Definition: CMakeLists.txt:1
static const char * _ulog_ident
Definition: ulog.c:31

◆ data

char data[]

Definition at line 1 of file blob.h.

◆ id_len

uint32_t id_len

Definition at line 0 of file blob.h.