Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
util.h File Reference
#include <stdarg.h>

Go to the source code of this file.

Macros

#define USAGE_TYPE_MSG
 

Functions

static void va_start (ap, str)
 
 fprintf (stderr,"FATAL ERROR: ")
 
 vfprintf (stderr, str, ap)
 
 exit (1)
 
charxstrdup (const char *s)
 
charjoin_path (const char *path, const char *name)
 
int util_is_printable_string (const void *data, int len)
 
char get_escape_char (const char *s, int *i)
 
charutilfdt_read (const char *filename)
 
int utilfdt_read_err (const char *filename, char **buffp)
 
int utilfdt_write (const char *filename, const void *blob)
 
int utilfdt_write_err (const char *filename, const void *blob)
 
int utilfdt_decode_type (const char *fmt, int *type, int *size)
 

Macro Definition Documentation

#define USAGE_TYPE_MSG
Value:
"<type>\ts=string, i=int, u=unsigned, x=hex\n" \
"\tOptional modifier prefix:\n" \
"\t\thh or b=byte, h=2 byte, l=4 byte (default)\n";

Definition at line 148 of file util.h.

Function Documentation

exit ( )
fprintf ( stderr  ,
"FATAL ERROR: "   
)
char get_escape_char ( const char s,
int i 
)

Definition at line 142 of file util.c.

char* join_path ( const char path,
const char name 
)

Definition at line 48 of file util.c.

int util_is_printable_string ( const void data,
int  len 
)

Check a string of a given length to see if it is all printable and has a valid terminator.

Parameters
dataThe string to check
lenThe string length including terminator
Returns
1 if a valid printable string, 0 if not

Definition at line 72 of file util.c.

int utilfdt_decode_type ( const char fmt,
int type,
int size 
)

Decode a data type string. The purpose of this string

The string consists of an optional character followed by the type: Modifier characters: hh or b 1 byte h 2 byte l 4 byte, default

Type character: s string i signed integer u unsigned integer x hex

TODO: Implement ll modifier (8 bytes) TODO: Implement o type (octal)

Parameters
fmtFormat string to process
typeReturns type found(s/d/u/x), or 0 if none
sizeReturns size found(1,2,4,8) or 4 if none
Returns
0 if ok, -1 on error (no type given, or other invalid format)

Definition at line 295 of file util.c.

char* utilfdt_read ( const char filename)

Read a device tree file into a buffer. This will report any errors on stderr.

Parameters
filenameThe filename to read, or - for stdin
Returns
Pointer to allocated buffer containing fdt, or NULL on error

Definition at line 238 of file util.c.

int utilfdt_read_err ( const char filename,
char **  buffp 
)

Read a device tree file into a buffer. Does not report errors, but only returns them. The value returned can be passed to strerror() to obtain an error message for the user.

Parameters
filenameThe filename to read, or - for stdin
buffpReturns pointer to buffer containing fdt
Returns
0 if ok, else an errno value representing the error

Definition at line 194 of file util.c.

int utilfdt_write ( const char filename,
const void blob 
)

Write a device tree buffer to a file. This will report any errors on stderr.

Parameters
filenameThe filename to write, or - for stdout
blobPoiner to buffer containing fdt
Returns
0 if ok, -1 on error

Definition at line 284 of file util.c.

int utilfdt_write_err ( const char filename,
const void blob 
)

Write a device tree buffer to a file. Does not report errors, but only returns them. The value returned can be passed to strerror() to obtain an error message for the user.

Parameters
filenameThe filename to write, or - for stdout
blobPoiner to buffer containing fdt
Returns
0 if ok, else an errno value representing the error

Definition at line 252 of file util.c.

static void va_start ( ap  ,
str   
)
vfprintf ( stderr  ,
str  ,
ap   
)
char* xstrdup ( const char s)

Definition at line 38 of file util.c.