0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LINUX_PARSER_H
0011 #define _LINUX_PARSER_H
0012
0013
0014 struct match_token {
0015 int token;
0016 const char *pattern;
0017 };
0018
0019 typedef struct match_token match_table_t[];
0020
0021
0022 enum {MAX_OPT_ARGS = 3};
0023
0024
0025 typedef struct {
0026 char *from;
0027 char *to;
0028 } substring_t;
0029
0030 int match_token(char *, const match_table_t table, substring_t args[]);
0031 int match_int(substring_t *, int *result);
0032 int match_uint(substring_t *s, unsigned int *result);
0033 int match_u64(substring_t *, u64 *result);
0034 int match_octal(substring_t *, int *result);
0035 int match_hex(substring_t *, int *result);
0036 bool match_wildcard(const char *pattern, const char *str);
0037 size_t match_strlcpy(char *, const substring_t *, size_t);
0038 char *match_strdup(const substring_t *);
0039
0040 #endif