chiark / gitweb /
[PATCH] update udev.rules.gentoo with new config file format.
[elogind.git] / namedev_parse.c
index 20ff60d640923458bf48a5861b402fb76cba7468..d5d2181cb68bb427ba34c84f187aff12187e0202 100644 (file)
@@ -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;
                        }