summaryrefslogtreecommitdiff
path: root/udev
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2010-12-12 20:07:15 +0100
committerKay Sievers <kay.sievers@vrfy.org>2010-12-12 20:07:15 +0100
commitcad40a5fe75d876af22f68b688494b9cd98cc899 (patch)
treee83a3a87fe2d8e9de28febd10741a379ad711f63 /udev
parent24d1076696ebe6696a8b8df414ab265aa6fc89c2 (diff)
udevd: switch to common id_filename functions
Diffstat (limited to 'udev')
-rw-r--r--udev/udev-node.c14
-rw-r--r--udev/udev-watch.c14
2 files changed, 6 insertions, 22 deletions
diff --git a/udev/udev-node.c b/udev/udev-node.c
index a9ffa988b1..0ceb1d5110 100644
--- a/udev/udev-node.c
+++ b/udev/udev-node.c
@@ -243,26 +243,20 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons
for (;;) {
struct udev_device *dev_db;
struct dirent *dent;
- int maj, min;
- char type, type2;
- dev_t devnum;
dent = readdir(dir);
if (dent == NULL || dent->d_name[0] == '\0')
break;
if (dent->d_name[0] == '.')
continue;
- if (sscanf(dent->d_name, "%c%i:%i", &type, &maj, &min) != 3)
- continue;
- info(udev, "found '%c%i:%i' claiming '%s'\n", type, maj, min, stackdir);
- devnum = makedev(maj, min);
+
+ info(udev, "found '%s' claiming '%s'\n", dent->d_name, stackdir);
/* did we find ourself? */
- type2 = strcmp(udev_device_get_subsystem(dev), "block") == 0 ? 'b' : 'c';
- if (udev_device_get_devnum(dev) == devnum && type == type2)
+ if (strcmp(dent->d_name, udev_device_get_id_filename(dev)) == 0)
continue;
- dev_db = udev_device_new_from_devnum(udev, type, devnum);
+ dev_db = udev_device_new_from_id_filename(udev, dent->d_name);
if (dev_db != NULL) {
const char *devnode;
diff --git a/udev/udev-watch.c b/udev/udev-watch.c
index 9e1b8d8553..f51a10dcab 100644
--- a/udev/udev-watch.c
+++ b/udev/udev-watch.c
@@ -72,8 +72,6 @@ void udev_watch_restore(struct udev *udev)
size_t l;
ssize_t len;
struct udev_device *dev;
- int maj, min;
- char type;
if (ent->d_name[0] == '.')
continue;
@@ -85,9 +83,7 @@ void udev_watch_restore(struct udev *udev)
goto unlink;
s[len] = '\0';
- if (sscanf(s, "%c%i:%i", &type, &maj, &min) != 3)
- goto unlink;
- dev = udev_device_new_from_devnum(udev, type, makedev(maj, min));
+ dev = udev_device_new_from_id_filename(udev, s);
if (dev == NULL)
goto unlink;
@@ -158,9 +154,6 @@ struct udev_device *udev_watch_lookup(struct udev *udev, int wd)
char *s;
size_t l;
ssize_t len;
- int maj, min;
- char type;
- dev_t devnum;
if (inotify_fd < 0 || wd < 0)
return NULL;
@@ -173,8 +166,5 @@ struct udev_device *udev_watch_lookup(struct udev *udev, int wd)
return NULL;
s[len] = '\0';
- if (sscanf(s, "%c%i:%i", &type, &maj, &min) != 3)
- return NULL;
- devnum = makedev(maj, min);
- return udev_device_new_from_devnum(udev, type, devnum);
+ return udev_device_new_from_id_filename(udev, s);
}