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 (gnu_printf, i, j)))
19 #define PRINTF(i, j) __attribute__((format (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()
64 extern char *xstrndup(const char *s, size_t len);
74 * or multiple strings each of non-zero length.
77 * @param len The string length including terminator
80 bool util_is_printable_string(const void *data, int len);
94 * @param filename The filename to read, or - for stdin
95 * @param len If non-NULL, the amount of data we managed to read
96 * @return Pointer to allocated buffer containing fdt, or NULL on error
98 char *utilfdt_read(const char *filename, size_t *len);
105 * @param filename The filename to read, or - for stdin
107 * @param len If non-NULL, the amount of data we managed to read
110 int utilfdt_read_err(const char *filename, char **buffp, size_t *len);
116 * @param filename The filename to write, or - for stdout
118 * @return 0 if ok, -1 on error
127 * @param filename The filename to write, or - for stdout
138 * hh or b 1 byte
153 * @param type Returns type found(s/d/u/x), or 0 if none
154 * @param size Returns size found(1,2,4,8) or 4 if none
155 * @return 0 if ok, -1 on error (no type given, or other invalid format)
160 * This is a usage message fragment for the -t option. It is the format
164 #define USAGE_TYPE_MSG \
167 "\t\thh or b=byte, h=2 byte, l=4 byte (default)";
173 * the data will be displayed either as cells (if len is a multiple of 4
174 * bytes) or bytes.
176 * If len is 0 then this function does nothing.
179 * @param len Length of property data
181 void utilfdt_print_data(const char *data, int len);
194 * @param errmsg If non-NULL, an error message to display
211 * @param errmsg If non-NULL, an error message to display
213 #define usage(errmsg) \
222 #define util_getopt_long() getopt_long(argc, argv, usage_short_opts, \
226 #define a_argument required_argument
229 #define USAGE_COMMON_SHORT_OPTS "hV"
232 #define USAGE_COMMON_LONG_OPTS \
238 #define USAGE_COMMON_OPTS_HELP \
244 #define case_USAGE_COMMON_FLAGS \