summaryrefslogtreecommitdiff
path: root/namedev_parse.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2005-02-14 06:03:06 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 23:36:12 -0700
commitfd9efc00a2e477423185c993b8ec4570ef3ee07d (patch)
tree08f7ddb6e135ef5101bf058cb91cdf293076a976 /namedev_parse.c
parente57e7bc10811fa87e5775012da9e9b2fb67099c3 (diff)
[PATCH] introduce OPTIONS=ignore_device, ignore_remove, all_partitions" key
Here we move all possible options into a own key to make it possible to have options-only rules. The options on the NAME key are removed from the man page and will be removed from a future version of udev. For ignore rules, OPTIONS="ignore" should be used. The rule: SUBSYSTEM="block", SYSFS{removable}="1", OPTIONS="all_partitions" will create all partitions for a block device which is known to have removable media (a check for cdrom drives would be needed too).
Diffstat (limited to 'namedev_parse.c')
-rw-r--r--namedev_parse.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/namedev_parse.c b/namedev_parse.c
index 7b5b963020..981daa7b3b 100644
--- a/namedev_parse.c
+++ b/namedev_parse.c
@@ -4,6 +4,7 @@
* Userspace devfs
*
* Copyright (C) 2003,2004 Greg Kroah-Hartman <greg@kroah.com>
+ * Copyright (C) 2003-2005 Kay Sievers <kay.sievers@vrfy.org>
*
*
* This program is free software; you can redistribute it and/or modify it
@@ -247,6 +248,7 @@ static int namedev_parse(const char *filename, void *data)
if (strncasecmp(temp2, FIELD_NAME, sizeof(FIELD_NAME)-1) == 0) {
attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1);
+ /* FIXME: remove old style options and make OPTIONS= mandatory */
if (attr != NULL) {
if (strstr(attr, ATTR_PARTITIONS) != NULL) {
dbg_parse("creation of partition nodes requested");
@@ -286,6 +288,23 @@ static int namedev_parse(const char *filename, void *data)
continue;
}
+ if (strcasecmp(temp2, FIELD_OPTIONS) == 0) {
+ if (strstr(temp3, ATTR_IGNORE_DEVICE) != NULL) {
+ dbg_parse("device should be ignored");
+ dev.ignore_device = 1;
+ }
+ if (strstr(temp3, ATTR_IGNORE_REMOVE) != NULL) {
+ dbg_parse("remove event should be ignored");
+ dev.ignore_remove = 1;
+ }
+ if (strstr(temp3, ATTR_PARTITIONS) != NULL) {
+ dbg_parse("creation of partition nodes requested");
+ dev.partitions = DEFAULT_PARTITIONS_COUNT;
+ }
+ valid = 1;
+ continue;
+ }
+
dbg("unknown type of field '%s'", temp2);
goto error;
}