diff options
author | Peter Schiffer <pschiffe@redhat.com> | 2014-05-09 17:37:40 +0200 |
---|---|---|
committer | Peter Schiffer <pschiffe@redhat.com> | 2014-05-12 19:20:43 +0200 |
commit | 28aed3c2c360b84762f76b322e9fc80bd74c036b (patch) | |
tree | 880f68596cbaf7e0e020a6f116c3e789cd4fd60a /src/hardware/LMI_PCIDeviceProvider.c | |
parent | 87a03ac7ebff779351e9782d40e691221195f8e0 (diff) | |
download | openlmi-providers-28aed3c2c360b84762f76b322e9fc80bd74c036b.tar.gz openlmi-providers-28aed3c2c360b84762f76b322e9fc80bd74c036b.tar.xz openlmi-providers-28aed3c2c360b84762f76b322e9fc80bd74c036b.zip |
Hardware: spring cleanup & refactor
* use openlmi common library where possible
* get rid of LMI_Hardware.h file
* some other cosmetic changes
Diffstat (limited to 'src/hardware/LMI_PCIDeviceProvider.c')
-rw-r--r-- | src/hardware/LMI_PCIDeviceProvider.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/hardware/LMI_PCIDeviceProvider.c b/src/hardware/LMI_PCIDeviceProvider.c index edb1528..d105628 100644 --- a/src/hardware/LMI_PCIDeviceProvider.c +++ b/src/hardware/LMI_PCIDeviceProvider.c @@ -21,7 +21,7 @@ #include <konkret/konkret.h> #include "LMI_PCIDevice.h" -#include "LMI_Hardware.h" +#include "utils.h" #include "PCIDev.h" static const CMPIBroker* _cb = NULL; @@ -78,12 +78,12 @@ static CMPIStatus LMI_PCIDeviceEnumInstances( u16 svid, subid, status, command_reg; struct pci_dev *dev; struct pci_cap *cap; - char vendor_buf[NAME_BUF_SIZE], *vendor_name; - char device_buf[NAME_BUF_SIZE], *device_name; - char subsys_buf[NAME_BUF_SIZE], *subsys_name; - char svendor_buf[NAME_BUF_SIZE], *svendor_name; - char device_id_str[PCI_DEVID_STR_SIZE]; - char instance_id[INSTANCE_ID_LEN]; + char vendor_buf[BUFLEN], *vendor_name; + char device_buf[BUFLEN], *device_name; + char subsys_buf[BUFLEN], *subsys_name; + char svendor_buf[BUFLEN], *svendor_name; + char device_id_str[BUFLEN]; + char instance_id[BUFLEN]; for (dev = acc_dev->devices; dev; dev = dev->next) { /* Ignore PCI Bridges */ @@ -92,25 +92,25 @@ static CMPIStatus LMI_PCIDeviceEnumInstances( continue; } - vendor_name = pci_lookup_name(acc_dev, vendor_buf, NAME_BUF_SIZE, + vendor_name = pci_lookup_name(acc_dev, vendor_buf, BUFLEN, PCI_LOOKUP_VENDOR, dev->vendor_id); - device_name = pci_lookup_name(acc_dev, device_buf, NAME_BUF_SIZE, + device_name = pci_lookup_name(acc_dev, device_buf, BUFLEN, PCI_LOOKUP_DEVICE, dev->vendor_id, dev->device_id); get_subid(dev, &svid, &subid); - subsys_name = pci_lookup_name(acc_dev, subsys_buf, NAME_BUF_SIZE, + subsys_name = pci_lookup_name(acc_dev, subsys_buf, BUFLEN, PCI_LOOKUP_DEVICE | PCI_LOOKUP_SUBSYSTEM, dev->vendor_id, dev->device_id, svid, subid); - svendor_name = pci_lookup_name(acc_dev, svendor_buf, NAME_BUF_SIZE, + svendor_name = pci_lookup_name(acc_dev, svendor_buf, BUFLEN, PCI_LOOKUP_VENDOR | PCI_LOOKUP_SUBSYSTEM, svid); status = pci_read_word(dev, PCI_STATUS); rev = pci_read_byte(dev, PCI_REVISION_ID); cache_line = pci_read_byte(dev, PCI_CACHE_LINE_SIZE); command_reg = pci_read_word(dev, PCI_COMMAND); - snprintf(device_id_str, PCI_DEVID_STR_SIZE, "%02x:%02x.%u", + snprintf(device_id_str, BUFLEN, "%02x:%02x.%u", dev->bus, dev->dev, dev->func); - snprintf(instance_id, INSTANCE_ID_LEN, - LMI_ORGID ":" LMI_ORGID "_" PCI_DEVICE_CLASS_NAME ":%s", device_id_str); + snprintf(instance_id, BUFLEN, + LMI_ORGID ":" LMI_PCIDevice_ClassName ":%s", device_id_str); LMI_PCIDevice_Init(&lmi_dev, _cb, ns); @@ -118,7 +118,7 @@ static CMPIStatus LMI_PCIDeviceEnumInstances( lmi_get_system_creation_class_name()); LMI_PCIDevice_Set_SystemName(&lmi_dev, lmi_get_system_name()); LMI_PCIDevice_Set_CreationClassName(&lmi_dev, - LMI_ORGID "_" PCI_DEVICE_CLASS_NAME); + LMI_PCIDevice_ClassName); LMI_PCIDevice_Set_Caption(&lmi_dev, "This object represents one logical PCI device contained in system."); |