Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Enumerations | Functions
parser.h File Reference

Go to the source code of this file.

Data Structures

struct  match_token
 
struct  substring_t
 

Typedefs

typedef struct match_token match_table_t []
 

Enumerations

enum  { MAX_OPT_ARGS = 3 }
 

Functions

int match_token (char *, const match_table_t table, substring_t args[])
 
int match_int (substring_t *, int *result)
 
int match_octal (substring_t *, int *result)
 
int match_hex (substring_t *, int *result)
 
size_t match_strlcpy (char *, const substring_t *, size_t)
 
charmatch_strdup (const substring_t *)
 

Typedef Documentation

typedef struct match_token match_table_t[]

Definition at line 17 of file parser.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
MAX_OPT_ARGS 

Definition at line 20 of file parser.h.

Function Documentation

int match_hex ( substring_t s,
int result 
)

match_hex: - scan a hex representation of an integer from a substring_t : substring_t to be scanned

Returns
: resulting integer on success

Description: Attempts to parse the &substring_t as a hexadecimal integer. On success, sets

Returns
to the integer represented by the string and returns 0. Returns either -ENOMEM or -EINVAL on failure.

Definition at line 190 of file parser.c.

int match_int ( substring_t s,
int result 
)

match_int: - scan a decimal representation of an integer from a substring_t : substring_t to be scanned

Returns
: resulting integer on success

Description: Attempts to parse the &substring_t as a decimal integer. On success, sets

Returns
to the integer represented by the string and returns 0. Returns either -ENOMEM or -EINVAL on failure.

Definition at line 162 of file parser.c.

int match_octal ( substring_t s,
int result 
)

match_octal: - scan an octal representation of an integer from a substring_t : substring_t to be scanned

Returns
: resulting integer on success

Description: Attempts to parse the &substring_t as an octal integer. On success, sets

Returns
to the integer represented by the string and returns 0. Returns either -ENOMEM or -EINVAL on failure.

Definition at line 176 of file parser.c.

char* match_strdup ( const substring_t s)

match_strdup: - allocate a new string with the contents of a substring_t : &substring_t to copy

Description: Allocates and returns a string filled with the contents of the &substring_t . The caller is responsible for freeing the returned string with kfree().

Definition at line 225 of file parser.c.

size_t match_strlcpy ( char dest,
const substring_t src,
size_t  size 
)

match_strlcpy: - Copy the characters from a substring_t to a sized buffer : where to copy to : &substring_t to copy : size of destination buffer

Description: Copy the characters in &substring_t to the c-style string . Copy no more than - 1 characters, plus the terminating NUL. Return length of .

Definition at line 205 of file parser.c.

int match_token ( char s,
const match_table_t  table,
substring_t  args[] 
)

match_token: - Find a token (and optional args) in a string : the string to examine for token/argument pairs : match_table_t describing the set of allowed option tokens and the arguments that may be associated with them. Must be terminated with a &struct match_token whose pattern is set to the NULL pointer. : array of MAX_OPT_ARGS &substring_t elements. Used to return match locations.

Description: Detects which if any of a set of token strings has been passed to it. Tokens can include up to MAX_OPT_ARGS instances of basic c-style format identifiers which will be taken into account when matching the tokens, and whose locations will be returned in the array.

Definition at line 107 of file parser.c.