summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Synacek <jsynacek@redhat.com>2014-04-29 08:33:13 +0200
committerJan Synacek <jsynacek@redhat.com>2014-04-30 15:54:14 +0200
commit55f63d29f5d2b4e82979d71386df58394e87ef5a (patch)
tree34227f5696df9b3a85c5999d2fd48f50be82681f
parentdab89c6afb2a2b339ebadea3d47e841cd749b5ef (diff)
downloadopenlmi-providers-55f63d29f5d2b4e82979d71386df58394e87ef5a.tar.gz
openlmi-providers-55f63d29f5d2b4e82979d71386df58394e87ef5a.tar.xz
openlmi-providers-55f63d29f5d2b4e82979d71386df58394e87ef5a.zip
libopenlmi: reorganize and gather
Make naming consistent. Gather common functionality into one library and try to use it across all providers. Introduce libtool-style versioning for libraries.
-rw-r--r--openlmi-providers.spec9
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/account/CMakeLists.txt2
-rw-r--r--src/account/LMI_AccountCapabilitiesProvider.c3
-rw-r--r--src/account/LMI_AccountManagementCapabilitiesProvider.c3
-rw-r--r--src/account/LMI_AccountManagementServiceCapabilitiesProvider.c3
-rw-r--r--src/account/LMI_AccountManagementServiceProvider.c13
-rw-r--r--src/account/LMI_AccountOnSystemProvider.c1
-rw-r--r--src/account/LMI_AccountProvider.c27
-rw-r--r--src/account/LMI_AccountSettingDataProvider.c1
-rw-r--r--src/account/LMI_AssignedAccountIdentityProvider.c3
-rw-r--r--src/account/LMI_AssignedGroupIdentityProvider.c3
-rw-r--r--src/account/LMI_EnabledAccountCapabilitiesProvider.c3
-rw-r--r--src/account/LMI_GroupProvider.c7
-rw-r--r--src/account/LMI_HostedAccountManagementServiceProvider.c1
-rw-r--r--src/account/LMI_IdentityProvider.c7
-rw-r--r--src/account/LMI_MemberOfGroupProvider.c7
-rw-r--r--src/account/LMI_OwningGroupProvider.c1
-rw-r--r--src/account/LMI_ServiceAffectsIdentityProvider.c5
-rw-r--r--src/account/indication_common.c7
-rw-r--r--src/account/indication_common.h1
-rw-r--r--src/account/macros.h8
-rw-r--r--src/common/CMakeLists.txt20
-rw-r--r--src/fan/CMakeLists.txt2
-rw-r--r--src/fan/LMI_FanAssociatedSensorProvider.c1
-rw-r--r--src/fan/LMI_FanProvider.c10
-rw-r--r--src/fan/LMI_FanSensorProvider.c9
-rw-r--r--src/fan/fan.c20
-rw-r--r--src/fan/fan.h1
-rw-r--r--src/globals.h37
-rw-r--r--src/hardware/CMakeLists.txt2
-rw-r--r--src/hardware/LMI_AssociatedProcessorCacheMemoryProvider.c9
-rw-r--r--src/hardware/LMI_BaseboardContainerProvider.c5
-rw-r--r--src/hardware/LMI_BaseboardProvider.c7
-rw-r--r--src/hardware/LMI_BatteryPhysicalPackageProvider.c5
-rw-r--r--src/hardware/LMI_BatteryProvider.c5
-rw-r--r--src/hardware/LMI_BatterySystemDeviceProvider.c3
-rw-r--r--src/hardware/LMI_ChassisComputerSystemPackageProvider.c3
-rw-r--r--src/hardware/LMI_ChassisProvider.c5
-rw-r--r--src/hardware/LMI_DiskDriveATAPortProvider.c5
-rw-r--r--src/hardware/LMI_DiskDriveATAProtocolEndpointProvider.c5
-rw-r--r--src/hardware/LMI_DiskDriveDeviceSAPImplementationProvider.c5
-rw-r--r--src/hardware/LMI_DiskDriveElementSoftwareIdentityProvider.c5
-rw-r--r--src/hardware/LMI_DiskDriveProvider.c5
-rw-r--r--src/hardware/LMI_DiskDriveRealizesProvider.c5
-rw-r--r--src/hardware/LMI_DiskDriveSAPAvailableForElementProvider.c5
-rw-r--r--src/hardware/LMI_DiskDriveSoftwareIdentityProvider.c3
-rw-r--r--src/hardware/LMI_DiskDriveSystemDeviceProvider.c3
-rw-r--r--src/hardware/LMI_DiskPhysicalPackageContainerProvider.c5
-rw-r--r--src/hardware/LMI_DiskPhysicalPackageProvider.c5
-rw-r--r--src/hardware/LMI_Hardware.h2
-rw-r--r--src/hardware/LMI_MemoryPhysicalPackageInConnectorProvider.c5
-rw-r--r--src/hardware/LMI_MemoryPhysicalPackageProvider.c5
-rw-r--r--src/hardware/LMI_MemoryProvider.c5
-rw-r--r--src/hardware/LMI_MemorySlotContainerProvider.c5
-rw-r--r--src/hardware/LMI_MemorySlotProvider.c5
-rw-r--r--src/hardware/LMI_MemorySystemDeviceProvider.c3
-rw-r--r--src/hardware/LMI_PCIBridgeProvider.c7
-rw-r--r--src/hardware/LMI_PCIBridgeSystemDeviceProvider.c5
-rw-r--r--src/hardware/LMI_PCIDeviceProvider.c7
-rw-r--r--src/hardware/LMI_PCIDeviceSystemDeviceProvider.c5
-rw-r--r--src/hardware/LMI_PhysicalBatteryContainerProvider.c5
-rw-r--r--src/hardware/LMI_PhysicalBatteryRealizesProvider.c5
-rw-r--r--src/hardware/LMI_PhysicalMemoryContainerProvider.c5
-rw-r--r--src/hardware/LMI_PhysicalMemoryProvider.c6
-rw-r--r--src/hardware/LMI_PhysicalMemoryRealizesProvider.c5
-rw-r--r--src/hardware/LMI_PointingDeviceProvider.c5
-rw-r--r--src/hardware/LMI_PortPhysicalConnectorContainerProvider.c5
-rw-r--r--src/hardware/LMI_PortPhysicalConnectorProvider.c5
-rw-r--r--src/hardware/LMI_ProcessorCacheMemoryProvider.c7
-rw-r--r--src/hardware/LMI_ProcessorCapabilitiesProvider.c5
-rw-r--r--src/hardware/LMI_ProcessorChipContainerProvider.c5
-rw-r--r--src/hardware/LMI_ProcessorChipProvider.c5
-rw-r--r--src/hardware/LMI_ProcessorChipRealizesProvider.c5
-rw-r--r--src/hardware/LMI_ProcessorElementCapabilitiesProvider.c7
-rw-r--r--src/hardware/LMI_ProcessorProvider.c7
-rw-r--r--src/hardware/LMI_ProcessorSystemDeviceProvider.c3
-rw-r--r--src/hardware/LMI_SystemSlotContainerProvider.c5
-rw-r--r--src/hardware/LMI_SystemSlotProvider.c5
-rw-r--r--src/hardware/dmidecode.c68
-rw-r--r--src/hardware/lsblk.c18
-rw-r--r--src/hardware/lscpu.c2
-rw-r--r--src/hardware/procfs.c2
-rw-r--r--src/hardware/smartctl.c20
-rw-r--r--src/hardware/sysfs.c32
-rw-r--r--src/hardware/utils.c42
-rw-r--r--src/hardware/utils.h5
-rw-r--r--src/journald/CMakeLists.txt2
-rw-r--r--src/journald/LMI_JournalLogRecordInstanceCreationIndicationProvider.c1
-rw-r--r--src/journald/LMI_JournalLogRecordProvider.c12
-rw-r--r--src/journald/LMI_JournalMessageLogProvider.c3
-rw-r--r--src/journald/LMI_JournalRecordInLogProvider.c3
-rw-r--r--src/journald/instutil.c71
-rw-r--r--src/libs/libopenlmi/CMakeLists.txt24
-rw-r--r--src/libs/libopenlmi/openlmi.c (renamed from src/common/openlmi.c)80
-rw-r--r--src/libs/libopenlmi/openlmi.conf (renamed from src/common/openlmi.conf)0
-rw-r--r--src/libs/libopenlmi/openlmi.h (renamed from src/common/openlmi.h)78
-rw-r--r--src/libs/libopenlmi/openlmi.pc.in (renamed from src/common/openlmi.pc.in)2
-rw-r--r--src/logicalfile/CMakeLists.txt2
-rw-r--r--src/logicalfile/LMI_DataFileProvider.c4
-rw-r--r--src/logicalfile/LMI_DirectoryContainsFileProvider.c60
-rw-r--r--src/logicalfile/LMI_FIFOPipeFileProvider.c4
-rw-r--r--src/logicalfile/LMI_FileIdentityProvider.c48
-rw-r--r--src/logicalfile/LMI_RootDirectoryProvider.c40
-rw-r--r--src/logicalfile/LMI_SymbolicLinkProvider.c12
-rw-r--r--src/logicalfile/LMI_UnixDeviceFileProvider.c4
-rw-r--r--src/logicalfile/LMI_UnixDirectoryProvider.c12
-rw-r--r--src/logicalfile/LMI_UnixFileProvider.c2
-rw-r--r--src/logicalfile/LMI_UnixSocketProvider.c4
-rw-r--r--src/logicalfile/file.c89
-rw-r--r--src/logicalfile/file.h50
-rw-r--r--src/power/CMakeLists.txt2
-rw-r--r--src/power/LMI_AssociatedPowerManagementServiceProvider.c2
-rw-r--r--src/power/LMI_ElementCapabilitiesProvider.c3
-rw-r--r--src/power/LMI_HostedPowerManagementServiceProvider.c2
-rw-r--r--src/power/LMI_PowerConcreteJobProvider.c3
-rw-r--r--src/power/LMI_PowerManagementCapabilitiesProvider.c2
-rw-r--r--src/power/LMI_PowerManagementServiceProvider.c2
-rw-r--r--src/power/power.c24
-rw-r--r--src/power/power.h3
-rw-r--r--src/realmd/CMakeLists.txt2
-rw-r--r--src/realmd/LMI_HostedRealmdServiceProvider.c1
-rw-r--r--src/realmd/LMI_RealmdServiceProvider.c1
-rw-r--r--src/realmd/rdcp_error.c8
-rw-r--r--src/realmd/rdcp_error.h2
-rw-r--r--src/realmd/rdcp_util.c2
-rw-r--r--src/realmd/rdcp_util.h1
-rw-r--r--src/service-dbus/CMakeLists.txt2
-rw-r--r--src/service-dbus/LMI_ServiceProvider.c9
-rw-r--r--src/service-dbus/util/serviceutil.h2
-rw-r--r--src/service/CMakeLists.txt2
-rw-r--r--src/service/LMI_ServiceProvider.c1
-rw-r--r--src/service/util/serviceutil.c18
-rw-r--r--src/service/util/serviceutil.h2
-rw-r--r--src/software-dbus/CMakeLists.txt2
135 files changed, 622 insertions, 735 deletions
diff --git a/openlmi-providers.spec b/openlmi-providers.spec
index ed0c91f..9a21e6e 100644
--- a/openlmi-providers.spec
+++ b/openlmi-providers.spec
@@ -4,7 +4,7 @@
Name: openlmi-providers
Version: 0.4.2
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: Set of basic CIM providers
%if 0%{?suse_version}
@@ -569,7 +569,7 @@ cp -pr tools/openlmitheme/* $RPM_BUILD_ROOT/%{python_sitelib}/sphinx/themes/open
%config(noreplace) %{_sysconfdir}/openlmi/openlmi.conf
%{_datadir}/%{name}/05_LMI_Qualifiers.mof
%{_datadir}/%{name}/30_LMI_Jobs.mof
-%{_libdir}/libopenlmicommon.so.*
+%{_libdir}/libopenlmi.so.*
%attr(755, root, root) %{_bindir}/openlmi-mof-register
%ghost %logfile
%dir %{_sharedstatedir}/openlmi-registration
@@ -581,7 +581,7 @@ cp -pr tools/openlmitheme/* $RPM_BUILD_ROOT/%{python_sitelib}/sphinx/themes/open
%doc README COPYING
%{_bindir}/openlmi-doc-class2rst
%{_bindir}/openlmi-doc-class2uml
-%{_libdir}/libopenlmicommon.so
+%{_libdir}/libopenlmi.so
%{_libdir}/pkgconfig/openlmi.pc
%dir %{_includedir}/openlmi
%{_includedir}/openlmi/openlmi.h
@@ -1068,6 +1068,9 @@ if [ "$1" -eq 0 ]; then
fi >> %logfile 2>&1
%changelog
+* Wed Apr 30 2014 Jan Synáček <jsynacek@redhat.com> - 0.4.2-5
+- Change openlmicommon.so* to openlmi.so*
+
* Mon Apr 14 2014 Tomas Bzatek <tbzatek@redhat.com> 0.4.2-4
- Disable the openlmi-devassistant subpackage on rhel
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 888b59a..79c316c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,10 +1,10 @@
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
- common
+ libs/libopenlmi
${CMPI_INCLUDE_DIR}
${GLIB_INCLUDE_DIRS})
-add_subdirectory(common)
+add_subdirectory(libs/libopenlmi)
if (WITH-FAN)
add_subdirectory(fan)
diff --git a/src/account/CMakeLists.txt b/src/account/CMakeLists.txt
index 83ca474..09a4322 100644
--- a/src/account/CMakeLists.txt
+++ b/src/account/CMakeLists.txt
@@ -46,7 +46,7 @@ pkg_check_modules(LIBUSER REQUIRED libuser>=0.60)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR} ${GLIB_INCLUDE_DIRS} ${LIBUSER_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/src/indmanager)
-target_link_libraries(${LIBRARY_NAME} openlmicommon ${KONKRETCMPI_LIBRARIES} ${GLIB_LIBRARIES} ${LIBUSER_LIBRARIES} openlmiindmanager)
+target_link_libraries(${LIBRARY_NAME} openlmi ${KONKRETCMPI_LIBRARIES} ${GLIB_LIBRARIES} ${LIBUSER_LIBRARIES} openlmiindmanager)
# Create registration file
cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers)
diff --git a/src/account/LMI_AccountCapabilitiesProvider.c b/src/account/LMI_AccountCapabilitiesProvider.c
index d304257..0aea405 100644
--- a/src/account/LMI_AccountCapabilitiesProvider.c
+++ b/src/account/LMI_AccountCapabilitiesProvider.c
@@ -24,7 +24,6 @@
#include "LMI_EnabledAccountCapabilities.h"
#include "macros.h"
-#include "globals.h"
#include "aux_lu.h"
#include "account_globals.h"
@@ -80,7 +79,7 @@ static CMPIStatus LMI_AccountCapabilitiesEnumInstances(
LMI_EnabledAccountCapabilitiesRef_Init(&leacref, _cb, nameSpace);
LMI_EnabledAccountCapabilitiesRef_Set_InstanceID(&leacref,
- ORGID":"LEACNAME);
+ LMI_ORGID":"LEACNAME);
luc = lu_start(NULL, lu_user, NULL, NULL, lu_prompt_console_quiet, NULL, &error);
if (!luc)
diff --git a/src/account/LMI_AccountManagementCapabilitiesProvider.c b/src/account/LMI_AccountManagementCapabilitiesProvider.c
index 3909603..42b74ac 100644
--- a/src/account/LMI_AccountManagementCapabilitiesProvider.c
+++ b/src/account/LMI_AccountManagementCapabilitiesProvider.c
@@ -24,7 +24,6 @@
#include <stdbool.h>
#include "macros.h"
-#include "globals.h"
#include "account_globals.h"
#define NAME LAMCNAME
@@ -68,7 +67,7 @@ static CMPIStatus LMI_AccountManagementCapabilitiesEnumInstances(
LMI_AccountManagementCapabilities_Init(&lamc, _cb, KNameSpace(cop));
LMI_AccountManagementCapabilities_Set_ElementNameEditSupported(
&lamc, false);
- LMI_AccountManagementCapabilities_Set_InstanceID(&lamc, ORGID":"LAMCNAME);
+ LMI_AccountManagementCapabilities_Set_InstanceID(&lamc, LMI_ORGID":"LAMCNAME);
LMI_AccountManagementCapabilities_Set_ElementName(&lamc, NAME);
LMI_AccountManagementCapabilities_Init_OperationsSupported(&lamc, 3);
diff --git a/src/account/LMI_AccountManagementServiceCapabilitiesProvider.c b/src/account/LMI_AccountManagementServiceCapabilitiesProvider.c
index efece85..84a0921 100644
--- a/src/account/LMI_AccountManagementServiceCapabilitiesProvider.c
+++ b/src/account/LMI_AccountManagementServiceCapabilitiesProvider.c
@@ -25,7 +25,6 @@
#include "macros.h"
#include "account_globals.h"
-#include "globals.h"
static const CMPIBroker* _cb;
@@ -76,7 +75,7 @@ static CMPIStatus LMI_AccountManagementServiceCapabilitiesEnumInstances(
LMI_AccountManagementCapabilitiesRef_Init(&lamcref, _cb, nameSpace);
LMI_AccountManagementCapabilitiesRef_Set_InstanceID(&lamcref,
- ORGID":"LAMCNAME);
+ LMI_ORGID":"LAMCNAME);
LMI_AccountManagementServiceCapabilities_Init(&lamsc, _cb, nameSpace);
LMI_AccountManagementServiceCapabilities_Set_ManagedElement(&lamsc,
diff --git a/src/account/LMI_AccountManagementServiceProvider.c b/src/account/LMI_AccountManagementServiceProvider.c
index 21473ea..e0e6f89 100644
--- a/src/account/LMI_AccountManagementServiceProvider.c
+++ b/src/account/LMI_AccountManagementServiceProvider.c
@@ -27,7 +27,6 @@
#include "LMI_Group.h"
#include "macros.h"
-#include "globals.h"
#include "aux_lu.h"
#include "account_globals.h"
@@ -57,7 +56,7 @@ static void LMI_AccountManagementServiceInitialize(const CMPIContext *ctx)
{
lmi_init(provider_name, _cb, ctx, provider_config_defaults);
if (init_lock_pools() == 0) {
- error("Unable to initialize lock pool.");
+ lmi_error("Unable to initialize lock pool.");
exit (1);
}
}
@@ -285,7 +284,7 @@ KUint32 LMI_AccountManagementService_CreateGroup(
pwdlockres = lckpwdf();
if (pwdlockres != 0)
- warn("Cannot acquire passwd file lock\n");
+ lmi_warn("Cannot acquire passwd file lock\n");
luc = lu_start(NULL, lu_user, NULL, NULL, lu_prompt_console_quiet, NULL,
&error);
@@ -341,7 +340,7 @@ KUint32 LMI_AccountManagementService_CreateGroup(
/* Output created group identity */
KRefA_Init(Identities, cb, 1);
LMI_IdentityRef_Init(&Identityref, cb, nameSpace);
- asprintf(&instanceid, ORGID":GID:%ld", aux_lu_get_long(lue, LU_GIDNUMBER));
+ asprintf(&instanceid, LMI_ORGID":GID:%ld", aux_lu_get_long(lue, LU_GIDNUMBER));
LMI_IdentityRef_Set_InstanceID(&Identityref, instanceid);
free(instanceid);
IdentityOP = LMI_IdentityRef_ToObjectPath(&Identityref, NULL);
@@ -429,7 +428,7 @@ KUint32 LMI_AccountManagementService_CreateAccount(
pwdlockres = lckpwdf();
if (pwdlockres != 0)
- warn("Cannot acquire passwd file lock\n");
+ lmi_warn("Cannot acquire passwd file lock\n");
luc = lu_start(NULL, lu_user, NULL, NULL, lu_prompt_console_quiet, NULL,
&error);
@@ -591,7 +590,7 @@ output:
/* Identity of Account */
LMI_IdentityRef_Init(&Identityref, cb, nameSpace);
- asprintf(&instanceid, ORGID":UID:%ld",
+ asprintf(&instanceid, LMI_ORGID":UID:%ld",
aux_lu_get_long(lue, LU_UIDNUMBER));
LMI_IdentityRef_Set_InstanceID(&Identityref, instanceid);
free(instanceid);
@@ -599,7 +598,7 @@ output:
KRefA_Set(Identities, 0, IdentityOP);
/* Identity of Group */
- asprintf(&instanceid, ORGID":GID:%ld",
+ asprintf(&instanceid, LMI_ORGID":GID:%ld",
aux_lu_get_long(lue, LU_GIDNUMBER));
LMI_IdentityRef_Set_InstanceID(&Identityref, instanceid);
free(instanceid);
diff --git a/src/account/LMI_AccountOnSystemProvider.c b/src/account/LMI_AccountOnSystemProvider.c
index 8bcd835..9c5960b 100644
--- a/src/account/LMI_AccountOnSystemProvider.c
+++ b/src/account/LMI_AccountOnSystemProvider.c
@@ -31,7 +31,6 @@
#include "aux_lu.h"
#include "macros.h"
#include "account_globals.h"
-#include "globals.h"
static const CMPIBroker* _cb;
diff --git a/src/account/LMI_AccountProvider.c b/src/account/LMI_AccountProvider.c
index ca9758a..fcfde9e 100644
--- a/src/account/LMI_AccountProvider.c
+++ b/src/account/LMI_AccountProvider.c
@@ -49,7 +49,6 @@
#include "aux_lu.h"
#include "macros.h"
-#include "globals.h"
#include "lock.h"
#include "account_globals.h"
@@ -72,7 +71,7 @@ static void LMI_AccountInitialize(const CMPIContext *ctx)
{
lmi_init(provider_name, _cb, ctx, provider_config_defaults);
if (init_lock_pools() == 0) {
- error("Unable to initialize lock pool.");
+ lmi_error("Unable to initialize lock pool.");
exit (1);
}
}
@@ -155,7 +154,7 @@ static CMPIStatus LMI_AccountEnumInstances(
if (last_change != SHADOW_VALUE_EMPTY)
{
LMI_Account_Set_PasswordLastChange(&la,
- CMNewDateTimeFromBinary(_cb, DAYSTOMS(last_change), false, rc));
+ CMNewDateTimeFromBinary(_cb, LMI_DAYS_TO_MS(last_change), false, rc));
}
min_lifetime = aux_lu_get_long(lue, LU_SHADOWMIN);
max_lifetime = aux_lu_get_long(lue, LU_SHADOWMAX);
@@ -163,22 +162,22 @@ static CMPIStatus LMI_AccountEnumInstances(
if (min_lifetime != SHADOW_VALUE_EMPTY)
{
LMI_Account_Set_PasswordPossibleChange(&la,
- CMNewDateTimeFromBinary(_cb, DAYSTOMS(min_lifetime), true, rc));
+ CMNewDateTimeFromBinary(_cb, LMI_DAYS_TO_MS(min_lifetime), true, rc));
}
if (max_lifetime != SHADOW_VALUE_EMPTY &&
max_lifetime != SHADOW_MAX_DISABLED)
{
LMI_Account_Set_PasswordExpiration(&la,
- CMNewDateTimeFromBinary(_cb, DAYSTOMS(max_lifetime), true, rc));
+ CMNewDateTimeFromBinary(_cb, LMI_DAYS_TO_MS(max_lifetime), true, rc));
warn = aux_lu_get_long(lue, LU_SHADOWWARNING);
LMI_Account_Set_PasswordExpirationWarning(&la,
- CMNewDateTimeFromBinary(_cb, DAYSTOMS(warn), true, rc));
+ CMNewDateTimeFromBinary(_cb, LMI_DAYS_TO_MS(warn), true, rc));
inactive = aux_lu_get_long(lue, LU_SHADOWINACTIVE);
if (inactive != SHADOW_VALUE_EMPTY)
{
LMI_Account_Set_PasswordInactivation(&la,
- CMNewDateTimeFromBinary(_cb, DAYSTOMS(inactive), true, rc));
+ CMNewDateTimeFromBinary(_cb, LMI_DAYS_TO_MS(inactive), true, rc));
}
}
else
@@ -192,7 +191,7 @@ static CMPIStatus LMI_AccountEnumInstances(
if (expire != SHADOW_VALUE_EMPTY)
{
LMI_Account_Set_AccountExpiration(&la,
- CMNewDateTimeFromBinary(_cb, DAYSTOMS(expire), false, rc));
+ CMNewDateTimeFromBinary(_cb, LMI_DAYS_TO_MS(expire), false, rc));
}
else
{
@@ -204,7 +203,7 @@ static CMPIStatus LMI_AccountEnumInstances(
if (last_login != SHADOW_VALUE_EMPTY)
{
LMI_Account_Set_LastLogin(&la,
- CMNewDateTimeFromBinary(_cb, STOMS(last_login), false, rc));
+ CMNewDateTimeFromBinary(_cb, LMI_SECS_TO_MS(last_login), false, rc));
}
password = aux_lu_get_str(lue, LU_SHADOWPASSWORD);
@@ -307,7 +306,7 @@ static CMPIStatus LMI_AccountModifyInstance(
get_giant_lock();
pwdlockres = lckpwdf();
if (pwdlockres != 0)
- warn("Cannot acquire passwd file lock\n");
+ lmi_warn("Cannot acquire passwd file lock\n");
luc = lu_start(NULL, lu_user, NULL, NULL, lu_prompt_console_quiet, NULL, &error);
if (!luc)
@@ -384,7 +383,7 @@ static CMPIStatus LMI_AccountModifyInstance(
{\
(VAR).interval = CMIsInterval(\
CMGetProperty(ci, (NAME), NULL).value.dateTime, NULL); \
- (VAR).value = MSTODAYS(CMGetBinaryFormat(\
+ (VAR).value = LMI_MS_TO_DAYS(CMGetBinaryFormat(\
CMGetProperty(ci, (NAME), NULL).value.dateTime, NULL));\
}\
@@ -552,7 +551,7 @@ static CMPIrc delete_user(
get_giant_lock();
pwdlockres = lckpwdf();
if (pwdlockres != 0)
- warn("Cannot acquire passwd file lock\n");
+ lmi_warn("Cannot acquire passwd file lock\n");
luc = lu_start(NULL, 0, NULL, NULL, lu_prompt_console_quiet, NULL, &error);
if (!luc) {
@@ -590,7 +589,7 @@ static CMPIrc delete_user(
if (!ret) {
const char *const home = lu_ent_get_first_string(lue, LU_HOMEDIRECTORY);
/* If null is returned then asprintf handle it. */
- warn("User's homedir %s could not be deleted: %s\n", home, lu_strerror(error));
+ lmi_warn("User's homedir %s could not be deleted: %s\n", home, lu_strerror(error));
/* Silently succeed, remove the user despite keeping homedir aside */
lu_error_free(&error);
}
@@ -766,7 +765,7 @@ KUint32 LMI_Account_ChangePassword(
pwdlockres = lckpwdf();
if (pwdlockres != 0)
- warn("Cannot acquire passwd file lock\n");
+ lmi_warn("Cannot acquire passwd file lock\n");
luc = lu_start(NULL, lu_user, NULL, NULL, lu_prompt_console_quiet, NULL,
&error);
diff --git a/src/account/LMI_AccountSettingDataProvider.c b/src/account/LMI_AccountSettingDataProvider.c
index e132a03..f5703f8 100644
--- a/src/account/LMI_AccountSettingDataProvider.c
+++ b/src/account/LMI_AccountSettingDataProvider.c
@@ -23,7 +23,6 @@
#include "macros.h"
#include "account_globals.h"
-#include "globals.h"
#include <libuser/config.h>
#include <libuser/user.h>
diff --git a/src/account/LMI_AssignedAccountIdentityProvider.c b/src/account/LMI_AssignedAccountIdentityProvider.c
index 1810455..80a8915 100644
--- a/src/account/LMI_AssignedAccountIdentityProvider.c
+++ b/src/account/LMI_AssignedAccountIdentityProvider.c
@@ -26,7 +26,6 @@
#include "aux_lu.h"
#include "macros.h"
#include "account_globals.h"
-#include "globals.h"
#include <libuser/entity.h>
#include <libuser/user.h>
@@ -89,7 +88,7 @@ static CMPIStatus LMI_AssignedAccountIdentityEnumInstances(
lue = g_ptr_array_index(accounts, i);
LMI_IdentityRef_Init(&liref, _cb, nameSpace);
- asprintf(&uid, ORGID":UID:%ld", aux_lu_get_long(lue, LU_UIDNUMBER));
+ asprintf(&uid, LMI_ORGID":UID:%ld", aux_lu_get_long(lue, LU_UIDNUMBER));
LMI_IdentityRef_Set_InstanceID(&liref, uid);
free(uid);
diff --git a/src/account/LMI_AssignedGroupIdentityProvider.c b/src/account/LMI_AssignedGroupIdentityProvider.c
index 2950dc0..57ab263 100644
--- a/src/account/LMI_AssignedGroupIdentityProvider.c
+++ b/src/account/LMI_AssignedGroupIdentityProvider.c
@@ -26,7 +26,6 @@
#include "aux_lu.h"
#include "macros.h"
#include "account_globals.h"
-#include "globals.h"
#include <libuser/entity.h>
#include <libuser/user.h>
@@ -92,7 +91,7 @@ static CMPIStatus LMI_AssignedGroupIdentityEnumInstances(
LMI_GroupRef_Set_Name(&lgref, aux_lu_get_str(lue, LU_GROUPNAME));
LMI_IdentityRef_Init(&liref, _cb, nameSpace);
- asprintf(&gid, ORGID":GID:%ld", aux_lu_get_long(lue, LU_GIDNUMBER));
+ asprintf(&gid, LMI_ORGID":GID:%ld", aux_lu_get_long(lue, LU_GIDNUMBER));
LMI_IdentityRef_Set_InstanceID(&liref, gid);
free(gid);
diff --git a/src/account/LMI_EnabledAccountCapabilitiesProvider.c b/src/account/LMI_EnabledAccountCapabilitiesProvider.c
index 319e926..c7b5221 100644
--- a/src/account/LMI_EnabledAccountCapabilitiesProvider.c
+++ b/src/account/LMI_EnabledAccountCapabilitiesProvider.c
@@ -23,7 +23,6 @@
#include "macros.h"
#include "account_globals.h"
-#include "globals.h"
#include <stdbool.h>
@@ -64,7 +63,7 @@ static CMPIStatus LMI_EnabledAccountCapabilitiesEnumInstances(
const char *nameSpace = KNameSpace(cop);
LMI_EnabledAccountCapabilities_Init(&leac, _cb, nameSpace);
- LMI_EnabledAccountCapabilities_Set_InstanceID(&leac, ORGID":"LEACNAME);
+ LMI_EnabledAccountCapabilities_Set_InstanceID(&leac, LMI_ORGID":"LEACNAME);
LMI_EnabledAccountCapabilities_Set_ElementName(&leac, LEACNAME);
LMI_EnabledAccountCapabilities_Init_RequestedStatesSupported(&leac, 0);
LMI_EnabledAccountCapabilities_Set_ElementNameEditSupported(&leac,
diff --git a/src/account/LMI_GroupProvider.c b/src/account/LMI_GroupProvider.c
index 20d93b5..7367358 100644
--- a/src/account/LMI_GroupProvider.c
+++ b/src/account/LMI_GroupProvider.c
@@ -31,7 +31,6 @@
#include "aux_lu.h"
#include "macros.h"
#include "account_globals.h"
-#include "globals.h"
#include "lock.h"
@@ -46,7 +45,7 @@ static void LMI_GroupInitialize(const CMPIContext *ctx)
{
lmi_init(provider_name, _cb, ctx, provider_config_defaults);
if (init_lock_pools() == 0) {
- error("Unable to initialize lock pool.");
+ lmi_error("Unable to initialize lock pool.");
exit (1);
}
@@ -103,7 +102,7 @@ static CMPIStatus LMI_GroupEnumInstances(
LMI_Group_Set_Name(&lg, aux_lu_get_str(lue, LU_GROUPNAME));
LMI_Group_Set_ElementName(&lg, aux_lu_get_str(lue, LU_GROUPNAME));
LMI_Group_Set_CommonName(&lg, aux_lu_get_str(lue, LU_GROUPNAME));
- asprintf(&instanceid, ORGID":GID:%ld",
+ asprintf(&instanceid, LMI_ORGID":GID:%ld",
aux_lu_get_long(lue, LU_GIDNUMBER));
LMI_Group_Set_InstanceID(&lg, instanceid);
free(instanceid);
@@ -175,7 +174,7 @@ static CMPIrc delete_group(
pwdlockres = lckpwdf();
if (pwdlockres != 0)
- warn("Cannot acquire passwd file lock\n");
+ lmi_warn("Cannot acquire passwd file lock\n");
luc = lu_start(NULL, 0, NULL, NULL, lu_prompt_console_quiet, NULL, &error);
if (!luc) {
diff --git a/src/account/LMI_HostedAccountManagementServiceProvider.c b/src/account/LMI_HostedAccountManagementServiceProvider.c
index 5d7b391..89fdcf3 100644
--- a/src/account/LMI_HostedAccountManagementServiceProvider.c
+++ b/src/account/LMI_HostedAccountManagementServiceProvider.c
@@ -25,7 +25,6 @@
#include "macros.h"
#include "account_globals.h"
-#include "globals.h"
static const CMPIBroker* _cb;
diff --git a/src/account/LMI_IdentityProvider.c b/src/account/LMI_IdentityProvider.c
index b86bff0..eb361ce 100644
--- a/src/account/LMI_IdentityProvider.c
+++ b/src/account/LMI_IdentityProvider.c
@@ -26,7 +26,6 @@
#include <libuser/user.h>
#include "macros.h"
-#include "globals.h"
#include "aux_lu.h"
#include "account_globals.h"
@@ -87,7 +86,7 @@ static CMPIStatus LMI_IdentityEnumInstances(
LMI_Identity_Init(&li, _cb, nameSpace);
/* Need to convert long int UID to the string */
- asprintf(&instanceid, ORGID":UID:%ld",
+ asprintf(&instanceid, LMI_ORGID":UID:%ld",
aux_lu_get_long(lue, LU_UIDNUMBER));
LMI_Identity_Set_InstanceID(&li, instanceid);
free(instanceid);
@@ -109,7 +108,7 @@ static CMPIStatus LMI_IdentityEnumInstances(
LMI_Identity_Init(&li, _cb, nameSpace);
/* Need to convert long int UID to the string */
- asprintf(&instanceid, ORGID":GID:%ld",
+ asprintf(&instanceid, LMI_ORGID":GID:%ld",
aux_lu_get_long(lue, LU_GIDNUMBER));
LMI_Identity_Set_InstanceID(&li, instanceid);
free(instanceid);
@@ -181,7 +180,7 @@ static CMPIStatus LMI_IdentityDeleteInstance(
pwdlockres = lckpwdf();
if (pwdlockres != 0)
- warn("Cannot acquire passwd file lock\n");
+ lmi_warn("Cannot acquire passwd file lock\n");
luc = lu_start(NULL, 0, NULL, NULL, lu_prompt_console_quiet, NULL, &error);
if (!luc)
diff --git a/src/account/LMI_MemberOfGroupProvider.c b/src/account/LMI_MemberOfGroupProvider.c
index 8751597..4928f4d 100644
--- a/src/account/LMI_MemberOfGroupProvider.c
+++ b/src/account/LMI_MemberOfGroupProvider.c
@@ -28,7 +28,6 @@
#include "aux_lu.h"
#include "macros.h"
#include "account_globals.h"
-#include "globals.h"
#include <libuser/entity.h>
#include <libuser/user.h>
@@ -104,7 +103,7 @@ static CMPIStatus LMI_MemberOfGroupEnumInstances(
lu_user_lookup_name(luc,
g_value_get_string(g_value_array_get_nth(accounts, j)),
luea, &error);
- asprintf(&uid, ORGID":UID:%ld",
+ asprintf(&uid, LMI_ORGID":UID:%ld",
aux_lu_get_long(luea, LU_UIDNUMBER));
LMI_IdentityRef_Init(&liref, _cb, nameSpace);
LMI_IdentityRef_Set_InstanceID(&liref, uid);
@@ -193,7 +192,7 @@ static CMPIStatus LMI_MemberOfGroupCreateInstance(
pwdlockres = lckpwdf();
if (pwdlockres != 0)
- warn("Cannot acquire passwd file lock\n");
+ lmi_warn("Cannot acquire passwd file lock\n");
luc = lu_start(NULL, 0, NULL, NULL, lu_prompt_console_quiet, NULL, &error);
if (!luc) {
@@ -291,7 +290,7 @@ static CMPIStatus LMI_MemberOfGroupDeleteInstance(
pwdlockres = lckpwdf();
if (pwdlockres != 0)
- warn("Cannot acquire passwd file lock\n");
+ lmi_warn("Cannot acquire passwd file lock\n");
luc = lu_start(NULL, 0, NULL, NULL, lu_prompt_console_quiet, NULL, &error);
if (!luc) {
diff --git a/src/account/LMI_OwningGroupProvider.c b/src/account/LMI_OwningGroupProvider.c
index 2fef2c8..0974aef 100644
--- a/src/account/LMI_OwningGroupProvider.c
+++ b/src/account/LMI_OwningGroupProvider.c
@@ -24,7 +24,6 @@
#include "LMI_Group.h"
#include "macros.h"
-#include "globals.h"
#include "aux_lu.h"
#include "account_globals.h"
diff --git a/src/account/LMI_ServiceAffectsIdentityProvider.c b/src/account/LMI_ServiceAffectsIdentityProvider.c
index 5eccab4..5d302a2 100644
--- a/src/account/LMI_ServiceAffectsIdentityProvider.c
+++ b/src/account/LMI_ServiceAffectsIdentityProvider.c
@@ -24,7 +24,6 @@
#include "LMI_Identity.h"
#include "macros.h"
-#include "globals.h"
#include "aux_lu.h"
#include "account_globals.h"
@@ -100,7 +99,7 @@ static CMPIStatus LMI_ServiceAffectsIdentityEnumInstances(
lue = g_ptr_array_index(accounts, i);
LMI_IdentityRef_Init(&liref, _cb, nameSpace);
- asprintf(&id, ORGID":UID:%ld", aux_lu_get_long(lue, LU_UIDNUMBER));
+ asprintf(&id, LMI_ORGID":UID:%ld", aux_lu_get_long(lue, LU_UIDNUMBER));
LMI_IdentityRef_Set_InstanceID(&liref, id);
free(id);
@@ -127,7 +126,7 @@ static CMPIStatus LMI_ServiceAffectsIdentityEnumInstances(
lue = g_ptr_array_index(accounts, i);
LMI_IdentityRef_Init(&liref, _cb, nameSpace);
- asprintf(&id, ORGID":GID:%ld", aux_lu_get_long(lue, LU_GIDNUMBER));
+ asprintf(&id, LMI_ORGID":GID:%ld", aux_lu_get_long(lue, LU_GIDNUMBER));
LMI_IdentityRef_Set_InstanceID(&liref, id);
free(id);
diff --git a/src/account/indication_common.c b/src/account/indication_common.c
index d9629b4..e64e02b 100644
--- a/src/account/indication_common.c
+++ b/src/account/indication_common.c
@@ -32,7 +32,6 @@
#include <errno.h>
#include "indication_common.h"
-#include <globals.h>
#define EVENT_SIZE (sizeof(struct inotify_event))
#define BUF_LEN (10 * EVENT_SIZE + NAME_MAX + 1)
@@ -104,7 +103,7 @@ void watcher_destroy(AccountIndication *ind)
bool watcher(AccountIndication *ind, void **data)
{
struct timespec curr_pwd, curr_grp;
- char errbuf[STRERROR_BUF_LEN];
+ char errbuf[BUFLEN];
if (ind->inotify_fd < 0)
return false;
@@ -113,7 +112,7 @@ bool watcher(AccountIndication *ind, void **data)
do {
const int len = read(ind->inotify_fd, buffer, BUF_LEN);
if (len < 0) {
- warn("account watcher: error reading from inotify fd: %s", strerror_r(errno, errbuf, sizeof(errbuf)));
+ lmi_warn("account watcher: error reading from inotify fd: %s", strerror_r(errno, errbuf, sizeof(errbuf)));
watcher_destroy(ind);
watcher_init(ind);
return false;
@@ -129,7 +128,7 @@ bool watcher(AccountIndication *ind, void **data)
while (i + (ssize_t) EVENT_SIZE < len) {
struct inotify_event *event = (struct inotify_event *) &buffer[i];
if (i + (ssize_t) EVENT_SIZE + event->len > len) {
- error("Unable to create watcher, inotify initialization failed");
+ lmi_error("Unable to create watcher, inotify initialization failed");
watcher_destroy(ind);
watcher_init(ind);
return false;
diff --git a/src/account/indication_common.h b/src/account/indication_common.h
index 14e41ff..dd3ee01 100644
--- a/src/account/indication_common.h
+++ b/src/account/indication_common.h
@@ -21,6 +21,7 @@
#include "LMI_Account.h"
#include "LMI_Group.h"
#include "LMI_Identity.h"
+#include "openlmi.h"
typedef struct {
int wd;
diff --git a/src/account/macros.h b/src/account/macros.h
index bd11e0b..dfa64e5 100644
--- a/src/account/macros.h
+++ b/src/account/macros.h
@@ -26,14 +26,6 @@
#define LAMCNAME "OpenLMI Linux Users Account Management Capabilities"
#define LEACNAME "OpenLMI Linux Account Capabilities"
-/* Organization ID. Used for InstaceIDs */
-#define ORGID "LMI"
-
-/* convert days to microseconds */
-#define DAYSTOMS(days) ((days) * 86400000000)
-#define MSTODAYS(ms) ((ms) / 86400000000)
-#define STOMS(s) ((s) * 1000000)
-
/* This will identify empty values in shadow file */
#define SHADOW_VALUE_EMPTY -1
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
deleted file mode 100644
index 129719f..0000000
--- a/src/common/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-set(OPENLMICOMMON_VERSION_MAJOR 0)
-set(OPENLMICOMMON_VERSION_MINOR 0)
-set(OPENLMICOMMON_VERSION_PATCH 1)
-set(OPENLMICOMMON_VERSION "${OPENLMICOMMON_VERSION_MAJOR}.${OPENLMICOMMON_VERSION_MINOR}.${OPENLMICOMMON_VERSION_PATCH}")
-
-configure_file(openlmi.pc.in ${CMAKE_CURRENT_BINARY_DIR}/openlmi.pc @ONLY)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/openlmi.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig)
-install(FILES openlmi.conf DESTINATION ${SYSCONF_INSTALL_DIR}/openlmi)
-
-add_library(openlmicommon SHARED
- openlmi.c
-)
-
-target_link_libraries(openlmicommon ${GLIB_LIBRARIES} dl)
-
-set_target_properties(openlmicommon PROPERTIES VERSION ${OPENLMICOMMON_VERSION})
-set_target_properties(openlmicommon PROPERTIES SOVERSION ${OPENLMICOMMON_VERSION_MAJOR})
-
-install(TARGETS openlmicommon DESTINATION lib${LIB_SUFFIX})
-install(FILES openlmi.h DESTINATION include/openlmi)
diff --git a/src/fan/CMakeLists.txt b/src/fan/CMakeLists.txt
index 446e38b..6ccccbb 100644
--- a/src/fan/CMakeLists.txt
+++ b/src/fan/CMakeLists.txt
@@ -25,7 +25,7 @@ add_library(${LIBRARY_NAME} SHARED
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR})
-target_link_libraries(${LIBRARY_NAME} openlmicommon ${KONKRETCMPI_LIBRARIES} sensors)
+target_link_libraries(${LIBRARY_NAME} openlmi ${KONKRETCMPI_LIBRARIES} sensors)
# Create registration file
cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers)
diff --git a/src/fan/LMI_FanAssociatedSensorProvider.c b/src/fan/LMI_FanAssociatedSensorProvider.c
index 249fdad..5879118 100644
--- a/src/fan/LMI_FanAssociatedSensorProvider.c
+++ b/src/fan/LMI_FanAssociatedSensorProvider.c
@@ -21,7 +21,6 @@
#include <konkret/konkret.h>
#include "LMI_FanAssociatedSensor.h"
#include "fan.h"
-#include "globals.h"
static const CMPIBroker* _cb;
diff --git a/src/fan/LMI_FanProvider.c b/src/fan/LMI_FanProvider.c
index 9e780ad..3d7145b 100644
--- a/src/fan/LMI_FanProvider.c
+++ b/src/fan/LMI_FanProvider.c
@@ -22,8 +22,8 @@
#include <konkret/konkret.h>
#include <stdint.h>
#include "LMI_Fan.h"
-#include "globals.h"
#include "fan.h"
+
static const CMPIBroker* _cb = NULL;
static void LMI_FanInitialize(const CMPIContext *ctx)
@@ -60,7 +60,7 @@ static CMPIStatus LMI_FanEnumInstances(
const char *ns = KNameSpace(cop);
CMPIStatus status;
- char buf[200];
+ char buf[BUFLEN];
struct fanlist *lptr = NULL;
struct fanlist *fans = NULL;
struct cim_fan *sptr;
@@ -82,7 +82,7 @@ static CMPIStatus LMI_FanEnumInstances(
LMI_Fan_Set_Caption(&w, "Computer's fan");
LMI_Fan_Set_Description(&w,"Computer's fan.");
- snprintf(buf, 200, "Fan \"%s\" on chip \"%s\"", sptr->name, sptr->chip_name);
+ snprintf(buf, BUFLEN, "Fan \"%s\" on chip \"%s\"", sptr->name, sptr->chip_name);
LMI_Fan_Set_ElementName(&w, buf);
// ManagedSystemElement
@@ -102,7 +102,7 @@ static CMPIStatus LMI_FanEnumInstances(
" Thus the measurement for this channel should not be trusted."
: "Fan seems to be functioning correctly.");
if (sptr->alarm || sptr->alarm_min || sptr->alarm_max) {
- snprintf(buf, 200, "These alarm flags are set by the fan's chip:"
+ snprintf(buf, BUFLEN, "These alarm flags are set by the fan's chip:"
" alarm=%s, min_alarm=%s, max_alarm=%s",
sptr->alarm ? "1":"0",
sptr->alarm_min ? "1":"0",
@@ -136,7 +136,7 @@ static CMPIStatus LMI_FanEnumInstances(
uint32_t i = 1;
int index = 0;
- debug("accessible_features: %d", sptr->accessible_features);
+ lmi_debug("accessible_features: %d", sptr->accessible_features);
LMI_Fan_Init_AccessibleFeatures(&w, 8);
while (i <= CIM_FAN_AF_FEATURE_MAX) {
if (i & sptr->accessible_features) {
diff --git a/src/fan/LMI_FanSensorProvider.c b/src/fan/LMI_FanSensorProvider.c
index 70e1be2..0df31ff 100644
--- a/src/fan/LMI_FanSensorProvider.c
+++ b/src/fan/LMI_FanSensorProvider.c
@@ -22,7 +22,6 @@
#include <konkret/konkret.h>
#include "LMI_FanSensor.h"
#include "fan.h"
-#include "globals.h"
static const CMPIBroker* _cb = NULL;
@@ -58,7 +57,7 @@ static CMPIStatus LMI_FanSensorEnumInstances(
const char** properties)
{
CMPIStatus status;
- char buf[200];
+ char buf[BUFLEN];
struct cim_fan *sptr = NULL;
struct fanlist *lptr = NULL, *fans = NULL;
if (enum_all_fans(&fans) != 0 ) {
@@ -78,7 +77,7 @@ static CMPIStatus LMI_FanSensorEnumInstances(
LMI_FanSensor_Set_Caption(&w, "Computer's fan");
LMI_FanSensor_Set_Description(&w,"Computer's fan.");
- snprintf(buf, 200, "Fan \"%s\" on chip \"%s\"", sptr->name, sptr->chip_name);
+ snprintf(buf, BUFLEN, "Fan \"%s\" on chip \"%s\"", sptr->name, sptr->chip_name);
LMI_FanSensor_Set_ElementName(&w, buf);
// ManagedSystemElement
@@ -99,7 +98,7 @@ static CMPIStatus LMI_FanSensorEnumInstances(
" Thus the measurement for this channel should not be trusted."
: "Fan seems to be functioning correctly.");
if (sptr->alarm || sptr->alarm_min || sptr->alarm_max) {
- snprintf(buf, 200, "These alarm flags are set by the fan's chip:"
+ snprintf(buf, BUFLEN, "These alarm flags are set by the fan's chip:"
" alarm=%s, min_alarm=%s, max_alarm=%s",
sptr->alarm ? "1":"0",
sptr->alarm_min ? "1":"0",
@@ -132,7 +131,7 @@ static CMPIStatus LMI_FanSensorEnumInstances(
LMI_FanSensor_Set_Caption(&w, "Fan's tachometer");
LMI_FanSensor_Set_Description(&w,"Associated sensor of fan. Giving information about its speed.");
- snprintf(buf, 200, "Tachometer of fan \"%s\" on chip \"%s\"", sptr->name, sptr->chip_name);
+ snprintf(buf, BUFLEN, "Tachometer of fan \"%s\" on chip \"%s\"", sptr->name, sptr->chip_name);
LMI_FanSensor_Set_ElementName(&w, buf);
// Sensor
diff --git a/src/fan/fan.c b/src/fan/fan.c
index adc49cc..a9cf754 100644
--- a/src/fan/fan.c
+++ b/src/fan/fan.c
@@ -23,18 +23,14 @@
#include <string.h>
#include <libgen.h>
#include <errno.h>
-#include <stdbool.h>
#include <sensors/sensors.h>
#include <sensors/error.h>
#include "fan.h"
-#include "globals.h"
const char *provider_name = "fan";
const ConfigEntry *provider_config_defaults = NULL;
-#define MAX_CHIP_NAME_LENGTH 200
-
//* constants *****************************************************************
static bool MODULE_INITIALIZED = false;
@@ -98,8 +94,8 @@ static cim_fan_error_t libsensors2cim_fan_error(int err) {
static const char * sprintf_chip_name(sensors_chip_name const *name) {
/** @return NULL on error, cstring otherwise, it needs to be freed */
int charcnt;
- char buf[MAX_CHIP_NAME_LENGTH];
- if ((charcnt = sensors_snprintf_chip_name(buf, MAX_CHIP_NAME_LENGTH, name)) < 0)
+ char buf[BUFLEN];
+ if ((charcnt = sensors_snprintf_chip_name(buf, BUFLEN, name)) < 0)
return NULL;
return strndup(buf, charcnt);
}
@@ -110,17 +106,17 @@ static cim_fan_error_t reload_config_file(char const * fp) {
* @return 0 on success */
FILE *config_file = NULL;
int err;
- char errbuf[STRERROR_BUF_LEN];
+ char errbuf[BUFLEN];
if (fp) {
if (!(config_file = fopen(fp, "r"))) {
- error("Cound not open config file \"%s\": %s\n",
- fp, strerror_r(errno, errbuf, sizeof(errbuf)));
+ lmi_error("Cound not open config file \"%s\": %s\n",
+ fp, strerror_r(errno, errbuf, sizeof(errbuf)));
}
}
err = sensors_init(config_file);
if (err) {
- error("sensors_init: %s\n", sensors_strerror(err));
+ lmi_error("sensors_init: %s\n", sensors_strerror(err));
if (config_file) fclose(config_file);
}else {
if (config_file) fclose(config_file);
@@ -251,12 +247,12 @@ static struct cim_fan * _load_fan_data( sensors_chip_name const *chip
return NULL;
}
if (!(f->chip_name = sprintf_chip_name(chip))) {
- error("could not get chip name\n");
+ lmi_error("could not get chip name\n");
goto lab_err_free_fan;
}
f->sys_path = chip->path;
if (!(f->name = sensors_get_label(chip, feature))) {
- error("could not get fan name for chip: %s\n",
+ lmi_error("could not get fan name for chip: %s\n",
f->chip_name);
goto lab_err_chip_name;
}
diff --git a/src/fan/fan.h b/src/fan/fan.h
index 6115ab2..4883e64 100644
--- a/src/fan/fan.h
+++ b/src/fan/fan.h
@@ -21,7 +21,6 @@
#ifndef LINUX_FAN_H_
#define LINUX_FAN_H_
-#include <stdbool.h>
#include "openlmi.h"
/** accessible features of fan
diff --git a/src/globals.h b/src/globals.h
deleted file mode 100644
index 128ba0a..0000000
--- a/src/globals.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012-2014 Red Hat, Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Authors: Radek Novacek <rnovacek@redhat.com>
- */
-
-#ifndef GLOBALS_H
-#define GLOBALS_H
-
-#include "openlmi.h"
-
-// Shortcuts for functions and macros from openlmicommon library
-#define get_system_creation_class_name lmi_get_system_creation_class_name
-#define get_system_name lmi_get_system_name
-#define debug lmi_debug
-#define warn lmi_warn
-#define error lmi_error
-
-#define ORGID "LMI"
-
-#define STRERROR_BUF_LEN 1024
-
-#endif
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 '#'.
diff --git a/src/journald/CMakeLists.txt b/src/journald/CMakeLists.txt
index 1e6f193..029f3f0 100644
--- a/src/journald/CMakeLists.txt
+++ b/src/journald/CMakeLists.txt
@@ -34,7 +34,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(${LIBRARY_NAME}
- openlmicommon
+ openlmi
openlmiindmanager
${KONKRETCMPI_LIBRARIES}
${GLIB2_LIBRARIES}
diff --git a/src/journald/LMI_JournalLogRecordInstanceCreationIndicationProvider.c b/src/journald/LMI_JournalLogRecordInstanceCreationIndicationProvider.c
index 7eb57f7..f6f3360 100644
--- a/src/journald/LMI_JournalLogRecordInstanceCreationIndicationProvider.c
+++ b/src/journald/LMI_JournalLogRecordInstanceCreationIndicationProvider.c
@@ -24,7 +24,6 @@
#include "ind_manager.h"
#include "instutil.h"
#include "journal.h"
-#include <globals.h>
static const CMPIBroker* _cb = NULL;
diff --git a/src/journald/LMI_JournalLogRecordProvider.c b/src/journald/LMI_JournalLogRecordProvider.c
index cf49535..d16880f 100644
--- a/src/journald/LMI_JournalLogRecordProvider.c
+++ b/src/journald/LMI_JournalLogRecordProvider.c
@@ -27,7 +27,7 @@
#include <glib.h>
#include <systemd/sd-journal.h>
-#include "globals.h"
+
#include "journal.h"
#include "instutil.h"
@@ -42,13 +42,13 @@ static void LMI_JournalLogRecordInitialize(const CMPIContext *ctx)
{
sd_journal *journal;
int r;
- char errbuf[STRERROR_BUF_LEN];
+ char errbuf[BUFLEN];
lmi_init(JOURNAL_CIM_LOG_NAME, _cb, ctx, provider_config_defaults);
r = sd_journal_open(&journal, 0);
if (r < 0) {
- error("Error opening journal: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_error("Error opening journal: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
return;
}
journal_iter = journal;
@@ -77,7 +77,7 @@ static CMPIStatus LMI_JournalLogRecordEnumInstanceNames(
int r;
LMI_JournalLogRecordRef log_record_ref;
unsigned long count = 0;
- char errbuf[STRERROR_BUF_LEN];
+ char errbuf[BUFLEN];
/* Open our own journal instance to prevent losing cursor position in the global instance */
r = sd_journal_open(&journal, 0);
@@ -145,7 +145,7 @@ static CMPIStatus LMI_JournalLogRecordGetInstance(
{
LMI_JournalLogRecord log_record;
int r;
- char errbuf[STRERROR_BUF_LEN];
+ char errbuf[BUFLEN];
LMI_JournalLogRecord_InitFromObjectPath(&log_record, _cb, cop);
@@ -202,7 +202,7 @@ static CMPIStatus LMI_JournalLogRecordCreateInstance(
int r;
CMPIrc rc;
bool found;
- char errbuf[STRERROR_BUF_LEN];
+ char errbuf[BUFLEN];
cr_cl_n = get_string_property("CreationClassName", ci);
log_cr_cl_n = get_string_property("LogCreationClassName", ci);
diff --git a/src/journald/LMI_JournalMessageLogProvider.c b/src/journald/LMI_JournalMessageLogProvider.c
index 297a775..4ce60e7 100644
--- a/src/journald/LMI_JournalMessageLogProvider.c
+++ b/src/journald/LMI_JournalMessageLogProvider.c
@@ -20,11 +20,10 @@
#include <konkret/konkret.h>
#include "LMI_JournalMessageLog.h"
-
#include <glib.h>
#include <systemd/sd-journal.h>
-#include "globals.h"
+
#include "journal.h"
#include "instutil.h"
diff --git a/src/journald/LMI_JournalRecordInLogProvider.c b/src/journald/LMI_JournalRecordInLogProvider.c
index 84f3960..a8b8efc 100644
--- a/src/journald/LMI_JournalRecordInLogProvider.c
+++ b/src/journald/LMI_JournalRecordInLogProvider.c
@@ -23,7 +23,6 @@
#include <systemd/sd-journal.h>
-#include "globals.h"
#include "journal.h"
#include "instutil.h"
@@ -68,7 +67,7 @@ static CMPIStatus LMI_JournalRecordInLogEnumInstances(
int r;
CMPIStatus rc;
unsigned long count = 0;
- char errbuf[STRERROR_BUF_LEN];
+ char errbuf[BUFLEN];
LMI_JournalMessageLogRef_Init(&message_log_ref, _cb, ns);
LMI_JournalMessageLogRef_Set_CreationClassName(&message_log_ref, LMI_JournalMessageLog_ClassName);
diff --git a/src/journald/instutil.c b/src/journald/instutil.c
index 413a8b1..b2ed0e7 100644
--- a/src/journald/instutil.c
+++ b/src/journald/instutil.c
@@ -21,13 +21,8 @@
#include <errno.h>
#include <syslog.h>
#include <unistd.h>
-#include <glib.h>
-
-#include <konkret/konkret.h>
-#include <cmpi/cmpimacs.h>
#include "instutil.h"
-#include "globals.h"
#include "journal.h"
#include "LMI_JournalLogRecord.h"
@@ -276,7 +271,7 @@ int match_journal_record(sd_journal *j, const char *message, const char *code_fu
void ind_init()
{
- char errbuf[STRERROR_BUF_LEN];
+ char errbuf[BUFLEN];
if (ind_journal == NULL) {
sd_journal *journal;
@@ -284,13 +279,13 @@ void ind_init()
r = sd_journal_open(&journal, 0);
if (r < 0) {
- error("ind_init(): Error opening journal: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_error("ind_init(): Error opening journal: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
return;
}
r = sd_journal_seek_tail(journal);
if (r < 0) {
- error("ind_init(): Error seeking to the end of the journal: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_error("ind_init(): Error seeking to the end of the journal: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
sd_journal_close(journal);
return;
}
@@ -298,13 +293,13 @@ void ind_init()
/* need to position the marker one step before EOF or otherwise the next sd_journal_next() call will overflow to the beginning */
r = sd_journal_previous(journal);
if (r < 0) {
- error("ind_init(): Error seeking to the end of the journal: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_error("ind_init(): Error seeking to the end of the journal: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
sd_journal_close(journal);
return;
}
ind_journal = journal;
} else
- warn("ind_init(): indications already initialized, possible bug in the code\n");
+ lmi_warn("ind_init(): indications already initialized, possible bug in the code\n");
}
void ind_destroy()
@@ -318,10 +313,10 @@ void ind_destroy()
bool ind_watcher(void **data)
{
int r;
- char errbuf[STRERROR_BUF_LEN];
+ char errbuf[BUFLEN];
if (ind_journal == NULL) {
- error("ind_watcher(): indications have not been initialized yet or error occurred previously\n");
+ lmi_error("ind_watcher(): indications have not been initialized yet or error occurred previously\n");
return false;
}
@@ -336,11 +331,11 @@ bool ind_watcher(void **data)
r = sd_journal_wait(ind_journal, (uint64_t) -1);
}
if (r < 0) {
- warn("ind_watcher(): Error while waiting for new record: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_warn("ind_watcher(): Error while waiting for new record: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
return false;
}
if (r == SD_JOURNAL_INVALIDATE) {
- warn("ind_watcher(): Journal not valid, reopen needed\n");
+ lmi_warn("ind_watcher(): Journal not valid, reopen needed\n");
ind_destroy();
ind_init();
return false;
@@ -356,14 +351,14 @@ bool ind_gather(const IMManager *manager, CMPIInstance **old, CMPIInstance **new
int r;
LMI_JournalLogRecord log_record;
CMPIStatus st;
- char errbuf[STRERROR_BUF_LEN];
+ char errbuf[BUFLEN];
g_return_val_if_fail(data != NULL, false);
journal = data;
r = sd_journal_next(journal);
if (r < 0) {
- error("ind_gather(): Failed to iterate to next entry: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_error("ind_gather(): Failed to iterate to next entry: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
return false;
}
if (r == 0) {
@@ -375,13 +370,13 @@ bool ind_gather(const IMManager *manager, CMPIInstance **old, CMPIInstance **new
LMI_JournalLogRecord_Init(&log_record, manager->broker, "root/cimv2");
r = create_LMI_JournalLogRecord(journal, &log_record, manager->broker);
if (r <= 0) {
- error("ind_gather(): Failed to create instance: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_error("ind_gather(): Failed to create instance: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
return false;
}
g_assert(new != NULL);
*new = LMI_JournalLogRecord_ToInstance(&log_record, &st);
- debug(" ind_gather(): new instance created\n");
+ lmi_debug(" ind_gather(): new instance created\n");
return true;
}
@@ -445,7 +440,7 @@ journal_iter_new(const gchar *req_cursor, gboolean seek_tail, sd_journal **journ
char *cursor;
sd_journal *journal;
int r;
- char errbuf[STRERROR_BUF_LEN];
+ char errbuf[BUFLEN];
gboolean eof_set;
if (journal_out)
@@ -453,7 +448,7 @@ journal_iter_new(const gchar *req_cursor, gboolean seek_tail, sd_journal **journ
r = sd_journal_open(&journal, 0);
if (r < 0) {
- error("Error opening journal: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_error("Error opening journal: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
return NULL;
}
@@ -467,7 +462,7 @@ journal_iter_new(const gchar *req_cursor, gboolean seek_tail, sd_journal **journ
}
if (r < 0) {
- error("Error seeking to the requested journal position: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_error("Error seeking to the requested journal position: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
sd_journal_close(journal);
return NULL;
}
@@ -477,7 +472,7 @@ journal_iter_new(const gchar *req_cursor, gboolean seek_tail, sd_journal **journ
else
r = sd_journal_next(journal);
if (r < 0) {
- error("Error stepping next in the journal: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_error("Error stepping next in the journal: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
sd_journal_close(journal);
return NULL;
}
@@ -485,7 +480,7 @@ journal_iter_new(const gchar *req_cursor, gboolean seek_tail, sd_journal **journ
r = sd_journal_get_cursor(journal, &cursor);
if (r < 0) {
- error("Error getting current cursor: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_error("Error getting current cursor: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
sd_journal_close(journal);
return NULL;
}
@@ -494,7 +489,7 @@ journal_iter_new(const gchar *req_cursor, gboolean seek_tail, sd_journal **journ
if (cmpi_iters == NULL)
cmpi_iters = g_hash_table_new_full(g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) sd_journal_close);
if (cmpi_iters == NULL) {
- error("Memory allocation failure\n");
+ lmi_error("Memory allocation failure\n");
sd_journal_close(journal);
G_UNLOCK(cmpi_iters);
return NULL;
@@ -503,7 +498,7 @@ journal_iter_new(const gchar *req_cursor, gboolean seek_tail, sd_journal **journ
if (iter_id)
iter_id_full = make_iterator_string(journal, cursor, iter_id, eof_set);
if (iter_id == NULL || iter_id_full == NULL) {
- error("Memory allocation failure\n");
+ lmi_error("Memory allocation failure\n");
sd_journal_close(journal);
} else {
g_hash_table_insert(cmpi_iters, iter_id, journal);
@@ -543,11 +538,11 @@ journal_iter_validate_id(gchar **iter_id, sd_journal **journal_out, gchar **pref
G_UNLOCK(cmpi_iters);
if (*journal_out == NULL || *journal_out != iter_ptr) {
/* Assume stale iterator ID, reopen journal and try to find the position by the cursor */
- warn("journal_iter_validate_id(): iterator pointer %p doesn't match with hashtable %p, reopening journal...\n", iter_ptr, *journal_out);
+ lmi_warn("journal_iter_validate_id(): iterator pointer %p doesn't match with hashtable %p, reopening journal...\n", iter_ptr, *journal_out);
g_free(*iter_id);
*iter_id = journal_iter_new(iter_cursor, FALSE, journal_out);
if (*iter_id == NULL) {
- error("The IterationIdentifier is not valid anymore: \'%s\'\n", *iter_id);
+ lmi_error("The IterationIdentifier is not valid anymore: \'%s\'\n", *iter_id);
res = FALSE;
}
}
@@ -575,7 +570,7 @@ journal_iter_cancel(const char *iter_id)
b = cmpi_iters && g_hash_table_remove(cmpi_iters, iter_id);
G_UNLOCK(cmpi_iters);
if (! b) {
- error("IterationIdentifier \'%s\' not registered\n", iter_id);
+ lmi_error("IterationIdentifier \'%s\' not registered\n", iter_id);
return false;
}
@@ -588,12 +583,12 @@ update_iter(gchar **iter_id, gboolean explicit_eof, sd_journal *journal)
gchar *iter_id_short;
char *cursor;
int r;
- char errbuf[STRERROR_BUF_LEN];
+ char errbuf[BUFLEN];
gboolean eof_set;
r = sd_journal_get_cursor(journal, &cursor);
if (r < 0) {
- error("Error getting current cursor: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_error("Error getting current cursor: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
return false;
}
@@ -608,12 +603,12 @@ bool
journal_iter_seek(gchar **iter_id, sd_journal *journal, gint64 position)
{
int r;
- char errbuf[STRERROR_BUF_LEN];
+ char errbuf[BUFLEN];
g_return_val_if_fail(journal != NULL, false);
if (position == 0) { /* NOP */
- warn("journal_iter_seek(): Spurious seek request to relative position 0\n");
+ lmi_warn("journal_iter_seek(): Spurious seek request to relative position 0\n");
return true;
}
@@ -623,12 +618,12 @@ journal_iter_seek(gchar **iter_id, sd_journal *journal, gint64 position)
r = sd_journal_previous_skip(journal, -position);
if (r < 0) {
- error("Error seeking to the requested position: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_error("Error seeking to the requested position: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
return false;
}
if (! update_iter(iter_id, r == 0, journal)) {
- error("Error seeking to the requested position\n");
+ lmi_error("Error seeking to the requested position\n");
return false;
}
@@ -640,7 +635,7 @@ journal_iter_get_data(gchar **iter_id, sd_journal *journal, gboolean step_next)
{
gchar *d;
int r;
- char errbuf[STRERROR_BUF_LEN];
+ char errbuf[BUFLEN];
gboolean eof_set;
g_return_val_if_fail(journal != NULL, false);
@@ -657,21 +652,21 @@ journal_iter_get_data(gchar **iter_id, sd_journal *journal, gboolean step_next)
/* Construct the message */
r = get_record_message(journal, TRUE, &d);
if (r < 0) {
- error("Error getting record message: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_error("Error getting record message: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
return NULL;
}
if (step_next) {
r = sd_journal_next(journal);
if (r < 0) {
- error("Error advancing to the next record: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
+ lmi_error("Error advancing to the next record: %s\n", strerror_r(-r, errbuf, sizeof(errbuf)));
g_free(d);
return NULL;
}
}
if (! update_iter(iter_id, r == 0, journal)) {
- error("Error getting record message\n");
+ lmi_error("Error getting record message\n");
return NULL;
}
diff --git a/src/libs/libopenlmi/CMakeLists.txt b/src/libs/libopenlmi/CMakeLists.txt
new file mode 100644
index 0000000..8540323
--- /dev/null
+++ b/src/libs/libopenlmi/CMakeLists.txt
@@ -0,0 +1,24 @@
+# This library uses libtool versioning. For more information on how to update
+# the version numbers, see libtool manual.
+# https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
+# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
+set(OPENLMI_VERSION_CURRENT 1)
+set(OPENLMI_VERSION_REVISION 0)
+set(OPENLMI_VERSION_AGE 2)
+set(OPENLMI_VERSION "${OPENLMI_VERSION_CURRENT}.${OPENLMI_VERSION_REVISION}.${OPENLMI_VERSION_AGE}")
+
+configure_file(openlmi.pc.in ${CMAKE_CURRENT_BINARY_DIR}/openlmi.pc @ONLY)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/openlmi.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig)
+install(FILES openlmi.conf DESTINATION ${SYSCONF_INSTALL_DIR}/openlmi)
+
+add_library(openlmi SHARED
+ openlmi.c
+)
+
+target_link_libraries(openlmi ${GLIB_LIBRARIES} dl)
+
+set_target_properties(openlmi PROPERTIES VERSION ${OPENLMI_VERSION})
+set_target_properties(openlmi PROPERTIES SOVERSION ${OPENLMI_VERSION_CURRENT})
+
+install(TARGETS openlmi DESTINATION lib${LIB_SUFFIX})
+install(FILES openlmi.h DESTINATION include/openlmi)
diff --git a/src/common/openlmi.c b/src/libs/libopenlmi/openlmi.c
index 508ffba..6257520 100644
--- a/src/common/openlmi.c
+++ b/src/libs/libopenlmi/openlmi.c
@@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors: Radek Novacek <rnovacek@redhat.com>
+ * Jan Synacek <jsynacek@redhat.com>
*/
#include "openlmi.h"
@@ -27,8 +28,6 @@
#include <string.h>
#include <netdb.h>
#include <stdio.h>
-#include <cmpimacs.h>
-#include <glib.h>
#include <dlfcn.h>
#include <pthread.h>
@@ -386,3 +385,80 @@ void _lmi_debug(int level, const char *file, int line, const char *format, ...)
}
free(text);
}
+
+
+
+CMPIStatus lmi_check_required(
+ const CMPIBroker *b,
+ const CMPIContext *ctx,
+ const CMPIObjectPath *o)
+{
+ CMPIStatus st;
+ CMPIData data;
+ const char *prop;
+
+ /* check computer system creation class name */
+ data = CMGetKey(o, "CSCreationClassName", &st);
+ lmi_check_status(st);
+
+ if (CMIsNullValue(data)) {
+ CMReturnWithChars(b, CMPI_RC_ERR_FAILED, "CSCreationClassName is empty");
+ }
+ prop = lmi_get_string_property_from_objectpath(o, "CSCreationClassName");
+ if (strcmp(prop, lmi_get_system_creation_class_name()) != 0) {
+ CMReturnWithChars(b, CMPI_RC_ERR_FAILED, "Wrong CSCreationClassName");
+ }
+
+ /* check fqdn */
+ data = CMGetKey(o, "CSName", &st);
+ lmi_check_status(st);
+ if (CMIsNullValue(data)) {
+ CMReturnWithChars(b, CMPI_RC_ERR_FAILED, "CSName is empty");
+ }
+ prop = lmi_get_string_property_from_objectpath(o, "CSName");
+ if (strcmp(prop, lmi_get_system_name()) != 0) {
+ CMReturnWithChars(b, CMPI_RC_ERR_FAILED, "Wrong CSName");
+ }
+
+ CMReturn(CMPI_RC_OK);
+}
+
+CMPIStatus lmi_check_assoc_class(
+ const CMPIBroker *cb,
+ const char *namespace,
+ const char *assocClass,
+ const char *class)
+{
+ CMPIObjectPath *o;
+ CMPIStatus st = {.rc = CMPI_RC_OK};
+
+ o = CMNewObjectPath(cb, namespace, class, &st);
+ if (!o) {
+ /* assume that status has been properly set */
+ return st;
+ } else if (st.rc != CMPI_RC_OK) {
+ CMRelease(o);
+ return st;
+ }
+ if (assocClass && !CMClassPathIsA(cb, o, assocClass, &st)) {
+ CMRelease(o);
+ st.rc = LMI_RC_ERR_CLASS_CHECK_FAILED;
+ return st;
+ }
+ CMRelease(o);
+ return st;
+}
+
+const char *lmi_get_string_property_from_objectpath(const CMPIObjectPath *o, const char *prop)
+{
+ CMPIData d;
+ d = CMGetKey(o, prop, NULL);
+ return KChars(d.value.string);
+}
+
+const char *lmi_get_string_property_from_instance(const CMPIInstance *i, const char *prop)
+{
+ CMPIData d;
+ d = CMGetProperty(i, prop, NULL);
+ return KChars(d.value.string);
+}
diff --git a/src/common/openlmi.conf b/src/libs/libopenlmi/openlmi.conf
index b86e3d9..b86e3d9 100644
--- a/src/common/openlmi.conf
+++ b/src/libs/libopenlmi/openlmi.conf
diff --git a/src/common/openlmi.h b/src/libs/libopenlmi/openlmi.h
index a46544c..7f151cd 100644
--- a/src/common/openlmi.h
+++ b/src/libs/libopenlmi/openlmi.h
@@ -16,14 +16,50 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors: Radek Novacek <rnovacek@redhat.com>
+ * Jan Synacek <jsynacek@redhat.com>
*/
#ifndef OPENLMI_H
#define OPENLMI_H
#include <cmpidt.h>
+#include <cmpimacs.h>
+#include <errno.h>
+#include <glib.h>
+#include <konkret/konkret.h>
+#include <limits.h>
#include <stdbool.h>
+#include <unistd.h>
+#ifndef BUFLEN
+ #define BUFLEN 1024
+#endif
+#ifndef PATH_MAX
+ #define PATH_MAX 4096
+#endif
+
+#define WHITESPACES " \f\n\r\t\v"
+
+#define ARRAY_SIZE(name) (sizeof(name) / sizeof(name[0]))
+
+/* Association sides. */
+#define LMI_GROUP_COMPONENT "GroupComponent"
+#define LMI_PART_COMPONENT "PartComponent"
+#define LMI_SAME_ELEMENT "SameElement"
+#define LMI_SYSTEM_ELEMENT "SystemElement"
+
+/* CMPI_RC_ERR_<error> values end at 200. 0xFF should be safe. */
+#define LMI_RC_ERR_CLASS_CHECK_FAILED 0xFF
+
+/* Organization ID. Used for InstaceIDs. */
+#define LMI_ORGID "LMI"
+
+/* Helper time conversion macros. */
+#define LMI_DAYS_TO_MS(days) ((days) * 86400000000)
+#define LMI_MS_TO_DAYS(ms) ((ms) / 86400000000)
+#define LMI_SECS_TO_MS(s) ((s) * 1000000)
+
+
typedef struct {
const char *group;
const char *key;
@@ -64,6 +100,7 @@ const char *lmi_get_system_name(void);
*/
const char *lmi_get_system_creation_class_name(void);
+
/**
* Initialize usage base openlmi tools like configuration file access,
* logging etc.
@@ -145,6 +182,7 @@ void lmi_set_log_level(int level);
* @retval true if succeeds
* @retval false if addition fails
*/
+/* TODO: Rename. Looks like a class. */
#define LMI_ReturnInstance(cr, w) KOkay(__KReturnInstance((cr), &(w).__base))
enum {
@@ -158,5 +196,41 @@ void _lmi_debug(int level, const char *file, int line, const char *format, ...);
#define lmi_info(...) _lmi_debug(_LMI_DEBUG_INFO, __FILE__, __LINE__, __VA_ARGS__)
#define lmi_warn(...) _lmi_debug(_LMI_DEBUG_WARN, __FILE__, __LINE__, __VA_ARGS__)
#define lmi_error(...) _lmi_debug(_LMI_DEBUG_ERROR, __FILE__, __LINE__, __VA_ARGS__)
-
-#endif
+#define lmi_dump_objectpath(o, lvl) \
+ lmi_##lvl("OP: %s", CMGetCharsPtr((o)->ft->toString(o, NULL), NULL))
+
+
+/* Shortcuts for functions and macros from openlmicommon library. */
+#define get_system_creation_class_name lmi_get_system_creation_class_name
+#define get_system_name lmi_get_system_name
+
+/* Status checking helpers. Beware of the returns! */
+#define lmi_check_status(st) \
+ do { \
+ if (st.rc != CMPI_RC_OK) { \
+ return st; \
+ } \
+ } while (0)
+
+#define lmi_check_class_check_status(st) \
+ do { \
+ if (st.rc == LMI_RC_ERR_CLASS_CHECK_FAILED) { \
+ CMReturn(CMPI_RC_OK); \
+ } \
+ lmi_check_status(st); \
+ } while (0)
+
+#define lmi_return_with_status(b, st, code, msg) \
+ do { \
+ KSetStatus2(b, st, code, msg); \
+ return *(st); \
+ } while(0)
+
+
+CMPIStatus lmi_check_required(const CMPIBroker *, const CMPIContext *, const CMPIObjectPath *);
+CMPIStatus lmi_check_assoc_class(const CMPIBroker *, const char *, const char *, const char *);
+
+const char *lmi_get_string_property_from_objectpath(const CMPIObjectPath *, const char *);
+const char *lmi_get_string_property_from_instance(const CMPIInstance *, const char *);
+
+#endif /* OPENLMI_H */
diff --git a/src/common/openlmi.pc.in b/src/libs/libopenlmi/openlmi.pc.in
index 939d672..5824e73 100644
--- a/src/common/openlmi.pc.in
+++ b/src/libs/libopenlmi/openlmi.pc.in
@@ -6,5 +6,5 @@ libdir=${exec_prefix}/lib@LIB_SUFFIX@
Name: openlmi
Description: OpenLMI provider support
Version: @OPENLMICOMMON_VERSION@
-Libs: -L${libdir} -lopenlmicommon
+Libs: -L${libdir} -lopenlmi
CFlags: -I${includedir}/openlmi
diff --git a/src/logicalfile/CMakeLists.txt b/src/logicalfile/CMakeLists.txt
index 3a09a4a..4e7e8fa 100644
--- a/src/logicalfile/CMakeLists.txt
+++ b/src/logicalfile/CMakeLists.txt
@@ -27,7 +27,7 @@ if(LIBSELINUX_FOUND EQUAL 1)
endif(LIBSELINUX_FOUND EQUAL 1)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR})
-target_link_libraries(${LIBRARY_NAME} openlmicommon
+target_link_libraries(${LIBRARY_NAME} openlmi
${KONKRETCMPI_LIBRARIES}
${LIBUDEV_LIBRARIES}
${LIBSELINUX_LIBRARIES})
diff --git a/src/logicalfile/LMI_DataFileProvider.c b/src/logicalfile/LMI_DataFileProvider.c
index 6abf9a4..cef3219 100644
--- a/src/logicalfile/LMI_DataFileProvider.c
+++ b/src/logicalfile/LMI_DataFileProvider.c
@@ -66,11 +66,11 @@ static CMPIStatus LMI_DataFileGetInstance(
logicalfile_t logicalfile;
st = lmi_check_required(_cb, cc, cop);
- check_status(st);
+ lmi_check_status(st);
LMI_DataFile_InitFromObjectPath(&logicalfile.lf.datafile, _cb, cop);
st = stat_logicalfile_and_fill(_cb, &logicalfile, S_IFREG, "Not a regular file: %s");
- check_status(st);
+ lmi_check_status(st);
KReturnInstance(cr, logicalfile.lf.datafile);
return st;
diff --git a/src/logicalfile/LMI_DirectoryContainsFileProvider.c b/src/logicalfile/LMI_DirectoryContainsFileProvider.c
index 2033804..bcf6d14 100644
--- a/src/logicalfile/LMI_DirectoryContainsFileProvider.c
+++ b/src/logicalfile/LMI_DirectoryContainsFileProvider.c
@@ -51,17 +51,17 @@ static CMPIStatus logicalfile_objectpath_from_path(
CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, err);
} else {
get_class_from_stat(&sb, fileclass);
- st = check_assoc_class(_cb, namespace, resultClass, fileclass);
- if (st.rc == RC_ERR_CLASS_CHECK_FAILED) {
+ st = lmi_check_assoc_class(_cb, namespace, resultClass, fileclass);
+ if (st.rc == LMI_RC_ERR_CLASS_CHECK_FAILED) {
st.rc = CMPI_RC_OK;
*o = NULL;
return st;
}
/* check status again for other possible errors */
- check_status(st);
+ lmi_check_status(st);
st = get_fsinfo_from_stat(_cb, &sb, abspath, &fsclassname, &fsname);
- check_status(st);
+ lmi_check_status(st);
}
CIM_LogicalFileRef cim_lfr;
@@ -107,7 +107,7 @@ static CMPIStatus dir_file_objectpaths(
dirname = g_path_get_dirname(path);
st = logicalfile_objectpath_from_path(dirname, resultClass, namespace, &o);
g_free(dirname);
- check_status(st);
+ lmi_check_status(st);
if (o) {
ops[i++] = o;
}
@@ -160,24 +160,24 @@ static CMPIStatus associators(
int group = -1;
int rgroup = -1;
- st = check_assoc_class(_cb, ns, assocClass, LMI_DirectoryContainsFile_ClassName);
- check_class_check_status(st);
+ st = lmi_check_assoc_class(_cb, ns, assocClass, LMI_DirectoryContainsFile_ClassName);
+ lmi_check_class_check_status(st);
/* role && resultRole checks */
if (role) {
- if (strcmp(role, GROUP_COMPONENT) != 0 && strcmp(role, PART_COMPONENT) != 0) {
+ if (strcmp(role, LMI_GROUP_COMPONENT) != 0 && strcmp(role, LMI_PART_COMPONENT) != 0) {
CMReturn(CMPI_RC_OK);
- } else if (strcmp(role, GROUP_COMPONENT) == 0) {
+ } else if (strcmp(role, LMI_GROUP_COMPONENT) == 0) {
group = 1;
- } else if (strcmp(role, PART_COMPONENT) == 0) {
+ } else if (strcmp(role, LMI_PART_COMPONENT) == 0) {
group = 0;
}
}
if (resultRole) {
- if (strcmp(resultRole, GROUP_COMPONENT) != 0 && strcmp(resultRole, PART_COMPONENT) != 0) {
+ if (strcmp(resultRole, LMI_GROUP_COMPONENT) != 0 && strcmp(resultRole, LMI_PART_COMPONENT) != 0) {
CMReturn(CMPI_RC_OK);
- } else if (strcmp(resultRole, GROUP_COMPONENT) == 0) {
+ } else if (strcmp(resultRole, LMI_GROUP_COMPONENT) == 0) {
rgroup = 1;
- } else if (strcmp(resultRole, PART_COMPONENT) == 0) {
+ } else if (strcmp(resultRole, LMI_PART_COMPONENT) == 0) {
rgroup = 0;
}
}
@@ -193,7 +193,7 @@ static CMPIStatus associators(
if (st.rc != CMPI_RC_OK) {
return st;
}
- path = get_string_property_from_op(cop, "Name");
+ path = lmi_get_string_property_from_objectpath(cop, "Name");
if (!path)
CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Cannot find Name property in provided LMI_UnixDirectory");
st = dir_file_objectpaths(cc, cr, resultClass, group, rgroup, properties, ns, path, refs, &count);
@@ -223,11 +223,11 @@ static CMPIStatus associators(
if (group == 1 || rgroup == 0) {
CMReturn(CMPI_RC_OK);
}
- path = get_string_property_from_op(cop, "Name");
+ path = lmi_get_string_property_from_objectpath(cop, "Name");
if (!path)
CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Cannot find Name property in provided CIM_logicalFile");
- st = check_assoc_class(_cb, ns, resultClass, LMI_UnixDirectory_ClassName);
- check_class_check_status(st);
+ st = lmi_check_assoc_class(_cb, ns, resultClass, LMI_UnixDirectory_ClassName);
+ lmi_check_class_check_status(st);
CIM_DirectoryRef lmi_dr;
CIM_DirectoryRef_Init(&lmi_dr, _cb, ns);
@@ -236,7 +236,7 @@ static CMPIStatus associators(
char *fsclassname = NULL;
st = get_fsinfo_from_path(_cb, path, &fsclassname, &fsname);
- check_status(st);
+ lmi_check_status(st);
gchar *dirname = g_path_get_dirname(path);
fill_logicalfile(CIM_DirectoryRef, &lmi_dr, dirname, fsclassname, fsname, LMI_UnixDirectory_ClassName);
@@ -283,14 +283,14 @@ static CMPIStatus references(
CMPIInstance *ci;
int group = -1;
- st = check_assoc_class(_cb, ns, assocClass, LMI_DirectoryContainsFile_ClassName);
- check_class_check_status(st);
+ st = lmi_check_assoc_class(_cb, ns, assocClass, LMI_DirectoryContainsFile_ClassName);
+ lmi_check_class_check_status(st);
if (role) {
- if (strcmp(role, GROUP_COMPONENT) != 0 && strcmp(role, PART_COMPONENT) != 0) {
+ if (strcmp(role, LMI_GROUP_COMPONENT) != 0 && strcmp(role, LMI_PART_COMPONENT) != 0) {
CMReturn(CMPI_RC_OK);
- } else if (strcmp(role, GROUP_COMPONENT) == 0) {
+ } else if (strcmp(role, LMI_GROUP_COMPONENT) == 0) {
group = 1;
- } else if (strcmp(role, PART_COMPONENT) == 0) {
+ } else if (strcmp(role, LMI_PART_COMPONENT) == 0) {
group = 0;
}
}
@@ -302,12 +302,12 @@ static CMPIStatus references(
if (CMClassPathIsA(_cb, cop, LMI_UnixDirectory_ClassName, &st)) {
st = lmi_check_required(_cb, cc, cop);
- check_status(st);
- path = get_string_property_from_op(cop, "Name");
+ lmi_check_status(st);
+ path = lmi_get_string_property_from_objectpath(cop, "Name");
if (!path)
CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Cannot find Name property in provided LMI_UnixDirectory");
st = get_fsinfo_from_path(_cb, path, &fsclassname, &fsname);
- check_status(st);
+ lmi_check_status(st);
/* got GroupComponent - DirectoryRef */
fill_logicalfile(CIM_DirectoryRef, &lmi_dr, path, fsclassname, fsname, LMI_UnixDirectory_ClassName);
o = CIM_DirectoryRef_ToObjectPath(&lmi_dr, &st);
@@ -318,7 +318,7 @@ static CMPIStatus references(
CMPIObjectPath *refs[MAX_REFS];
unsigned int count = 0;
st = dir_file_objectpaths(cc, cr, NULL, group, -1, properties, ns, path, refs, &count);
- check_status(st);
+ lmi_check_status(st);
if (count > MAX_REFS) {
CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Too many files in a single directory...");
}
@@ -336,13 +336,13 @@ static CMPIStatus references(
}
} else if (CMClassPathIsA(_cb, cop, CIM_LogicalFile_ClassName, &st)) {
st = lmi_check_required(_cb, cc, cop);
- check_status(st);
- path = get_string_property_from_op(cop, "Name");
+ lmi_check_status(st);
+ path = lmi_get_string_property_from_objectpath(cop, "Name");
if (!path)
CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Cannot find Name property in provided CIM_LogicalFile");
get_class_from_path(path, ccname);
st = get_fsinfo_from_path(_cb, path, &fsclassname, &fsname);
- check_status(st);
+ lmi_check_status(st);
/* got PartComponent - LogicalFileRef */
if (group == 1) {
CMReturn(CMPI_RC_OK);
diff --git a/src/logicalfile/LMI_FIFOPipeFileProvider.c b/src/logicalfile/LMI_FIFOPipeFileProvider.c
index 49062bd..1330f56 100644
--- a/src/logicalfile/LMI_FIFOPipeFileProvider.c
+++ b/src/logicalfile/LMI_FIFOPipeFileProvider.c
@@ -66,11 +66,11 @@ static CMPIStatus LMI_FIFOPipeFileGetInstance(
logicalfile_t logicalfile;
st = lmi_check_required(_cb, cc, cop);
- check_status(st);
+ lmi_check_status(st);
LMI_FIFOPipeFile_InitFromObjectPath(&logicalfile.lf.fifopipefile, _cb, cop);
st = stat_logicalfile_and_fill(_cb, &logicalfile, S_IFIFO, "No such FIFO: %s");
- check_status(st);
+ lmi_check_status(st);
KReturnInstance(cr, logicalfile.lf.fifopipefile);
return st;
diff --git a/src/logicalfile/LMI_FileIdentityProvider.c b/src/logicalfile/LMI_FileIdentityProvider.c
index 82010b8..b1a8599 100644
--- a/src/logicalfile/LMI_FileIdentityProvider.c
+++ b/src/logicalfile/LMI_FileIdentityProvider.c
@@ -48,25 +48,25 @@ static CMPIStatus associators(
char *fsname = NULL;
char *fsclassname = NULL;
- st = check_assoc_class(_cb, ns, assocClass, LMI_FileIdentity_ClassName);
- check_class_check_status(st);
+ st = lmi_check_assoc_class(_cb, ns, assocClass, LMI_FileIdentity_ClassName);
+ lmi_check_class_check_status(st);
if (CMClassPathIsA(_cb, cop, LMI_UnixFile_ClassName, &st)) {
/* got UnixFile - SameElement */
st = lmi_check_required(_cb, cc, cop);
- check_status(st);
+ lmi_check_status(st);
- path = get_string_property_from_op(cop, "LFName");
+ path = lmi_get_string_property_from_objectpath(cop, "LFName");
get_class_from_path(path, fileclass);
st = get_fsinfo_from_path(_cb, path, &fsclassname, &fsname);
- check_status(st);
+ lmi_check_status(st);
- st = check_assoc_class(_cb, ns, resultClass, fileclass);
- check_class_check_status(st);
- if (role && strcmp(role, SAME_ELEMENT) != 0) {
+ st = lmi_check_assoc_class(_cb, ns, resultClass, fileclass);
+ lmi_check_class_check_status(st);
+ if (role && strcmp(role, LMI_SAME_ELEMENT) != 0) {
CMReturn(CMPI_RC_OK);
}
- if (resultRole && strcmp(resultRole, SYSTEM_ELEMENT) != 0) {
+ if (resultRole && strcmp(resultRole, LMI_SYSTEM_ELEMENT) != 0) {
CMReturn(CMPI_RC_OK);
}
@@ -78,22 +78,22 @@ static CMPIStatus associators(
} else if (CMClassPathIsA(_cb, cop, CIM_LogicalFile_ClassName, &st)) {
/* got LogicalFile - SystemElement */
st = lmi_check_required(_cb, cc, cop);
- check_status(st);
+ lmi_check_status(st);
- path = get_string_property_from_op(cop, "Name");
+ path = lmi_get_string_property_from_objectpath(cop, "Name");
- st = check_assoc_class(_cb, ns, resultClass, LMI_UnixFile_ClassName);
- check_class_check_status(st);
- if (role && strcmp(role, SYSTEM_ELEMENT) != 0) {
+ st = lmi_check_assoc_class(_cb, ns, resultClass, LMI_UnixFile_ClassName);
+ lmi_check_class_check_status(st);
+ if (role && strcmp(role, LMI_SYSTEM_ELEMENT) != 0) {
CMReturn(CMPI_RC_OK);
}
- if (resultRole && strcmp(resultRole, SAME_ELEMENT) != 0) {
+ if (resultRole && strcmp(resultRole, LMI_SAME_ELEMENT) != 0) {
CMReturn(CMPI_RC_OK);
}
get_class_from_path(path, fileclass);
st = get_fsinfo_from_path(_cb, path, &fsclassname, &fsname);
- check_status(st);
+ lmi_check_status(st);
LMI_UnixFile lmi_uf;
LMI_UnixFile_Init(&lmi_uf, _cb, ns);
@@ -138,8 +138,8 @@ static CMPIStatus references(
char *fsname = NULL;
char *fsclassname = NULL;
- st = check_assoc_class(_cb, ns, assocClass, LMI_FileIdentity_ClassName);
- check_class_check_status(st);
+ st = lmi_check_assoc_class(_cb, ns, assocClass, LMI_FileIdentity_ClassName);
+ lmi_check_class_check_status(st);
LMI_FileIdentity_Init(&lmi_fi, _cb, ns);
@@ -152,12 +152,12 @@ static CMPIStatus references(
return st;
}
- path = get_string_property_from_op(cop, "LFName");
+ path = lmi_get_string_property_from_objectpath(cop, "LFName");
get_class_from_path(path, fileclass);
st = get_fsinfo_from_path(_cb, path, &fsclassname, &fsname);
- check_status(st);
+ lmi_check_status(st);
- if (role && strcmp(role, SAME_ELEMENT) != 0) {
+ if (role && strcmp(role, LMI_SAME_ELEMENT) != 0) {
CMReturn(CMPI_RC_OK);
}
@@ -178,13 +178,13 @@ static CMPIStatus references(
return st;
}
- if (role && strcmp(role, SYSTEM_ELEMENT) != 0) {
+ if (role && strcmp(role, LMI_SYSTEM_ELEMENT) != 0) {
CMReturn(CMPI_RC_OK);
}
- path = get_string_property_from_op(cop, "Name");
+ path = lmi_get_string_property_from_objectpath(cop, "Name");
get_class_from_path(path, fileclass);
st = get_fsinfo_from_path(_cb, path, &fsclassname, &fsname);
- check_status(st);
+ lmi_check_status(st);
/* SameElement */
LMI_UnixFile lmi_uf;
diff --git a/src/logicalfile/LMI_RootDirectoryProvider.c b/src/logicalfile/LMI_RootDirectoryProvider.c
index 9c2a2db..4ada3f5 100644
--- a/src/logicalfile/LMI_RootDirectoryProvider.c
+++ b/src/logicalfile/LMI_RootDirectoryProvider.c
@@ -41,25 +41,25 @@ static CMPIStatus associators(
CMPIStatus st;
const char *ns = KNameSpace(cop);
const char *comp_ccname = get_system_creation_class_name();
- const char *path = get_string_property_from_op(cop, "Name");
+ const char *path = lmi_get_string_property_from_objectpath(cop, "Name");
char *fsname = NULL;
char *fsclassname = NULL;
const char *systemname = lmi_get_system_creation_class_name();
- st = check_assoc_class(_cb, ns, assocClass, LMI_RootDirectory_ClassName);
- check_class_check_status(st);
+ st = lmi_check_assoc_class(_cb, ns, assocClass, LMI_RootDirectory_ClassName);
+ lmi_check_class_check_status(st);
st = get_fsinfo_from_path(_cb, "/", &fsclassname, &fsname);
- check_status(st);
+ lmi_check_status(st);
if (CMClassPathIsA(_cb, cop, LMI_UnixDirectory_ClassName, &st)) {
/* got LMI_UnixDirectory - PartComponent */
- st = check_assoc_class(_cb, ns, resultClass, comp_ccname);
- check_class_check_status(st);
- if (role && strcmp(role, PART_COMPONENT) != 0) {
+ st = lmi_check_assoc_class(_cb, ns, resultClass, comp_ccname);
+ lmi_check_class_check_status(st);
+ if (role && strcmp(role, LMI_PART_COMPONENT) != 0) {
CMReturn(CMPI_RC_OK);
}
- if (resultRole && strcmp(resultRole, GROUP_COMPONENT) != 0) {
+ if (resultRole && strcmp(resultRole, LMI_GROUP_COMPONENT) != 0) {
CMReturn(CMPI_RC_OK);
}
/* ignore this association if the directory is not root */
@@ -75,12 +75,12 @@ static CMPIStatus associators(
}
} else if (CMClassPathIsA(_cb, cop, systemname, &st)) {
/* got CIM_ComputerSystem - GroupComponent */
- st = check_assoc_class(_cb, ns, resultClass, LMI_UnixDirectory_ClassName);
- check_class_check_status(st);
- if (role && strcmp(role, GROUP_COMPONENT) != 0) {
+ st = lmi_check_assoc_class(_cb, ns, resultClass, LMI_UnixDirectory_ClassName);
+ lmi_check_class_check_status(st);
+ if (role && strcmp(role, LMI_GROUP_COMPONENT) != 0) {
CMReturn(CMPI_RC_OK);
}
- if (resultRole && strcmp(resultRole, PART_COMPONENT) != 0) {
+ if (resultRole && strcmp(resultRole, LMI_PART_COMPONENT) != 0) {
CMReturn(CMPI_RC_OK);
}
@@ -117,24 +117,24 @@ static CMPIStatus references(
CMPIInstance *ci;
CMPIStatus st;
const char *ns = KNameSpace(cop);
- const char *path = get_string_property_from_op(cop, "Name");
+ const char *path = lmi_get_string_property_from_objectpath(cop, "Name");
char ccname[BUFLEN];
get_class_from_path(path, ccname);
const char *systemname = lmi_get_system_creation_class_name();
- st = check_assoc_class(_cb, ns, assocClass, LMI_RootDirectory_ClassName);
- check_class_check_status(st);
+ st = lmi_check_assoc_class(_cb, ns, assocClass, LMI_RootDirectory_ClassName);
+ lmi_check_class_check_status(st);
char *fsname = NULL;
char *fsclassname = NULL;
st = get_fsinfo_from_path(_cb, "/", &fsclassname, &fsname);
- check_status(st);
+ lmi_check_status(st);
LMI_RootDirectory_Init(&lmi_rd, _cb, ns);
if (strcmp(ccname, LMI_UnixDirectory_ClassName) == 0) {
/* got UnixDirectory - PartComponent */
- if (role && strcmp(role, PART_COMPONENT) != 0) {
+ if (role && strcmp(role, LMI_PART_COMPONENT) != 0) {
CMReturn(CMPI_RC_OK);
}
/* ignore this association if the directory is not root */
@@ -142,14 +142,14 @@ static CMPIStatus references(
CMReturn(CMPI_RC_OK);
}
st = lmi_check_required(_cb, cc, cop);
- check_status(st);
+ lmi_check_status(st);
LMI_RootDirectory_SetObjectPath_PartComponent(&lmi_rd, cop);
LMI_RootDirectory_SetObjectPath_GroupComponent(&lmi_rd,
lmi_get_computer_system());
} else if (CMClassPathIsA(_cb, cop, systemname, &st)) {
/* got CIM_ComputerSystem - GroupComponent */
- if (role && strcmp(role, GROUP_COMPONENT) != 0) {
+ if (role && strcmp(role, LMI_GROUP_COMPONENT) != 0) {
CMReturn(CMPI_RC_OK);
}
LMI_RootDirectory_SetObjectPath_GroupComponent(&lmi_rd, cop);
@@ -218,7 +218,7 @@ static CMPIStatus LMI_RootDirectoryEnumInstances(
LMI_UnixDirectory lmi_ud;
LMI_UnixDirectory_Init(&lmi_ud, _cb, ns);
st = get_fsinfo_from_path(_cb, "/", &fsclassname, &fsname);
- check_status(st);
+ lmi_check_status(st);
fill_logicalfile(LMI_UnixDirectory, &lmi_ud, "/", fsclassname, fsname, LMI_UnixDirectory_ClassName);
o = LMI_UnixDirectory_ToObjectPath(&lmi_ud, NULL);
LMI_RootDirectory_SetObjectPath_PartComponent(&lmi_rd, o);
diff --git a/src/logicalfile/LMI_SymbolicLinkProvider.c b/src/logicalfile/LMI_SymbolicLinkProvider.c
index e200316..68a6142 100644
--- a/src/logicalfile/LMI_SymbolicLinkProvider.c
+++ b/src/logicalfile/LMI_SymbolicLinkProvider.c
@@ -66,11 +66,11 @@ static CMPIStatus LMI_SymbolicLinkGetInstance(
logicalfile_t logicalfile;
st = lmi_check_required(_cb, cc, cop);
- check_status(st);
+ lmi_check_status(st);
LMI_SymbolicLink_InitFromObjectPath(&logicalfile.lf.symboliclink, _cb, cop);
st = stat_logicalfile_and_fill(_cb, &logicalfile, S_IFLNK, "No such symlink: %s");
- check_status(st);
+ lmi_check_status(st);
KReturnInstance(cr, logicalfile.lf.symboliclink);
return st;
@@ -85,12 +85,12 @@ static CMPIStatus LMI_SymbolicLinkCreateInstance(
{
CMPIStatus st = {.rc = CMPI_RC_OK};
CMPIObjectPath *iop = CMGetObjectPath(ci, &st);
- check_status(st);
+ lmi_check_status(st);
st = lmi_check_required(_cb, cc, iop);
- check_status(st);
+ lmi_check_status(st);
- const char *path = get_string_property_from_instance(ci, "Name");
- const char *target = get_string_property_from_instance(ci, "TargetFile");
+ const char *path = lmi_get_string_property_from_instance(ci, "Name");
+ const char *target = lmi_get_string_property_from_instance(ci, "TargetFile");
bool allow = lmi_read_config_boolean("LMI_SymbolicLink", "AllowSymlink");
diff --git a/src/logicalfile/LMI_UnixDeviceFileProvider.c b/src/logicalfile/LMI_UnixDeviceFileProvider.c
index ab1ec01..3062094 100644
--- a/src/logicalfile/LMI_UnixDeviceFileProvider.c
+++ b/src/logicalfile/LMI_UnixDeviceFileProvider.c
@@ -66,11 +66,11 @@ static CMPIStatus LMI_UnixDeviceFileGetInstance(
logicalfile_t logicalfile;
st = lmi_check_required(_cb, cc, cop);
- check_status(st);
+ lmi_check_status(st);
LMI_UnixDeviceFile_InitFromObjectPath(&logicalfile.lf.unixdevicefile, _cb, cop);
st = stat_logicalfile_and_fill(_cb, &logicalfile, S_IFCHR | S_IFBLK, "No such device: %s");
- check_status(st);
+ lmi_check_status(st);
KReturnInstance(cr, logicalfile.lf.unixdevicefile);
return st;
diff --git a/src/logicalfile/LMI_UnixDirectoryProvider.c b/src/logicalfile/LMI_UnixDirectoryProvider.c
index 0f19cbb..1ca995b 100644
--- a/src/logicalfile/LMI_UnixDirectoryProvider.c
+++ b/src/logicalfile/LMI_UnixDirectoryProvider.c
@@ -66,11 +66,11 @@ static CMPIStatus LMI_UnixDirectoryGetInstance(
logicalfile_t logicalfile;
st = lmi_check_required(_cb, cc, cop);
- check_status(st);
+ lmi_check_status(st);
LMI_UnixDirectory_InitFromObjectPath(&logicalfile.lf.unixdirectory, _cb, cop);
st = stat_logicalfile_and_fill(_cb, &logicalfile, S_IFDIR, "Not a directory: %s");
- check_status(st);
+ lmi_check_status(st);
KReturnInstance(cr, logicalfile.lf.unixdirectory);
return st;
@@ -85,11 +85,11 @@ static CMPIStatus LMI_UnixDirectoryCreateInstance(
{
CMPIStatus st;
CMPIObjectPath *iop = CMGetObjectPath(ci, &st);
- check_status(st);
+ lmi_check_status(st);
st = lmi_check_required(_cb, cc, iop);
- check_status(st);
+ lmi_check_status(st);
- const char *path = get_string_property_from_op(iop, "Name");
+ const char *path = lmi_get_string_property_from_objectpath(iop, "Name");
bool allow = lmi_read_config_boolean("LMI_UnixDirectory", "AllowMkdir");
if (allow && mkdir(path, 0777) < 0) {
@@ -125,7 +125,7 @@ static CMPIStatus LMI_UnixDirectoryDeleteInstance(
const CMPIResult* cr,
const CMPIObjectPath* cop)
{
- const char *path = get_string_property_from_op(cop, "Name");
+ const char *path = lmi_get_string_property_from_objectpath(cop, "Name");
bool allow = lmi_read_config_boolean("LMI_UnixDirectory", "AllowRmdir");
if (allow && rmdir(path) < 0) {
diff --git a/src/logicalfile/LMI_UnixFileProvider.c b/src/logicalfile/LMI_UnixFileProvider.c
index b17da5f..52e7b9c 100644
--- a/src/logicalfile/LMI_UnixFileProvider.c
+++ b/src/logicalfile/LMI_UnixFileProvider.c
@@ -140,7 +140,7 @@ static CMPIStatus LMI_UnixFileGetInstance(
fsname = (char *) KChars(lmi_file.FSName.value);
fsclassname = (char *) KChars(lmi_file.FSCreationClassName.value);
st = get_fsinfo_from_stat(_cb, &sb, path, &fsclassname, &fsname);
- check_status(st);
+ lmi_check_status(st);
LMI_UnixFile_Set_FSCreationClassName(&lmi_file, fsclassname);
LMI_UnixFile_Set_FSName(&lmi_file, fsname);
get_class_from_stat(&sb, aux);
diff --git a/src/logicalfile/LMI_UnixSocketProvider.c b/src/logicalfile/LMI_UnixSocketProvider.c
index a637f33..d19753c 100644
--- a/src/logicalfile/LMI_UnixSocketProvider.c
+++ b/src/logicalfile/LMI_UnixSocketProvider.c
@@ -66,11 +66,11 @@ static CMPIStatus LMI_UnixSocketGetInstance(
logicalfile_t logicalfile;
st = lmi_check_required(_cb, cc, cop);
- check_status(st);
+ lmi_check_status(st);
LMI_UnixSocket_InitFromObjectPath(&logicalfile.lf.unixsocket, _cb, cop);
st = stat_logicalfile_and_fill(_cb, &logicalfile, S_IFSOCK, "No such socket: %s");
- check_status(st);
+ lmi_check_status(st);
KReturnInstance(cr, logicalfile.lf.unixsocket);
return st;
diff --git a/src/logicalfile/file.c b/src/logicalfile/file.c
index ac68b6f..03c99da 100644
--- a/src/logicalfile/file.c
+++ b/src/logicalfile/file.c
@@ -29,40 +29,6 @@ const ConfigEntry *provider_config_defaults = (const ConfigEntry *)&(ConfigEntry
const char *provider_name = "logicalfile";
-CMPIStatus lmi_check_required(
- const CMPIBroker *b,
- const CMPIContext *ctx,
- const CMPIObjectPath *o)
-{
- const char *prop;
-
- CMPIStatus st;
- CMPIData data;
- /* check computer system creation class name */
- data = CMGetKey(o, "CSCreationClassName", &st);
- check_status(st);
- if (CMIsNullValue(data)) {
- CMReturnWithChars(b, CMPI_RC_ERR_FAILED, "CSCreationClassName is empty");
- }
- prop = get_string_property_from_op(o, "CSCreationClassName");
- if (strcmp(prop, lmi_get_system_creation_class_name()) != 0) {
- CMReturnWithChars(b, CMPI_RC_ERR_FAILED, "Wrong CSCreationClassName");
- }
-
- /* check fqdn */
- data = CMGetKey(o, "CSName", &st);
- check_status(st);
- if (CMIsNullValue(data)) {
- CMReturnWithChars(b, CMPI_RC_ERR_FAILED, "CSName is empty");
- }
- prop = get_string_property_from_op(o, "CSName");
- if (strcmp(prop, lmi_get_system_name()) != 0) {
- CMReturnWithChars(b, CMPI_RC_ERR_FAILED, "Wrong CSName");
- }
-
- CMReturn(CMPI_RC_OK);
-}
-
void get_class_from_stat(const struct stat *sb, char *fileclass) {
(S_ISREG(sb->st_mode)) ? strcpy(fileclass, "LMI_DataFile") :
(S_ISDIR(sb->st_mode)) ? strcpy(fileclass, "LMI_UnixDirectory") :
@@ -99,14 +65,14 @@ CMPIStatus get_fsinfo_from_stat(const CMPIBroker *b, const struct stat *sb, cons
udev_ctx = udev_new();
if (!udev_ctx) {
- return_with_status(b, &st, ERR_FAILED, "Could not create udev context");
+ lmi_return_with_status(b, &st, ERR_FAILED, "Could not create udev context");
}
udev_dev = udev_device_new_from_devnum(udev_ctx, 'b', sb->st_dev);
if ((dev_name = udev_device_get_property_value(udev_dev, "ID_FS_UUID_ENC"))) {
if (!*fsname) {
if (asprintf(fsname, "UUID=%s", dev_name) < 0) {
- return_with_status(b, &st, ERR_FAILED, "asprintf failed");
+ lmi_return_with_status(b, &st, ERR_FAILED, "asprintf failed");
}
}
if (!*fsclassname) {
@@ -115,7 +81,7 @@ CMPIStatus get_fsinfo_from_stat(const CMPIBroker *b, const struct stat *sb, cons
} else if ((dev_name = udev_device_get_property_value(udev_dev, "DEVNAME"))) {
if (!*fsname) {
if (asprintf(fsname, "DEVICE=%s", dev_name) < 0) {
- return_with_status(b, &st, ERR_FAILED, "asprintf failed");
+ lmi_return_with_status(b, &st, ERR_FAILED, "asprintf failed");
}
}
if (!*fsclassname) {
@@ -124,7 +90,7 @@ CMPIStatus get_fsinfo_from_stat(const CMPIBroker *b, const struct stat *sb, cons
} else {
if (!*fsname) {
if (asprintf(fsname, "PATH=%s", path) < 0) {
- return_with_status(b, &st, ERR_FAILED, "asprintf failed");
+ lmi_return_with_status(b, &st, ERR_FAILED, "asprintf failed");
}
}
if (!*fsclassname) {
@@ -143,51 +109,12 @@ CMPIStatus get_fsinfo_from_path(const CMPIBroker *b, const char *path, char **fs
struct stat sb;
if (lstat(path, &sb) < 0) {
- return_with_status(b, &st, ERR_FAILED, "lstat(2) failed");
+ lmi_return_with_status(b, &st, ERR_FAILED, "lstat(2) failed");
}
return get_fsinfo_from_stat(b, &sb, path, fsclassname, fsname);
}
-const char *get_string_property_from_op(const CMPIObjectPath *o, const char *prop)
-{
- CMPIData d;
- d = CMGetKey(o, prop, NULL);
- return KChars(d.value.string);
-}
-
-const char *get_string_property_from_instance(const CMPIInstance *i, const char *prop)
-{
- CMPIData d;
- d = CMGetProperty(i, prop, NULL);
- return KChars(d.value.string);
-}
-
-CMPIStatus check_assoc_class(
- const CMPIBroker *cb,
- const char *namespace,
- const char *assocClass,
- const char *class)
-{
- CMPIObjectPath *o;
- CMPIStatus st = {.rc = CMPI_RC_OK};
-
- o = CMNewObjectPath(cb, namespace, class, &st);
- if (!o) {
- /* assume that status has been properly set */
- return st;
- } else if (st.rc != CMPI_RC_OK) {
- CMRelease(o);
- return st;
- }
- if (assocClass && !CMClassPathIsA(cb, o, assocClass, &st)) {
- CMRelease(o);
- st.rc = RC_ERR_CLASS_CHECK_FAILED;
- return st;
- }
- CMRelease(o);
- return st;
-}
CMPIStatus stat_logicalfile_and_fill(
const CMPIBroker *b,
@@ -214,7 +141,7 @@ CMPIStatus stat_logicalfile_and_fill(
fsname = (char *) KChars(lf->lf.datafile.FSName.value);
fsclassname = (char *) KChars(lf->lf.datafile.FSCreationClassName.value);
st = get_fsinfo_from_stat(b, &sb, path, &fsclassname, &fsname);
- check_status(st);
+ lmi_check_status(st);
switch(mode) {
case S_IFREG:
@@ -264,10 +191,6 @@ CMPIStatus stat_logicalfile_and_fill(
return st;
}
-void _dump_objectpath(const CMPIObjectPath *o)
-{
- printf("OP: %s\n", CMGetCharsPtr(o->ft->toString(o, NULL), NULL));
-}
/* vi: set et: */
/* Local Variables: */
/* indent-tabs-mode: nil */
diff --git a/src/logicalfile/file.h b/src/logicalfile/file.h
index d2f573b..a5291ed 100644
--- a/src/logicalfile/file.h
+++ b/src/logicalfile/file.h
@@ -20,48 +20,27 @@
#ifndef _FILE_H
#define _FILE_H
-#include <linux/limits.h>
#include <sys/stat.h>
#include <dirent.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
#include <libgen.h>
-#include <konkret/konkret.h>
-#include <assert.h>
#include <libudev.h>
-#include <errno.h>
-#include <unistd.h>
+#include <assert.h>
#include "LMI_DataFile.h"
#include "LMI_UnixDeviceFile.h"
#include "LMI_SymbolicLink.h"
#include "LMI_UnixDirectory.h"
#include "LMI_UnixSocket.h"
#include "LMI_FIFOPipeFile.h"
-#include "globals.h"
-
-#ifndef BUFLEN
- #define BUFLEN 512
-#endif
-#ifndef PATH_MAX
- #define PATH_MAX 4096
-#endif
+#include "openlmi.h"
const ConfigEntry *provider_config_defaults;
const char *provider_name;
#define FSCREATIONCLASSNAME_LOCAL "LMI_LocalFileSystem"
#define FSCREATIONCLASSNAME_TRANSIENT "LMI_TransientFileSystem"
-#define GROUP_COMPONENT "GroupComponent"
-#define PART_COMPONENT "PartComponent"
-#define SAME_ELEMENT "SameElement"
-#define SYSTEM_ELEMENT "SystemElement"
#define DEVTYPE_BLK 2
#define DEVTYPE_CHR 3
-/* CMPI_RC_ERR_<error> values end at 200. 0xFF should be safe. */
-#define RC_ERR_CLASS_CHECK_FAILED 0xFF
-
#define sb_permmask(sb) ((sb).st_mode & (S_IRWXU | S_IRWXG | S_IRWXO))
#define sb_isreadable(sb) ( \
(sb_permmask(sb) & S_IRUSR) || \
@@ -78,7 +57,6 @@ const char *provider_name;
(sb_permmask(sb) & S_IXGRP) || \
(sb_permmask(sb) & S_IXOTH) \
)
-#define stoms(t) ((t)*1000000)
#define fill_logicalfile(type, obj, name, fsclassname, fsname, creation_class) \
type##_Set_Name((obj), (name)); \
@@ -96,23 +74,8 @@ const char *provider_name;
LMI_##cmpitype##_Set_Writeable(lmi_file, sb_iswriteable(sb)); \
LMI_##cmpitype##_Set_Executable(lmi_file, sb_isexecutable(sb)); \
LMI_##cmpitype##_Set_FileSize(lmi_file, sb.st_size); \
- LMI_##cmpitype##_Set_LastAccessed(lmi_file, CMNewDateTimeFromBinary(b, stoms(sb.st_atime), 0, NULL)); \
- LMI_##cmpitype##_Set_LastModified(lmi_file, CMNewDateTimeFromBinary(b, stoms(sb.st_mtime), 0, NULL));
-
-#define check_status(st) \
- if (st.rc != CMPI_RC_OK) { \
- return st; \
- }
-
-#define check_class_check_status(st) \
- if (st.rc == RC_ERR_CLASS_CHECK_FAILED) { \
- CMReturn(CMPI_RC_OK); \
- } \
- check_status(st);
-
-#define return_with_status(b, st, code, msg) \
- KSetStatus2(b, st, code, msg); \
- return *(st);
+ LMI_##cmpitype##_Set_LastAccessed(lmi_file, CMNewDateTimeFromBinary(b, LMI_SECS_TO_MS(sb.st_atime), 0, NULL)); \
+ LMI_##cmpitype##_Set_LastModified(lmi_file, CMNewDateTimeFromBinary(b, LMI_SECS_TO_MS(sb.st_mtime), 0, NULL));
typedef struct {
union {
@@ -125,16 +88,11 @@ typedef struct {
} lf;
} logicalfile_t;
-CMPIStatus lmi_check_required(const CMPIBroker *, const CMPIContext *, const CMPIObjectPath *);
void get_class_from_stat(const struct stat *, char *);
int get_class_from_path(const char *, char *);
CMPIStatus get_fsinfo_from_stat(const CMPIBroker *, const struct stat *, const char *, char **, char **);
CMPIStatus get_fsinfo_from_path(const CMPIBroker *, const char *, char **, char **);
-const char *get_string_property_from_op(const CMPIObjectPath *, const char *);
-const char *get_string_property_from_instance(const CMPIInstance *, const char *);
-CMPIStatus check_assoc_class(const CMPIBroker *, const char *, const char *, const char *);
CMPIStatus stat_logicalfile_and_fill(const CMPIBroker *, logicalfile_t *, mode_t, const char *);
-void _dump_objectpath(const CMPIObjectPath *);
#endif /* _FILE_H */
/* vi: set et: */
diff --git a/src/power/CMakeLists.txt b/src/power/CMakeLists.txt
index 44b2109..0519c4a 100644
--- a/src/power/CMakeLists.txt
+++ b/src/power/CMakeLists.txt
@@ -43,7 +43,7 @@ endif (${SYSTEMCTL_FOUND})
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR} ${GLIB_INCLUDE_DIRS})
-target_link_libraries(${LIBRARY_NAME} openlmicommon ${KONKRETCMPI_LIBRARIES} ${GLIB_LIBRARIES})
+target_link_libraries(${LIBRARY_NAME} openlmi ${KONKRETCMPI_LIBRARIES} ${GLIB_LIBRARIES})
# Create registration file
cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers)
diff --git a/src/power/LMI_AssociatedPowerManagementServiceProvider.c b/src/power/LMI_AssociatedPowerManagementServiceProvider.c
index 74c426f..25cfc9c 100644
--- a/src/power/LMI_AssociatedPowerManagementServiceProvider.c
+++ b/src/power/LMI_AssociatedPowerManagementServiceProvider.c
@@ -21,10 +21,8 @@
#include "LMI_AssociatedPowerManagementService.h"
#include "LMI_PowerManagementService.h"
#include "CIM_ComputerSystem.h"
-
#include "power.h"
-#include "globals.h"
static const CMPIBroker* _cb;
diff --git a/src/power/LMI_ElementCapabilitiesProvider.c b/src/power/LMI_ElementCapabilitiesProvider.c
index 25c2865..7d7d58f 100644
--- a/src/power/LMI_ElementCapabilitiesProvider.c
+++ b/src/power/LMI_ElementCapabilitiesProvider.c
@@ -20,7 +20,6 @@
#include <konkret/konkret.h>
#include "LMI_ElementCapabilities.h"
-#include "globals.h"
#include "power.h"
static const CMPIBroker* _cb;
@@ -80,7 +79,7 @@ static CMPIStatus LMI_ElementCapabilitiesEnumInstances(
LMI_PowerManagementCapabilitiesRef powerManagementCapabilitiesRef;
LMI_PowerManagementCapabilitiesRef_Init(&powerManagementCapabilitiesRef, _cb, ns);
- LMI_PowerManagementCapabilitiesRef_Set_InstanceID(&powerManagementCapabilitiesRef, ORGID ":LMI_PowerManagementCapabilities");
+ LMI_PowerManagementCapabilitiesRef_Set_InstanceID(&powerManagementCapabilitiesRef, LMI_ORGID ":LMI_PowerManagementCapabilities");
LMI_ElementCapabilities_Set_Capabilities(&w, &powerManagementCapabilitiesRef);
diff --git a/src/power/LMI_HostedPowerManagementServiceProvider.c b/src/power/LMI_HostedPowerManagementServiceProvider.c
index 9663ed1..80f0111 100644
--- a/src/power/LMI_HostedPowerManagementServiceProvider.c
+++ b/src/power/LMI_HostedPowerManagementServiceProvider.c
@@ -21,8 +21,6 @@
#include <cmpimacs.h>
#include <konkret/konkret.h>
#include "LMI_HostedPowerManagementService.h"
-
-#include "globals.h"
#include "power.h"
static const CMPIBroker* _cb;
diff --git a/src/power/LMI_PowerConcreteJobProvider.c b/src/power/LMI_PowerConcreteJobProvider.c
index ef6e501..a4d09c8 100644
--- a/src/power/LMI_PowerConcreteJobProvider.c
+++ b/src/power/LMI_PowerConcreteJobProvider.c
@@ -21,7 +21,6 @@
#include <konkret/konkret.h>
#include <stdint.h>
#include "LMI_PowerConcreteJob.h"
-#include "globals.h"
static const CMPIBroker* _cb = NULL;
@@ -80,7 +79,7 @@ static CMPIStatus LMI_PowerConcreteJobEnumInstances(
powerStateChangeJob = plist->data;
LMI_PowerConcreteJob concreteJob;
LMI_PowerConcreteJob_Init(&concreteJob, _cb, ns);
- if (asprintf(&instanceid, ORGID ":LMI_PowerConcreteJob:%ld", job_id(powerStateChangeJob)) < 0) {
+ if (asprintf(&instanceid, LMI_ORGID ":LMI_PowerConcreteJob:%ld", job_id(powerStateChangeJob)) < 0) {
KReturn2(_cb, ERR_FAILED, "Memory allocation failed");
}
LMI_PowerConcreteJob_Set_InstanceID(&concreteJob, instanceid);
diff --git a/src/power/LMI_PowerManagementCapabilitiesProvider.c b/src/power/LMI_PowerManagementCapabilitiesProvider.c
index ca02083..c0ad710 100644
--- a/src/power/LMI_PowerManagementCapabilitiesProvider.c
+++ b/src/power/LMI_PowerManagementCapabilitiesProvider.c
@@ -69,7 +69,7 @@ static CMPIStatus LMI_PowerManagementCapabilitiesEnumInstances(
LMI_PowerManagementCapabilities w;
LMI_PowerManagementCapabilities_Init(&w, _cb, ns);
// TODO: make it unique
- LMI_PowerManagementCapabilities_Set_InstanceID(&w, ORGID ":LMI_PowerManagementCapabilities");
+ LMI_PowerManagementCapabilities_Set_InstanceID(&w, LMI_ORGID ":LMI_PowerManagementCapabilities");
LMI_PowerManagementCapabilities_Set_ElementName(&w, "PowerManagementCapabilities");
LMI_PowerManagementCapabilities_Set_Caption(&w, "Power Management Capabilities");
diff --git a/src/power/LMI_PowerManagementServiceProvider.c b/src/power/LMI_PowerManagementServiceProvider.c
index 9759b1c..162d798 100644
--- a/src/power/LMI_PowerManagementServiceProvider.c
+++ b/src/power/LMI_PowerManagementServiceProvider.c
@@ -19,9 +19,7 @@
*/
#include "LMI_PowerManagementService.h"
-
#include "power.h"
-#include "globals.h"
static const CMPIBroker* _cb = NULL;
diff --git a/src/power/power.c b/src/power/power.c
index 6ec24b6..cbd62a5 100644
--- a/src/power/power.c
+++ b/src/power/power.c
@@ -23,8 +23,6 @@
#include <stdlib.h>
#include <assert.h>
-#include <glib.h>
-
#ifdef HAS_GDBUS
# include <gio/gio.h>
@@ -41,8 +39,6 @@
#include "LMI_AssociatedPowerManagementService.h"
#include "LMI_PowerConcreteJob.h"
-#include "globals.h"
-
const char *provider_name = "powermanagement";
const ConfigEntry *provider_config_defaults = NULL;
@@ -137,7 +133,7 @@ Proxy *power_create_logind()
G_DBUS_PROXY_FLAGS_NONE, NULL, LOGIND_NAME, LOGIND_PATH,
LOGIND_INTERFACE, NULL, &err)) == NULL) {
- error("Unable to connect to logind via DBus: %s", err->message);
+ lmi_error("Unable to connect to logind via DBus: %s", err->message);
g_error_free(err);
return NULL;
}
@@ -145,7 +141,7 @@ Proxy *power_create_logind()
// the proxied object doesn't exist => don't use logind
if (g_dbus_proxy_get_cached_property_names(logind_proxy) == NULL) {
g_object_unref(logind_proxy);
- debug("Logind DBus interface is not available");
+ lmi_debug("Logind DBus interface is not available");
return NULL;
}
return logind_proxy;
@@ -164,7 +160,7 @@ bool power_call_logind(Proxy *proxy, const char *method)
g_variant_new("(b)", false), G_DBUS_CALL_FLAGS_NONE, -1, NULL,
&err)) == NULL) {
- error("Unable to call: %s", method, err->message);
+ lmi_error("Unable to call: %s", method, err->message);
g_error_free(err);
return false;
} else {
@@ -186,7 +182,7 @@ bool power_check_logind(Proxy *proxy, const char *method)
if ((result = g_dbus_proxy_call_sync(proxy, method, g_variant_new("()"),
G_DBUS_CALL_FLAGS_NONE, -1, NULL, &err)) == NULL) {
- error("Unable to call %s: %s", method, err->message);
+ lmi_error("Unable to call %s: %s", method, err->message);
g_error_free(err);
return false;
} else {
@@ -236,7 +232,7 @@ void *state_change_thread(void *data)
MUTEX_UNLOCK(powerStateChangeJob->power);
}
- debug("State change thread cancelled\n");
+ lmi_debug("State change thread cancelled\n");
return NULL;
}
@@ -313,7 +309,7 @@ void *state_change_thread(void *data)
powerStateChangeJob->timeOfLastChange = time(NULL);
MUTEX_UNLOCK(powerStateChangeJob);
- debug("State change thread finished\n");
+ lmi_debug("State change thread finished\n");
return NULL;
}
@@ -334,13 +330,13 @@ int power_request_power_state(Power *power, unsigned short state)
}
free(states);
if (!found) {
- error("Invalid state requested: %d\n", state);
+ lmi_error("Invalid state requested: %d\n", state);
return CMPI_RC_ERR_INVALID_PARAMETER;
}
PowerStateChangeJob *powerStateChangeJob = malloc(sizeof(PowerStateChangeJob));
if (powerStateChangeJob == NULL) {
- error("Memory allocation failed");
+ lmi_error("Memory allocation failed");
return CMPI_RC_ERR_FAILED;
}
powerStateChangeJob->id = job_max_id++;
@@ -379,7 +375,7 @@ int power_request_power_state(Power *power, unsigned short state)
powerStateChangeJob->thread = power->broker->xft->newThread(state_change_thread, powerStateChangeJob, 1);
power->jobs = g_list_append(power->jobs, powerStateChangeJob);
MUTEX_UNLOCK(power);
- debug("State change thread started\n");
+ lmi_debug("State change thread started\n");
return rc;
}
@@ -388,7 +384,7 @@ unsigned short *power_available_requested_power_states(Power *power, int *count)
{
unsigned short *list = malloc(17 * sizeof(unsigned short));
if (list == NULL) {
- error("Memory allocation failed");
+ lmi_error("Memory allocation failed");
return NULL;
}
int i = 0;
diff --git a/src/power/power.h b/src/power/power.h
index 48a9409..477484b 100644
--- a/src/power/power.h
+++ b/src/power/power.h
@@ -21,8 +21,7 @@
#ifndef POWER_H
#define POWER_H
-#include <glib.h>
-#include "globals.h"
+#include "openlmi.h"
const char *provider_name;
const ConfigEntry *provider_config_defaults;
diff --git a/src/realmd/CMakeLists.txt b/src/realmd/CMakeLists.txt
index dbf2e54..af4d1c2 100644
--- a/src/realmd/CMakeLists.txt
+++ b/src/realmd/CMakeLists.txt
@@ -36,7 +36,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(${LIBRARY_NAME}
- openlmicommon
+ openlmi
${KONKRETCMPI_LIBRARIES}
${DBUS1_LIBRARIES}
${GLIB2_LIBRARIES}
diff --git a/src/realmd/LMI_HostedRealmdServiceProvider.c b/src/realmd/LMI_HostedRealmdServiceProvider.c
index 37d93fc..eecedbb 100644
--- a/src/realmd/LMI_HostedRealmdServiceProvider.c
+++ b/src/realmd/LMI_HostedRealmdServiceProvider.c
@@ -2,7 +2,6 @@
#include "LMI_HostedRealmdService.h"
#include "CIM_ComputerSystem.h"
#include "rdcp_util.h"
-#include "globals.h"
static const CMPIBroker* _cb;
diff --git a/src/realmd/LMI_RealmdServiceProvider.c b/src/realmd/LMI_RealmdServiceProvider.c
index 448fe49..d69e290 100644
--- a/src/realmd/LMI_RealmdServiceProvider.c
+++ b/src/realmd/LMI_RealmdServiceProvider.c
@@ -1,7 +1,6 @@
#include <konkret/konkret.h>
#include "LMI_RealmdService.h"
#include "rdcp_util.h"
-#include "globals.h"
#include "rdcp_error.h"
#include "rdcp_dbus.h"
diff --git a/src/realmd/rdcp_error.c b/src/realmd/rdcp_error.c
index 93d7ac3..cbc2f10 100644
--- a/src/realmd/rdcp_error.c
+++ b/src/realmd/rdcp_error.c
@@ -57,8 +57,8 @@ handle_g_error(GError **g_error, const CMPIBroker* mb, CMPIStatus* st, CMPIrc rc
g_return_val_if_fail (g_error != NULL && *g_error != NULL, failsafe_status);
g_return_val_if_fail (st != NULL, failsafe_status);
- message = g_string_sized_new(DEFAULT_STATUS_MSG_SIZE);
- g_string_append_printf(message, "%s: ", ORGID);
+ message = g_string_sized_new(BUFLEN);
+ g_string_append_printf(message, "%s: ", LMI_ORGID);
if (format) {
va_start(va, format);
@@ -106,8 +106,8 @@ SetCMPIStatus(const CMPIBroker* mb, CMPIStatus* st, CMPIrc rc,
g_return_val_if_fail (st != NULL, failsafe_status);
if (format) {
- message = g_string_sized_new(DEFAULT_STATUS_MSG_SIZE);
- g_string_append_printf(message, "%s: ", ORGID);
+ message = g_string_sized_new(BUFLEN);
+ g_string_append_printf(message, "%s: ", LMI_ORGID);
va_start(va, format);
g_string_append_vprintf(message, format, va);
diff --git a/src/realmd/rdcp_error.h b/src/realmd/rdcp_error.h
index ff60d5b..4865fb7 100644
--- a/src/realmd/rdcp_error.h
+++ b/src/realmd/rdcp_error.h
@@ -23,8 +23,6 @@ rdcp_error_code_to_string(rdcp_error_codes ec);
#define LMI_REALMD_RESULT_DOMAIN_DOES_NOT_SUPPORT_PROVIDED_CREDENTIALS 3
#define LMI_REALMD_RESULT_DOMAIN_DOES_NOT_SUPPORT_JOINING 4
-#define DEFAULT_STATUS_MSG_SIZE 128
-
CMPIStatus
handle_g_error(GError **g_error, const CMPIBroker* cb, CMPIStatus* status, CMPIrc rc,
const gchar *format, ...)
diff --git a/src/realmd/rdcp_util.c b/src/realmd/rdcp_util.c
index 30cb790..1d9d98d 100644
--- a/src/realmd/rdcp_util.c
+++ b/src/realmd/rdcp_util.c
@@ -269,7 +269,7 @@ instance_id_from_dbus_path(const char *dbus_path)
GString *g_instance_id = NULL;
g_instance_id = g_string_new(NULL);
- g_string_printf(g_instance_id, "%s:%s", ORGID, dbus_path);
+ g_string_printf(g_instance_id, "%s:%s", LMI_ORGID, dbus_path);
return g_string_free(g_instance_id, FALSE);
}
diff --git a/src/realmd/rdcp_util.h b/src/realmd/rdcp_util.h
index fb7dc85..c45fb73 100644
--- a/src/realmd/rdcp_util.h
+++ b/src/realmd/rdcp_util.h
@@ -9,7 +9,6 @@
#include "rdcp_error.h"
#include "openlmi.h"
-#include "globals.h"
const char *provider_name;
const ConfigEntry *provider_config_defaults;
diff --git a/src/service-dbus/CMakeLists.txt b/src/service-dbus/CMakeLists.txt
index 4ba3231..b1c42f1 100644
--- a/src/service-dbus/CMakeLists.txt
+++ b/src/service-dbus/CMakeLists.txt
@@ -28,7 +28,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
${GIO_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/src/indmanager)
target_link_libraries(${LIBRARY_NAME}
- openlmicommon
+ openlmi
openlmiindmanager
${KONKRETCMPI_LIBRARIES}
${GIO_LIBRARIES})
diff --git a/src/service-dbus/LMI_ServiceProvider.c b/src/service-dbus/LMI_ServiceProvider.c
index 709faa5..1f370c1 100644
--- a/src/service-dbus/LMI_ServiceProvider.c
+++ b/src/service-dbus/LMI_ServiceProvider.c
@@ -23,7 +23,6 @@
#include <stdint.h>
#include "LMI_Service.h"
#include "util/serviceutil.h"
-#include "globals.h"
static const CMPIBroker* _cb = NULL;
@@ -48,7 +47,7 @@ static CMPIStatus LMI_ServiceEnumInstanceNames(
{
const char *ns = KNameSpace(cop);
SList *slist = NULL;
- char output[1024];
+ char output[BUFLEN];
slist = service_find_all(output, sizeof(output));
if (slist == NULL) {
@@ -79,7 +78,7 @@ static CMPIStatus LMI_ServiceEnumInstances(
{
AllServices *svcs = NULL;
CMPIStatus status;
- char output[1024];
+ char output[BUFLEN];
if ((svcs = service_get_properties_all(output, sizeof(output))) != NULL) {
for(int i = 0; i < svcs->cnt; i++) {
@@ -130,7 +129,7 @@ static CMPIStatus LMI_ServiceGetInstance(
const CMPIObjectPath* cop,
const char** properties)
{
- char output[1024];
+ char output[BUFLEN];
int res;
LMI_Service w;
LMI_Service_InitFromObjectPath(&w, _cb, cop);
@@ -260,7 +259,7 @@ KUint32 LMI_Service_RequestStateChange(
unsigned int Service_RunOperation(const char *service, const char *operation, CMPIStatus *status)
{
- char output[1024];
+ char output[BUFLEN];
int res = service_operation(service, operation, output, sizeof(output));
if (res == 0) {
KSetStatus2(_cb, status, OK, output);
diff --git a/src/service-dbus/util/serviceutil.h b/src/service-dbus/util/serviceutil.h
index c5b0abf..4c2b63f 100644
--- a/src/service-dbus/util/serviceutil.h
+++ b/src/service-dbus/util/serviceutil.h
@@ -28,8 +28,6 @@
#include "openlmi.h"
#include "LMI_Service.h"
-#define ARRAY_SIZE(name) (sizeof(name) / sizeof(name[0]))
-
/* systemd job result string */
#define JR_DONE "done"
diff --git a/src/service/CMakeLists.txt b/src/service/CMakeLists.txt
index 6d75d38..aa2c6e2 100644
--- a/src/service/CMakeLists.txt
+++ b/src/service/CMakeLists.txt
@@ -21,7 +21,7 @@ add_library(${LIBRARY_NAME} SHARED
)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR})
-target_link_libraries(${LIBRARY_NAME} openlmicommon ${KONKRETCMPI_LIBRARIES})
+target_link_libraries(${LIBRARY_NAME} openlmi ${KONKRETCMPI_LIBRARIES})
# Create registration file
cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers)
diff --git a/src/service/LMI_ServiceProvider.c b/src/service/LMI_ServiceProvider.c
index 034418e..355e49c 100644
--- a/src/service/LMI_ServiceProvider.c
+++ b/src/service/LMI_ServiceProvider.c
@@ -23,7 +23,6 @@
#include <stdint.h>
#include "LMI_Service.h"
#include "util/serviceutil.h"
-#include "globals.h"
static const CMPIBroker* _cb = NULL;
diff --git a/src/service/util/serviceutil.c b/src/service/util/serviceutil.c
index 121360d..522c78e 100644
--- a/src/service/util/serviceutil.c
+++ b/src/service/util/serviceutil.c
@@ -29,8 +29,6 @@
#include "serviceutil.h"
-#define OPERATION_BUFSIZE 300
-#define STATUS_BUFSIZE 2000
#define MAX_SLIST_CNT 1000
char *suscript = "/usr/libexec/serviceutil.sh";
@@ -63,7 +61,7 @@ Service_Free_SList(SList *slist)
SList *
Service_Find_All(void)
{
- char svname[256];
+ char svname[BUFLEN];
Control *cc = malloc(sizeof(Control));
SList *slist;
@@ -101,18 +99,18 @@ Service_Find_All(void)
void *
Service_Begin_Enum(const char *service)
{
- char cmdbuffer[STATUS_BUFSIZE];
+ char cmdbuffer[BUFLEN];
Control *cc = malloc(sizeof(Control));
memset(&cmdbuffer, '\0', sizeof(cmdbuffer));
if (cc)
{
- snprintf(cmdbuffer, STATUS_BUFSIZE, "%s status %s", suscript, service);
+ snprintf(cmdbuffer, BUFLEN, "%s status %s", suscript, service);
cc->fp = popen(cmdbuffer, "r");
if (cc->fp)
{
- snprintf(cmdbuffer, STATUS_BUFSIZE, "%s is-enabled %s", suscript, service);
+ snprintf(cmdbuffer, BUFLEN, "%s is-enabled %s", suscript, service);
cc->fp2 = popen(cmdbuffer, "r");
if (!cc->fp2)
{
@@ -134,8 +132,8 @@ Service_Begin_Enum(const char *service)
int
Service_Next_Enum(void *handle, Service* svc, const char *service)
{
- char result[2000];
- char svname[256];
+ char result[BUFLEN];
+ char svname[BUFLEN];
int pid = 0;
Control *cc = (Control *) handle;
int state = 0, ret = 0;
@@ -204,7 +202,7 @@ unsigned int
Service_Operation(const char *service, const char *method, char *result, int resultlen)
{
int res = 0;
- char cmdbuffer[OPERATION_BUFSIZE];
+ char cmdbuffer[BUFLEN];
const char *const proc_path = "/proc/self/fd/";
char template[] = "/tmp/Service_OperationXXXXXX";
@@ -218,7 +216,7 @@ Service_Operation(const char *service, const char *method, char *result, int res
char cmd[cmd_size];
snprintf(cmd, cmd_size, "%s%ul", proc_path, tfd);
- snprintf(cmdbuffer, OPERATION_BUFSIZE, "%s %s %s > %s", suscript, method, service, cmd);
+ snprintf(cmdbuffer, BUFLEN, "%s %s %s > %s", suscript, method, service, cmd);
res = system(cmdbuffer);
diff --git a/src/service/util/serviceutil.h b/src/service/util/serviceutil.h
index d0b6663..0f6e31f 100644
--- a/src/service/util/serviceutil.h
+++ b/src/service/util/serviceutil.h
@@ -25,8 +25,6 @@
#include <stdio.h>
#include "openlmi.h"
-#define ARRAY_SIZE(name) (sizeof(name) / sizeof(name[0]))
-
const char *provider_name;
const ConfigEntry *provider_config_defaults;
diff --git a/src/software-dbus/CMakeLists.txt b/src/software-dbus/CMakeLists.txt
index 5202c33..050df9c 100644
--- a/src/software-dbus/CMakeLists.txt
+++ b/src/software-dbus/CMakeLists.txt
@@ -27,7 +27,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
${CMPI_INCLUDE_DIR}
${PACKAGEKIT_INCLUDE_DIRS})
target_link_libraries(${LIBRARY_NAME}
- openlmicommon
+ openlmi
${KONKRETCMPI_LIBRARIES}
${PACKAGEKIT_LIBRARIES})