Lines Matching refs:path

2  * compose persistent device path
38 static int path_prepend(char **path, const char *fmt, ...) {
49 if (*path != NULL) {
52 err = asprintf(&new, "%s-%s", pre, *path);
56 free(*path);
57 *path = new;
59 *path = pre;
69 static int format_lun_number(struct udev_device *dev, char **path) {
74 return path_prepend(path, "lun-%lu", lun);
76 return path_prepend(path, "lun-0x%04lx%04lx00000000", lun & 0xffff, (lun >> 16) & 0xffff);
97 static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, char **path) {
105 assert(path);
121 path_prepend(path, "fc-%s-%s", port, lun);
128 static struct udev_device *handle_scsi_sas_wide_port(struct udev_device *parent, char **path) {
137 assert(path);
159 path_prepend(path, "sas-%s-%s", sas_address, lun);
166 static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **path)
182 assert(path);
217 parent = handle_scsi_sas_wide_port(parent, path);
250 path_prepend(path, "sas-exp%s-phy%s-%s", sas_address, phy_id, lun);
252 path_prepend(path, "sas-phy%s-%s", phy_id, lun);
262 static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **path) {
274 assert(path);
314 path_prepend(path, "ip-%s:%s-iscsi-%s-%s", addr, port, target, lun);
322 static struct udev_device *handle_scsi_ata(struct udev_device *parent, char **path) {
330 assert(path);
349 path_prepend(path, "ata-%s", port_no);
355 static struct udev_device *handle_scsi_default(struct udev_device *parent, char **path) {
366 assert(path);
436 path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun);
442 static struct udev_device *handle_scsi_hyperv(struct udev_device *parent, char **path) {
451 assert(path);
476 path_prepend(path, "vmbus-%s-%s", guid, lun);
481 static struct udev_device *handle_scsi(struct udev_device *parent, char **path, bool *supported_parent) {
494 path_prepend(path, "ieee1394-0x%s", id);
503 parent = handle_scsi_fibre_channel(parent, path);
509 parent = handle_scsi_sas(parent, path);
515 parent = handle_scsi_iscsi(parent, path);
521 parent = handle_scsi_ata(parent, path);
526 parent = handle_scsi_hyperv(parent, path);
530 parent = handle_scsi_default(parent, path);
535 static struct udev_device *handle_cciss(struct udev_device *parent, char **path) {
543 path_prepend(path, "cciss-disk%u", disk);
548 static void handle_scsi_tape(struct udev_device *dev, char **path) {
552 if (*path != NULL)
557 path_prepend(path, "nst%c", name[3]);
559 path_prepend(path, "st%c", name[2]);
562 static struct udev_device *handle_usb(struct udev_device *parent, char **path) {
580 path_prepend(path, "usb-0:%s", port);
584 static struct udev_device *handle_bcma(struct udev_device *parent, char **path) {
592 path_prepend(path, "bcma-%u", core);
597 static struct udev_device *handle_ap(struct udev_device *parent, char **path) {
601 assert(path);
607 path_prepend(path, "ap-%s-%s", type, func);
610 path_prepend(path, "ap-%s", udev_device_get_sysname(parent));
618 char *path = NULL;
624 /* walk up the chain of devices and compose path */
633 handle_scsi_tape(parent, &path);
635 parent = handle_scsi(parent, &path, &supported_parent);
638 parent = handle_cciss(parent, &path);
641 parent = handle_usb(parent, &path);
644 parent = handle_bcma(parent, &path);
647 path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent));
650 path_prepend(&path, "pci-%s", udev_device_get_sysname(parent));
654 path_prepend(&path, "platform-%s", udev_device_get_sysname(parent));
659 path_prepend(&path, "acpi-%s", udev_device_get_sysname(parent));
663 path_prepend(&path, "xen-%s", udev_device_get_sysname(parent));
669 path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent));
673 path_prepend(&path, "scm-%s", udev_device_get_sysname(parent));
678 path_prepend(&path, "ccw-%s", udev_device_get_sysname(parent));
683 path_prepend(&path, "ccwgroup-%s", udev_device_get_sysname(parent));
688 parent = handle_ap(parent, &path);
692 path_prepend(&path, "iucv-%s", udev_device_get_sysname(parent));
708 path = mfree(path);
716 path = mfree(path);
718 if (path != NULL) {
724 for (p = path, i = 0; *p; p++) {
748 udev_builtin_add_property(dev, test, "ID_PATH", path);
750 free(path);
759 .help = "Compose persistent device path",