diff options
author | kay.sievers@vrfy.org <kay.sievers@vrfy.org> | 2004-02-16 21:44:28 -0800 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 21:32:28 -0700 |
commit | 50e5de03d16be3e35e65cdf65f552807ad24e996 (patch) | |
tree | 46c83042e99cf64eb308ac6bd47fab4f75525733 /namedev_parse.c | |
parent | bb7386472466e55f75df024d18e8da37a222bb41 (diff) |
[PATCH] udev - create all partitions of blockdevice
Here is the first try to create all partitons of a blockdevice, since
removable media devices may need to acces the expected partition to
revalidate the media.
It uses the attribute syntax introduced with the last %s{file} patch.
I'm using this with my multi-slot-flash-card-reader:
SYSFS{model}="USB Storage-SMC ", NAME{all_partitions}="smartmedia"
SYSFS{model}="USB Storage-CFC ", NAME{all_partitions}="compactflash"
SYSFS{model}="USB Storage-MSC ", NAME{all_partitions}="memorystick"
SYSFS{model}="USB Storage-MMC ", NAME{all_partitions}="multimedia"
and I get:
tree /udev/
/udev/
|-- memorystick
|-- memorystick1
|-- memorystick10
|-- memorystick11
|-- memorystick12
|-- memorystick13
|-- memorystick14
|-- memorystick15
|-- memorystick2
|-- memorystick3
|-- memorystick4
|-- memorystick5
|-- memorystick6
|-- memorystick7
|-- memorystick8
|-- memorystick9
|-- multimedia
|-- multimedia1
|-- multimedia10
|-- multimedia11
|-- multimedia12
|-- multimedia13
|-- multimedia14
|-- multimedia15
|-- multimedia2
|-- multimedia3
|-- multimedia4
|-- multimedia5
|-- multimedia6
|-- multimedia7
|-- multimedia8
|-- multimedia9
...
If needed, we can make the number of partions to create
adjustable with the attribute?
Diffstat (limited to 'namedev_parse.c')
-rw-r--r-- | namedev_parse.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/namedev_parse.c b/namedev_parse.c index 20ff60d640..d5d2181cb6 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -91,13 +91,6 @@ static char *get_key_attribute(char *str) char *pos; char *attr; - attr = strchr(str, '_'); - if (attr != NULL) { - attr++; - dbg("attribute='%s'", attr); - return attr; - } - attr = strchr(str, '{'); if (attr != NULL) { attr++; @@ -111,6 +104,13 @@ static char *get_key_attribute(char *str) return attr; } + attr = strchr(str, '_'); + if (attr != NULL) { + attr++; + dbg("attribute='%s'", attr); + return attr; + } + return NULL; } @@ -221,7 +221,13 @@ int namedev_init_rules(void) continue; } - if (strcasecmp(temp2, FIELD_NAME) == 0) { + if (strncasecmp(temp2, FIELD_NAME, sizeof(FIELD_NAME)-1) == 0) { + attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1); + if (attr != NULL) + if (strcasecmp(attr, ATTR_PARTITIONS) == 0) { + dbg_parse("creation of partition nodes requested"); + dev.partitions = PARTITIONS_COUNT; + } strfieldcpy(dev.name, temp3); continue; } |