summaryrefslogtreecommitdiff
path: root/udev
diff options
context:
space:
mode:
Diffstat (limited to 'udev')
-rw-r--r--udev/udev-node.c38
-rw-r--r--udev/udev-rules.c14
-rw-r--r--udev/udev.xml7
-rw-r--r--udev/udevadm-info.c4
4 files changed, 22 insertions, 41 deletions
diff --git a/udev/udev-node.c b/udev/udev-node.c
index 4492c2e393..34de268464 100644
--- a/udev/udev-node.c
+++ b/udev/udev-node.c
@@ -396,6 +396,8 @@ int udev_node_remove(struct udev_device *dev)
struct udev_list_entry *list_entry;
const char *devnode;
struct stat stats;
+ struct udev_device *dev_check;
+ char filename[UTIL_PATH_SIZE];
int err = 0;
/* remove/update symlinks, remove symlinks from name index */
@@ -404,32 +406,36 @@ int udev_node_remove(struct udev_device *dev)
devnode = udev_device_get_devnode(dev);
if (devnode == NULL)
- return 0;
+ goto out;
+
if (stat(devnode, &stats) != 0) {
info(udev, "device node '%s' not found\n", devnode);
- return 0;
+ goto out;
}
+
if (stats.st_rdev != udev_device_get_devnum(dev)) {
info(udev, "device node '%s' points to a different device, skip removal\n", devnode);
- return -1;
+ err = -1;
+ goto out;
}
- if (udev_device_get_ignore_remove(dev)) {
- info(udev, "ignore_remove for '%s'\n", udev_device_get_devnode(dev));
- } else {
- struct udev_device *dev_check;
-
- dev_check = udev_device_new_from_syspath(udev, udev_device_get_syspath(dev));
- if (dev_check != NULL && stats.st_rdev == udev_device_get_devnum(dev_check)) {
- /* do not remove device node if the same sys-device is re-created in the meantime */
- info(udev, "keeping device node of existing device'%s'\n", devnode);
- } else {
- info(udev, "removing device node '%s'\n", devnode);
- err = util_unlink_secure(udev, devnode);
- }
+ dev_check = udev_device_new_from_syspath(udev, udev_device_get_syspath(dev));
+ if (dev_check != NULL) {
+ /* do not remove device node if the same sys-device is re-created in the meantime */
+ info(udev, "keeping device node of existing device'%s'\n", devnode);
udev_device_unref(dev_check);
+ goto out;
+ }
+
+ util_strscpyl(filename, sizeof(filename), LIBEXECDIR "/devices", &devnode[strlen(udev_get_dev_path(udev))], NULL);
+ if (stat(filename, &stats) == 0 || stats.st_rdev == udev_device_get_devnum(dev)) {
+ info(udev, "static device entry found '%s', skip removal\n", devnode);
+ goto out;
}
+ info(udev, "removing device node '%s'\n", devnode);
+ err = util_unlink_secure(udev, devnode);
util_delete_path(udev, devnode);
+out:
return err;
}
diff --git a/udev/udev-rules.c b/udev/udev-rules.c
index a4a86b664a..4f18acaa78 100644
--- a/udev/udev-rules.c
+++ b/udev/udev-rules.c
@@ -1463,13 +1463,6 @@ static int add_rule(struct udev_rules *rules, char *line,
err(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 9275e0f79f..dce953dbce 100644
--- a/udev/udev.xml
+++ b/udev/udev.xml
@@ -436,13 +436,6 @@
<para>Rule and device options:</para>
<variablelist>
<varlistentry>
- <term><option>ignore_remove</option></term>
- <listitem>
- <para>Do not remove the device node when the device goes away. This may be
- useful as a workaround for broken device drivers.</para>
- </listitem>
- </varlistentry>
- <varlistentry>
<term><option>link_priority=<replaceable>value</replaceable></option></term>
<listitem>
<para>Specify the priority of the created symlinks. Devices with higher
diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c
index c57620feef..5f6209af2a 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);