X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=namedev.c;h=cff338f1a719b635c06a33c765d2376f46869f4b;hp=1e600bbe6d2b997112325133dbc03c980c2d12d7;hb=5f7c4c1bb07c4398331b548de366c76c05eed1ff;hpb=07562d6ecf64f708a3a20388200ec8bd9c5a3774 diff --git a/namedev.c b/namedev.c index 1e600bbe6..cff338f1a 100644 --- a/namedev.c +++ b/namedev.c @@ -200,11 +200,12 @@ static void apply_format(struct udevice *udev, unsigned char *string) case 'D': if (strlen(udev->kernel_number) == 0) { strcat(pos, "disc"); + dbg("substitute devfs disc"); break; } strcat(pos, "part"); strcat(pos, udev->kernel_number); - dbg("substitute kernel number '%s'", udev->kernel_number); + dbg("substitute devfs part '%s'", udev->kernel_number); break; case 'm': sprintf(pos, "%u", udev->minor); @@ -229,8 +230,10 @@ static void apply_format(struct udevice *udev, unsigned char *string) break; } } - strcat(pos, pos3); - dbg("substitute partial callout output '%s'", pos3); + if (pos3) { + strcat(pos, pos3); + dbg("substitute partial callout output '%s'", pos3); + } } else { strcat(pos, udev->callout_value); dbg("substitute callout output '%s'", udev->callout_value); @@ -252,6 +255,8 @@ static struct bus_file { } bus_files[] = { { .bus = "scsi", .file = "vendor" }, { .bus = "usb", .file = "idVendor" }, + { .bus = "ide", .file = "detach_state" }, + { .bus = "pci", .file = "vendor" }, {} }; @@ -398,7 +403,10 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev if (dev->type != CALLOUT) continue; - if (sysfs_device) { + if (dev->bus[0] != '\0') { + /* as the user specified a bus, we must match it up */ + if (!sysfs_device) + continue; dbg("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); if (strcasecmp(dev->bus, sysfs_device->bus) != 0) continue; @@ -469,7 +477,10 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, if (dev->type != LABEL) continue; - if (sysfs_device) { + if (dev->bus[0] != '\0') { + /* as the user specified a bus, we must match it up */ + if (!sysfs_device) + continue; dbg("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); if (strcasecmp(dev->bus, sysfs_device->bus) != 0) continue; @@ -644,9 +655,9 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { temp = strrchr(filename, '/'); if (temp) { + char *temp2 = strrchr(filename, '/'); partition = 1; *temp = 0x00; - char *temp2 = strrchr(filename, '/'); dbg("temp2 = %s", temp2); if (temp2 && (strcmp(temp2, "/block") == 0)) { /* oops, we have no parent block device, so go back to original directory */