X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=namedev_parse.c;h=ed38db4b142267e6f617cff36af0482c4306058a;hp=7b5b963020275eb181c168217044e62593f2cbd5;hb=c98cb35eb5f24940cf8836be96de42c9e8795f27;hpb=6d56416665863dc2b4fb107dbdc779e4791bdf9e diff --git a/namedev_parse.c b/namedev_parse.c index 7b5b96302..ed38db4b1 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -4,6 +4,7 @@ * Userspace devfs * * Copyright (C) 2003,2004 Greg Kroah-Hartman + * Copyright (C) 2003-2005 Kay Sievers * * * This program is free software; you can redistribute it and/or modify it @@ -152,7 +153,7 @@ static int namedev_parse(const char *filename, void *data) /* skip backslash and newline from multi line rules */ for (i = j = 0; i < count; i++) { - if (bufline[i] == '\\' || bufline[i] == '\n') + if (bufline[i] == '\\' && bufline[i+1] == '\n') continue; line[j++] = bufline[i]; @@ -170,6 +171,18 @@ static int namedev_parse(const char *filename, void *data) if (retval) break; + if (strcasecmp(temp2, FIELD_KERNEL) == 0) { + strfieldcpy(dev.kernel, temp3); + valid = 1; + continue; + } + + if (strcasecmp(temp2, FIELD_SUBSYSTEM) == 0) { + strfieldcpy(dev.subsystem, temp3); + valid = 1; + continue; + } + if (strcasecmp(temp2, FIELD_BUS) == 0) { strfieldcpy(dev.bus, temp3); valid = 1; @@ -214,18 +227,6 @@ static int namedev_parse(const char *filename, void *data) continue; } - if (strcasecmp(temp2, FIELD_KERNEL) == 0) { - strfieldcpy(dev.kernel, temp3); - valid = 1; - 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; @@ -247,17 +248,21 @@ 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) { + if (strstr(attr, OPTION_PARTITIONS) != NULL) { dbg_parse("creation of partition nodes requested"); dev.partitions = DEFAULT_PARTITIONS_COUNT; } - if (strstr(attr, ATTR_IGNORE_REMOVE) != NULL) { + if (strstr(attr, OPTION_IGNORE_REMOVE) != NULL) { dbg_parse("remove event should be ignored"); dev.ignore_remove = 1; } } - strfieldcpy(dev.name, temp3); + if (temp3[0] != '\0') + strfieldcpy(dev.name, temp3); + else + dev.ignore_device = 1; valid = 1; continue; } @@ -286,6 +291,23 @@ static int namedev_parse(const char *filename, void *data) continue; } + if (strcasecmp(temp2, FIELD_OPTIONS) == 0) { + if (strstr(temp3, OPTION_IGNORE_DEVICE) != NULL) { + dbg_parse("device should be ignored"); + dev.ignore_device = 1; + } + if (strstr(temp3, OPTION_IGNORE_REMOVE) != NULL) { + dbg_parse("remove event should be ignored"); + dev.ignore_remove = 1; + } + if (strstr(temp3, OPTION_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; }