Lines Matching refs:names
167 static int dev_pci_onboard(sd_device *dev, const LinkInfo *info, NetNames *names) { in dev_pci_onboard() argument
176 assert(names); in dev_pci_onboard()
179 if (sd_device_get_sysattr_value(names->pcidev, "acpi_index", &attr) >= 0) in dev_pci_onboard()
180 log_device_debug(names->pcidev, "acpi_index=%s", attr); in dev_pci_onboard()
183 r = sd_device_get_sysattr_value(names->pcidev, "index", &attr); in dev_pci_onboard()
186 log_device_debug(names->pcidev, "index=%s", attr); in dev_pci_onboard()
191 return log_device_debug_errno(names->pcidev, r, in dev_pci_onboard()
194 return log_device_debug_errno(names->pcidev, SYNTHETIC_ERRNO(EINVAL), in dev_pci_onboard()
197 return log_device_debug_errno(names->pcidev, SYNTHETIC_ERRNO(ENOENT), in dev_pci_onboard()
208 s = names->pci_onboard; in dev_pci_onboard()
209 l = sizeof(names->pci_onboard); in dev_pci_onboard()
217 names->pci_onboard[0] = '\0'; in dev_pci_onboard()
220 empty_to_na(names->pci_onboard)); in dev_pci_onboard()
222 if (sd_device_get_sysattr_value(names->pcidev, "label", &names->pci_onboard_label) >= 0) in dev_pci_onboard()
223 … log_device_debug(dev, "Onboard label from PCI device: %s", names->pci_onboard_label); in dev_pci_onboard()
225 names->pci_onboard_label = NULL; in dev_pci_onboard()
325 static int dev_pci_slot(sd_device *dev, const LinkInfo *info, NetNames *names) { in dev_pci_slot() argument
339 assert(names); in dev_pci_slot()
341 r = sd_device_get_sysname(names->pcidev, &sysname); in dev_pci_slot()
343 return log_device_debug_errno(names->pcidev, r, "Failed to get sysname: %m"); in dev_pci_slot()
352 is_pci_ari_enabled(names->pcidev)) in dev_pci_slot()
381 s = names->pci_path; in dev_pci_slot()
382 l = sizeof(names->pci_path); in dev_pci_slot()
386 if (func > 0 || is_pci_multifunction(names->pcidev)) in dev_pci_slot()
394 names->pci_path[0] = '\0'; in dev_pci_slot()
398 empty_to_na(names->pci_path)); in dev_pci_slot()
417 hotplug_slot_dev = names->pcidev; in dev_pci_slot()
454 … if (naming_scheme_has(NAMING_BRIDGE_MULTIFUNCTION_SLOT) && !is_pci_multifunction(names->pcidev)) { in dev_pci_slot()
476 s = names->pci_slot; in dev_pci_slot()
477 l = sizeof(names->pci_slot); in dev_pci_slot()
481 if (func > 0 || is_pci_multifunction(names->pcidev)) in dev_pci_slot()
488 names->pci_slot[0] = '\0'; in dev_pci_slot()
492 empty_to_na(names->pci_slot)); in dev_pci_slot()
498 static int names_vio(sd_device *dev, NetNames *names) { in names_vio() argument
530 xsprintf(names->vio_slot, "v%u", slotid); in names_vio()
531 names->type = NET_VIO; in names_vio()
532 log_device_debug(dev, "Vio slot identifier: slotid=%u → %s", slotid, names->vio_slot); in names_vio()
540 static int names_platform(sd_device *dev, NetNames *names, bool test) { in names_platform() argument
597 xsprintf(names->platform_path, "a%s%xi%u", vendor, model, instance); in names_platform()
598 names->type = NET_PLATFORM; in names_platform()
600 vendor, model, instance, names->platform_path); in names_platform()
604 static int names_pci(sd_device *dev, const LinkInfo *info, NetNames *names) { in names_pci() argument
613 assert(names); in names_pci()
627 names->type = NET_PCI; in names_pci()
628 names->pcidev = parent; in names_pci()
630 r = sd_device_get_parent_with_subsystem_devtype(dev, "pci", NULL, &names->pcidev); in names_pci()
636 get_virtfn_info(names->pcidev, &physfn_pcidev, &virtfn_suffix) >= 0) { in names_pci()
645 … if (strlen(vf_names.pci_onboard) + strlen(virtfn_suffix) < sizeof(names->pci_onboard)) in names_pci()
646 strscpyl(names->pci_onboard, sizeof(names->pci_onboard), in names_pci()
649 … if (strlen(vf_names.pci_slot) + strlen(virtfn_suffix) < sizeof(names->pci_slot)) in names_pci()
650 strscpyl(names->pci_slot, sizeof(names->pci_slot), in names_pci()
653 … if (strlen(vf_names.pci_path) + strlen(virtfn_suffix) < sizeof(names->pci_path)) in names_pci()
654 strscpyl(names->pci_path, sizeof(names->pci_path), in names_pci()
657 dev_pci_onboard(dev, info, names); in names_pci()
658 dev_pci_slot(dev, info, names); in names_pci()
664 static int names_usb(sd_device *dev, NetNames *names) { in names_usb() argument
672 assert(names); in names_usb()
708 s = names->usb_ports; in names_usb()
709 l = strpcpyl(&s, sizeof(names->usb_ports), "u", ports, NULL); in names_usb()
713 l = strpcpyl(&s, sizeof(names->usb_ports), "c", config, NULL); in names_usb()
717 l = strpcpyl(&s, sizeof(names->usb_ports), "i", interf, NULL); in names_usb()
722 … (int) strlen(ports), sysname + (ports - name), config, interf, names->usb_ports); in names_usb()
723 names->type = NET_USB; in names_usb()
727 static int names_bcma(sd_device *dev, NetNames *names) { in names_bcma() argument
734 assert(names); in names_bcma()
752 xsprintf(names->bcma_core, "b%u", core); in names_bcma()
754 names->type = NET_BCMA; in names_bcma()
755 log_device_debug(dev, "BCMA core identifier: core=%u → \"%s\"", core, names->bcma_core); in names_bcma()
759 static int names_ccw(sd_device *dev, NetNames *names) { in names_ccw() argument
766 assert(names); in names_ccw()
812 if (!snprintf_ok(names->ccw_busid, sizeof(names->ccw_busid), "c%s", bus_id)) in names_ccw()
815 names->type = NET_CCW; in names_ccw()
816 log_device_debug(dev, "CCW identifier: ccw_busid=%s → \"%s\"", bus_id, names->ccw_busid); in names_ccw()
852 static int names_netdevsim(sd_device *dev, const LinkInfo *info, NetNames *names) { in names_netdevsim() argument
863 assert(names); in names_netdevsim()
878 …if (!snprintf_ok(names->netdevsim_path, sizeof(names->netdevsim_path), "i%un%s", addr, info->phys_… in names_netdevsim()
881 names->type = NET_NETDEVSIM; in names_netdevsim()
886 static int names_xen(sd_device *dev, NetNames *names) { in names_xen() argument
893 assert(names); in names_xen()
934 xsprintf(names->xen_slot, "X%u", id); in names_xen()
935 names->type = NET_XENVIF; in names_xen()
968 NetNames names = {}; in builtin_net_id() local
1037 if (names_ccw(dev, &names) >= 0 && names.type == NET_CCW) { in builtin_net_id()
1040 if (snprintf_ok(str, sizeof str, "%s%s", prefix, names.ccw_busid)) in builtin_net_id()
1046 if (names_vio(dev, &names) >= 0 && names.type == NET_VIO) { in builtin_net_id()
1049 if (snprintf_ok(str, sizeof str, "%s%s", prefix, names.vio_slot)) in builtin_net_id()
1055 if (names_platform(dev, &names, test) >= 0 && names.type == NET_PLATFORM) { in builtin_net_id()
1058 if (snprintf_ok(str, sizeof str, "%s%s", prefix, names.platform_path)) in builtin_net_id()
1064 if (names_netdevsim(dev, &info, &names) >= 0 && names.type == NET_NETDEVSIM) { in builtin_net_id()
1067 if (snprintf_ok(str, sizeof str, "%s%s", prefix, names.netdevsim_path)) in builtin_net_id()
1074 if (names_xen(dev, &names) >= 0 && names.type == NET_XENVIF) { in builtin_net_id()
1077 if (snprintf_ok(str, sizeof str, "%s%s", prefix, names.xen_slot)) in builtin_net_id()
1083 if (names_pci(dev, &info, &names) < 0) in builtin_net_id()
1087 if (names.type == NET_PCI) { in builtin_net_id()
1090 if (names.pci_onboard[0] && in builtin_net_id()
1091 snprintf_ok(str, sizeof str, "%s%s", prefix, names.pci_onboard)) in builtin_net_id()
1094 if (names.pci_onboard_label && in builtin_net_id()
1097 names.pci_onboard_label)) in builtin_net_id()
1100 if (names.pci_path[0] && in builtin_net_id()
1101 snprintf_ok(str, sizeof str, "%s%s", prefix, names.pci_path)) in builtin_net_id()
1104 if (names.pci_slot[0] && in builtin_net_id()
1105 snprintf_ok(str, sizeof str, "%s%s", prefix, names.pci_slot)) in builtin_net_id()
1111 if (names_usb(dev, &names) >= 0 && names.type == NET_USB) { in builtin_net_id()
1114 if (names.pci_path[0] && in builtin_net_id()
1115 snprintf_ok(str, sizeof str, "%s%s%s", prefix, names.pci_path, names.usb_ports)) in builtin_net_id()
1118 if (names.pci_slot[0] && in builtin_net_id()
1119 snprintf_ok(str, sizeof str, "%s%s%s", prefix, names.pci_slot, names.usb_ports)) in builtin_net_id()
1125 if (names_bcma(dev, &names) >= 0 && names.type == NET_BCMA) { in builtin_net_id()
1128 if (names.pci_path[0] && in builtin_net_id()
1129 snprintf_ok(str, sizeof str, "%s%s%s", prefix, names.pci_path, names.bcma_core)) in builtin_net_id()
1132 if (names.pci_slot[0] && in builtin_net_id()
1133 snprintf_ok(str, sizeof str, "%s%s%s", prefix, names.pci_slot, names.bcma_core)) in builtin_net_id()