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 (__MINGW_PRINTF_FORMAT, i, j)))
19 #define PRINTF(i, j) __attribute__((format (gnu_printf, i, j)))
21 #define PRINTF(i, j) __attribute__((format (printf, i, j)))
23 #define NORETURN __attribute__((noreturn))
25 #define PRINTF(i, j)
26 #define NORETURN
29 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
31 #define stringify(s) stringify_(s)
32 #define stringify_(s) #s
45 static inline void *xmalloc(size_t len) in xmalloc() argument
47 void *new = malloc(len); in xmalloc()
55 static inline void *xrealloc(void *p, size_t len) in xrealloc() argument
57 void *new = realloc(p, len); in xrealloc()
60 die("realloc() failed (len=%zd)\n", len); in xrealloc()
66 extern char *xstrndup(const char *s, size_t len);
76 * or multiple strings each of non-zero length.
79 * @param len The string length including terminator
82 bool util_is_printable_string(const void *data, int len);
96 * @param filename The filename to read, or - for stdin
97 * @param len If non-NULL, the amount of data we managed to read
98 * @return Pointer to allocated buffer containing fdt, or NULL on error
100 char *utilfdt_read(const char *filename, size_t *len);
107 * @param filename The filename to read, or - for stdin
109 * @param len If non-NULL, the amount of data we managed to read
112 int utilfdt_read_err(const char *filename, char **buffp, size_t *len);
118 * @param filename The filename to write, or - for stdout
120 * @return 0 if ok, -1 on error
129 * @param filename The filename to write, or - for stdout
140 * hh or b 1 byte
155 * @param type Returns type found(s/d/u/x), or 0 if none
156 * @param size Returns size found(1,2,4,8) or 4 if none
157 * @return 0 if ok, -1 on error (no type given, or other invalid format)
162 * This is a usage message fragment for the -t option. It is the format
166 #define USAGE_TYPE_MSG \
169 "\t\thh or b=byte, h=2 byte, l=4 byte (default)";
175 * the data will be displayed either as cells (if len is a multiple of 4
176 * bytes) or bytes.
178 * If len is 0 then this function does nothing.
181 * @param len Length of property data
183 void utilfdt_print_data(const char *data, int len);
196 * @param errmsg If non-NULL, an error message to display
213 * @param errmsg If non-NULL, an error message to display
215 #define usage(errmsg) \
224 #define util_getopt_long() getopt_long(argc, argv, usage_short_opts, \
228 #define a_argument required_argument
231 #define USAGE_COMMON_SHORT_OPTS "hV"
234 #define USAGE_COMMON_LONG_OPTS \
240 #define USAGE_COMMON_OPTS_HELP \
246 #define case_USAGE_COMMON_FLAGS \