X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=namedev_parse.c;h=eabd9c98bb1957f089af68b14e958cf7d22fd009;hb=5e39f90b14ccf242618086a0242000fc11317a75;hp=5bd59d83f230ea2113bacb48ccf25efbe86c2c06;hpb=1134a81b98e189a8ec99a1ea4aba8e52b358873b;p=elogind.git diff --git a/namedev_parse.c b/namedev_parse.c index 5bd59d83f..eabd9c98b 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 @@ -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,10 +248,11 @@ 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"); - dev.partitions = PARTITIONS_COUNT; + dev.partitions = DEFAULT_PARTITIONS_COUNT; } if (strstr(attr, ATTR_IGNORE_REMOVE) != NULL) { dbg_parse("remove event should be ignored"); @@ -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; } @@ -338,3 +357,14 @@ int namedev_init(void) return retval; } + +void namedev_close(void) +{ + struct config_device *dev; + + list_for_each_entry(dev, &config_device_list, node) { + list_del(&dev->node); + free(dev); + } +} +