diff options
author | Radek Novacek <rnovacek@redhat.com> | 2012-07-30 09:52:44 +0200 |
---|---|---|
committer | Radek Novacek <rnovacek@redhat.com> | 2012-07-30 09:52:44 +0200 |
commit | ef14153afbe20032292818f54107ded9665ed8ba (patch) | |
tree | 9d38ee9a5e406eb63a58fe2b33638da01831c1d6 | |
parent | 10a17ee9c626b0d231806b8fab37cb7e3f0f9a1d (diff) | |
download | openlmi-providers-ef14153afbe20032292818f54107ded9665ed8ba.tar.gz openlmi-providers-ef14153afbe20032292818f54107ded9665ed8ba.tar.xz openlmi-providers-ef14153afbe20032292818f54107ded9665ed8ba.zip |
service: use global functions for getting system (creation class) name
-rw-r--r-- | src/service/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/service/Linux_ServiceProvider.c | 8 | ||||
-rw-r--r-- | src/service/ServiceUtils.c | 62 | ||||
-rw-r--r-- | src/service/ServiceUtils.h | 38 |
4 files changed, 4 insertions, 105 deletions
diff --git a/src/service/CMakeLists.txt b/src/service/CMakeLists.txt index 631e0c8..2ee6a2c 100644 --- a/src/service/CMakeLists.txt +++ b/src/service/CMakeLists.txt @@ -5,7 +5,6 @@ set(MOF Linux_Service.mof) set(provider_SRCS util/serviceutil.c - ServiceUtils.c ) konkretcmpi_generate(${MOF} diff --git a/src/service/Linux_ServiceProvider.c b/src/service/Linux_ServiceProvider.c index a0c8ccc..cbfb4f6 100644 --- a/src/service/Linux_ServiceProvider.c +++ b/src/service/Linux_ServiceProvider.c @@ -1,8 +1,8 @@ #include <konkret/konkret.h> #include <stdint.h> #include "Linux_Service.h" -#include "ServiceUtils.h" #include "util/serviceutil.h" +#include "globals.h" static const CMPIBroker* _cb = NULL; @@ -31,9 +31,9 @@ static CMPIStatus Linux_ServiceEnumInstanceNames( for (int i = 0; i < slist->cnt; i++) { Linux_ServiceRef w; Linux_ServiceRef_Init(&w, _cb, ns); - Linux_ServiceRef_Set_CreationClassName(&w, CreationClassName()); - Linux_ServiceRef_Set_SystemCreationClassName(&w, SystemCreationClassName()); - Linux_ServiceRef_Set_SystemName(&w, SystemName()); + Linux_ServiceRef_Set_CreationClassName(&w, "Linux_Service"); + Linux_ServiceRef_Set_SystemCreationClassName(&w, get_system_creation_class_name()); + Linux_ServiceRef_Set_SystemName(&w, get_system_name()); Linux_ServiceRef_Set_Name(&w, slist->name[i]); KReturnObjectPath(cr, w); diff --git a/src/service/ServiceUtils.c b/src/service/ServiceUtils.c deleted file mode 100644 index fca8167..0000000 --- a/src/service/ServiceUtils.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * ServiceUtils.c - * - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Based on Syslog_ServiceUtils.c from sblim-cmpi-syslog written by - * R Sharada <sharada@in.ibm.com>, Copyright (c) IBM Corp. 2003, 2009 - * - * Red Hat Author(s): Vitezslav Crhonek <vcrhonek@redhat.com> - * - */ - -#include <cmpidt.h> -#include <cmpift.h> -#include <cmpimacs.h> -#include <unistd.h> -#include <string.h> - -#include "ServiceUtils.h" -#include "util/serviceutil.h" -static char sccn[] = "CIM_UnitaryComputerSystem"; -static char ccn[] = "Linux_Service"; -static char csn[500] = ""; - - - -char * -SystemCreationClassName() -{ - return sccn; -} - - - -char * -SystemName() -{ - if (*csn == 0) - gethostname(csn, sizeof(csn)); - return csn; -} - - - -char * -CreationClassName() -{ - return ccn; -} diff --git a/src/service/ServiceUtils.h b/src/service/ServiceUtils.h deleted file mode 100644 index c76bc3c..0000000 --- a/src/service/ServiceUtils.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * ServiceUtils.h - * - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Based on Syslog_ServiceUtils.h from sblim-cmpi-syslog written by - * R Sharada <sharada@in.ibm.com>, Copyright (c) IBM Corp. 2003, 2009 - * - * Red Hat Author(s): Vitezslav Crhonek <vcrhonek@redhat.com> - * - */ - -#ifndef SERVICEUTILS_H -#define SERVICEUTILS_H - -char * -SystemCreationClassName(); - -char * -SystemName(); - -char * -CreationClassName(); - -#endif |