X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fudev%2Fudev-builtin-path_id.c;h=3ca59e011373a963d0282f01e32be33dfcc24a4c;hb=86e6e5d1b4e78d62d1a45539c1de141bc5e839aa;hp=0659967c686818970a33d22f8f4eefc25fdbdd85;hpb=dd8b2bf433a42683380b6fa041660dd92f91b6a9;p=elogind.git diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c index 0659967c6..3ca59e011 100644 --- a/src/udev/udev-builtin-path_id.c +++ b/src/udev/udev-builtin-path_id.c @@ -32,6 +32,7 @@ #include "udev.h" +_printf_(2,3) static int path_prepend(char **path, const char *fmt, ...) { va_list va; @@ -70,9 +71,9 @@ static int format_lun_number(struct udev_device *dev, char **path) /* address method 0, peripheral device addressing with bus id of zero */ if (lun < 256) - return path_prepend(path, "lun-%d", lun); + return path_prepend(path, "lun-%lu", lun); /* handle all other lun addressing methods by using a variant of the original lun format */ - return path_prepend(path, "lun-0x%04x%04x00000000", (lun & 0xffff), (lun >> 16) & 0xffff); + return path_prepend(path, "lun-0x%04lx%04lx00000000", lun & 0xffff, (lun >> 16) & 0xffff); } static struct udev_device *skip_subsystem(struct udev_device *dev, const char *subsys) @@ -452,6 +453,19 @@ static struct udev_device *handle_usb(struct udev_device *parent, char **path) return parent; } +static struct udev_device *handle_bcma(struct udev_device *parent, char **path) +{ + const char *sysname; + unsigned int core; + + sysname = udev_device_get_sysname(parent); + if (sscanf(sysname, "bcma%*u:%u", &core) != 1) + return NULL; + + path_prepend(path, "bcma-%u", core); + return parent; +} + static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path) { struct udev_device *scsi_dev; @@ -509,6 +523,9 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool } else if (streq(subsys, "usb")) { parent = handle_usb(parent, &path); some_transport = true; + } else if (streq(subsys, "bcma")) { + parent = handle_bcma(parent, &path); + some_transport = true; } else if (streq(subsys, "serio")) { path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent)); parent = skip_subsystem(parent, "serio"); @@ -525,9 +542,6 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool } else if (streq(subsys, "xen")) { path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "xen"); - } else if (streq(subsys, "virtio")) { - path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "virtio"); } else if (streq(subsys, "scm")) { path_prepend(&path, "scm-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "scm");