Lines Matching +full:len +full:- +full:or +full:- +full:define
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #define UTIL_H
17 #define PRINTF(i, j) __attribute__((format (printf, i, j)))
19 #define PRINTF(i, j) __attribute__((format (gnu_printf, i, j)))
21 #define NORETURN __attribute__((noreturn))
23 #define PRINTF(i, j)
24 #define NORETURN
27 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
29 #define stringify(s) stringify_(s)
30 #define stringify_(s) #s
43 static inline void *xmalloc(size_t len) in xmalloc() argument
45 void *new = malloc(len); in xmalloc()
53 static inline void *xrealloc(void *p, size_t len) in xrealloc() argument
55 void *new = realloc(p, len); in xrealloc()
58 die("realloc() failed (len=%zd)\n", len); in xrealloc()
73 * or multiple strings each of non-zero length.
76 * @param len The string length including terminator
79 bool util_is_printable_string(const void *data, int len);
93 * @param filename The filename to read, or - for stdin
94 * @param len If non-NULL, the amount of data we managed to read
95 * @return Pointer to allocated buffer containing fdt, or NULL on error
97 char *utilfdt_read(const char *filename, size_t *len);
104 * @param filename The filename to read, or - for stdin
106 * @param len If non-NULL, the amount of data we managed to read
109 int utilfdt_read_err(const char *filename, char **buffp, size_t *len);
115 * @param filename The filename to write, or - for stdout
117 * @return 0 if ok, -1 on error
126 * @param filename The filename to write, or - for stdout
137 * hh or b 1 byte
151 * @param type Returns type found(s/d/u/x), or 0 if none
152 * @param size Returns size found(1,2,4,8) or 4 if none
153 * @return 0 if ok, -1 on error (no type given, or other invalid format)
158 * This is a usage message fragment for the -t option. It is the format
162 #define USAGE_TYPE_MSG \
165 "\t\thh or b=byte, h=2 byte, l=4 byte (default)";
171 * the data will be displayed either as cells (if len is a multiple of 4
172 * bytes) or bytes.
174 * If len is 0 then this function does nothing.
177 * @param len Length of property data
179 void utilfdt_print_data(const char *data, int len);
192 * @param errmsg If non-NULL, an error message to display
209 * @param errmsg If non-NULL, an error message to display
211 #define usage(errmsg) \
220 #define util_getopt_long() getopt_long(argc, argv, usage_short_opts, \
224 #define a_argument required_argument
227 #define USAGE_COMMON_SHORT_OPTS "hV"
230 #define USAGE_COMMON_LONG_OPTS \
236 #define USAGE_COMMON_OPTS_HELP \
242 #define case_USAGE_COMMON_FLAGS \