summaryrefslogtreecommitdiff
path: root/udev_db.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2005-02-18 03:30:03 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 23:36:13 -0700
commit1cec1c241600fc11121f9504bc9e95836c03bd9c (patch)
tree7ce2ccaa9ea5c15c3289726c2c2698ae8762f031 /udev_db.c
parent3f930093f9ac79dca6bcc2dcbc8714c143709478 (diff)
[PATCH] remove the device node only if the major/minor number matches
Diffstat (limited to 'udev_db.c')
-rw-r--r--udev_db.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/udev_db.c b/udev_db.c
index df7cfbb259..0be7620ad7 100644
--- a/udev_db.c
+++ b/udev_db.c
@@ -79,6 +79,7 @@ int udev_db_add_device(struct udevice *udev)
fprintf(f, "P:%s\n", udev->devpath);
fprintf(f, "N:%s\n", udev->name);
fprintf(f, "S:%s\n", udev->symlink);
+ fprintf(f, "M:%u:%u\n", udev->major, udev->minor);
fprintf(f, "A:%u\n", udev->partitions);
fprintf(f, "R:%u\n", udev->ignore_remove);
@@ -90,6 +91,7 @@ int udev_db_add_device(struct udevice *udev)
static int parse_db_file(struct udevice *udev, const char *filename)
{
char line[NAME_SIZE];
+ char temp[NAME_SIZE];
char *bufline;
char *buf;
size_t bufsize;
@@ -120,6 +122,13 @@ static int parse_db_file(struct udevice *udev, const char *filename)
strncpy(udev->name, &bufline[2], count-2);
udev->name[count-2] = '\0';
break;
+ case 'M':
+ if (count > NAME_SIZE)
+ count = NAME_SIZE-1;
+ strncpy(temp, &bufline[2], count-2);
+ temp[count-2] = '\0';
+ sscanf(temp, "%u:%u", &udev->major, &udev->minor);
+ break;
case 'S':
if (count > NAME_SIZE)
count = NAME_SIZE-1;