udev-rules.c revision 75cb1ac51ea0176926c749bd0f22c19ce8b20e5f
/*
* Copyright (C) 2003-2010 Kay Sievers <kay.sievers@vrfy.org>
* Copyright (C) 2008 Alan Jenkins <alan-jenkins@tuffmail.co.uk>
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stddef.h>
#include <limits.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <ctype.h>
#include <unistd.h>
#include <errno.h>
#include <dirent.h>
#include <fnmatch.h>
#include <time.h>
#include "udev.h"
#define PREALLOC_TOKEN 2048
#define PREALLOC_TRIE 256
struct uid_gid {
unsigned int name_off;
union {
};
};
struct trie_node {
/* this node's first child */
unsigned int child_idx;
/* the next child of our parent node's child list */
unsigned int next_child_idx;
/* this node's last child (shortcut for append) */
unsigned int last_child_idx;
unsigned int value_off;
unsigned short value_len;
unsigned char key;
};
struct udev_rules {
int resolve_names;
/* every key in the rules file becomes a token */
unsigned int token_cur;
unsigned int token_max;
/* all key strings are copied to a single string buffer */
char *buf;
unsigned int buf_count;
/* during rule parsing, strings are indexed to find duplicates */
struct trie_node *trie_nodes;
unsigned int trie_nodes_cur;
unsigned int trie_nodes_max;
unsigned int uids_cur;
unsigned int uids_max;
unsigned int gids_cur;
unsigned int gids_max;
};
/* KEY=="", KEY!="", KEY+="", KEY="", KEY:="" */
enum operation_type {
};
enum string_glob_type {
GL_PLAIN, /* no special chars */
GL_GLOB, /* shell globs ?,*,[] */
GL_SPLIT, /* multi-value A|B */
GL_SPLIT_GLOB, /* multi-value with glob A*|B* */
GL_SOMETHING, /* commonly used "?*" */
};
enum string_subst_type {
};
enum token_type {
TK_M_ACTION, /* val */
TK_M_DEVPATH, /* val */
TK_M_KERNEL, /* val */
TK_M_DEVLINK, /* val */
TK_M_NAME, /* val */
TK_M_ENV, /* val, attr */
TK_M_TAG, /* val */
TK_M_SUBSYSTEM, /* val */
TK_M_DRIVER, /* val */
TK_M_WAITFOR, /* val */
TK_M_ATTR, /* val, attr */
TK_M_KERNELS, /* val */
TK_M_SUBSYSTEMS, /* val */
TK_M_DRIVERS, /* val */
TK_M_ATTRS, /* val, attr */
TK_M_TEST, /* val, mode_t */
TK_M_PROGRAM, /* val */
TK_M_IMPORT_FILE, /* val */
TK_M_IMPORT_PROG, /* val */
TK_M_IMPORT_DB, /* val */
TK_M_IMPORT_PARENT, /* val */
TK_M_RESULT, /* val */
TK_A_INOTIFY_WATCH, /* int */
TK_A_DEVLINK_PRIO, /* int */
TK_A_OWNER, /* val */
TK_A_GROUP, /* val */
TK_A_MODE, /* val */
TK_A_OWNER_ID, /* uid_t */
TK_A_GROUP_ID, /* gid_t */
TK_A_MODE_ID, /* mode_t */
TK_A_ENV, /* val, attr */
TK_A_TAG, /* val */
TK_A_NAME, /* val */
TK_A_DEVLINK, /* val */
TK_A_EVENT_TIMEOUT, /* int */
TK_A_ATTR, /* val, attr */
TK_A_RUN, /* val, bool */
TK_A_GOTO, /* size_t */
};
/* we try to pack stuff in a way that we take only 12 bytes per token */
struct token {
union {
unsigned char type; /* same as in rule and key */
struct {
unsigned int flags:8;
unsigned short token_count;
unsigned int label_off;
unsigned short filename_off;
unsigned short filename_line;
} rule;
struct {
unsigned int value_off;
union {
unsigned int attr_off;
int devlink_unique;
int fail_on_error;
unsigned int rule_goto;
int devlink_prio;
int event_timeout;
int watch;
};
} key;
};
};
#define MAX_TK 64
struct rule_tmp {
struct udev_rules *rules;
unsigned int token_cur;
};
#ifdef ENABLE_DEBUG
{
static const char *operation_strs[] = {
[OP_UNSET] = "UNSET",
[OP_MATCH] = "match",
[OP_NOMATCH] = "nomatch",
[OP_MATCH_MAX] = "MATCH_MAX",
[OP_ADD] = "add",
[OP_ASSIGN] = "assign",
[OP_ASSIGN_FINAL] = "assign-final",
} ;
return operation_strs[type];
}
{
static const char *string_glob_strs[] = {
[GL_UNSET] = "UNSET",
[GL_PLAIN] = "plain",
[GL_GLOB] = "glob",
[GL_SPLIT] = "split",
[GL_SPLIT_GLOB] = "split-glob",
[GL_SOMETHING] = "split-glob",
};
return string_glob_strs[type];
}
{
static const char *token_strs[] = {
[TK_UNSET] = "UNSET",
[TK_RULE] = "RULE",
[TK_M_ACTION] = "M ACTION",
[TK_M_DEVPATH] = "M DEVPATH",
[TK_M_KERNEL] = "M KERNEL",
[TK_M_DEVLINK] = "M DEVLINK",
[TK_M_NAME] = "M NAME",
[TK_M_ENV] = "M ENV",
[TK_M_TAG] = "M TAG",
[TK_M_SUBSYSTEM] = "M SUBSYSTEM",
[TK_M_DRIVER] = "M DRIVER",
[TK_M_WAITFOR] = "M WAITFOR",
[TK_M_ATTR] = "M ATTR",
[TK_M_PARENTS_MIN] = "M PARENTS_MIN",
[TK_M_KERNELS] = "M KERNELS",
[TK_M_SUBSYSTEMS] = "M SUBSYSTEMS",
[TK_M_DRIVERS] = "M DRIVERS",
[TK_M_ATTRS] = "M ATTRS",
[TK_M_PARENTS_MAX] = "M PARENTS_MAX",
[TK_M_TEST] = "M TEST",
[TK_M_PROGRAM] = "M PROGRAM",
[TK_M_IMPORT_FILE] = "M IMPORT_FILE",
[TK_M_IMPORT_PROG] = "M IMPORT_PROG",
[TK_M_IMPORT_DB] = "M IMPORT_DB",
[TK_M_IMPORT_PARENT] = "M IMPORT_PARENT",
[TK_M_RESULT] = "M RESULT",
[TK_M_MAX] = "M MAX",
[TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE",
[TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE",
[TK_A_INOTIFY_WATCH] = "A INOTIFY_WATCH",
[TK_A_DEVLINK_PRIO] = "A DEVLINK_PRIO",
[TK_A_OWNER] = "A OWNER",
[TK_A_GROUP] = "A GROUP",
[TK_A_MODE] = "A MODE",
[TK_A_OWNER_ID] = "A OWNER_ID",
[TK_A_GROUP_ID] = "A GROUP_ID",
[TK_A_MODE_ID] = "A MODE_ID",
[TK_A_ENV] = "A ENV",
[TK_A_TAG] = "A ENV",
[TK_A_NAME] = "A NAME",
[TK_A_DEVLINK] = "A DEVLINK",
[TK_A_EVENT_TIMEOUT] = "A EVENT_TIMEOUT",
[TK_A_ATTR] = "A ATTR",
[TK_A_RUN] = "A RUN",
[TK_A_GOTO] = "A GOTO",
[TK_END] = "END",
};
return token_strs[type];
}
{
switch (type) {
case TK_RULE:
{
break;
}
case TK_M_ACTION:
case TK_M_DEVPATH:
case TK_M_KERNEL:
case TK_M_SUBSYSTEM:
case TK_M_DRIVER:
case TK_M_WAITFOR:
case TK_M_DEVLINK:
case TK_M_NAME:
case TK_M_KERNELS:
case TK_M_SUBSYSTEMS:
case TK_M_DRIVERS:
case TK_M_PROGRAM:
case TK_M_IMPORT_FILE:
case TK_M_IMPORT_PROG:
case TK_M_IMPORT_DB:
case TK_M_IMPORT_PARENT:
case TK_M_RESULT:
case TK_A_NAME:
case TK_A_DEVLINK:
case TK_A_OWNER:
case TK_A_GROUP:
case TK_A_MODE:
case TK_A_RUN:
break;
case TK_M_ATTR:
case TK_M_ATTRS:
case TK_M_ENV:
case TK_A_ATTR:
case TK_A_ENV:
break;
case TK_M_TAG:
case TK_A_TAG:
break;
case TK_A_STRING_ESCAPE_NONE:
break;
case TK_M_TEST:
break;
case TK_A_INOTIFY_WATCH:
break;
case TK_A_DEVLINK_PRIO:
break;
case TK_A_OWNER_ID:
break;
case TK_A_GROUP_ID:
break;
case TK_A_MODE_ID:
break;
case TK_A_EVENT_TIMEOUT:
break;
case TK_A_GOTO:
break;
case TK_END:
break;
case TK_M_PARENTS_MIN:
case TK_M_PARENTS_MAX:
case TK_M_MAX:
case TK_UNSET:
break;
}
}
{
unsigned int i;
}
#else
#endif /* ENABLE_DEBUG */
{
int off;
/* grow buffer if needed */
char *buf;
unsigned int add;
/* double the buffer size */
return -1;
}
return off;
}
{
unsigned int node_idx;
unsigned int new_node_idx;
unsigned char key;
unsigned short len;
unsigned int depth;
unsigned int off;
/* walk trie, start from last character of str to find matching tails */
node_idx = 0;
unsigned int child_idx;
/* match against current node */
return off;
/* lookup child node */
while (child_idx > 0) {
break;
}
if (child_idx == 0)
break;
}
/* string not found, add it */
/* grow trie nodes if needed */
unsigned int add;
/* double the buffer size */
if (add < 8)
add = 8;
return -1;
}
/* get a new node */
rules->trie_nodes_cur++;
/* join the parent's child list */
} else {
struct trie_node *last_child;
}
return off;
}
{
/* grow buffer if needed */
unsigned int add;
/* double the buffer size */
if (add < 8)
add = 8;
return -1;
}
return 0;
}
{
unsigned int i;
unsigned int off;
/* lookup, if we know it already */
return uid;
}
}
/* grow buffer if needed */
unsigned int add;
/* double the buffer size */
if (add < 1)
add = 8;
return uid;
}
if (off <= 0)
return uid;
return uid;
}
{
unsigned int i;
unsigned int off;
/* lookup, if we know it already */
return gid;
}
}
/* grow buffer if needed */
unsigned int add;
/* double the buffer size */
if (add < 1)
add = 8;
return gid;
}
if (off <= 0)
return gid;
return gid;
}
{
char *key;
char *val;
/* find key */
key++;
/* comment or empty line */
return -1;
return -1;
val[0] = '\0';
val++;
/* find value */
val++;
/* terminate key */
if (len == 0)
return -1;
len--;
/* terminate value */
if (len == 0)
return -1;
len--;
if (len == 0)
return -1;
/* unquote */
return -1;
}
val++;
}
/* handle device, renamed by external tool, returning new path */
char syspath[UTIL_PATH_SIZE];
} else {
struct udev_list_entry *entry;
/* store in db, skip private keys */
if (key[0] != '.')
}
return 0;
}
{
FILE *f;
char line[UTIL_LINE_SIZE];
if (f == NULL)
return -1;
fclose(f);
return 0;
}
{
char **envp;
char result[4096];
char *line;
return -1;
char *pos;
pos[0] = '\0';
}
}
return 0;
}
{
struct udev_device *dev_parent;
struct udev_list_entry *list_entry;
if (dev_parent == NULL)
return -1;
struct udev_list_entry *entry;
/* store in db, skip private keys */
if (key[0] != '.')
}
}
return 0;
}
#define WAIT_LOOP_PER_SECOND 50
{
char filepath[UTIL_PATH_SIZE];
char devicepath[UTIL_PATH_SIZE];
/* a relative path is a device attribute */
devicepath[0] = '\0';
if (file[0] != '/') {
}
while (--loop) {
/* lookup file */
return 0;
}
/* make sure, the device did not disappear in the meantime */
return -2;
}
}
return -1;
}
{
int found = 0;
char *pos;
char dirname[UTIL_PATH_SIZE];
const char *tail;
return -1;
pos[0] = '\0';
continue;
found = 1;
break;
}
}
}
}
return found;
}
static int get_key(struct udev *udev, char **line, char **key, enum operation_type *op, char **value)
{
char *linepos;
char *temp;
return -1;
/* skip whitespace */
linepos++;
/* get the key */
if (linepos[0] == '\0')
return -1;
while (1) {
linepos++;
if (linepos[0] == '\0')
return -1;
break;
if (linepos[0] == '=')
break;
break;
}
/* remember end of key */
/* skip whitespace after key */
linepos++;
if (linepos[0] == '\0')
return -1;
/* get operation type */
linepos += 2;
*op = OP_NOMATCH;
linepos += 2;
linepos += 2;
} else if (linepos[0] == '=') {
linepos++;
*op = OP_ASSIGN_FINAL;
linepos += 2;
} else
return -1;
/* terminate key */
temp[0] = '\0';
/* skip whitespace after operator */
linepos++;
if (linepos[0] == '\0')
return -1;
/* get the value */
if (linepos[0] == '"')
linepos++;
else
return -1;
/* terminate */
if (!temp)
return -1;
temp[0] = '\0';
temp++;
/* move line to next key */
return 0;
}
/* extract possible KEY{attr} */
{
char *pos;
char *attr;
attr++;
return NULL;
}
pos[0] = '\0';
return attr;
}
return NULL;
}
enum operation_type op,
{
switch (type) {
case TK_M_ACTION:
case TK_M_DEVPATH:
case TK_M_KERNEL:
case TK_M_SUBSYSTEM:
case TK_M_DRIVER:
case TK_M_WAITFOR:
case TK_M_DEVLINK:
case TK_M_NAME:
case TK_M_KERNELS:
case TK_M_SUBSYSTEMS:
case TK_M_DRIVERS:
case TK_M_PROGRAM:
case TK_M_IMPORT_FILE:
case TK_M_IMPORT_PROG:
case TK_M_IMPORT_DB:
case TK_M_IMPORT_PARENT:
case TK_M_RESULT:
case TK_A_OWNER:
case TK_A_GROUP:
case TK_A_MODE:
case TK_A_NAME:
case TK_A_GOTO:
case TK_M_TAG:
case TK_A_TAG:
break;
case TK_M_ENV:
case TK_M_ATTR:
case TK_M_ATTRS:
case TK_A_ATTR:
case TK_A_ENV:
break;
case TK_A_DEVLINK:
break;
case TK_M_TEST:
break;
case TK_A_STRING_ESCAPE_NONE:
break;
case TK_A_RUN:
break;
case TK_A_INOTIFY_WATCH:
case TK_A_DEVLINK_PRIO:
break;
case TK_A_OWNER_ID:
break;
case TK_A_GROUP_ID:
break;
case TK_A_MODE_ID:
break;
case TK_A_EVENT_TIMEOUT:
break;
case TK_RULE:
case TK_M_PARENTS_MIN:
case TK_M_PARENTS_MAX:
case TK_M_MAX:
case TK_END:
case TK_UNSET:
return -1;
}
/* check if we need to split or call fnmatch() while matching rules */
enum string_glob_type glob;
int has_split;
int has_glob;
has_glob = (strchr(value, '*') != NULL || strchr(value, '?') != NULL || strchr(value, '[') != NULL);
} else if (has_split) {
} else if (has_glob) {
glob = GL_SOMETHING;
else
} else {
}
}
/* check if assigned value has substitution chars */
if (value[0] == '[')
else
}
if (attr[0] == '[')
else
}
return -1;
}
return 0;
}
{
unsigned int i;
unsigned int start = 0;
unsigned int next_idx = 0;
unsigned int j;
/* find smallest value */
continue;
next_idx = j;
}
}
/* add token and mark done */
return -1;
/* shrink range */
start++;
end--;
}
return 0;
}
{
char *linepos;
char *attr;
bool bus_warn = false;
bool sysfs_warn = false;
bool id_warn = false;
while (1) {
char *key;
char *value;
enum operation_type op;
break;
if (op > OP_MATCH_MAX) {
goto invalid;
}
continue;
}
if (op > OP_MATCH_MAX) {
goto invalid;
}
continue;
}
if (op > OP_MATCH_MAX) {
goto invalid;
}
continue;
}
if (op > OP_MATCH_MAX) {
goto invalid;
}
/* bus, class, subsystem events should all be the same */
} else
continue;
}
if (op > OP_MATCH_MAX) {
goto invalid;
}
continue;
}
goto invalid;
}
if (op < OP_MATCH_MAX) {
} else {
}
continue;
}
if (op > OP_MATCH_MAX) {
goto invalid;
}
continue;
}
if (!id_warn) {
id_warn = true;
"please use KERNEL= to match the event device, or KERNELS= "
}
if (op > OP_MATCH_MAX) {
goto invalid;
}
continue;
}
if (op > OP_MATCH_MAX) {
goto invalid;
}
continue;
}
if (!bus_warn) {
bus_warn = true;
"please use SUBSYSTEM= to match the event device, or SUBSYSTEMS= "
}
if (op > OP_MATCH_MAX) {
goto invalid;
}
continue;
}
if (op > OP_MATCH_MAX) {
goto invalid;
}
continue;
}
if (op > OP_MATCH_MAX) {
goto invalid;
}
goto invalid;
}
continue;
}
if (!sysfs_warn) {
sysfs_warn = true;
"please use ATTR{}= to match the event device, or ATTRS{}= "
}
if (op > OP_MATCH_MAX) {
goto invalid;
}
goto invalid;
}
continue;
}
goto invalid;
}
if (op < OP_MATCH_MAX) {
goto invalid;
} else {
goto invalid;
}
continue;
}
if (op < OP_MATCH_MAX)
else
continue;
}
continue;
}
if (op > OP_MATCH_MAX) {
goto invalid;
}
continue;
}
} else {
/* figure it out if it is executable */
char file[UTIL_PATH_SIZE];
char *pos;
if (value[0] != '/')
else
if (pos)
pos[0] = '\0';
} else {
}
}
continue;
}
if (op > OP_MATCH_MAX) {
goto invalid;
}
} else {
}
continue;
}
int flag = 0;
flag = 1;
continue;
}
continue;
}
continue;
}
continue;
}
if (op < OP_MATCH_MAX) {
} else {
continue;
}
if (value[0] == '\0')
continue;
}
continue;
}
if (op < OP_MATCH_MAX) {
} else {
int flag = 0;
flag = 1;
}
continue;
}
char *endptr;
if (endptr[0] == '\0') {
} else if (rules->resolve_names >= 0) {
}
continue;
}
char *endptr;
if (endptr[0] == '\0') {
} else if (rules->resolve_names >= 0) {
}
continue;
}
char *endptr;
if (endptr[0] == '\0')
else
continue;
}
const char *pos;
}
}
}
const int off = 0;
} else {
const int on = 1;
}
}
continue;
}
}
/* add rule token */
goto invalid;
/* add tokens to list, sorted by type */
goto invalid;
return 0;
return -1;
}
{
FILE *f;
unsigned int first_token;
char line[UTIL_LINE_SIZE];
int line_nr = 0;
unsigned int i;
if (f == NULL)
return -1;
char *key;
/* skip whitespace */
line_nr++;
key++;
/* comment */
if (key[0] == '#')
continue;
if (len < 3)
continue;
/* continue reading if backslash+newline is found */
break;
break;
line_nr++;
}
continue;
}
}
fclose(f);
/* link GOTOs to LABEL rules in this file to be able to fast-forward */
unsigned int j;
continue;
continue;
continue;
break;
}
}
}
return 0;
}
static int add_matching_files(struct udev *udev, struct udev_list_node *file_list, const char *dirname, const char *suffix)
{
char filename[UTIL_PATH_SIZE];
return -1;
}
while (1) {
break;
continue;
/* look for file matching with specified suffix */
const char *ext;
continue;
continue;
}
}
return 0;
}
{
struct udev_rules *rules;
struct udev_list_node file_list;
return NULL;
/* init token array and string buffer */
return NULL;
return NULL;
/* offset 0 is always '\0' */
return NULL;
/* offset 0 is the trie root, with an empty string */
/* custom rules location for testing */
} else {
struct udev_list_node sort_list;
/* read default rules */
/* sort all rules files by basename into list of files */
continue;
/* sort entry into existing list */
continue;
break;
}
/* found later file, insert before */
break;
}
}
/* current file already handled */
continue;
/* no later file, append to end of list */
}
}
/* add all filenames to the string buffer */
unsigned int filename_off;
/* the offset in the rule is limited to unsigned short */
if (filename_off < USHRT_MAX)
}
/* parse list of files */
else
}
/* shrink allocated token and string buffer */
}
}
char *buf;
}
}
/* cleanup trie */
rules->trie_nodes_cur = 0;
rules->trie_nodes_max = 0;
return rules;
}
{
return;
}
{
char *pos;
int match = 0;
val = "";
case GL_PLAIN:
break;
case GL_GLOB:
break;
case GL_SPLIT:
{
const char *split;
while (1) {
const char *next;
if (match)
break;
} else {
break;
}
}
break;
}
case GL_SPLIT_GLOB:
{
char value[UTIL_PATH_SIZE];
pos[0] = '\0';
}
if (match)
break;
}
break;
}
case GL_SOMETHING:
break;
case GL_UNSET:
return -1;
}
return 0;
}
return 0;
}
return -1;
}
static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct udev_event *event, struct token *cur)
{
const char *name;
char nbuf[UTIL_NAME_SIZE];
const char *value;
char vbuf[UTIL_NAME_SIZE];
case SB_FORMAT:
/* fall through */
case SB_NONE:
return -1;
break;
case SB_SUBSYS:
return -1;
break;
default:
return -1;
}
/* remove trailing whitespace, if not asked to match for it */
const char *key_value;
}
}
}
}
enum escape_type {
};
{
bool can_set_name;
return -1;
/* loop through token list, match, run actions or forward to next rule */
while (1) {
case TK_RULE:
/* current rule */
/* possibly skip rules which want to set NAME, SYMLINK, OWNER, GROUP, MODE */
goto nomatch;
esc = ESCAPE_UNSET;
break;
case TK_M_ACTION:
goto nomatch;
break;
case TK_M_DEVPATH:
goto nomatch;
break;
case TK_M_KERNEL:
goto nomatch;
break;
case TK_M_DEVLINK:
{
struct udev_list_entry *list_entry;
int match = 0;
const char *devlink;
match = 1;
break;
}
}
if (!match)
goto nomatch;
break;
}
case TK_M_NAME:
goto nomatch;
break;
case TK_M_ENV:
{
const char *value;
value = "";
}
goto nomatch;
break;
}
case TK_M_TAG:
{
struct udev_list_entry *list_entry;
bool match = false;
match = true;
break;
}
}
goto nomatch;
break;
}
case TK_M_SUBSYSTEM:
goto nomatch;
break;
case TK_M_DRIVER:
goto nomatch;
break;
case TK_M_WAITFOR:
{
char filename[UTIL_PATH_SIZE];
int found;
goto nomatch;
break;
}
case TK_M_ATTR:
goto nomatch;
break;
case TK_M_KERNELS:
case TK_M_SUBSYSTEMS:
case TK_M_DRIVERS:
case TK_M_ATTRS:
{
/* get whole sequence of parent matches */
next++;
/* loop over parents */
while (1) {
/* loop over sequence of parent match keys */
case TK_M_KERNELS:
goto try_parent;
break;
case TK_M_SUBSYSTEMS:
goto try_parent;
break;
case TK_M_DRIVERS:
goto try_parent;
break;
case TK_M_ATTRS:
goto try_parent;
break;
default:
goto nomatch;
}
}
/* all keys matched */
break;
goto nomatch;
}
/* move behind our sequence of parent match keys */
continue;
}
case TK_M_TEST:
{
char filename[UTIL_PATH_SIZE];
int match;
if (filename[0] != '/') {
char tmp[UTIL_PATH_SIZE];
}
}
}
goto nomatch;
goto nomatch;
break;
}
case TK_M_PROGRAM:
{
char program[UTIL_PATH_SIZE];
char **envp;
char result[UTIL_PATH_SIZE];
goto nomatch;
} else {
int count;
if (count > 0)
}
goto nomatch;
}
break;
}
case TK_M_IMPORT_FILE:
{
char import[UTIL_PATH_SIZE];
goto nomatch;
break;
}
case TK_M_IMPORT_PROG:
{
char import[UTIL_PATH_SIZE];
goto nomatch;
break;
}
case TK_M_IMPORT_DB:
{
const char *value;
struct udev_list_entry *entry;
} else {
goto nomatch;
}
break;
}
case TK_M_IMPORT_PARENT:
{
char import[UTIL_PATH_SIZE];
goto nomatch;
break;
}
case TK_M_RESULT:
goto nomatch;
break;
case TK_A_STRING_ESCAPE_NONE:
esc = ESCAPE_NONE;
break;
break;
case TK_A_INOTIFY_WATCH:
break;
case TK_A_DEVLINK_PRIO:
break;
case TK_A_OWNER:
{
char owner[UTIL_NAME_SIZE];
if (event->owner_final)
break;
break;
}
case TK_A_GROUP:
{
char group[UTIL_NAME_SIZE];
if (event->group_final)
break;
break;
}
case TK_A_MODE:
{
char mode[UTIL_NAME_SIZE];
char *endptr;
if (event->mode_final)
break;
if (endptr[0] != '\0') {
}
break;
}
case TK_A_OWNER_ID:
if (event->owner_final)
break;
break;
case TK_A_GROUP_ID:
if (event->group_final)
break;
break;
case TK_A_MODE_ID:
if (event->mode_final)
break;
break;
case TK_A_ENV:
{
if (value[0] != '\0') {
char temp_value[UTIL_NAME_SIZE];
struct udev_list_entry *entry;
/* store in db, skip private keys */
if (name[0] != '.')
} else {
}
break;
}
case TK_A_TAG:
break;
case TK_A_NAME:
{
char name_str[UTIL_PATH_SIZE];
int count;
if (event->name_final)
break;
if (count > 0)
}
break;
}
case TK_A_DEVLINK:
{
char temp[UTIL_PATH_SIZE];
char filename[UTIL_PATH_SIZE];
int count = 0;
if (event->devlink_final)
break;
break;
/* allow multiple symlinks separated by spaces */
if (esc == ESCAPE_UNSET)
else if (esc == ESCAPE_REPLACE)
if (count > 0)
pos++;
next[0] = '\0';
next++;
}
if (pos[0] != '\0') {
}
}
break;
case TK_A_EVENT_TIMEOUT:
break;
case TK_A_ATTR:
{
char attr[UTIL_PATH_SIZE];
char value[UTIL_NAME_SIZE];
FILE *f;
if (f != NULL) {
fclose(f);
} else {
}
break;
}
case TK_A_RUN:
{
struct udev_list_entry *list_entry;
break;
}
case TK_A_GOTO:
break;
continue;
case TK_END:
return 0;
case TK_M_PARENTS_MIN:
case TK_M_PARENTS_MAX:
case TK_M_MAX:
case TK_UNSET:
goto nomatch;
}
cur++;
continue;
/* fast-forward to next rule */
}
}