From: Kay Sievers Date: Tue, 13 Apr 2010 10:45:38 +0000 (+0200) Subject: remove "ignore_remove" option X-Git-Tag: 174~556 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=a89d342dfb45b54e29381af9dbc495bbb2b057af remove "ignore_remove" option --- diff --git a/NEWS b/NEWS index c422eaa8e..ea5c19d7f 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,12 @@ needed for usual hardware. Udev can not safely make assumptions about non-exixting partition major/minor numbers, and therefore no longer provide such an unreliable and unsafe option. +The option "ignore_remove" was removed from udev. With devtmpfs +udev passed control over device nodes to the kernel. This option +should no longer be needed, or can not work as advertised. Neither +udev nor the kernel will remove device nodes which are copied from +the /lib/udev/devices/ directory. + All "add|change" matches are replaced by "!remove" in the rules and in the udev logic. All types of events will update possible symlinks and permissions, only "remove" is handled special now. diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 19c20b2cc..5e4381ec2 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -41,8 +41,6 @@ int udev_device_update_db(struct udev_device *udev_device) udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) if (udev_list_entry_get_flags(list_entry)) goto file; - if (udev_device_get_ignore_remove(udev_device)) - goto file; if (udev_device_get_devlink_priority(udev_device) != 0) goto file; if (udev_device_get_event_timeout(udev_device) >= 0) @@ -93,8 +91,6 @@ file: fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device)); if (udev_device_get_event_timeout(udev_device) >= 0) fprintf(f, "T:%i\n", udev_device_get_event_timeout(udev_device)); - if (udev_device_get_ignore_remove(udev_device)) - fprintf(f, "R:%i\n", udev_device_get_ignore_remove(udev_device)); if (udev_device_get_watch_handle(udev_device) >= 0) fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device)); udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 75cc61c5f..b3b6a6311 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -75,7 +75,6 @@ struct udev_device { unsigned int envp_uptodate:1; unsigned int driver_set:1; unsigned int info_loaded:1; - unsigned int ignore_remove:1; }; struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) @@ -283,9 +282,6 @@ int udev_device_read_db(struct udev_device *udev_device) case 'T': udev_device_set_event_timeout(udev_device, atoi(val)); break; - case 'R': - udev_device_set_ignore_remove(udev_device, atoi(val)); - break; case 'E': udev_device_add_property_from_string(udev_device, val); break; @@ -1434,19 +1430,6 @@ int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio) return 0; } -int udev_device_get_ignore_remove(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - device_load_info(udev_device); - return udev_device->ignore_remove; -} - -int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore) -{ - udev_device->ignore_remove = ignore; - return 0; -} - int udev_device_get_watch_handle(struct udev_device *udev_device) { if (!udev_device->info_loaded) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index bf9e923b6..8dc469ec9 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -95,8 +95,6 @@ int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum); int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); int udev_device_get_devlink_priority(struct udev_device *udev_device); int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio); -int udev_device_get_ignore_remove(struct udev_device *udev_device); -int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore); int udev_device_get_watch_handle(struct udev_device *udev_device); int udev_device_set_watch_handle(struct udev_device *udev_device, int handle); void udev_device_set_info_loaded(struct udev_device *device); diff --git a/test/udev-test.pl b/test/udev-test.pl index 4633d6be2..a4d3a728f 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -975,16 +975,6 @@ EOF exp_name => "link4", rules => < "ignore remove event test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_rem_error => "yes", - rules => <udev, "NAME=\"%%k\" is superfluous and breaks " "kernel supplied names, please remove it from %s:%u\n", filename, lineno); rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL); - attr = get_key_attribute(rules->udev, key + sizeof("NAME")-1); - if (attr != NULL) { - if (strstr(attr, "ignore_remove") != NULL) { - dbg(rules->udev, "remove event should be ignored\n"); - rule_add_key(&rule_tmp, TK_A_IGNORE_REMOVE, 0, NULL, NULL); - } - } } rule_tmp.rule.rule.flags = 1; continue; @@ -1540,10 +1533,6 @@ static int add_rule(struct udev_rules *rules, char *line, if (strcmp(key, "OPTIONS") == 0) { const char *pos; - if (strstr(value, "ignore_remove") != NULL) { - dbg(rules->udev, "remove event should be ignored\n"); - rule_add_key(&rule_tmp, TK_A_IGNORE_REMOVE, 0, NULL, NULL); - } pos = strstr(value, "link_priority="); if (pos != NULL) { int prio = atoi(&pos[strlen("link_priority=")]); @@ -2501,9 +2490,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_A_EVENT_TIMEOUT: udev_device_set_event_timeout(event->dev, cur->key.event_timeout); break; - case TK_A_IGNORE_REMOVE: - udev_device_set_ignore_remove(event->dev, 1); - break; case TK_A_ATTR: { const char *key_name = &rules->buf[cur->key.attr_off]; diff --git a/udev/udev.xml b/udev/udev.xml index 9275e0f79..dce953dbc 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -435,13 +435,6 @@ Rule and device options: - - - - Do not remove the device node when the device goes away. This may be - useful as a workaround for broken device drivers. - - diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index c57620fee..5f6209af2 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -142,10 +142,6 @@ static void print_record(struct udev_device *device) if (i != 0) printf("L: %i\n", i); - i = udev_device_get_ignore_remove(device); - if (i != 0) - printf("R: %u\n", i); - i = udev_device_get_watch_handle(device); if (i >= 0) printf("W: %u\n", i);