summaryrefslogtreecommitdiff
path: root/udev_sysfs.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2005-02-21 13:44:39 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 23:36:13 -0700
commit7e720bd4ad8257d81d273d98294ebbcc03ade9ba (patch)
tree5ce8a27d9abe0213679e815d1d13bcc4597da3d8 /udev_sysfs.c
parent1cec1c241600fc11121f9504bc9e95836c03bd9c (diff)
[PATCH] switch major/minor to dev_t
Diffstat (limited to 'udev_sysfs.c')
-rw-r--r--udev_sysfs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/udev_sysfs.c b/udev_sysfs.c
index fd7330a161..f0666509ea 100644
--- a/udev_sysfs.c
+++ b/udev_sysfs.c
@@ -59,6 +59,23 @@ static const struct subsystem_file {
{ NULL, NULL }
};
+dev_t get_devt(struct sysfs_class_device *class_dev)
+{
+ struct sysfs_attribute *attr = NULL;
+ unsigned int major, minor;
+
+ attr = sysfs_get_classdev_attr(class_dev, "dev");
+ if (attr == NULL)
+ return 0;
+ dbg("dev='%s'", attr->value);
+
+ if (sscanf(attr->value, "%u:%u", &major, &minor) != 2)
+ return 0;
+ dbg("found major=%d, minor=%d", major, minor);
+
+ return makedev(major, minor);
+}
+
int subsystem_expect_no_dev(const char *subsystem)
{
const struct subsystem_file *file;