diff options
author | kay.sievers@vrfy.org <kay.sievers@vrfy.org> | 2005-02-14 06:03:06 +0100 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 23:36:12 -0700 |
commit | fd9efc00a2e477423185c993b8ec4570ef3ee07d (patch) | |
tree | 08f7ddb6e135ef5101bf058cb91cdf293076a976 /namedev.c | |
parent | e57e7bc10811fa87e5775012da9e9b2fb67099c3 (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.c')
-rw-r--r-- | namedev.c | 38 |
1 files changed, 23 insertions, 15 deletions
@@ -4,6 +4,7 @@ * Userspace devfs * * Copyright (C) 2003 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 @@ -749,14 +750,31 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d dbg("process rule"); if (match_rule(udev, dev, class_dev, sysfs_device) == 0) { - /* empty name, symlink and perms will not create any node */ + /* FIXME: remove old style ignore rule and make OPTION="ignore" mandatory */ if (dev->name[0] == '\0' && dev->symlink[0] == '\0' && - dev->mode == 0000 && dev->owner[0] == '\0' && dev->group[0] == '\0') { + dev->mode == 0000 && dev->owner[0] == '\0' && dev->group[0] == '\0' && + !dev->ignore_device && !dev->partitions && !dev->ignore_remove) { info("configured rule in '%s[%i]' applied, '%s' is ignored", dev->config_file, dev->config_line, udev->kernel_name); return -1; } + /* apply options */ + if (dev->ignore_device) { + info("configured rule in '%s[%i]' applied, '%s' is ignored", + dev->config_file, dev->config_line, udev->kernel_name); + return -1; + } + if (dev->ignore_remove) { + udev->ignore_remove = dev->ignore_remove; + dbg_parse("remove event should be ignored"); + } + /* apply all_partitions option only at a main block device */ + if (dev->partitions && udev->type == 'b' && udev->kernel_number[0] == '\0') { + udev->partitions = dev->partitions; + dbg("creation of partition nodes requested"); + } + /* apply permissions */ if (dev->mode != 0000) { udev->mode = dev->mode; @@ -788,11 +806,6 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d /* rule matches */ if (dev->name[0] != '\0') { - /* apply all_partitions flag only at a main block device */ - if (dev->partitions > 0 && - (udev->type != 'b' || udev->kernel_number[0] != '\0')) - continue; - info("configured rule in '%s[%i]' applied, '%s' becomes '%s'", dev->config_file, dev->config_line, udev->kernel_name, dev->name); @@ -800,15 +813,10 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); strfieldcpy(udev->config_file, dev->config_file); udev->config_line = dev->config_line; - udev->ignore_remove = dev->ignore_remove; - - if (udev->type == 'n') - goto exit; - - udev->partitions = dev->partitions; - dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", - udev->name, udev->owner, udev->group, udev->mode, udev->partitions); + if (udev->type != 'n') + dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", + udev->name, udev->owner, udev->group, udev->mode, udev->partitions); goto exit; } |