dump_perm_dev(dev);
}
-/* extract possible KEY{attr} or KEY_attr */
+/* extract possible KEY{attr} */
static char *get_key_attribute(char *str)
{
char *pos;
return attr;
}
- attr = strchr(str, '_');
- if (attr != NULL) {
- attr++;
- dbg("attribute='%s'", attr);
- return attr;
- }
-
return NULL;
}
-static int namedev_parse_rules(char *filename)
+static int namedev_parse_rules(const char *filename, void *data)
{
char line[LINE_SIZE];
char *bufline;
continue;
}
- /* empty line? */
- if (bufline[0] == '\0' || bufline[0] == '\n')
- continue;
-
/* eat the whitespace */
- while (isspace(bufline[0])) {
+ while ((count > 0) && isspace(bufline[0])) {
bufline++;
count--;
}
+ if (count == 0)
+ continue;
/* see if this is a comment */
if (bufline[0] == COMMENT_CHARACTER)
continue;
}
+ if (strcasecmp(temp2, FIELD_SUBSYSTEM) == 0) {
+ strfieldcpy(dev.subsystem, temp3);
+ valid = 1;
+ continue;
+ }
+
+ if (strcasecmp(temp2, FIELD_DRIVER) == 0) {
+ strfieldcpy(dev.driver, temp3);
+ valid = 1;
+ continue;
+ }
+
if (strcasecmp(temp2, FIELD_PROGRAM) == 0) {
program_given = 1;
strfieldcpy(dev.program, temp3);
if (strncasecmp(temp2, FIELD_NAME, sizeof(FIELD_NAME)-1) == 0) {
attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1);
- if (attr != NULL && strcasecmp(attr, ATTR_PARTITIONS) == 0) {
+ if (attr != NULL) {
+ if (strstr(attr, ATTR_PARTITIONS) != NULL) {
dbg_parse("creation of partition nodes requested");
dev.partitions = PARTITIONS_COUNT;
}
+ if (strstr(attr, ATTR_IGNORE_REMOVE) != NULL) {
+ dbg_parse("remove event should be ignored");
+ dev.ignore_remove = 1;
+ }
+ }
strfieldcpy(dev.name, temp3);
valid = 1;
continue;
return retval;
}
-static int namedev_parse_permissions(char *filename)
+static int namedev_parse_permissions(const char *filename, void *data)
{
char line[LINE_SIZE];
char *bufline;
continue;
}
- /* empty line? */
- if (bufline[0] == '\0' || bufline[0] == '\n')
- continue;
-
/* eat the whitespace */
- while (isspace(bufline[0])) {
+ while ((count > 0) && isspace(bufline[0])) {
bufline++;
count--;
}
+ if (count == 0)
+ continue;
/* see if this is a comment */
if (bufline[0] == COMMENT_CHARACTER)
return retval;
}
-int namedev_init_rules()
+int namedev_init_rules(void)
{
struct stat stats;
stat(udev_rules_filename, &stats);
if ((stats.st_mode & S_IFMT) != S_IFDIR)
- return namedev_parse_rules(udev_rules_filename);
+ return namedev_parse_rules(udev_rules_filename, NULL);
else
- return call_foreach_file(namedev_parse_rules,
- udev_rules_filename, RULEFILE_SUFFIX);
+ return call_foreach_file(namedev_parse_rules, udev_rules_filename,
+ RULEFILE_SUFFIX, NULL);
}
-int namedev_init_permissions()
+int namedev_init_permissions(void)
{
struct stat stats;
stat(udev_permissions_filename, &stats);
if ((stats.st_mode & S_IFMT) != S_IFDIR)
- return namedev_parse_permissions(udev_permissions_filename);
+ return namedev_parse_permissions(udev_permissions_filename, NULL);
else
- return call_foreach_file(namedev_parse_permissions,
- udev_permissions_filename, PERMFILE_SUFFIX);
+ return call_foreach_file(namedev_parse_permissions, udev_permissions_filename,
+ PERMFILE_SUFFIX, NULL);
}