Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
systemsmanagement:wbem
openhpi-cim
0003-Provide-correct-SystemName-close-session-o...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0003-Provide-correct-SystemName-close-session-on-Cleanup.patch of Package openhpi-cim
From 3ddbc0fd4e1bf0759969d6d9cb5538fa94bab305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de> Date: Wed, 19 Oct 2011 14:15:01 +0200 Subject: [PATCH 3/4] Provide correct SystemName, close session on Cleanup() --- src/Hpi.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/src/Hpi.c b/src/Hpi.c index 46f8e72..a38ecdb 100644 --- a/src/Hpi.c +++ b/src/Hpi.c @@ -29,6 +29,10 @@ static char _CLASSNAME[] = "HPI_LogicalDevice"; #include "cmpimacs.h" #include <SaHpi.h> #include <oh_utils.h> +#include <stdlib.h> +#include <netdb.h> +#include <netinet/in.h> +#include <sys/socket.h> /* NULL terminated list of key property names for this class */ static char * _KEYNAMES[] = {"RID", NULL}; @@ -56,6 +60,20 @@ static struct hpi_handle { /* Handle to the CIM broker. This is initialized by the CIMOM when the provider is loaded */ static const CMPIBroker * _BROKER; +static char *fqdn() +{ +#ifndef NI_MAXHOST +#define NI_MAXHOST 1025 +#endif + char buf[NI_MAXHOST]; + char *s; + gethostname(buf, NI_MAXHOST); + s = buf + strlen(buf); + *s++ = '.'; + getdomainname(s, NI_MAXHOST-(s-buf+1)); + + return strdup(buf); +} /* --------------------------------------------------------------------------- * CMPI INSTANCE PROVIDER FUNCTIONS @@ -101,6 +119,7 @@ static CMPIStatus EnumInstanceNames( rdr_id = SAHPI_FIRST_ENTRY; do { + char *s; memset(&rdr, 0, sizeof(rdr)); error = saHpiRdrGet(hpi_hnd.sid, entry.ResourceId, @@ -137,10 +156,11 @@ static CMPIStatus EnumInstanceNames( CMAddKey(objectpath, "DeviceID", (CMPIValue *)buf, CMPI_chars); - CMAddKey(objectpath, "SystemCreationClassName", (CMPIValue *)"Linux_ComputerSystem", CMPI_chars); - - CMAddKey(objectpath, "SystemName", (CMPIValue *)"Laptop", CMPI_chars); + CMAddKey(objectpath, "SystemCreationClassName", (CMPIValue *)"HPI_LogicalDevice", CMPI_chars); + s = fqdn(); + CMAddKey(objectpath, "SystemName", (CMPIValue *)s, CMPI_chars); + free(s); CMAddKey(objectpath, "CreationClassName", (CMPIValue *)"HPI_LogicalDevice", CMPI_chars); /* Add the object path for this resource to the list of results */ @@ -187,7 +207,7 @@ static CMPIStatus EnumInstances( _OSBASE_TRACE(1,("%s:EnumInstances() called", _CLASSNAME)); do { - + char *s; error = saHpiRptEntryGet(hpi_hnd.sid, entry_id, &entry_id, &entry); @@ -234,8 +254,11 @@ static CMPIStatus EnumInstances( CMSetProperty(instance, "DeviceID", (CMPIValue *)buf, CMPI_chars); - CMSetProperty(instance, "SystemCreationClassName", (CMPIValue *)"Linux_ComputerSystem", CMPI_chars); - CMSetProperty(instance, "SystemName", (CMPIValue *)"Laptop", CMPI_chars); + CMSetProperty(instance, "SystemCreationClassName", (CMPIValue *)"HPI_LogicalDevice", CMPI_chars); + s = fqdn(); + CMSetProperty(instance, "SystemName", (CMPIValue *)s, CMPI_chars); + free(s); + CMSetProperty(instance, "CreationClassName", (CMPIValue *)"HPI_LogicalDevice", CMPI_chars); /* SessionId */ @@ -534,7 +557,7 @@ static CMPIStatus Cleanup( _OSBASE_TRACE(1,("%s:Cleanup() called", self->ft->miName)); - /* Nothing needs to be done for cleanup */ + saHpiSessionClose(hpi_hnd.sid); /* Finished */ -- 2.38.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor