diff options
Diffstat (limited to 'src/hardware')
57 files changed, 192 insertions, 241 deletions
diff --git a/src/hardware/CMakeLists.txt b/src/hardware/CMakeLists.txt index 29b63d3..ce7a06a 100644 --- a/src/hardware/CMakeLists.txt +++ b/src/hardware/CMakeLists.txt @@ -31,7 +31,7 @@ add_library(${LIBRARY_NAME} SHARED pkg_check_modules(LIBPCI REQUIRED libpci) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR} ${LIBPCI_INCLUDE_DIR}) -target_link_libraries(${LIBRARY_NAME} m openlmicommon ${KONKRETCMPI_LIBRARIES} ${LIBPCI_LIBRARIES}) +target_link_libraries(${LIBRARY_NAME} m openlmi ${KONKRETCMPI_LIBRARIES} ${LIBPCI_LIBRARIES}) # Create registration file cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers) diff --git a/src/hardware/LMI_AssociatedProcessorCacheMemoryProvider.c b/src/hardware/LMI_AssociatedProcessorCacheMemoryProvider.c index d786f3d..9c627a9 100644 --- a/src/hardware/LMI_AssociatedProcessorCacheMemoryProvider.c +++ b/src/hardware/LMI_AssociatedProcessorCacheMemoryProvider.c @@ -22,7 +22,6 @@ #include "LMI_AssociatedProcessorCacheMemory.h" #include "LMI_Processor.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" #include "lscpu.h" #include "sysfs.h" @@ -137,7 +136,7 @@ static CMPIStatus LMI_AssociatedProcessorCacheMemoryEnumInstances( get_system_creation_class_name()); LMI_ProcessorRef_Set_SystemName(&lmi_cpu, get_system_name()); LMI_ProcessorRef_Set_CreationClassName(&lmi_cpu, - ORGID "_" CPU_CLASS_NAME); + LMI_ORGID "_" CPU_CLASS_NAME); LMI_ProcessorRef_Set_DeviceID(&lmi_cpu, dmi_cpus[i].id); /* loop caches */ @@ -155,7 +154,7 @@ static CMPIStatus LMI_AssociatedProcessorCacheMemoryEnumInstances( LMI_ProcessorCacheMemoryRef_Set_SystemName(&lmi_cpu_cache, get_system_name()); LMI_ProcessorCacheMemoryRef_Set_CreationClassName( - &lmi_cpu_cache, ORGID "_" CPU_CACHE_CLASS_NAME); + &lmi_cpu_cache, LMI_ORGID "_" CPU_CACHE_CLASS_NAME); LMI_ProcessorCacheMemoryRef_Set_DeviceID( &lmi_cpu_cache, dmi_cpu_caches[j].id); @@ -219,7 +218,7 @@ static CMPIStatus LMI_AssociatedProcessorCacheMemoryEnumInstances( LMI_ProcessorCacheMemoryRef_Set_SystemName(&lmi_cpu_cache, get_system_name()); LMI_ProcessorCacheMemoryRef_Set_CreationClassName(&lmi_cpu_cache, - ORGID "_" CPU_CACHE_CLASS_NAME); + LMI_ORGID "_" CPU_CACHE_CLASS_NAME); LMI_ProcessorCacheMemoryRef_Set_DeviceID(&lmi_cpu_cache, sysfs_cpu_caches[i].id); @@ -231,7 +230,7 @@ static CMPIStatus LMI_AssociatedProcessorCacheMemoryEnumInstances( get_system_creation_class_name()); LMI_ProcessorRef_Set_SystemName(&lmi_cpu, get_system_name()); LMI_ProcessorRef_Set_CreationClassName(&lmi_cpu, - ORGID "_" CPU_CLASS_NAME); + LMI_ORGID "_" CPU_CLASS_NAME); if (dmi_cpus_nb > 0) { LMI_ProcessorRef_Set_DeviceID(&lmi_cpu, dmi_cpus[j].id); diff --git a/src/hardware/LMI_BaseboardContainerProvider.c b/src/hardware/LMI_BaseboardContainerProvider.c index 4fb2d37..1ac1ff2 100644 --- a/src/hardware/LMI_BaseboardContainerProvider.c +++ b/src/hardware/LMI_BaseboardContainerProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_BaseboardContainer.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb; @@ -73,12 +72,12 @@ static CMPIStatus LMI_BaseboardContainerEnumInstances( LMI_ChassisRef_Init(&lmi_chassis, _cb, ns); LMI_ChassisRef_Set_CreationClassName(&lmi_chassis, - ORGID "_" CHASSIS_CLASS_NAME); + LMI_ORGID "_" CHASSIS_CLASS_NAME); LMI_ChassisRef_Set_Tag(&lmi_chassis, dmi_get_chassis_tag(&dmi_chassis)); LMI_BaseboardRef_Init(&lmi_baseboard, _cb, ns); LMI_BaseboardRef_Set_CreationClassName(&lmi_baseboard, - ORGID "_" BASEBOARD_CLASS_NAME); + LMI_ORGID "_" BASEBOARD_CLASS_NAME); if (strcmp(dmi_baseboard.serial_number, "Not Specified") == 0) { LMI_BaseboardRef_Set_Tag(&lmi_baseboard, "0"); } else { diff --git a/src/hardware/LMI_BaseboardProvider.c b/src/hardware/LMI_BaseboardProvider.c index fd7d65b..cb3622f 100644 --- a/src/hardware/LMI_BaseboardProvider.c +++ b/src/hardware/LMI_BaseboardProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_Baseboard.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb = NULL; @@ -68,7 +67,7 @@ static CMPIStatus LMI_BaseboardEnumInstances( LMI_Baseboard_Init(&lmi_baseboard, _cb, ns); LMI_Baseboard_Set_CreationClassName(&lmi_baseboard, - ORGID "_" BASEBOARD_CLASS_NAME); + LMI_ORGID "_" BASEBOARD_CLASS_NAME); LMI_Baseboard_Set_PackageType(&lmi_baseboard, LMI_Baseboard_PackageType_Cross_Connect_Backplane); LMI_Baseboard_Set_Name(&lmi_baseboard, BASEBOARD_CLASS_NAME); @@ -81,11 +80,11 @@ static CMPIStatus LMI_BaseboardEnumInstances( if (strcmp(dmi_baseboard.serial_number, "Not Specified") == 0) { LMI_Baseboard_Set_Tag(&lmi_baseboard, "0"); LMI_Baseboard_Set_InstanceID(&lmi_baseboard, - ORGID ":" ORGID "_" BASEBOARD_CLASS_NAME ":0"); + LMI_ORGID ":" LMI_ORGID "_" BASEBOARD_CLASS_NAME ":0"); } else { LMI_Baseboard_Set_Tag(&lmi_baseboard, dmi_baseboard.serial_number); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" BASEBOARD_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" BASEBOARD_CLASS_NAME ":%s", dmi_baseboard.serial_number); LMI_Baseboard_Set_InstanceID(&lmi_baseboard, instance_id); } diff --git a/src/hardware/LMI_BatteryPhysicalPackageProvider.c b/src/hardware/LMI_BatteryPhysicalPackageProvider.c index 3b17aa2..7ff67da 100644 --- a/src/hardware/LMI_BatteryPhysicalPackageProvider.c +++ b/src/hardware/LMI_BatteryPhysicalPackageProvider.c @@ -22,7 +22,6 @@ #include <konkret/konkret.h> #include "LMI_BatteryPhysicalPackage.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb = NULL; @@ -73,7 +72,7 @@ static CMPIStatus LMI_BatteryPhysicalPackageEnumInstances( LMI_BatteryPhysicalPackage_Init(&lmi_batt_phys, _cb, ns); LMI_BatteryPhysicalPackage_Set_CreationClassName(&lmi_batt_phys, - ORGID "_" BATTERY_PHYS_PKG_CLASS_NAME); + LMI_ORGID "_" BATTERY_PHYS_PKG_CLASS_NAME); LMI_BatteryPhysicalPackage_Set_PackageType(&lmi_batt_phys, LMI_BatteryPhysicalPackage_PackageType_Battery); LMI_BatteryPhysicalPackage_Set_Caption(&lmi_batt_phys, @@ -82,7 +81,7 @@ static CMPIStatus LMI_BatteryPhysicalPackageEnumInstances( "This object represents one physical battery package in system."); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" BATTERY_PHYS_PKG_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" BATTERY_PHYS_PKG_CLASS_NAME ":%s", dmi_batt[i].name); LMI_BatteryPhysicalPackage_Set_Tag(&lmi_batt_phys, dmi_batt[i].name); diff --git a/src/hardware/LMI_BatteryProvider.c b/src/hardware/LMI_BatteryProvider.c index 133ecd8..4996c8e 100644 --- a/src/hardware/LMI_BatteryProvider.c +++ b/src/hardware/LMI_BatteryProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_Battery.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" CMPIUint16 get_chemistry(const char *dmi_val); @@ -76,7 +75,7 @@ static CMPIStatus LMI_BatteryEnumInstances( get_system_creation_class_name()); LMI_Battery_Set_SystemName(&lmi_batt, get_system_name()); LMI_Battery_Set_CreationClassName(&lmi_batt, - ORGID "_" BATTERY_CLASS_NAME); + LMI_ORGID "_" BATTERY_CLASS_NAME); LMI_Battery_Set_BatteryStatus(&lmi_batt, LMI_Battery_BatteryStatus_Unknown); LMI_Battery_Init_OperationalStatus(&lmi_batt, 1); @@ -91,7 +90,7 @@ static CMPIStatus LMI_BatteryEnumInstances( "This object represents one battery in system."); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" BATTERY_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" BATTERY_CLASS_NAME ":%s", dmi_batt[i].name); LMI_Battery_Set_DeviceID(&lmi_batt, dmi_batt[i].name); diff --git a/src/hardware/LMI_BatterySystemDeviceProvider.c b/src/hardware/LMI_BatterySystemDeviceProvider.c index ce2acf0..90a2076 100644 --- a/src/hardware/LMI_BatterySystemDeviceProvider.c +++ b/src/hardware/LMI_BatterySystemDeviceProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_BatterySystemDevice.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb; @@ -75,7 +74,7 @@ static CMPIStatus LMI_BatterySystemDeviceEnumInstances( get_system_creation_class_name()); LMI_BatteryRef_Set_SystemName(&lmi_batt, get_system_name()); LMI_BatteryRef_Set_CreationClassName(&lmi_batt, - ORGID "_" BATTERY_CLASS_NAME); + LMI_ORGID "_" BATTERY_CLASS_NAME); LMI_BatteryRef_Set_DeviceID(&lmi_batt, dmi_batt[i].name); LMI_BatterySystemDevice_SetObjectPath_GroupComponent( diff --git a/src/hardware/LMI_ChassisComputerSystemPackageProvider.c b/src/hardware/LMI_ChassisComputerSystemPackageProvider.c index e63faaa..e95dc83 100644 --- a/src/hardware/LMI_ChassisComputerSystemPackageProvider.c +++ b/src/hardware/LMI_ChassisComputerSystemPackageProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_ChassisComputerSystemPackage.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb; @@ -69,7 +68,7 @@ static CMPIStatus LMI_ChassisComputerSystemPackageEnumInstances( LMI_ChassisRef_Init(&lmi_chassis, _cb, ns); LMI_ChassisRef_Set_CreationClassName(&lmi_chassis, - ORGID "_" CHASSIS_CLASS_NAME); + LMI_ORGID "_" CHASSIS_CLASS_NAME); LMI_ChassisRef_Set_Tag(&lmi_chassis, dmi_get_chassis_tag(&dmi_chassis)); LMI_ChassisComputerSystemPackage_SetObjectPath_Dependent( diff --git a/src/hardware/LMI_ChassisProvider.c b/src/hardware/LMI_ChassisProvider.c index ef8567a..d5ad789 100644 --- a/src/hardware/LMI_ChassisProvider.c +++ b/src/hardware/LMI_ChassisProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_Chassis.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" #include "virt_what.h" @@ -71,7 +70,7 @@ static CMPIStatus LMI_ChassisEnumInstances( LMI_Chassis_Init(&lmi_chassis, _cb, ns); LMI_Chassis_Set_CreationClassName(&lmi_chassis, - ORGID "_" CHASSIS_CLASS_NAME); + LMI_ORGID "_" CHASSIS_CLASS_NAME); LMI_Chassis_Set_PackageType(&lmi_chassis, LMI_Chassis_PackageType_Chassis_Frame); LMI_Chassis_Set_Caption(&lmi_chassis, "System Chassis"); @@ -80,7 +79,7 @@ static CMPIStatus LMI_ChassisEnumInstances( tag = dmi_get_chassis_tag(&dmi_chassis); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" CHASSIS_CLASS_NAME ":%s", tag); + LMI_ORGID ":" LMI_ORGID "_" CHASSIS_CLASS_NAME ":%s", tag); LMI_Chassis_Set_Tag(&lmi_chassis, tag); LMI_Chassis_Set_InstanceID(&lmi_chassis, instance_id); diff --git a/src/hardware/LMI_DiskDriveATAPortProvider.c b/src/hardware/LMI_DiskDriveATAPortProvider.c index 122b3aa..56a1aa7 100644 --- a/src/hardware/LMI_DiskDriveATAPortProvider.c +++ b/src/hardware/LMI_DiskDriveATAPortProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_DiskDriveATAPort.h" #include "LMI_Hardware.h" -#include "globals.h" #include "smartctl.h" #include "lsblk.h" @@ -87,7 +86,7 @@ static CMPIStatus LMI_DiskDriveATAPortEnumInstances( get_system_creation_class_name()); LMI_DiskDriveATAPort_Set_SystemName(&lmi_hdd_ata_port, get_system_name()); LMI_DiskDriveATAPort_Set_CreationClassName(&lmi_hdd_ata_port, - ORGID "_" DISK_DRIVE_ATA_PORT_CLASS_NAME); + LMI_ORGID "_" DISK_DRIVE_ATA_PORT_CLASS_NAME); LMI_DiskDriveATAPort_Set_Caption(&lmi_hdd_ata_port, "Disk Drive ATA Port"); LMI_DiskDriveATAPort_Set_Description(&lmi_hdd_ata_port, @@ -99,7 +98,7 @@ static CMPIStatus LMI_DiskDriveATAPortEnumInstances( "%s " DISK_DRIVE_ATA_PORT_CLASS_NAME, lsblk_hdds[i].name); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" DISK_DRIVE_ATA_PORT_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" DISK_DRIVE_ATA_PORT_CLASS_NAME ":%s", name); LMI_DiskDriveATAPort_Set_DeviceID(&lmi_hdd_ata_port, name); diff --git a/src/hardware/LMI_DiskDriveATAProtocolEndpointProvider.c b/src/hardware/LMI_DiskDriveATAProtocolEndpointProvider.c index 0e13d9e..089f8c6 100644 --- a/src/hardware/LMI_DiskDriveATAProtocolEndpointProvider.c +++ b/src/hardware/LMI_DiskDriveATAProtocolEndpointProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_DiskDriveATAProtocolEndpoint.h" #include "LMI_Hardware.h" -#include "globals.h" #include "lsblk.h" static const CMPIBroker* _cb = NULL; @@ -80,7 +79,7 @@ static CMPIStatus LMI_DiskDriveATAProtocolEndpointEnumInstances( LMI_DiskDriveATAProtocolEndpoint_Set_SystemName(&lmi_hdd_endpoint, get_system_name()); LMI_DiskDriveATAProtocolEndpoint_Set_CreationClassName(&lmi_hdd_endpoint, - ORGID "_" DISK_DRIVE_ATA_PROTO_ENDPOINT_CLASS_NAME); + LMI_ORGID "_" DISK_DRIVE_ATA_PROTO_ENDPOINT_CLASS_NAME); LMI_DiskDriveATAProtocolEndpoint_Set_Caption(&lmi_hdd_endpoint, "Disk Drive ATA Protocol Endpoint"); LMI_DiskDriveATAProtocolEndpoint_Set_Description(&lmi_hdd_endpoint, @@ -95,7 +94,7 @@ static CMPIStatus LMI_DiskDriveATAProtocolEndpointEnumInstances( "%s " DISK_DRIVE_ATA_PROTO_ENDPOINT_CLASS_NAME, lsblk_hdds[i].name); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" DISK_DRIVE_ATA_PROTO_ENDPOINT_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" DISK_DRIVE_ATA_PROTO_ENDPOINT_CLASS_NAME ":%s", name); LMI_DiskDriveATAProtocolEndpoint_Set_Name(&lmi_hdd_endpoint, name); diff --git a/src/hardware/LMI_DiskDriveDeviceSAPImplementationProvider.c b/src/hardware/LMI_DiskDriveDeviceSAPImplementationProvider.c index f34ae8f..ab4ee90 100644 --- a/src/hardware/LMI_DiskDriveDeviceSAPImplementationProvider.c +++ b/src/hardware/LMI_DiskDriveDeviceSAPImplementationProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_DiskDriveDeviceSAPImplementation.h" #include "LMI_Hardware.h" -#include "globals.h" #include "lsblk.h" static const CMPIBroker* _cb; @@ -87,7 +86,7 @@ static CMPIStatus LMI_DiskDriveDeviceSAPImplementationEnumInstances( LMI_DiskDriveATAPortRef_Set_SystemName(&lmi_hdd_ata_port, get_system_name()); LMI_DiskDriveATAPortRef_Set_CreationClassName(&lmi_hdd_ata_port, - ORGID "_" DISK_DRIVE_ATA_PORT_CLASS_NAME); + LMI_ORGID "_" DISK_DRIVE_ATA_PORT_CLASS_NAME); LMI_DiskDriveATAPortRef_Set_DeviceID(&lmi_hdd_ata_port, name); snprintf(name, ELEMENT_NAME_LEN, @@ -100,7 +99,7 @@ static CMPIStatus LMI_DiskDriveDeviceSAPImplementationEnumInstances( LMI_DiskDriveATAProtocolEndpointRef_Set_SystemName(&lmi_hdd_ata_endp, get_system_name()); LMI_DiskDriveATAProtocolEndpointRef_Set_CreationClassName(&lmi_hdd_ata_endp, - ORGID "_" DISK_DRIVE_ATA_PROTO_ENDPOINT_CLASS_NAME); + LMI_ORGID "_" DISK_DRIVE_ATA_PROTO_ENDPOINT_CLASS_NAME); LMI_DiskDriveATAProtocolEndpointRef_Set_Name(&lmi_hdd_ata_endp, name); LMI_DiskDriveDeviceSAPImplementation_Set_Antecedent(&lmi_hdd_sap_impl, diff --git a/src/hardware/LMI_DiskDriveElementSoftwareIdentityProvider.c b/src/hardware/LMI_DiskDriveElementSoftwareIdentityProvider.c index ba79371..e07e2ed 100644 --- a/src/hardware/LMI_DiskDriveElementSoftwareIdentityProvider.c +++ b/src/hardware/LMI_DiskDriveElementSoftwareIdentityProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_DiskDriveElementSoftwareIdentity.h" #include "LMI_Hardware.h" -#include "globals.h" #include "lsblk.h" static const CMPIBroker* _cb; @@ -82,11 +81,11 @@ static CMPIStatus LMI_DiskDriveElementSoftwareIdentityEnumInstances( get_system_creation_class_name()); LMI_DiskDriveRef_Set_SystemName(&lmi_hdd, get_system_name()); LMI_DiskDriveRef_Set_CreationClassName(&lmi_hdd, - ORGID "_" DISK_DRIVE_CLASS_NAME); + LMI_ORGID "_" DISK_DRIVE_CLASS_NAME); LMI_DiskDriveRef_Set_DeviceID(&lmi_hdd, lsblk_hdds[i].name); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" DISK_DRIVE_SW_IDENTITY_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" DISK_DRIVE_SW_IDENTITY_CLASS_NAME ":%s", lsblk_hdds[i].name); LMI_DiskDriveSoftwareIdentityRef_Init(&lmi_hdd_swi, _cb, ns); diff --git a/src/hardware/LMI_DiskDriveProvider.c b/src/hardware/LMI_DiskDriveProvider.c index feaae00..5a28a0a 100644 --- a/src/hardware/LMI_DiskDriveProvider.c +++ b/src/hardware/LMI_DiskDriveProvider.c @@ -23,7 +23,6 @@ #include <konkret/konkret.h> #include "LMI_DiskDrive.h" #include "LMI_Hardware.h" -#include "globals.h" #include "smartctl.h" #include "lsblk.h" #include "sysfs.h" @@ -99,13 +98,13 @@ static CMPIStatus LMI_DiskDriveEnumInstances( get_system_creation_class_name()); LMI_DiskDrive_Set_SystemName(&lmi_hdd, get_system_name()); LMI_DiskDrive_Set_CreationClassName(&lmi_hdd, - ORGID "_" DISK_DRIVE_CLASS_NAME); + LMI_ORGID "_" DISK_DRIVE_CLASS_NAME); LMI_DiskDrive_Set_Caption(&lmi_hdd, "Disk Drive"); LMI_DiskDrive_Set_Description(&lmi_hdd, "This object represents one physical disk drive in system."); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" DISK_DRIVE_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" DISK_DRIVE_CLASS_NAME ":%s", lsblk_hdds[i].name); LMI_DiskDrive_Set_DeviceID(&lmi_hdd, lsblk_hdds[i].name); diff --git a/src/hardware/LMI_DiskDriveRealizesProvider.c b/src/hardware/LMI_DiskDriveRealizesProvider.c index 0c40fdb..2756dec 100644 --- a/src/hardware/LMI_DiskDriveRealizesProvider.c +++ b/src/hardware/LMI_DiskDriveRealizesProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_DiskDriveRealizes.h" #include "LMI_Hardware.h" -#include "globals.h" #include "lsblk.h" static const CMPIBroker* _cb; @@ -81,12 +80,12 @@ static CMPIStatus LMI_DiskDriveRealizesEnumInstances( get_system_creation_class_name()); LMI_DiskDriveRef_Set_SystemName(&lmi_hdd, get_system_name()); LMI_DiskDriveRef_Set_CreationClassName(&lmi_hdd, - ORGID "_" DISK_DRIVE_CLASS_NAME); + LMI_ORGID "_" DISK_DRIVE_CLASS_NAME); LMI_DiskDriveRef_Set_DeviceID(&lmi_hdd, lsblk_hdds[i].name); LMI_DiskPhysicalPackageRef_Init(&lmi_hdd_phys, _cb, ns); LMI_DiskPhysicalPackageRef_Set_CreationClassName(&lmi_hdd_phys, - ORGID "_" DISK_PHYS_PKG_CLASS_NAME); + LMI_ORGID "_" DISK_PHYS_PKG_CLASS_NAME); LMI_DiskPhysicalPackageRef_Set_Tag(&lmi_hdd_phys, lsblk_hdds[i].name); LMI_DiskDriveRealizes_Set_Dependent(&lmi_hdd_realizes, &lmi_hdd); diff --git a/src/hardware/LMI_DiskDriveSAPAvailableForElementProvider.c b/src/hardware/LMI_DiskDriveSAPAvailableForElementProvider.c index ee964b1..51b5f44 100644 --- a/src/hardware/LMI_DiskDriveSAPAvailableForElementProvider.c +++ b/src/hardware/LMI_DiskDriveSAPAvailableForElementProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_DiskDriveSAPAvailableForElement.h" #include "LMI_Hardware.h" -#include "globals.h" #include "lsblk.h" static const CMPIBroker* _cb; @@ -82,7 +81,7 @@ static CMPIStatus LMI_DiskDriveSAPAvailableForElementEnumInstances( get_system_creation_class_name()); LMI_DiskDriveRef_Set_SystemName(&lmi_hdd, get_system_name()); LMI_DiskDriveRef_Set_CreationClassName(&lmi_hdd, - ORGID "_" DISK_DRIVE_CLASS_NAME); + LMI_ORGID "_" DISK_DRIVE_CLASS_NAME); LMI_DiskDriveRef_Set_DeviceID(&lmi_hdd, lsblk_hdds[i].name); snprintf(name, ELEMENT_NAME_LEN, @@ -95,7 +94,7 @@ static CMPIStatus LMI_DiskDriveSAPAvailableForElementEnumInstances( LMI_DiskDriveATAProtocolEndpointRef_Set_SystemName(&lmi_hdd_ata_endp, get_system_name()); LMI_DiskDriveATAProtocolEndpointRef_Set_CreationClassName(&lmi_hdd_ata_endp, - ORGID "_" DISK_DRIVE_ATA_PROTO_ENDPOINT_CLASS_NAME); + LMI_ORGID "_" DISK_DRIVE_ATA_PROTO_ENDPOINT_CLASS_NAME); LMI_DiskDriveATAProtocolEndpointRef_Set_Name(&lmi_hdd_ata_endp, name); LMI_DiskDriveSAPAvailableForElement_Set_ManagedElement(&lmi_hdd_sap, diff --git a/src/hardware/LMI_DiskDriveSoftwareIdentityProvider.c b/src/hardware/LMI_DiskDriveSoftwareIdentityProvider.c index 528ad51..34043fa 100644 --- a/src/hardware/LMI_DiskDriveSoftwareIdentityProvider.c +++ b/src/hardware/LMI_DiskDriveSoftwareIdentityProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_DiskDriveSoftwareIdentity.h" #include "LMI_Hardware.h" -#include "globals.h" #include "smartctl.h" #include "lsblk.h" @@ -89,7 +88,7 @@ static CMPIStatus LMI_DiskDriveSoftwareIdentityEnumInstances( "This object represents firmware of disk drive in system."); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" DISK_DRIVE_SW_IDENTITY_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" DISK_DRIVE_SW_IDENTITY_CLASS_NAME ":%s", lsblk_hdds[i].name); snprintf(name, ELEMENT_NAME_LEN, "%s disk firmware", lsblk_hdds[i].name); diff --git a/src/hardware/LMI_DiskDriveSystemDeviceProvider.c b/src/hardware/LMI_DiskDriveSystemDeviceProvider.c index e29997a..87fc99d 100644 --- a/src/hardware/LMI_DiskDriveSystemDeviceProvider.c +++ b/src/hardware/LMI_DiskDriveSystemDeviceProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_DiskDriveSystemDevice.h" #include "LMI_Hardware.h" -#include "globals.h" #include "lsblk.h" static const CMPIBroker* _cb; @@ -80,7 +79,7 @@ static CMPIStatus LMI_DiskDriveSystemDeviceEnumInstances( get_system_creation_class_name()); LMI_DiskDriveRef_Set_SystemName(&lmi_hdd, get_system_name()); LMI_DiskDriveRef_Set_CreationClassName(&lmi_hdd, - ORGID "_" DISK_DRIVE_CLASS_NAME); + LMI_ORGID "_" DISK_DRIVE_CLASS_NAME); LMI_DiskDriveRef_Set_DeviceID(&lmi_hdd, lsblk_hdds[i].name); LMI_DiskDriveSystemDevice_SetObjectPath_GroupComponent( diff --git a/src/hardware/LMI_DiskPhysicalPackageContainerProvider.c b/src/hardware/LMI_DiskPhysicalPackageContainerProvider.c index b9c40f5..48e390a 100644 --- a/src/hardware/LMI_DiskPhysicalPackageContainerProvider.c +++ b/src/hardware/LMI_DiskPhysicalPackageContainerProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_DiskPhysicalPackageContainer.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" #include "lsblk.h" @@ -75,7 +74,7 @@ static CMPIStatus LMI_DiskPhysicalPackageContainerEnumInstances( LMI_ChassisRef_Init(&lmi_chassis, _cb, ns); LMI_ChassisRef_Set_CreationClassName(&lmi_chassis, - ORGID "_" CHASSIS_CLASS_NAME); + LMI_ORGID "_" CHASSIS_CLASS_NAME); LMI_ChassisRef_Set_Tag(&lmi_chassis, dmi_get_chassis_tag(&dmi_chassis)); for (i = 0; i < lsblk_hdds_nb; i++) { @@ -88,7 +87,7 @@ static CMPIStatus LMI_DiskPhysicalPackageContainerEnumInstances( LMI_DiskPhysicalPackageRef_Init(&lmi_hdd, _cb, ns); LMI_DiskPhysicalPackageRef_Set_CreationClassName(&lmi_hdd, - ORGID "_" DISK_PHYS_PKG_CLASS_NAME); + LMI_ORGID "_" DISK_PHYS_PKG_CLASS_NAME); LMI_DiskPhysicalPackageRef_Set_Tag(&lmi_hdd, lsblk_hdds[i].name); LMI_DiskPhysicalPackageContainer_Set_GroupComponent(&lmi_hdd_container, diff --git a/src/hardware/LMI_DiskPhysicalPackageProvider.c b/src/hardware/LMI_DiskPhysicalPackageProvider.c index 001205b..f619e0b 100644 --- a/src/hardware/LMI_DiskPhysicalPackageProvider.c +++ b/src/hardware/LMI_DiskPhysicalPackageProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_DiskPhysicalPackage.h" #include "LMI_Hardware.h" -#include "globals.h" #include "smartctl.h" #include "lsblk.h" @@ -101,7 +100,7 @@ static CMPIStatus LMI_DiskPhysicalPackageEnumInstances( LMI_DiskPhysicalPackage_Init(&lmi_hdd, _cb, ns); LMI_DiskPhysicalPackage_Set_CreationClassName(&lmi_hdd, - ORGID "_" DISK_PHYS_PKG_CLASS_NAME); + LMI_ORGID "_" DISK_PHYS_PKG_CLASS_NAME); LMI_DiskPhysicalPackage_Set_PackageType(&lmi_hdd, LMI_DiskPhysicalPackage_PackageType_Storage_Media_Package_e_g___Disk_or_Tape_Drive); LMI_DiskPhysicalPackage_Set_Caption(&lmi_hdd, "Physical Disk Package"); @@ -109,7 +108,7 @@ static CMPIStatus LMI_DiskPhysicalPackageEnumInstances( "This object represents one physical disk package in system."); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" DISK_PHYS_PKG_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" DISK_PHYS_PKG_CLASS_NAME ":%s", lsblk_hdds[i].name); LMI_DiskPhysicalPackage_Set_Tag(&lmi_hdd, lsblk_hdds[i].name); diff --git a/src/hardware/LMI_Hardware.h b/src/hardware/LMI_Hardware.h index 29d8c9b..db4d589 100644 --- a/src/hardware/LMI_Hardware.h +++ b/src/hardware/LMI_Hardware.h @@ -21,7 +21,7 @@ #ifndef LMI_HARDWARE_H_ #define LMI_HARDWARE_H_ -#include "globals.h" +#include "openlmi.h" const ConfigEntry *provider_config_defaults; const char *provider_name; diff --git a/src/hardware/LMI_MemoryPhysicalPackageInConnectorProvider.c b/src/hardware/LMI_MemoryPhysicalPackageInConnectorProvider.c index 51a6192..04d4384 100644 --- a/src/hardware/LMI_MemoryPhysicalPackageInConnectorProvider.c +++ b/src/hardware/LMI_MemoryPhysicalPackageInConnectorProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_MemoryPhysicalPackageInConnector.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb; @@ -75,7 +74,7 @@ static CMPIStatus LMI_MemoryPhysicalPackageInConnectorEnumInstances( LMI_MemoryPhysicalPackageRef_Init(&lmi_phys_mem_pkg, _cb, ns); LMI_MemoryPhysicalPackageRef_Set_CreationClassName(&lmi_phys_mem_pkg, - ORGID "_" MEMORY_PHYS_PKG_CLASS_NAME); + LMI_ORGID "_" MEMORY_PHYS_PKG_CLASS_NAME); LMI_MemoryPhysicalPackageRef_Set_Tag(&lmi_phys_mem_pkg, dmi_memory.modules[i].serial_number); @@ -85,7 +84,7 @@ static CMPIStatus LMI_MemoryPhysicalPackageInConnectorEnumInstances( dmi_memory.slots[j].slot_number); LMI_MemorySlotRef_Init(&lmi_mem_slot, _cb, ns); LMI_MemorySlotRef_Set_CreationClassName(&lmi_mem_slot, - ORGID "_" MEMORY_SLOT_CLASS_NAME); + LMI_ORGID "_" MEMORY_SLOT_CLASS_NAME); LMI_MemorySlotRef_Set_Tag(&lmi_mem_slot, tag); LMI_MemoryPhysicalPackageInConnector_Set_Antecedent( diff --git a/src/hardware/LMI_MemoryPhysicalPackageProvider.c b/src/hardware/LMI_MemoryPhysicalPackageProvider.c index fc82af1..e277fc1 100644 --- a/src/hardware/LMI_MemoryPhysicalPackageProvider.c +++ b/src/hardware/LMI_MemoryPhysicalPackageProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_MemoryPhysicalPackage.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb = NULL; @@ -70,7 +69,7 @@ static CMPIStatus LMI_MemoryPhysicalPackageEnumInstances( LMI_MemoryPhysicalPackage_Init(&lmi_phys_mem_pkg, _cb, ns); LMI_MemoryPhysicalPackage_Set_CreationClassName(&lmi_phys_mem_pkg, - ORGID "_" MEMORY_PHYS_PKG_CLASS_NAME); + LMI_ORGID "_" MEMORY_PHYS_PKG_CLASS_NAME); LMI_MemoryPhysicalPackage_Set_PackageType(&lmi_phys_mem_pkg, LMI_MemoryPhysicalPackage_PackageType_Memory); LMI_MemoryPhysicalPackage_Set_Caption(&lmi_phys_mem_pkg, @@ -79,7 +78,7 @@ static CMPIStatus LMI_MemoryPhysicalPackageEnumInstances( "This object represents one physical memory package in system."); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" MEMORY_PHYS_PKG_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" MEMORY_PHYS_PKG_CLASS_NAME ":%s", dmi_memory.modules[i].serial_number); LMI_MemoryPhysicalPackage_Set_Tag(&lmi_phys_mem_pkg, diff --git a/src/hardware/LMI_MemoryProvider.c b/src/hardware/LMI_MemoryProvider.c index e0dcfef..4626bea 100644 --- a/src/hardware/LMI_MemoryProvider.c +++ b/src/hardware/LMI_MemoryProvider.c @@ -24,7 +24,6 @@ #include <limits.h> #include "LMI_Memory.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" #include "procfs.h" #include "sysfs.h" @@ -85,7 +84,7 @@ static CMPIStatus LMI_MemoryEnumInstances( LMI_Memory_Set_SystemCreationClassName(&lmi_mem, get_system_creation_class_name()); LMI_Memory_Set_SystemName(&lmi_mem, get_system_name()); - LMI_Memory_Set_CreationClassName(&lmi_mem, ORGID "_" MEM_CLASS_NAME); + LMI_Memory_Set_CreationClassName(&lmi_mem, LMI_ORGID "_" MEM_CLASS_NAME); LMI_Memory_Set_DeviceID(&lmi_mem, "0"); LMI_Memory_Set_Volatile(&lmi_mem, 1); @@ -102,7 +101,7 @@ static CMPIStatus LMI_MemoryEnumInstances( LMI_Memory_Set_Description(&lmi_mem, "This object represents all memory available in system."); LMI_Memory_Set_InstanceID(&lmi_mem, - ORGID ":" ORGID "_" MEM_CLASS_NAME ":0"); + LMI_ORGID ":" LMI_ORGID "_" MEM_CLASS_NAME ":0"); LMI_Memory_Set_IsCompressed(&lmi_mem, 0); LMI_Memory_Set_Purpose(&lmi_mem, "The system memory is temporary storage " "area storing instructions and data required by processor " diff --git a/src/hardware/LMI_MemorySlotContainerProvider.c b/src/hardware/LMI_MemorySlotContainerProvider.c index 6dd21d3..8852954 100644 --- a/src/hardware/LMI_MemorySlotContainerProvider.c +++ b/src/hardware/LMI_MemorySlotContainerProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_MemorySlotContainer.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb; @@ -74,7 +73,7 @@ static CMPIStatus LMI_MemorySlotContainerEnumInstances( LMI_ChassisRef_Init(&lmi_chassis, _cb, ns); LMI_ChassisRef_Set_CreationClassName(&lmi_chassis, - ORGID "_" CHASSIS_CLASS_NAME); + LMI_ORGID "_" CHASSIS_CLASS_NAME); if (strcmp(dmi_chassis.serial_number, "Not Specified") == 0) { LMI_ChassisRef_Set_Tag(&lmi_chassis, "0"); } else { @@ -88,7 +87,7 @@ static CMPIStatus LMI_MemorySlotContainerEnumInstances( LMI_MemorySlotRef_Init(&lmi_mem_slot, _cb, ns); LMI_MemorySlotRef_Set_CreationClassName(&lmi_mem_slot, - ORGID "_" MEMORY_SLOT_CLASS_NAME); + LMI_ORGID "_" MEMORY_SLOT_CLASS_NAME); LMI_MemorySlotRef_Set_Tag(&lmi_mem_slot, tag); LMI_MemorySlotContainer_Set_GroupComponent(&lmi_mem_slot_container, diff --git a/src/hardware/LMI_MemorySlotProvider.c b/src/hardware/LMI_MemorySlotProvider.c index d3c4a82..2c8116f 100644 --- a/src/hardware/LMI_MemorySlotProvider.c +++ b/src/hardware/LMI_MemorySlotProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_MemorySlot.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb = NULL; @@ -71,7 +70,7 @@ static CMPIStatus LMI_MemorySlotEnumInstances( snprintf(tag, LONG_INT_LEN, "%d", dmi_memory.slots[i].slot_number); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" MEMORY_SLOT_CLASS_NAME ":%d", + LMI_ORGID ":" LMI_ORGID "_" MEMORY_SLOT_CLASS_NAME ":%d", dmi_memory.slots[i].slot_number); LMI_MemorySlot_Set_ConnectorLayout(&lmi_mem_slot, @@ -83,7 +82,7 @@ static CMPIStatus LMI_MemorySlotEnumInstances( LMI_MemorySlot_ConnectorGender_Female); LMI_MemorySlot_Set_CreationClassName(&lmi_mem_slot, - ORGID "_" MEMORY_SLOT_CLASS_NAME); + LMI_ORGID "_" MEMORY_SLOT_CLASS_NAME); LMI_MemorySlot_Set_Tag(&lmi_mem_slot, tag); LMI_MemorySlot_Set_Number(&lmi_mem_slot, dmi_memory.slots[i].slot_number); diff --git a/src/hardware/LMI_MemorySystemDeviceProvider.c b/src/hardware/LMI_MemorySystemDeviceProvider.c index 1eef31f..0c3c7c5 100644 --- a/src/hardware/LMI_MemorySystemDeviceProvider.c +++ b/src/hardware/LMI_MemorySystemDeviceProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_MemorySystemDevice.h" #include "LMI_Hardware.h" -#include "globals.h" static const CMPIBroker* _cb; @@ -65,7 +64,7 @@ static CMPIStatus LMI_MemorySystemDeviceEnumInstances( LMI_MemoryRef_Set_SystemCreationClassName(&lmi_mem, get_system_creation_class_name()); LMI_MemoryRef_Set_SystemName(&lmi_mem, get_system_name()); - LMI_MemoryRef_Set_CreationClassName(&lmi_mem, ORGID "_" MEM_CLASS_NAME); + LMI_MemoryRef_Set_CreationClassName(&lmi_mem, LMI_ORGID "_" MEM_CLASS_NAME); LMI_MemoryRef_Set_DeviceID(&lmi_mem, "0"); LMI_MemorySystemDevice_SetObjectPath_GroupComponent( diff --git a/src/hardware/LMI_PCIBridgeProvider.c b/src/hardware/LMI_PCIBridgeProvider.c index e84bea3..ee8aa50 100644 --- a/src/hardware/LMI_PCIBridgeProvider.c +++ b/src/hardware/LMI_PCIBridgeProvider.c @@ -22,7 +22,6 @@ #include "LMI_PCIBridge.h" #include "LMI_Hardware.h" #include "PCIDev.h" -#include "globals.h" CMPIUint16 get_bridge_type(const char *bridge_type); @@ -40,7 +39,7 @@ static void LMI_PCIBridgeInitialize(const CMPIContext *ctx) | PCI_FILL_ROM_BASE | PCI_FILL_CLASS | PCI_FILL_CAPS) != 0) { - error("Failed to access the PCI bus."); + lmi_error("Failed to access the PCI bus."); abort(); } } @@ -131,7 +130,7 @@ static CMPIStatus LMI_PCIBridgeEnumInstances( snprintf(device_id_str, PCI_DEVID_STR_SIZE, "%02x:%02x.%u", dev->bus, dev->dev, dev->func); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" PCI_BRIDGE_CLASS_NAME ":%s", device_id_str); + LMI_ORGID ":" LMI_ORGID "_" PCI_BRIDGE_CLASS_NAME ":%s", device_id_str); LMI_PCIBridge_Init(&lmi_dev, _cb, ns); @@ -139,7 +138,7 @@ static CMPIStatus LMI_PCIBridgeEnumInstances( get_system_creation_class_name()); LMI_PCIBridge_Set_SystemName(&lmi_dev, get_system_name()); LMI_PCIBridge_Set_CreationClassName(&lmi_dev, - ORGID "_" PCI_BRIDGE_CLASS_NAME); + LMI_ORGID "_" PCI_BRIDGE_CLASS_NAME); LMI_PCIBridge_Set_Caption(&lmi_dev, "This object represents one PCI bridge contained in system."); diff --git a/src/hardware/LMI_PCIBridgeSystemDeviceProvider.c b/src/hardware/LMI_PCIBridgeSystemDeviceProvider.c index 1b26613..c413d1f 100644 --- a/src/hardware/LMI_PCIBridgeSystemDeviceProvider.c +++ b/src/hardware/LMI_PCIBridgeSystemDeviceProvider.c @@ -22,7 +22,6 @@ #include "LMI_PCIBridgeSystemDevice.h" #include "LMI_Hardware.h" #include "PCIDev.h" -#include "globals.h" static const CMPIBroker* _cb; @@ -33,7 +32,7 @@ static void LMI_PCIBridgeSystemDeviceInitialize(const CMPIContext *ctx) lmi_init(provider_name, _cb, ctx, provider_config_defaults); if (init_pci_access(&acc_system_bridge, PCI_FILL_CLASS) != 0) { - error("Failed to access the PCI bus."); + lmi_error("Failed to access the PCI bus."); abort(); } } @@ -88,7 +87,7 @@ static CMPIStatus LMI_PCIBridgeSystemDeviceEnumInstances( get_system_creation_class_name()); LMI_PCIBridgeRef_Set_SystemName(&lmi_dev, get_system_name()); LMI_PCIBridgeRef_Set_CreationClassName(&lmi_dev, - ORGID "_" PCI_BRIDGE_CLASS_NAME); + LMI_ORGID "_" PCI_BRIDGE_CLASS_NAME); LMI_PCIBridgeRef_Set_DeviceID(&lmi_dev, device_id_str); LMI_PCIBridgeSystemDevice_SetObjectPath_GroupComponent( diff --git a/src/hardware/LMI_PCIDeviceProvider.c b/src/hardware/LMI_PCIDeviceProvider.c index 1c94915..e2d0e55 100644 --- a/src/hardware/LMI_PCIDeviceProvider.c +++ b/src/hardware/LMI_PCIDeviceProvider.c @@ -23,7 +23,6 @@ #include "LMI_PCIDevice.h" #include "LMI_Hardware.h" #include "PCIDev.h" -#include "globals.h" static const CMPIBroker* _cb = NULL; @@ -39,7 +38,7 @@ static void LMI_PCIDeviceInitialize(const CMPIContext *ctx) | PCI_FILL_ROM_BASE | PCI_FILL_CLASS | PCI_FILL_CAPS) != 0) { - error("Failed to access the PCI bus."); + lmi_error("Failed to access the PCI bus."); abort(); } } @@ -111,7 +110,7 @@ static CMPIStatus LMI_PCIDeviceEnumInstances( snprintf(device_id_str, PCI_DEVID_STR_SIZE, "%02x:%02x.%u", dev->bus, dev->dev, dev->func); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" PCI_DEVICE_CLASS_NAME ":%s", device_id_str); + LMI_ORGID ":" LMI_ORGID "_" PCI_DEVICE_CLASS_NAME ":%s", device_id_str); LMI_PCIDevice_Init(&lmi_dev, _cb, ns); @@ -119,7 +118,7 @@ static CMPIStatus LMI_PCIDeviceEnumInstances( get_system_creation_class_name()); LMI_PCIDevice_Set_SystemName(&lmi_dev, get_system_name()); LMI_PCIDevice_Set_CreationClassName(&lmi_dev, - ORGID "_" PCI_DEVICE_CLASS_NAME); + LMI_ORGID "_" PCI_DEVICE_CLASS_NAME); LMI_PCIDevice_Set_Caption(&lmi_dev, "This object represents one logical PCI device contained in system."); diff --git a/src/hardware/LMI_PCIDeviceSystemDeviceProvider.c b/src/hardware/LMI_PCIDeviceSystemDeviceProvider.c index cb011e9..7231c08 100644 --- a/src/hardware/LMI_PCIDeviceSystemDeviceProvider.c +++ b/src/hardware/LMI_PCIDeviceSystemDeviceProvider.c @@ -22,7 +22,6 @@ #include "LMI_PCIDeviceSystemDevice.h" #include "LMI_Hardware.h" #include "PCIDev.h" -#include "globals.h" static const CMPIBroker* _cb; @@ -33,7 +32,7 @@ static void LMI_PCIDeviceSystemDeviceInitialize(const CMPIContext *ctx) lmi_init(provider_name, _cb, ctx, provider_config_defaults); if (init_pci_access(&acc_system_dev, PCI_FILL_CLASS) != 0) { - error("Failed to access the PCI bus."); + lmi_error("Failed to access the PCI bus."); abort(); } } @@ -88,7 +87,7 @@ static CMPIStatus LMI_PCIDeviceSystemDeviceEnumInstances( get_system_creation_class_name()); LMI_PCIDeviceRef_Set_SystemName(&lmi_dev, get_system_name()); LMI_PCIDeviceRef_Set_CreationClassName(&lmi_dev, - ORGID "_" PCI_DEVICE_CLASS_NAME); + LMI_ORGID "_" PCI_DEVICE_CLASS_NAME); LMI_PCIDeviceRef_Set_DeviceID(&lmi_dev, device_id_str); LMI_PCIDeviceSystemDevice_SetObjectPath_GroupComponent( diff --git a/src/hardware/LMI_PhysicalBatteryContainerProvider.c b/src/hardware/LMI_PhysicalBatteryContainerProvider.c index 4972641..57985e9 100644 --- a/src/hardware/LMI_PhysicalBatteryContainerProvider.c +++ b/src/hardware/LMI_PhysicalBatteryContainerProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_PhysicalBatteryContainer.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb; @@ -74,7 +73,7 @@ static CMPIStatus LMI_PhysicalBatteryContainerEnumInstances( LMI_ChassisRef_Init(&lmi_chassis, _cb, ns); LMI_ChassisRef_Set_CreationClassName(&lmi_chassis, - ORGID "_" CHASSIS_CLASS_NAME); + LMI_ORGID "_" CHASSIS_CLASS_NAME); LMI_ChassisRef_Set_Tag(&lmi_chassis, dmi_get_chassis_tag(&dmi_chassis)); for (i = 0; i < dmi_batt_nb; i++) { @@ -82,7 +81,7 @@ static CMPIStatus LMI_PhysicalBatteryContainerEnumInstances( LMI_BatteryPhysicalPackageRef_Init(&lmi_batt_phys, _cb, ns); LMI_BatteryPhysicalPackageRef_Set_CreationClassName(&lmi_batt_phys, - ORGID "_" BATTERY_PHYS_PKG_CLASS_NAME); + LMI_ORGID "_" BATTERY_PHYS_PKG_CLASS_NAME); LMI_BatteryPhysicalPackageRef_Set_Tag(&lmi_batt_phys, dmi_batt[i].name); LMI_PhysicalBatteryContainer_Set_GroupComponent( diff --git a/src/hardware/LMI_PhysicalBatteryRealizesProvider.c b/src/hardware/LMI_PhysicalBatteryRealizesProvider.c index e35b4c6..5cc6afb 100644 --- a/src/hardware/LMI_PhysicalBatteryRealizesProvider.c +++ b/src/hardware/LMI_PhysicalBatteryRealizesProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_PhysicalBatteryRealizes.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb; @@ -76,12 +75,12 @@ static CMPIStatus LMI_PhysicalBatteryRealizesEnumInstances( get_system_creation_class_name()); LMI_BatteryRef_Set_SystemName(&lmi_batt, get_system_name()); LMI_BatteryRef_Set_CreationClassName(&lmi_batt, - ORGID "_" BATTERY_CLASS_NAME); + LMI_ORGID "_" BATTERY_CLASS_NAME); LMI_BatteryRef_Set_DeviceID(&lmi_batt, dmi_batt[i].name); LMI_BatteryPhysicalPackageRef_Init(&lmi_batt_phys, _cb, ns); LMI_BatteryPhysicalPackageRef_Set_CreationClassName(&lmi_batt_phys, - ORGID "_" BATTERY_PHYS_PKG_CLASS_NAME); + LMI_ORGID "_" BATTERY_PHYS_PKG_CLASS_NAME); LMI_BatteryPhysicalPackageRef_Set_Tag(&lmi_batt_phys, dmi_batt[i].name); LMI_PhysicalBatteryRealizes_Set_Antecedent(&lmi_phys_batt_realizes, diff --git a/src/hardware/LMI_PhysicalMemoryContainerProvider.c b/src/hardware/LMI_PhysicalMemoryContainerProvider.c index 3c995e4..bff9955 100644 --- a/src/hardware/LMI_PhysicalMemoryContainerProvider.c +++ b/src/hardware/LMI_PhysicalMemoryContainerProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_PhysicalMemoryContainer.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb; @@ -72,13 +71,13 @@ static CMPIStatus LMI_PhysicalMemoryContainerEnumInstances( LMI_PhysicalMemoryRef_Init(&lmi_phys_mem, _cb, ns); LMI_PhysicalMemoryRef_Set_CreationClassName(&lmi_phys_mem, - ORGID "_" PHYS_MEM_CLASS_NAME); + LMI_ORGID "_" PHYS_MEM_CLASS_NAME); LMI_PhysicalMemoryRef_Set_Tag(&lmi_phys_mem, dmi_memory.modules[i].serial_number); LMI_MemoryPhysicalPackageRef_Init(&lmi_phys_mem_pkg, _cb, ns); LMI_MemoryPhysicalPackageRef_Set_CreationClassName(&lmi_phys_mem_pkg, - ORGID "_" MEMORY_PHYS_PKG_CLASS_NAME); + LMI_ORGID "_" MEMORY_PHYS_PKG_CLASS_NAME); LMI_MemoryPhysicalPackageRef_Set_Tag(&lmi_phys_mem_pkg, dmi_memory.modules[i].serial_number); diff --git a/src/hardware/LMI_PhysicalMemoryProvider.c b/src/hardware/LMI_PhysicalMemoryProvider.c index c859671..b7dc9a7 100644 --- a/src/hardware/LMI_PhysicalMemoryProvider.c +++ b/src/hardware/LMI_PhysicalMemoryProvider.c @@ -21,7 +21,7 @@ #include <konkret/konkret.h> #include "LMI_PhysicalMemory.h" #include "LMI_Hardware.h" -#include "globals.h" + #include "dmidecode.h" CMPIUint16 get_form_factor(const char *dmi_ff); @@ -73,10 +73,10 @@ static CMPIStatus LMI_PhysicalMemoryEnumInstances( LMI_PhysicalMemory_Init(&lmi_phys_mem, _cb, ns); LMI_PhysicalMemory_Set_CreationClassName(&lmi_phys_mem, - ORGID "_" PHYS_MEM_CLASS_NAME); + LMI_ORGID "_" PHYS_MEM_CLASS_NAME); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" PHYS_MEM_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" PHYS_MEM_CLASS_NAME ":%s", dmi_memory.modules[i].serial_number); LMI_PhysicalMemory_Set_Tag(&lmi_phys_mem, diff --git a/src/hardware/LMI_PhysicalMemoryRealizesProvider.c b/src/hardware/LMI_PhysicalMemoryRealizesProvider.c index d7ec945..9128450 100644 --- a/src/hardware/LMI_PhysicalMemoryRealizesProvider.c +++ b/src/hardware/LMI_PhysicalMemoryRealizesProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_PhysicalMemoryRealizes.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb; @@ -71,7 +70,7 @@ static CMPIStatus LMI_PhysicalMemoryRealizesEnumInstances( LMI_MemoryRef_Set_SystemCreationClassName(&lmi_mem, get_system_creation_class_name()); LMI_MemoryRef_Set_SystemName(&lmi_mem, get_system_name()); - LMI_MemoryRef_Set_CreationClassName(&lmi_mem, ORGID "_" MEM_CLASS_NAME); + LMI_MemoryRef_Set_CreationClassName(&lmi_mem, LMI_ORGID "_" MEM_CLASS_NAME); LMI_MemoryRef_Set_DeviceID(&lmi_mem, "0"); for (i = 0; i < dmi_memory.modules_nb; i++) { @@ -79,7 +78,7 @@ static CMPIStatus LMI_PhysicalMemoryRealizesEnumInstances( LMI_PhysicalMemoryRef_Init(&lmi_phys_mem, _cb, ns); LMI_PhysicalMemoryRef_Set_CreationClassName(&lmi_phys_mem, - ORGID "_" PHYS_MEM_CLASS_NAME); + LMI_ORGID "_" PHYS_MEM_CLASS_NAME); LMI_PhysicalMemoryRef_Set_Tag(&lmi_phys_mem, dmi_memory.modules[i].serial_number); diff --git a/src/hardware/LMI_PointingDeviceProvider.c b/src/hardware/LMI_PointingDeviceProvider.c index d7966e9..1b169df 100644 --- a/src/hardware/LMI_PointingDeviceProvider.c +++ b/src/hardware/LMI_PointingDeviceProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_PointingDevice.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" CMPIUint16 get_pointingtype(const char *dmi_val); @@ -76,13 +75,13 @@ static CMPIStatus LMI_PointingDeviceEnumInstances( get_system_creation_class_name()); LMI_PointingDevice_Set_SystemName(&lmi_dev, get_system_name()); LMI_PointingDevice_Set_CreationClassName(&lmi_dev, - ORGID "_" POINTING_DEVICE_CLASS_NAME); + LMI_ORGID "_" POINTING_DEVICE_CLASS_NAME); LMI_PointingDevice_Set_Caption(&lmi_dev, "Pointing Device"); LMI_PointingDevice_Set_Description(&lmi_dev, "This object represents one pointing device."); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" POINTING_DEVICE_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" POINTING_DEVICE_CLASS_NAME ":%s", dmi_dev[i].type); LMI_PointingDevice_Set_DeviceID(&lmi_dev, dmi_dev[i].type); diff --git a/src/hardware/LMI_PortPhysicalConnectorContainerProvider.c b/src/hardware/LMI_PortPhysicalConnectorContainerProvider.c index c6a49d8..591fdcc 100644 --- a/src/hardware/LMI_PortPhysicalConnectorContainerProvider.c +++ b/src/hardware/LMI_PortPhysicalConnectorContainerProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_PortPhysicalConnectorContainer.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb; @@ -74,7 +73,7 @@ static CMPIStatus LMI_PortPhysicalConnectorContainerEnumInstances( LMI_ChassisRef_Init(&lmi_chassis, _cb, ns); LMI_ChassisRef_Set_CreationClassName(&lmi_chassis, - ORGID "_" CHASSIS_CLASS_NAME); + LMI_ORGID "_" CHASSIS_CLASS_NAME); LMI_ChassisRef_Set_Tag(&lmi_chassis, dmi_get_chassis_tag(&dmi_chassis)); for (i = 0; i < dmi_ports_nb; i++) { @@ -82,7 +81,7 @@ static CMPIStatus LMI_PortPhysicalConnectorContainerEnumInstances( LMI_PortPhysicalConnectorRef_Init(&lmi_port, _cb, ns); LMI_PortPhysicalConnectorRef_Set_CreationClassName(&lmi_port, - ORGID "_" PORT_PHYS_CONN_CLASS_NAME); + LMI_ORGID "_" PORT_PHYS_CONN_CLASS_NAME); LMI_PortPhysicalConnectorRef_Set_Tag(&lmi_port, dmi_ports[i].name); LMI_PortPhysicalConnectorContainer_Set_GroupComponent( diff --git a/src/hardware/LMI_PortPhysicalConnectorProvider.c b/src/hardware/LMI_PortPhysicalConnectorProvider.c index 5467960..9f2cac2 100644 --- a/src/hardware/LMI_PortPhysicalConnectorProvider.c +++ b/src/hardware/LMI_PortPhysicalConnectorProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_PortPhysicalConnector.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" CMPIUint16 get_connectorlayout(const char *dmi_val); @@ -74,13 +73,13 @@ static CMPIStatus LMI_PortPhysicalConnectorEnumInstances( LMI_PortPhysicalConnector_Init(&lmi_port, _cb, ns); LMI_PortPhysicalConnector_Set_CreationClassName(&lmi_port, - ORGID "_" PORT_PHYS_CONN_CLASS_NAME); + LMI_ORGID "_" PORT_PHYS_CONN_CLASS_NAME); LMI_PortPhysicalConnector_Set_Caption(&lmi_port, "Physical Port"); LMI_PortPhysicalConnector_Set_Description(&lmi_port, "This object represents one physical port on the chassis."); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" PORT_PHYS_CONN_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" PORT_PHYS_CONN_CLASS_NAME ":%s", dmi_ports[i].name); conn_layout = get_connectorlayout(dmi_ports[i].type); diff --git a/src/hardware/LMI_ProcessorCacheMemoryProvider.c b/src/hardware/LMI_ProcessorCacheMemoryProvider.c index b8e0bfe..2365856 100644 --- a/src/hardware/LMI_ProcessorCacheMemoryProvider.c +++ b/src/hardware/LMI_ProcessorCacheMemoryProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_ProcessorCacheMemory.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" #include "sysfs.h" @@ -93,7 +92,7 @@ static CMPIStatus LMI_ProcessorCacheMemoryEnumInstances( LMI_ProcessorCacheMemory_Set_SystemName(&lmi_cpu_cache, get_system_name()); LMI_ProcessorCacheMemory_Set_CreationClassName(&lmi_cpu_cache, - ORGID "_" CPU_CACHE_CLASS_NAME); + LMI_ORGID "_" CPU_CACHE_CLASS_NAME); LMI_ProcessorCacheMemory_Set_BlockSize(&lmi_cpu_cache, 1); LMI_ProcessorCacheMemory_Set_Volatile(&lmi_cpu_cache, 1); @@ -118,7 +117,7 @@ static CMPIStatus LMI_ProcessorCacheMemoryEnumInstances( /* do we have dmidecode output? */ if (dmi_cpu_caches_nb > 0) { snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" CPU_CACHE_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" CPU_CACHE_CLASS_NAME ":%s", dmi_cpu_caches[i].id); LMI_ProcessorCacheMemory_Set_DeviceID(&lmi_cpu_cache, @@ -134,7 +133,7 @@ static CMPIStatus LMI_ProcessorCacheMemoryEnumInstances( get_cachestatus(dmi_cpu_caches[i].status)); } else { snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" CPU_CACHE_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" CPU_CACHE_CLASS_NAME ":%s", sysfs_cpu_caches[i].id); LMI_ProcessorCacheMemory_Set_DeviceID(&lmi_cpu_cache, diff --git a/src/hardware/LMI_ProcessorCapabilitiesProvider.c b/src/hardware/LMI_ProcessorCapabilitiesProvider.c index 906b7c2..c125541 100644 --- a/src/hardware/LMI_ProcessorCapabilitiesProvider.c +++ b/src/hardware/LMI_ProcessorCapabilitiesProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_ProcessorCapabilities.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" #include "lscpu.h" @@ -91,7 +90,7 @@ static CMPIStatus LMI_ProcessorCapabilitiesEnumInstances( /* do we have output from dmidecode program? */ if (dmi_cpus_nb > 0) { snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" CPU_CAP_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" CPU_CAP_CLASS_NAME ":%s", dmi_cpus[i].id); snprintf(element_name, ELEMENT_NAME_LEN, "%s%s", element_name_string, dmi_cpus[i].id); @@ -99,7 +98,7 @@ static CMPIStatus LMI_ProcessorCapabilitiesEnumInstances( threads = dmi_cpus[i].threads; } else { snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" CPU_CAP_CLASS_NAME ":%u", i); + LMI_ORGID ":" LMI_ORGID "_" CPU_CAP_CLASS_NAME ":%u", i); snprintf(element_name, ELEMENT_NAME_LEN, "%s%u", element_name_string, i); } diff --git a/src/hardware/LMI_ProcessorChipContainerProvider.c b/src/hardware/LMI_ProcessorChipContainerProvider.c index 5c524eb..0c2f646 100644 --- a/src/hardware/LMI_ProcessorChipContainerProvider.c +++ b/src/hardware/LMI_ProcessorChipContainerProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_ProcessorChipContainer.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb; @@ -74,7 +73,7 @@ static CMPIStatus LMI_ProcessorChipContainerEnumInstances( LMI_ChassisRef_Init(&lmi_chassis, _cb, ns); LMI_ChassisRef_Set_CreationClassName(&lmi_chassis, - ORGID "_" CHASSIS_CLASS_NAME); + LMI_ORGID "_" CHASSIS_CLASS_NAME); LMI_ChassisRef_Set_Tag(&lmi_chassis, dmi_get_chassis_tag(&dmi_chassis)); for (i = 0; i < dmi_cpus_nb; i++) { @@ -82,7 +81,7 @@ static CMPIStatus LMI_ProcessorChipContainerEnumInstances( LMI_ProcessorChipRef_Init(&lmi_cpu_chip, _cb, ns); LMI_ProcessorChipRef_Set_CreationClassName(&lmi_cpu_chip, - ORGID "_" CPU_CHIP_CLASS_NAME); + LMI_ORGID "_" CPU_CHIP_CLASS_NAME); LMI_ProcessorChipRef_Set_Tag(&lmi_cpu_chip, dmi_cpus[i].id); LMI_ProcessorChipContainer_Set_GroupComponent(&lmi_cpu_chip_container, diff --git a/src/hardware/LMI_ProcessorChipProvider.c b/src/hardware/LMI_ProcessorChipProvider.c index 946758f..d3a2d14 100644 --- a/src/hardware/LMI_ProcessorChipProvider.c +++ b/src/hardware/LMI_ProcessorChipProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_ProcessorChip.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" #include "procfs.h" @@ -76,10 +75,10 @@ static CMPIStatus LMI_ProcessorChipEnumInstances( LMI_ProcessorChip_Init(&lmi_cpu_chip, _cb, ns); LMI_ProcessorChip_Set_CreationClassName(&lmi_cpu_chip, - ORGID "_" CPU_CHIP_CLASS_NAME); + LMI_ORGID "_" CPU_CHIP_CLASS_NAME); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" CPU_CHIP_CLASS_NAME ":%s", dmi_cpus[i].id); + LMI_ORGID ":" LMI_ORGID "_" CPU_CHIP_CLASS_NAME ":%s", dmi_cpus[i].id); cpu_name = dmi_cpus[i].name; if (!cpu_name || !strlen(cpu_name) diff --git a/src/hardware/LMI_ProcessorChipRealizesProvider.c b/src/hardware/LMI_ProcessorChipRealizesProvider.c index 6a126cc..e1b0bed 100644 --- a/src/hardware/LMI_ProcessorChipRealizesProvider.c +++ b/src/hardware/LMI_ProcessorChipRealizesProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_ProcessorChipRealizes.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb; @@ -76,12 +75,12 @@ static CMPIStatus LMI_ProcessorChipRealizesEnumInstances( get_system_creation_class_name()); LMI_ProcessorRef_Set_SystemName(&lmi_cpu, get_system_name()); LMI_ProcessorRef_Set_CreationClassName(&lmi_cpu, - ORGID "_" CPU_CLASS_NAME); + LMI_ORGID "_" CPU_CLASS_NAME); LMI_ProcessorRef_Set_DeviceID(&lmi_cpu, dmi_cpus[i].id); LMI_ProcessorChipRef_Init(&lmi_cpu_chip, _cb, ns); LMI_ProcessorChipRef_Set_CreationClassName(&lmi_cpu_chip, - ORGID "_" CPU_CHIP_CLASS_NAME); + LMI_ORGID "_" CPU_CHIP_CLASS_NAME); LMI_ProcessorChipRef_Set_Tag(&lmi_cpu_chip, dmi_cpus[i].id); LMI_ProcessorChipRealizes_Set_Antecedent(&lmi_cpu_chip_realizes, diff --git a/src/hardware/LMI_ProcessorElementCapabilitiesProvider.c b/src/hardware/LMI_ProcessorElementCapabilitiesProvider.c index 5372000..5ec6a96 100644 --- a/src/hardware/LMI_ProcessorElementCapabilitiesProvider.c +++ b/src/hardware/LMI_ProcessorElementCapabilitiesProvider.c @@ -23,7 +23,6 @@ #include "LMI_ProcessorCapabilities.h" #include "LMI_Processor.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" #include "lscpu.h" @@ -95,7 +94,7 @@ static CMPIStatus LMI_ProcessorElementCapabilitiesEnumInstances( get_system_creation_class_name()); LMI_ProcessorRef_Set_SystemName(&lmi_cpu, get_system_name()); LMI_ProcessorRef_Set_CreationClassName(&lmi_cpu, - ORGID "_" CPU_CLASS_NAME); + LMI_ORGID "_" CPU_CLASS_NAME); LMI_ProcessorCapabilitiesRef_Init(&lmi_cpu_cap, _cb, ns); @@ -104,7 +103,7 @@ static CMPIStatus LMI_ProcessorElementCapabilitiesEnumInstances( LMI_ProcessorRef_Set_DeviceID(&lmi_cpu, dmi_cpus[i].id); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" CPU_CAP_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" CPU_CAP_CLASS_NAME ":%s", dmi_cpus[i].id); } else { char cpu_id[LONG_INT_LEN]; @@ -112,7 +111,7 @@ static CMPIStatus LMI_ProcessorElementCapabilitiesEnumInstances( LMI_ProcessorRef_Set_DeviceID(&lmi_cpu, cpu_id); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" CPU_CAP_CLASS_NAME ":%u", i); + LMI_ORGID ":" LMI_ORGID "_" CPU_CAP_CLASS_NAME ":%u", i); } LMI_ProcessorCapabilitiesRef_Set_InstanceID(&lmi_cpu_cap, instance_id); diff --git a/src/hardware/LMI_ProcessorProvider.c b/src/hardware/LMI_ProcessorProvider.c index a7d2c2c..67d1987 100644 --- a/src/hardware/LMI_ProcessorProvider.c +++ b/src/hardware/LMI_ProcessorProvider.c @@ -24,7 +24,6 @@ #include <sys/utsname.h> #include "LMI_Processor.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" #include "lscpu.h" #include "procfs.h" @@ -128,7 +127,7 @@ static CMPIStatus LMI_ProcessorEnumInstances( LMI_Processor_Set_SystemCreationClassName(&lmi_cpu, get_system_creation_class_name()); LMI_Processor_Set_SystemName(&lmi_cpu, get_system_name()); - LMI_Processor_Set_CreationClassName(&lmi_cpu, ORGID "_" CPU_CLASS_NAME); + LMI_Processor_Set_CreationClassName(&lmi_cpu, LMI_ORGID "_" CPU_CLASS_NAME); LMI_Processor_Set_Caption(&lmi_cpu, CPU_CLASS_NAME); LMI_Processor_Set_Description(&lmi_cpu, "This object represents one physical processor in system."); @@ -150,7 +149,7 @@ static CMPIStatus LMI_ProcessorEnumInstances( enabled_cores = dmi_cpus[i].enabled_cores; stepping = dmi_cpus[i].stepping; snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" CPU_CLASS_NAME ":%s", dmi_cpus[i].id); + LMI_ORGID ":" LMI_ORGID "_" CPU_CLASS_NAME ":%s", dmi_cpus[i].id); LMI_Processor_Set_DeviceID(&lmi_cpu, dmi_cpus[i].id); LMI_Processor_Set_Family(&lmi_cpu, family); @@ -184,7 +183,7 @@ static CMPIStatus LMI_ProcessorEnumInstances( char cpu_id[LONG_INT_LEN]; snprintf(cpu_id, LONG_INT_LEN, "%u", i); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" CPU_CLASS_NAME ":%s", cpu_id); + LMI_ORGID ":" LMI_ORGID "_" CPU_CLASS_NAME ":%s", cpu_id); cpustatus = get_cpustatus("Enabled"); enabledstate = get_enabledstate(cpustatus); if (enabledstate == LMI_Processor_EnabledState_Enabled) { diff --git a/src/hardware/LMI_ProcessorSystemDeviceProvider.c b/src/hardware/LMI_ProcessorSystemDeviceProvider.c index 0335e18..e8ac492 100644 --- a/src/hardware/LMI_ProcessorSystemDeviceProvider.c +++ b/src/hardware/LMI_ProcessorSystemDeviceProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_ProcessorSystemDevice.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb; @@ -75,7 +74,7 @@ static CMPIStatus LMI_ProcessorSystemDeviceEnumInstances( get_system_creation_class_name()); LMI_ProcessorRef_Set_SystemName(&lmi_cpu, get_system_name()); LMI_ProcessorRef_Set_CreationClassName(&lmi_cpu, - ORGID "_" CPU_CLASS_NAME); + LMI_ORGID "_" CPU_CLASS_NAME); LMI_ProcessorRef_Set_DeviceID(&lmi_cpu, dmi_cpus[i].id); LMI_ProcessorSystemDevice_SetObjectPath_GroupComponent( diff --git a/src/hardware/LMI_SystemSlotContainerProvider.c b/src/hardware/LMI_SystemSlotContainerProvider.c index ea4c95e..16139cb 100644 --- a/src/hardware/LMI_SystemSlotContainerProvider.c +++ b/src/hardware/LMI_SystemSlotContainerProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_SystemSlotContainer.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" static const CMPIBroker* _cb; @@ -74,7 +73,7 @@ static CMPIStatus LMI_SystemSlotContainerEnumInstances( LMI_ChassisRef_Init(&lmi_chassis, _cb, ns); LMI_ChassisRef_Set_CreationClassName(&lmi_chassis, - ORGID "_" CHASSIS_CLASS_NAME); + LMI_ORGID "_" CHASSIS_CLASS_NAME); LMI_ChassisRef_Set_Tag(&lmi_chassis, dmi_get_chassis_tag(&dmi_chassis)); for (i = 0; i < dmi_slots_nb; i++) { @@ -82,7 +81,7 @@ static CMPIStatus LMI_SystemSlotContainerEnumInstances( LMI_SystemSlotRef_Init(&lmi_slot, _cb, ns); LMI_SystemSlotRef_Set_CreationClassName(&lmi_slot, - ORGID "_" SYSTEM_SLOT_CLASS_NAME); + LMI_ORGID "_" SYSTEM_SLOT_CLASS_NAME); LMI_SystemSlotRef_Set_Tag(&lmi_slot, dmi_slots[i].name); LMI_SystemSlotContainer_Set_GroupComponent( diff --git a/src/hardware/LMI_SystemSlotProvider.c b/src/hardware/LMI_SystemSlotProvider.c index 0cb73cb..730c242 100644 --- a/src/hardware/LMI_SystemSlotProvider.c +++ b/src/hardware/LMI_SystemSlotProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_SystemSlot.h" #include "LMI_Hardware.h" -#include "globals.h" #include "dmidecode.h" CMPIUint16 get_connectorlayout_slot(const char *dmi_val); @@ -75,7 +74,7 @@ static CMPIStatus LMI_SystemSlotEnumInstances( LMI_SystemSlot_Init(&lmi_slot, _cb, ns); LMI_SystemSlot_Set_CreationClassName(&lmi_slot, - ORGID "_" SYSTEM_SLOT_CLASS_NAME); + LMI_ORGID "_" SYSTEM_SLOT_CLASS_NAME); LMI_SystemSlot_Set_Caption(&lmi_slot, "System Slot"); LMI_SystemSlot_Set_Description(&lmi_slot, "This object represents one system slot."); @@ -83,7 +82,7 @@ static CMPIStatus LMI_SystemSlotEnumInstances( LMI_SystemSlot_ConnectorGender_Female); snprintf(instance_id, INSTANCE_ID_LEN, - ORGID ":" ORGID "_" SYSTEM_SLOT_CLASS_NAME ":%s", + LMI_ORGID ":" LMI_ORGID "_" SYSTEM_SLOT_CLASS_NAME ":%s", dmi_slots[i].name); conn_layout = get_connectorlayout_slot(dmi_slots[i].type); maxlinkwidth = get_maxlinkwidth(dmi_slots[i].link_width); diff --git a/src/hardware/dmidecode.c b/src/hardware/dmidecode.c index ca1070d..69afbc4 100644 --- a/src/hardware/dmidecode.c +++ b/src/hardware/dmidecode.c @@ -133,7 +133,7 @@ short check_dmiprocessor_attributes(DmiProcessor *cpu) done: if (ret != 0) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return ret; @@ -162,14 +162,14 @@ short dmi_get_processors(DmiProcessor **cpus, unsigned *cpus_nb) /* if no processor was found */ if (*cpus_nb < 1) { - warn("Dmidecode didn't recognize any processor."); + lmi_warn("Dmidecode didn't recognize any processor."); goto done; } /* allocate memory for processors */ *cpus = (DmiProcessor *)calloc(*cpus_nb, sizeof(DmiProcessor)); if (!(*cpus)) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); *cpus_nb = 0; goto done; } @@ -347,7 +347,7 @@ short dmi_get_processors(DmiProcessor **cpus, unsigned *cpus_nb) (*cpus)[curr_cpu].characteristics = (char **)calloc((*cpus)[curr_cpu].charact_nb, sizeof(char *)); if (!(*cpus)[curr_cpu].characteristics) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); (*cpus)[curr_cpu].charact_nb = 0; goto done; } @@ -360,7 +360,7 @@ short dmi_get_processors(DmiProcessor **cpus, unsigned *cpus_nb) } else { (*cpus)[curr_cpu].characteristics[j] = strdup(""); if (!(*cpus)[curr_cpu].characteristics[j]) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); goto done; } } @@ -505,7 +505,7 @@ short check_dmi_cpu_cache_attributes(DmiCpuCache *cache) done: if (ret != 0) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return ret; @@ -534,14 +534,14 @@ short dmi_get_cpu_caches(DmiCpuCache **caches, unsigned *caches_nb) /* if no cache was found */ if (*caches_nb < 1) { - warn("Dmidecode didn't recognize any processor cache memory."); + lmi_warn("Dmidecode didn't recognize any processor cache memory."); goto done; } /* allocate memory for caches */ *caches = (DmiCpuCache *)calloc(*caches_nb, sizeof(DmiCpuCache)); if (!(*caches)) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); *caches_nb = 0; goto done; } @@ -556,12 +556,12 @@ short dmi_get_cpu_caches(DmiCpuCache **caches, unsigned *caches_nb) char *id_start = buffer[i] + 7; char *id_end = strchr(buffer[i], ','); if (!id_end) { - warn("Unrecognized output from dmidecode program."); + lmi_warn("Unrecognized output from dmidecode program."); goto done; } (*caches)[curr_cache].id = strndup(id_start, id_end - id_start); if (!(*caches)[curr_cache].id) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); goto done; } @@ -794,7 +794,7 @@ short check_dmi_memory_attributes(DmiMemory *memory) done: if (ret != 0) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return ret; @@ -826,14 +826,14 @@ short dmi_get_memory(DmiMemory *memory) /* if no module was found */ if (memory->modules_nb < 1) { - warn("Dmidecode didn't recognize any memory module."); + lmi_warn("Dmidecode didn't recognize any memory module."); goto done; } /* allocate memory for modules */ memory->modules = (DmiMemoryModule *)calloc(memory->modules_nb, sizeof(DmiMemoryModule)); if (!memory->modules) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); memory->modules_nb = 0; goto done; } @@ -882,7 +882,7 @@ short dmi_get_memory(DmiMemory *memory) } if (asprintf(&memory->modules[curr_mem].name, str_format, memory_size) < 0) { memory->modules[curr_mem].name = NULL; - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); goto done; } @@ -891,7 +891,7 @@ short dmi_get_memory(DmiMemory *memory) total_width = 0; data_width = 0; - debug("Found %s at index %d", + lmi_debug("Found %s at index %d", memory->modules[curr_mem].name, curr_mem); continue; @@ -912,7 +912,7 @@ short dmi_get_memory(DmiMemory *memory) buf = NULL; if (asprintf(&memory->modules[curr_mem].serial_number, "%u", curr_mem) < 0) { memory->modules[curr_mem].serial_number = NULL; - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); goto done; } } @@ -991,7 +991,7 @@ short dmi_get_memory(DmiMemory *memory) /* allocate memory for slots */ memory->slots = (DmiMemorySlot *)calloc(memory->slots_nb, sizeof(DmiMemorySlot)); if (!memory->slots) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); memory->slots_nb = 0; goto done; } @@ -1208,7 +1208,7 @@ short check_dmi_chassis_attributes(DmiChassis *chassis) done: if (ret != 0) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return ret; @@ -1229,7 +1229,7 @@ short dmi_get_chassis(DmiChassis *chassis) /* empty output from dmidecode */ if (buffer_size < 5) { - warn("Dmidecode has no information about chassis."); + lmi_warn("Dmidecode has no information about chassis."); goto done; } @@ -1440,7 +1440,7 @@ short check_dmi_baseboard_attributes(DmiBaseboard *baseboard) done: if (ret != 0) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return ret; @@ -1461,7 +1461,7 @@ short dmi_get_baseboard(DmiBaseboard *baseboard) /* empty output from dmidecode */ if (buffer_size < 5) { - warn("Dmidecode has no information about baseboard."); + lmi_warn("Dmidecode has no information about baseboard."); goto done; } @@ -1575,7 +1575,7 @@ short check_dmiport_attributes(DmiPort *port) done: if (ret != 0) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return ret; @@ -1604,14 +1604,14 @@ short dmi_get_ports(DmiPort **ports, unsigned *ports_nb) /* if no port was found */ if (*ports_nb < 1) { - warn("Dmidecode didn't recognize any port."); + lmi_warn("Dmidecode didn't recognize any port."); goto done; } /* allocate memory for ports */ *ports = (DmiPort *)calloc(*ports_nb, sizeof(DmiPort)); if (!(*ports)) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); *ports_nb = 0; goto done; } @@ -1737,7 +1737,7 @@ short check_dmislot_attributes(DmiSystemSlot *slot) done: if (ret != 0) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return ret; @@ -1766,14 +1766,14 @@ short dmi_get_system_slots(DmiSystemSlot **slots, unsigned *slots_nb) /* if no slot was found */ if (*slots_nb < 1) { - warn("Dmidecode didn't recognize any system slot."); + lmi_warn("Dmidecode didn't recognize any system slot."); goto done; } /* allocate memory for slots */ *slots = (DmiSystemSlot *)calloc(*slots_nb, sizeof(DmiSystemSlot)); if (!(*slots)) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); *slots_nb = 0; goto done; } @@ -1816,7 +1816,7 @@ short dmi_get_system_slots(DmiSystemSlot **slots, unsigned *slots_nb) (*slots)[curr_slot].link_width = strdup(exploded_buf[0]); if (!(*slots)[curr_slot].link_width) { free_2d_buffer(&exploded_buf, &exploded_buf_size); - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); goto done; } from = 1; @@ -1925,7 +1925,7 @@ short check_dmipointingdev_attributes(DmiPointingDevice *dev) done: if (ret != 0) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return ret; @@ -1954,14 +1954,14 @@ short dmi_get_pointing_devices(DmiPointingDevice **devices, unsigned *devices_nb /* if no slot was found */ if (*devices_nb < 1) { - warn("Dmidecode didn't recognize any pointing device."); + lmi_warn("Dmidecode didn't recognize any pointing device."); goto done; } /* allocate memory for pointing devices */ *devices = (DmiPointingDevice *)calloc(*devices_nb, sizeof(DmiPointingDevice)); if (!(*devices)) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); *devices_nb = 0; goto done; } @@ -2100,7 +2100,7 @@ short check_dmibattery_attributes(DmiBattery *batt) done: if (ret != 0) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return ret; @@ -2129,14 +2129,14 @@ short dmi_get_batteries(DmiBattery **batteries, unsigned *batteries_nb) /* if no battery was found */ if (*batteries_nb < 1) { - warn("Dmidecode didn't recognize any batteries."); + lmi_warn("Dmidecode didn't recognize any batteries."); goto done; } /* allocate memory for batteries */ *batteries = (DmiBattery *)calloc(*batteries_nb, sizeof(DmiBattery)); if (!(*batteries)) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); *batteries_nb = 0; goto done; } diff --git a/src/hardware/lsblk.c b/src/hardware/lsblk.c index 512ccad..a6d2980 100644 --- a/src/hardware/lsblk.c +++ b/src/hardware/lsblk.c @@ -85,7 +85,7 @@ short check_lsblkhdd_attributes(LsblkHdd *hdd) done: if (ret != 0) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return ret; @@ -95,7 +95,7 @@ short lsblk_get_hdds(LsblkHdd **hdds, unsigned *hdds_nb) { short ret = -1; unsigned i, curr_hdd = 0, buffer_size = 0; - char **buffer = NULL, *path, *type, *buf, errbuf[STRERROR_BUF_LEN]; + char **buffer = NULL, *path, *type, *buf, errbuf[BUFLEN]; struct stat sb; unsigned long capacity = 0; @@ -112,14 +112,14 @@ short lsblk_get_hdds(LsblkHdd **hdds, unsigned *hdds_nb) /* if no hard drive was found */ if (*hdds_nb < 1) { - warn("Lsblk didn't recognize any hard drive."); + lmi_warn("Lsblk didn't recognize any hard drive."); goto done; } /* allocate memory for hard drives */ *hdds = (LsblkHdd *)calloc(*hdds_nb, sizeof(LsblkHdd)); if (!(*hdds)) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); *hdds_nb = 0; goto done; } @@ -131,13 +131,13 @@ short lsblk_get_hdds(LsblkHdd **hdds, unsigned *hdds_nb) continue; } if (stat(path, &sb) != 0) { - warn("Stat() call on file \"%s\" failed: %s", + lmi_warn("Stat() call on file \"%s\" failed: %s", path, strerror_r(errno, errbuf, sizeof(errbuf))); free(path); continue; } if ((sb.st_mode & S_IFMT) != S_IFBLK) { - warn("File \"%s\" is not a block device.", path); + lmi_warn("File \"%s\" is not a block device.", path); free(path); continue; } @@ -181,7 +181,7 @@ short lsblk_get_hdds(LsblkHdd **hdds, unsigned *hdds_nb) (*hdds)[curr_hdd].basename = strdup(basename(path)); if (!(*hdds)[curr_hdd].basename) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); goto done; } @@ -189,11 +189,11 @@ short lsblk_get_hdds(LsblkHdd **hdds, unsigned *hdds_nb) } if (curr_hdd != *hdds_nb) { - warn("Not all reported drives by lsblk were processed."); + lmi_warn("Not all reported drives by lsblk were processed."); LsblkHdd *tmp_hdd = (LsblkHdd *)realloc(*hdds, curr_hdd * sizeof(LsblkHdd)); if (!tmp_hdd) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); goto done; } *hdds = tmp_hdd; diff --git a/src/hardware/lscpu.c b/src/hardware/lscpu.c index e2a0f5a..3407cea 100644 --- a/src/hardware/lscpu.c +++ b/src/hardware/lscpu.c @@ -54,7 +54,7 @@ short check_lscpuprocessor_attributes(LscpuProcessor *cpu) done: if (ret != 0) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return ret; diff --git a/src/hardware/procfs.c b/src/hardware/procfs.c index 26d5913..71c3c63 100644 --- a/src/hardware/procfs.c +++ b/src/hardware/procfs.c @@ -52,7 +52,7 @@ short check_cpuinfoprocessor_attributes(CpuinfoProcessor *cpu) done: if (ret != 0) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return ret; diff --git a/src/hardware/smartctl.c b/src/hardware/smartctl.c index d637acc..452700d 100644 --- a/src/hardware/smartctl.c +++ b/src/hardware/smartctl.c @@ -102,7 +102,7 @@ short check_smctlhdd_attributes(SmartctlHdd *hdd) done: if (ret != 0) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return ret; @@ -121,7 +121,7 @@ short scan_smctlhdd_devices(SmartctlHdd **hdds, unsigned *hdds_nb) unsigned i, curr_hdd = 0, buffer_size = 0, sec_buffer_size = 0; char **buffer = NULL, **sec_buffer = NULL; struct stat sb; - char errbuf[STRERROR_BUF_LEN]; + char errbuf[BUFLEN]; smartctl_free_hdds(hdds, hdds_nb); @@ -135,14 +135,14 @@ short scan_smctlhdd_devices(SmartctlHdd **hdds, unsigned *hdds_nb) /* if no hard drive was found */ if (*hdds_nb < 1) { - warn("Smartctl didn't recognize any hard drive."); + lmi_warn("Smartctl didn't recognize any hard drive."); goto done; } /* allocate memory for hard drives */ *hdds = (SmartctlHdd *)calloc(*hdds_nb, sizeof(SmartctlHdd)); if (!(*hdds)) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); *hdds_nb = 0; goto done; } @@ -156,14 +156,14 @@ short scan_smctlhdd_devices(SmartctlHdd **hdds, unsigned *hdds_nb) } if (stat(sec_buffer[0], &sb) != 0) { - warn("Stat() call on file \"%s\" failed: %s", + lmi_warn("Stat() call on file \"%s\" failed: %s", sec_buffer[0], strerror_r(errno, errbuf, sizeof(errbuf))); free_2d_buffer(&sec_buffer, &sec_buffer_size); continue; } if ((sb.st_mode & S_IFMT) != S_IFBLK) { - warn("File \"%s\" is not a block device.", sec_buffer[0]); + lmi_warn("File \"%s\" is not a block device.", sec_buffer[0]); free_2d_buffer(&sec_buffer, &sec_buffer_size); continue; } @@ -173,7 +173,7 @@ short scan_smctlhdd_devices(SmartctlHdd **hdds, unsigned *hdds_nb) (*hdds)[curr_hdd].dev_path = strdup(sec_buffer[0]); (*hdds)[curr_hdd].dev_basename = strdup(basename(sec_buffer[0])); if (!(*hdds)[curr_hdd].dev_path || !(*hdds)[curr_hdd].dev_basename) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); free_2d_buffer(&sec_buffer, &sec_buffer_size); continue; } @@ -183,12 +183,12 @@ short scan_smctlhdd_devices(SmartctlHdd **hdds, unsigned *hdds_nb) } if (curr_hdd != *hdds_nb) { - warn("There's some \"smartctl --scan\" output mismatch, " + lmi_warn("There's some \"smartctl --scan\" output mismatch, " "not all reported drives were processed."); SmartctlHdd *tmp_hdd = (SmartctlHdd *)realloc(*hdds, curr_hdd * sizeof(SmartctlHdd)); if (!tmp_hdd) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); goto done; } *hdds = tmp_hdd; @@ -355,7 +355,7 @@ short smartctl_get_hdds(SmartctlHdd **hdds, unsigned *hdds_nb) sscanf(buf2, "%lu", &(*hdds)[curr_hdd].capacity); free(buf2); } else { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } free(buf); buf = NULL; diff --git a/src/hardware/sysfs.c b/src/hardware/sysfs.c index 2e02081..1e8de84 100644 --- a/src/hardware/sysfs.c +++ b/src/hardware/sysfs.c @@ -26,13 +26,13 @@ short path_get_unsigned(const char *path, unsigned *result) short ret = -1; unsigned buffer_size = 0; char **buffer = NULL; - char errbuf[STRERROR_BUF_LEN]; + char errbuf[BUFLEN]; if (read_file(path, &buffer, &buffer_size) != 0 || buffer_size < 1) { goto done; } if (sscanf(buffer[0], "%u", result) != 1) { - warn("Failed to parse file: \"%s\"; Error: %s", + lmi_warn("Failed to parse file: \"%s\"; Error: %s", path, strerror_r(errno, errbuf, sizeof(errbuf))); goto done; } @@ -60,7 +60,7 @@ short path_get_string(const char *path, char **result) } *result = trim(buffer[0], NULL); if (!(*result)) { - warn("Failed to parse file: \"%s\"", path); + lmi_warn("Failed to parse file: \"%s\"", path); goto done; } @@ -120,7 +120,7 @@ short check_sysfs_cpu_cache_attributes(SysfsCpuCache *cache) done: if (ret != 0) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return ret; @@ -140,7 +140,7 @@ short copy_sysfs_cpu_cache(SysfsCpuCache *to, const SysfsCpuCache from) to->type = strdup(from.type); if (!to->id || !to->name || !to->type) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); free(to->id); to->id = NULL; free(to->name); @@ -161,7 +161,7 @@ short sysfs_get_cpu_caches(SysfsCpuCache **caches, unsigned *caches_nb) DmiProcessor *dmi_cpus = NULL; unsigned dmi_cpus_nb = 0, cpus_nb = 0; LscpuProcessor lscpu; - char errbuf[STRERROR_BUF_LEN]; + char errbuf[BUFLEN]; *caches_nb = 0; @@ -178,7 +178,7 @@ short sysfs_get_cpu_caches(SysfsCpuCache **caches, unsigned *caches_nb) } else if (lscpu.processors > 0) { cpus_nb = lscpu.processors; } else { - warn("No processor found."); + lmi_warn("No processor found."); goto done; } @@ -187,7 +187,7 @@ short sysfs_get_cpu_caches(SysfsCpuCache **caches, unsigned *caches_nb) char *cache_dir = SYSFS_CPU_PATH "/cpu0/cache"; dir = opendir(cache_dir); if (!dir) { - warn("Failed to read directory: \"%s\"; Error: %s", + lmi_warn("Failed to read directory: \"%s\"; Error: %s", cache_dir, strerror_r(errno, errbuf, sizeof(errbuf))); goto done; } @@ -201,14 +201,14 @@ short sysfs_get_cpu_caches(SysfsCpuCache **caches, unsigned *caches_nb) /* if no cache was found */ if (*caches_nb < 1) { - warn("No processor cache was found in sysfs."); + lmi_warn("No processor cache was found in sysfs."); goto done; } /* allocate memory for caches */ *caches = (SysfsCpuCache *)calloc(*caches_nb * cpus_nb, sizeof(SysfsCpuCache)); if (!(*caches)) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); *caches_nb = 0; goto done; } @@ -237,13 +237,13 @@ short sysfs_get_cpu_caches(SysfsCpuCache **caches, unsigned *caches_nb) } if (asprintf(&(*caches)[i].id, format_str, level) < 0) { (*caches)[i].id = NULL; - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); goto done; } if (asprintf(&(*caches)[i].name, "Level %u %s cache", level, buf) < 0) { (*caches)[i].name = NULL; - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); goto done; } (*caches)[i].type = buf; @@ -346,7 +346,7 @@ short sysfs_get_sizes_of_hugepages(unsigned **sizes, unsigned *sizes_nb) { short ret = -1; DIR *dir = NULL; - char errbuf[STRERROR_BUF_LEN]; + char errbuf[BUFLEN]; *sizes_nb = 0; *sizes = NULL; @@ -355,7 +355,7 @@ short sysfs_get_sizes_of_hugepages(unsigned **sizes, unsigned *sizes_nb) char *sizes_dir = SYSFS_KERNEL_MM "/hugepages"; dir = opendir(sizes_dir); if (!dir) { - warn("Failed to read directory: \"%s\"; Error: %s", + lmi_warn("Failed to read directory: \"%s\"; Error: %s", sizes_dir, strerror_r(errno, errbuf, sizeof(errbuf))); goto done; } @@ -368,14 +368,14 @@ short sysfs_get_sizes_of_hugepages(unsigned **sizes, unsigned *sizes_nb) /* if no size was found */ if (*sizes_nb < 1) { - warn("Looks like kernel doesn't support huge memory pages."); + lmi_warn("Looks like kernel doesn't support huge memory pages."); goto done; } /* allocate memory for sizes */ *sizes = (unsigned *)calloc(*sizes_nb, sizeof(unsigned)); if (!(*sizes)) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); *sizes_nb = 0; goto done; } diff --git a/src/hardware/utils.c b/src/hardware/utils.c index 4193fd9..1fa6594 100644 --- a/src/hardware/utils.c +++ b/src/hardware/utils.c @@ -34,7 +34,7 @@ short read_fp_to_2d_buffer(FILE *fp, char ***buffer, unsigned *buffer_size) free_2d_buffer(buffer, buffer_size); if (!fp) { - warn("Given file pointer is NULL."); + lmi_warn("Given file pointer is NULL."); goto done; } @@ -42,7 +42,7 @@ short read_fp_to_2d_buffer(FILE *fp, char ***buffer, unsigned *buffer_size) tmp_buffer_lines = 128; tmp_buffer = (char **)calloc(tmp_buffer_lines, sizeof(char *)); if (!tmp_buffer) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); tmp_buffer_lines = 0; goto done; } @@ -59,7 +59,7 @@ short read_fp_to_2d_buffer(FILE *fp, char ***buffer, unsigned *buffer_size) char **newtmp = (char **)realloc(tmp_buffer, tmp_buffer_lines * sizeof(char *)); if (!newtmp) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); tmp_buffer_lines /= 2; goto done; } @@ -71,7 +71,7 @@ short read_fp_to_2d_buffer(FILE *fp, char ***buffer, unsigned *buffer_size) if (!tmp_buffer[lines_read]) { tmp_buffer[lines_read] = strdup(""); if (!tmp_buffer[lines_read]) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); goto done; } } @@ -79,7 +79,7 @@ short read_fp_to_2d_buffer(FILE *fp, char ***buffer, unsigned *buffer_size) } if (lines_read < 1) { - warn("No data read from given source."); + lmi_warn("No data read from given source."); goto done; } @@ -88,7 +88,7 @@ short read_fp_to_2d_buffer(FILE *fp, char ***buffer, unsigned *buffer_size) char **newtmp = (char **)realloc(tmp_buffer, lines_read * sizeof(char *)); if (!newtmp) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); goto done; } tmp_buffer = newtmp; @@ -132,19 +132,19 @@ short run_command(const char *command, char ***buffer, unsigned *buffer_size) { FILE *fp = NULL; short ret = -1; - char errbuf[STRERROR_BUF_LEN]; + char errbuf[BUFLEN]; /* if command is empty */ if (!command || strlen(command) < 1) { - warn("Given command is empty."); + lmi_warn("Given command is empty."); goto done; } /* execute command */ - debug("Running command: \"%s\"", command); + lmi_debug("Running command: \"%s\"", command); fp = popen(command, "r"); if (!fp) { - warn("Failed to run command: \"%s\"; Error: %s", + lmi_warn("Failed to run command: \"%s\"; Error: %s", command, strerror_r(errno, errbuf, sizeof(errbuf))); goto done; } @@ -159,13 +159,13 @@ done: if (fp) { int ret_code = pclose(fp); if (ret_code == -1) { - warn("Failed to run command: \"%s\"; Error: %s", + lmi_warn("Failed to run command: \"%s\"; Error: %s", command, strerror_r(errno, errbuf, sizeof(errbuf))); if (ret == 0) { ret = -1; } } else if (ret_code != 0) { - warn("Command \"%s\" exited unexpectedly with return code: %d", + lmi_warn("Command \"%s\" exited unexpectedly with return code: %d", command, ret_code); ret = ret_code; } @@ -185,15 +185,15 @@ short read_file(const char *filename, char ***buffer, unsigned *buffer_size) /* if filename is empty */ if (!filename || strlen(filename) < 1) { - warn("Given file name is empty."); + lmi_warn("Given file name is empty."); goto done; } /* open file */ - debug("Reading \"%s\" file.", filename); + lmi_debug("Reading \"%s\" file.", filename); fp = fopen(filename, "r"); if (!fp) { - warn("Failed to open \"%s\" file.", filename); + lmi_warn("Failed to open \"%s\" file.", filename); goto done; } @@ -272,7 +272,7 @@ char *trim(const char *str, const char *delims) /* copy string */ out = strndup(str, l); if (!out) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); } return out; @@ -305,7 +305,7 @@ short explode(const char *str, const char *delims, char ***buffer, unsigned *buf tmp_buffer_size = 128; tmp_buffer = (char **)calloc(tmp_buffer_size, sizeof(char *)); if (!tmp_buffer) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); tmp_buffer_size = 0; goto done; } @@ -327,7 +327,7 @@ short explode(const char *str, const char *delims, char ***buffer, unsigned *buf char **new_temp = (char **)realloc(tmp_buffer, tmp_buffer_size * sizeof(char *)); if (!new_temp) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); tmp_buffer_size /= 2; goto done; } @@ -336,7 +336,7 @@ short explode(const char *str, const char *delims, char ***buffer, unsigned *buf /* copy the substring */ tmp_buffer[item] = strndup(ts, l); if (!tmp_buffer[item]) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); goto done; } item++; @@ -348,7 +348,7 @@ short explode(const char *str, const char *delims, char ***buffer, unsigned *buf char **new_temp = (char **)realloc(tmp_buffer, item * sizeof(char *)); if (!new_temp) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); goto done; } tmp_buffer = new_temp; @@ -393,7 +393,7 @@ char *append_str(char *str, ...) /* reallocate string */ char *temp = (char *)realloc(str, newlen); if (!temp) { - warn("Failed to allocate memory."); + lmi_warn("Failed to allocate memory."); return NULL; } str = temp; diff --git a/src/hardware/utils.h b/src/hardware/utils.h index 17f6d4d..91dfdf5 100644 --- a/src/hardware/utils.h +++ b/src/hardware/utils.h @@ -26,13 +26,10 @@ #include <string.h> #include <errno.h> #include <stdarg.h> -#include "globals.h" +#include "openlmi.h" #define LONG_INT_LEN 21 /* 64 bit unsigned int can have 20 decimals + \0 */ -#define WHITESPACES " \f\n\r\t\v" - - /* * Read given file pointer and save it's output in buffer. Number of lines read * is stored in buffer_size. Function skips lines starting with '#'. |