summaryrefslogtreecommitdiff
path: root/libudev/libudev-queue-private.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-08-19 20:49:49 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-08-19 20:49:49 +0200
commit2ffc9cc1917b1bb6fe86881a94a47dce9aa15168 (patch)
tree842ba77f43018179ce42e5433ce1c6cd63559c60 /libudev/libudev-queue-private.c
parent24d1fea8bd609f9eb7901efd7cba7f2dee05f557 (diff)
change database file names
With very deeply nested devices, We can not use a single file name to carry an entire DEVPATH. Use <subsystem>:<sysname> as the database filename, which should also simplify the handling of devices moving around, as these values will not change but still be unique. For the name stack we use the <maj>:<min> now as the filename. > On Tue, Aug 18, 2009 at 09:59:56AM -0400, Ric Wheeler wrote: > The first is that udev grumbles during boot about "file name too long" > like the following: > > Aug 17 06:49:58 megadeth udevd-event[20447]: unable to create db file > '/dev/.udev/db/\x2fdevices\x2fpci0000:00\x2f0000:00:04.0\x2f0000:17:00.0\x2f0000:18:0a.0\x2f0000:1f:00.0\x2fhost11\x2fport-11:0\x2fexpander-11:0\x2fport-11:0:0\x2fexpander-11:1\x2fport-11:1:0\x2fexpander-11:2\x2fport-11:2:17\x2fexpander-11:3\x2fport-11:3:1\x2fend_device-11:3:1\x2fbsg\x2fend_device-11:3:1': > File name too long
Diffstat (limited to 'libudev/libudev-queue-private.c')
-rw-r--r--libudev/libudev-queue-private.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c
index 4dea4ad0e7..e0a8738e0e 100644
--- a/libudev/libudev-queue-private.c
+++ b/libudev/libudev-queue-private.c
@@ -396,16 +396,13 @@ static void update_failed(struct udev_queue_export *udev_queue_export,
{
struct udev *udev = udev_device_get_udev(udev_device);
char filename[UTIL_PATH_SIZE];
- char *s;
- size_t l;
if (state != DEVICE_FAILED && udev_queue_export->failed_count == 0)
return;
/* location of failed file */
- s = filename;
- l = util_strpcpyl(&s, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/failed/", NULL);
- util_path_encode(udev_device_get_devpath(udev_device), s, l);
+ util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/failed/",
+ udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL);
switch (state) {
case DEVICE_FAILED:
@@ -428,14 +425,13 @@ static void update_failed(struct udev_queue_export *udev_queue_export,
break;
case DEVICE_FINISHED:
- if (udev_device_get_devpath_old(udev_device) != NULL) {
+ if (udev_device_get_sysname_old(udev_device) != NULL &&
+ strcmp(udev_device_get_sysname_old(udev_device), udev_device_get_sysname(udev_device)) != 0) {
/* "move" event - rename failed file to current name, do not delete failed */
char filename_old[UTIL_PATH_SIZE];
- s = filename_old;
- l = util_strpcpyl(&s, sizeof(filename_old), udev_get_dev_path(udev_queue_export->udev), "/.udev/failed/", NULL);
- util_path_encode(udev_device_get_devpath_old(udev_device), s, l);
-
+ util_strscpyl(filename_old, sizeof(filename_old), udev_get_dev_path(udev), "/.udev/failed/",
+ udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname_old(udev_device), NULL);
if (rename(filename_old, filename) == 0)
info(udev, "renamed devpath, moved failed state of '%s' to %s'\n",
udev_device_get_devpath_old(udev_device), udev_device_get_devpath(udev_device));