summaryrefslogtreecommitdiff
path: root/udev_db.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-11-13 14:43:24 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 22:27:34 -0700
commit7efa217db0db946e68e6274e2b9cbe0a973ec47a (patch)
tree80c697681846807293352b05ee2e5b9e9ef7af79 /udev_db.c
parentd4a32aa2e4804de9189574213749616dda57faa7 (diff)
[PATCH] add NAME{ignore_remove} attribute
Some broken ide drivers are generating high event traffic, with add/remove events. With this attribute, it can be specified, that the node is always available. It may be used in conjunction with the new DRIVER= match to catch specific kernel device drivers.
Diffstat (limited to 'udev_db.c')
-rw-r--r--udev_db.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/udev_db.c b/udev_db.c
index f2a890ea42..e07e72b858 100644
--- a/udev_db.c
+++ b/udev_db.c
@@ -79,7 +79,8 @@ 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, "A:%d\n", udev->partitions);
+ fprintf(f, "A:%u\n", udev->partitions);
+ fprintf(f, "R:%u\n", udev->ignore_remove);
fclose(f);
@@ -111,21 +112,34 @@ static int parse_db_file(struct udevice *udev, const char *filename)
if (count > DEVPATH_SIZE)
count = DEVPATH_SIZE-1;
strncpy(udev->devpath, &bufline[2], count-2);
+ udev->devpath[count-2] = '\0';
break;
case 'N':
if (count > NAME_SIZE)
count = NAME_SIZE-1;
strncpy(udev->name, &bufline[2], count-2);
+ udev->name[count-2] = '\0';
break;
case 'S':
if (count > NAME_SIZE)
count = NAME_SIZE-1;
strncpy(udev->symlink, &bufline[2], count-2);
+ udev->symlink[count-2] = '\0';
break;
case 'A':
- strfieldcpy(line, &bufline[2]);
+ if (count > NAME_SIZE)
+ count = NAME_SIZE-1;
+ strncpy(line, &bufline[2], count-2);
+ line[count-2] = '\0';
udev->partitions = atoi(line);
break;
+ case 'R':
+ if (count > NAME_SIZE)
+ count = NAME_SIZE-1;
+ strncpy(line, &bufline[2], count-2);
+ line[count-2] = '\0';
+ udev->ignore_remove = atoi(line);
+ break;
}
}