diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2010-12-10 13:27:03 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2010-12-10 13:27:03 +0100 |
commit | 2713e6ab0abfc47a54ccbae26be22471aef46b24 (patch) | |
tree | 1e7836caac97f0ece62bf40a32dff93f937f262e /udev/udev-node.c | |
parent | 4281da1fa6fda10c15bee984825fc607a8385004 (diff) |
udevd: always create /dev/{char,block}/$major:$minor
Diffstat (limited to 'udev/udev-node.c')
-rw-r--r-- | udev/udev-node.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/udev/udev-node.c b/udev/udev-node.c index 92634427f9..70488c420b 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -369,6 +369,7 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) { struct udev *udev = udev_device_get_udev(dev); + char filename[UTIL_PATH_SIZE]; struct udev_list_entry *list_entry; int err = 0; @@ -382,6 +383,13 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) goto exit; } + /* always add /dev/{block,char}/$major:$minor */ + snprintf(filename, sizeof(filename), "%s/%s/%u:%u", + udev_get_dev_path(udev), + strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); + node_symlink(udev, udev_device_get_devnode(dev), filename); + /* create/update symlinks, add symlinks to name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { if (udev_list_entry_get_flags(list_entry)) @@ -401,6 +409,7 @@ int udev_node_remove(struct udev_device *dev) 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 */ @@ -434,6 +443,13 @@ int udev_node_remove(struct udev_device *dev) err = util_unlink_secure(udev, devnode); if (err == 0) util_delete_path(udev, devnode); + + /* remove /dev/{block,char}/$major:$minor */ + snprintf(filename, sizeof(filename), "%s/%s/%u:%u", + udev_get_dev_path(udev), + strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); + unlink(filename); out: return err; } |