From 7f40ebbf575d93a9d0bc540c484969ec614f308b Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Fri, 8 Feb 2013 13:16:31 +0100 Subject: New provider: LogicalFile --- src/CMakeLists.txt | 4 + src/logicalfile/CMakeLists.txt | 29 ++ src/logicalfile/LMI_DataFileProvider.c | 147 ++++++++ .../LMI_DirectoryContainsFileProvider.c | 411 +++++++++++++++++++++ src/logicalfile/LMI_FIFOPipeFileProvider.c | 147 ++++++++ src/logicalfile/LMI_FileIdentityProvider.c | 302 +++++++++++++++ src/logicalfile/LMI_SymbolicLinkProvider.c | 157 ++++++++ src/logicalfile/LMI_UnixDeviceFileProvider.c | 162 ++++++++ src/logicalfile/LMI_UnixDirectoryProvider.c | 160 ++++++++ src/logicalfile/LMI_UnixFileProvider.c | 177 +++++++++ src/logicalfile/file.c | 76 ++++ src/logicalfile/file.h | 107 ++++++ 12 files changed, 1879 insertions(+) create mode 100644 src/logicalfile/CMakeLists.txt create mode 100644 src/logicalfile/LMI_DataFileProvider.c create mode 100644 src/logicalfile/LMI_DirectoryContainsFileProvider.c create mode 100644 src/logicalfile/LMI_FIFOPipeFileProvider.c create mode 100644 src/logicalfile/LMI_FileIdentityProvider.c create mode 100644 src/logicalfile/LMI_SymbolicLinkProvider.c create mode 100644 src/logicalfile/LMI_UnixDeviceFileProvider.c create mode 100644 src/logicalfile/LMI_UnixDirectoryProvider.c create mode 100644 src/logicalfile/LMI_UnixFileProvider.c create mode 100644 src/logicalfile/file.c create mode 100644 src/logicalfile/file.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6d41f49..7318911 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,3 +28,7 @@ endif (WITH-ACCOUNT) if (WITH-HARDWARE) add_subdirectory(hardware) endif (WITH-HARDWARE) + +if (WITH-LOGICALFILE) + add_subdirectory(logicalfile) +endif (WITH-LOGICALFILE) diff --git a/src/logicalfile/CMakeLists.txt b/src/logicalfile/CMakeLists.txt new file mode 100644 index 0000000..8b0097a --- /dev/null +++ b/src/logicalfile/CMakeLists.txt @@ -0,0 +1,29 @@ + +set(PROVIDER_NAME LogicalFile) +set(LIBRARY_NAME cmpiLMI_${PROVIDER_NAME}) +set(MOF LMI_LogicalFile.mof) + +set(provider_SRCS + file.c +) + +konkretcmpi_generate(${MOF} + CIM_PROVIDERS + CIM_HEADERS +) + +add_library(${LIBRARY_NAME} SHARED + ${provider_SRCS} + ${CIM_PROVIDERS} + ${CIM_HEADERS} +) + +#pkg_check_modules(LIBPCI REQUIRED libpci) + +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR} ${LIBPCI_INCLUDE_DIR}) +target_link_libraries(${LIBRARY_NAME} openlmicommon ${KONKRETCMPI_LIBRARIES} ${LIBPCI_LIBRARIES}) + +# Create registration file +cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers) + +install(TARGETS ${LIBRARY_NAME} DESTINATION lib${LIB_SUFFIX}/cmpi) diff --git a/src/logicalfile/LMI_DataFileProvider.c b/src/logicalfile/LMI_DataFileProvider.c new file mode 100644 index 0000000..aa8e9e1 --- /dev/null +++ b/src/logicalfile/LMI_DataFileProvider.c @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2012 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: Jan Synacek + */ +#include +#include "LMI_DataFile.h" +#include "file.h" + +static const CMPIBroker* _cb = NULL; + +static void LMI_DataFileInitialize() +{ +} + +static CMPIStatus LMI_DataFileCleanup( + CMPIInstanceMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_DataFileEnumInstanceNames( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_DataFileEnumInstances( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_DataFileGetInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + get_instance(DataFile, S_IFREG, "Not a regular file: %s"); + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_DataFileCreateInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_DataFileModifyInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_DataFileDeleteInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_DataFileExecQuery( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* lang, + const char* query) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +CMInstanceMIStub( + LMI_DataFile, + LMI_DataFile, + _cb, + LMI_DataFileInitialize()) + +static CMPIStatus LMI_DataFileMethodCleanup( + CMPIMethodMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_DataFileInvokeMethod( + CMPIMethodMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* meth, + const CMPIArgs* in, + CMPIArgs* out) +{ + return LMI_DataFile_DispatchMethod( + _cb, mi, cc, cr, cop, meth, in, out); +} + +CMMethodMIStub( + LMI_DataFile, + LMI_DataFile, + _cb, + LMI_DataFileInitialize()) + +KONKRET_REGISTRATION( + "root/cimv2", + "LMI_DataFile", + "LMI_DataFile", + "instance method") +/* vi: set et: */ diff --git a/src/logicalfile/LMI_DirectoryContainsFileProvider.c b/src/logicalfile/LMI_DirectoryContainsFileProvider.c new file mode 100644 index 0000000..29bde15 --- /dev/null +++ b/src/logicalfile/LMI_DirectoryContainsFileProvider.c @@ -0,0 +1,411 @@ +/* + * Copyright (C) 2012 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: Jan Synacek + */ +#include +#include "LMI_DirectoryContainsFile.h" +#include "LMI_UnixDirectory.h" +#include "CIM_LogicalFile.h" +#include "CIM_Directory.h" +#include "file.h" + +static const CMPIBroker* _cb; + +/* XXX if a directory contains more than MAX_REFS files, + * broker will abort with an error */ +/* const unsigned int MAX_REFS = 65536; */ +const unsigned int MAX_REFS = 4096; + +static CMPIStatus dir_file_objectpaths( + const CMPIContext* cc, + const CMPIResult* cr, + const char** properties, + const char *namespace, + const char *path, + CMPIObjectPath **ops, + unsigned int *count) +{ + CMPIObjectPath *o; + CMPIStatus st; + unsigned int i = 0; + + struct stat sb; + struct dirent *de; + DIR *dp; + dp = opendir(path); + while ((de = readdir(dp))) { + if (!strcmp(de->d_name, ".")) { + continue; + } + + char rpath[BUFLEN]; + char fileclass[BUFLEN]; + char *aux = strdup(path); + + if (!strcmp(de->d_name, "..")) { + strncpy(rpath, dirname(aux), BUFLEN); + free(aux); + } else { + snprintf(rpath, BUFLEN, "%s/%s", + (!strcmp(path, "/")) ? "" : path, + de->d_name); + } + + if (lstat(rpath, &sb) < 0) { + char err[BUFLEN]; + snprintf(err, BUFLEN, "Can't stat file: %s", rpath); + CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, err); + } else { + (S_ISREG(sb.st_mode)) ? strcpy(fileclass, "LMI_DataFile") : + (S_ISDIR(sb.st_mode)) ? strcpy(fileclass, "LMI_UnixDirectory") : + (S_ISCHR(sb.st_mode)) ? strcpy(fileclass, "LMI_UnixDeviceFile") : + (S_ISBLK(sb.st_mode)) ? strcpy(fileclass, "LMI_UnixDeviceFile") : + (S_ISLNK(sb.st_mode)) ? strcpy(fileclass, "LMI_SymbolicLink") : + (S_ISFIFO(sb.st_mode)) ? strcpy(fileclass, "LMI_FIFOPipeFile") : + strcpy(fileclass, "Unknown"); + } + + CIM_LogicalFileRef cim_lfr; + CIM_LogicalFileRef_Init(&cim_lfr, _cb, namespace); + fill_logicalfile(CIM_LogicalFileRef, &cim_lfr, rpath, fileclass); + o = CIM_LogicalFileRef_ToObjectPath(&cim_lfr, &st); + CMSetClassName(o, fileclass); + + ops[i++] = o; + } + *count = i; + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus associators( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* resultClass, + const char* role, + const char* resultRole, + const char** properties, + int names) +{ + CMPIObjectPath *o; + CMPIInstance *ci; + CMPIStatus st; + CMPIData cd, pathd; + const char *ns = KNameSpace(cop); + + st = lmi_check_required(_cb, cop, LOGICALFILE); + if (st.rc != CMPI_RC_OK) { + return st; + } + + cd = CMGetKey(cop, "CreationClassName", &st); + const char *ccname = KChars(cd.value.string); + pathd = CMGetKey(cop, "Name", &st); + const char *path = KChars(pathd.value.string); + + CMPIObjectPath *refs[MAX_REFS]; + unsigned int count; + + if (CMClassPathIsA(_cb, cop, LMI_UnixDirectory_ClassName, &st)) { + /* UnixDirectory */ + st = dir_file_objectpaths(cc, cr, properties, ns, path, refs, &count); + if (st.rc != CMPI_RC_OK) { + return st; + } + if (count > MAX_REFS) { + CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Too many files in a single directory..."); + } + for (unsigned int i = 0; i < count; i++) { + if (names) { + CMReturnObjectPath(cr, refs[i]); + } else { + ci = _cb->bft->getInstance(_cb, cc, refs[i], properties, &st); + CMReturnInstance(cr, ci); + } + } + } else { + /* LogicalFile */ + CIM_LogicalFileRef cim_lfr; + CIM_LogicalFileRef_Init(&cim_lfr, _cb, ns); + fill_logicalfile(CIM_LogicalFileRef, &cim_lfr, path, ccname); + + o = CIM_LogicalFileRef_ToObjectPath(&cim_lfr, &st); + CMSetClassName(o, ccname); + if (names) { + CMReturnObjectPath(cr, o); + } else { + ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); + CMReturnInstance(cr, ci); + } + } + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus references( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* role, + const char** properties, + int names) +{ + LMI_DirectoryContainsFile lmi_dcf; + CMPIStatus st; + CMPIData pathd; + CMPIData cd; + const char *ns = KNameSpace(cop); + + /* GroupComponent */ + CIM_DirectoryRef lmi_dr; + /* PartComponent */ + CIM_LogicalFileRef lmi_lfr; + CMPIObjectPath *o; + CMPIInstance *ci; + + CIM_DirectoryRef_Init(&lmi_dr, _cb, ns); + CIM_LogicalFileRef_Init(&lmi_lfr, _cb, ns); + LMI_DirectoryContainsFile_Init(&lmi_dcf, _cb, ns); + + st = lmi_check_required(_cb, cop, LOGICALFILE); + if (st.rc != CMPI_RC_OK) { + return st; + } + + cd = CMGetKey(cop, "CreationClassName", &st); + const char *ccname = KChars(cd.value.string); + pathd = CMGetKey(cop, "Name", &st); + const char *path = KChars(pathd.value.string); + + if (!strcmp(ccname, LMI_UnixDirectory_ClassName)) { + /* got GroupComponent - DirectoryRef */ + fill_logicalfile(CIM_DirectoryRef, &lmi_dr, path, LMI_UnixDirectory_ClassName); + o = CIM_DirectoryRef_ToObjectPath(&lmi_dr, &st); + CMSetClassName(o, LMI_UnixDirectory_ClassName); + LMI_DirectoryContainsFile_SetObjectPath_GroupComponent(&lmi_dcf, o); + + /* PartComponent */ + CMPIObjectPath *refs[MAX_REFS]; + unsigned int count; + st = dir_file_objectpaths(cc, cr, properties, ns, path, refs, &count); + if (st.rc != CMPI_RC_OK) { + return st; + } + if (count > MAX_REFS) { + CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Too many files in a single directory..."); + } + for (unsigned int i = 0; i < count; i++) { + if (names) { + LMI_DirectoryContainsFile_SetObjectPath_PartComponent(&lmi_dcf, refs[i]); + o = LMI_DirectoryContainsFile_ToObjectPath(&lmi_dcf, &st); + CMReturnObjectPath(cr, o); + } else { + ci = _cb->bft->getInstance(_cb, cc, refs[i], properties, &st); + CMReturnInstance(cr, ci); + } + } + } else { + /* got PartComponent - LogicalFileRef */ + fill_logicalfile(CIM_LogicalFileRef, &lmi_lfr, path, ccname); + o = CIM_LogicalFileRef_ToObjectPath(&lmi_lfr, &st); + CMSetClassName(o, ccname); + LMI_DirectoryContainsFile_SetObjectPath_PartComponent(&lmi_dcf, o); + + /* GroupComponent */ + char *aux = strdup(path); + fill_logicalfile(CIM_DirectoryRef, &lmi_dr, dirname(aux), LMI_UnixDirectory_ClassName); + o = CIM_DirectoryRef_ToObjectPath(&lmi_dr, &st); + CMSetClassName(o, LMI_UnixDirectory_ClassName); + if (names) { + LMI_DirectoryContainsFile_SetObjectPath_GroupComponent(&lmi_dcf, o); + o = LMI_DirectoryContainsFile_ToObjectPath(&lmi_dcf, &st); + CMReturnObjectPath(cr, o); + } else { + ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); + CMReturnInstance(cr, ci); + } + free(aux); + } + CMReturn(CMPI_RC_OK); +} + +static void LMI_DirectoryContainsFileInitialize() +{ +} + +static CMPIStatus LMI_DirectoryContainsFileCleanup( + CMPIInstanceMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_DirectoryContainsFileEnumInstanceNames( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_DirectoryContainsFileEnumInstances( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_DirectoryContainsFileGetInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + /* TODO TBI */ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_DirectoryContainsFileCreateInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_DirectoryContainsFileModifyInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci, + const char**properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_DirectoryContainsFileDeleteInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_DirectoryContainsFileExecQuery( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* lang, + const char* query) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_DirectoryContainsFileAssociationCleanup( + CMPIAssociationMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + + +static CMPIStatus LMI_DirectoryContainsFileAssociators( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* resultClass, + const char* role, + const char* resultRole, + const char** properties) +{ + return associators(mi, cc, cr, cop, assocClass, resultClass, role, resultRole, + properties, 0); +} + +static CMPIStatus LMI_DirectoryContainsFileAssociatorNames( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* resultClass, + const char* role, + const char* resultRole) +{ + return associators(mi, cc, cr, cop, assocClass, resultClass, role, resultRole, + NULL, 1); +} + +static CMPIStatus LMI_DirectoryContainsFileReferences( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* role, + const char** properties) +{ + return references(mi, cc, cr, cop, assocClass, role, properties, 0); +} + +static CMPIStatus LMI_DirectoryContainsFileReferenceNames( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* role) +{ + return references(mi, cc, cr, cop, assocClass, role, NULL, 1); +} + +CMInstanceMIStub( + LMI_DirectoryContainsFile, + LMI_DirectoryContainsFile, + _cb, + LMI_DirectoryContainsFileInitialize()) + +CMAssociationMIStub( + LMI_DirectoryContainsFile, + LMI_DirectoryContainsFile, + _cb, + LMI_DirectoryContainsFileInitialize()) + +KONKRET_REGISTRATION( + "root/cimv2", + "LMI_DirectoryContainsFile", + "LMI_DirectoryContainsFile", + "instance association") +/* vi: set et: */ diff --git a/src/logicalfile/LMI_FIFOPipeFileProvider.c b/src/logicalfile/LMI_FIFOPipeFileProvider.c new file mode 100644 index 0000000..3a4c1ff --- /dev/null +++ b/src/logicalfile/LMI_FIFOPipeFileProvider.c @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2012 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: Jan Synacek + */ +#include +#include "LMI_FIFOPipeFile.h" +#include "file.h" + +static const CMPIBroker* _cb = NULL; + +static void LMI_FIFOPipeFileInitialize() +{ +} + +static CMPIStatus LMI_FIFOPipeFileCleanup( + CMPIInstanceMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_FIFOPipeFileEnumInstanceNames( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_FIFOPipeFileEnumInstances( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_FIFOPipeFileGetInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + get_instance(FIFOPipeFile, S_IFIFO, "No such FIFO: %s"); + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_FIFOPipeFileCreateInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_FIFOPipeFileModifyInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_FIFOPipeFileDeleteInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_FIFOPipeFileExecQuery( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* lang, + const char* query) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +CMInstanceMIStub( + LMI_FIFOPipeFile, + LMI_FIFOPipeFile, + _cb, + LMI_FIFOPipeFileInitialize()) + +static CMPIStatus LMI_FIFOPipeFileMethodCleanup( + CMPIMethodMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_FIFOPipeFileInvokeMethod( + CMPIMethodMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* meth, + const CMPIArgs* in, + CMPIArgs* out) +{ + return LMI_FIFOPipeFile_DispatchMethod( + _cb, mi, cc, cr, cop, meth, in, out); +} + +CMMethodMIStub( + LMI_FIFOPipeFile, + LMI_FIFOPipeFile, + _cb, + LMI_FIFOPipeFileInitialize()) + +KONKRET_REGISTRATION( + "root/cimv2", + "LMI_FIFOPipeFile", + "LMI_FIFOPipeFile", + "instance method") +/* vi: set et: */ diff --git a/src/logicalfile/LMI_FileIdentityProvider.c b/src/logicalfile/LMI_FileIdentityProvider.c new file mode 100644 index 0000000..453764e --- /dev/null +++ b/src/logicalfile/LMI_FileIdentityProvider.c @@ -0,0 +1,302 @@ +/* + * Copyright (C) 2012 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: Jan Synacek + */ +#include +#include "CIM_LogicalFile.h" +#include "CIM_UnixFile.h" +#include "LMI_FileIdentity.h" +#include "LMI_UnixFile.h" +#include "LMI_DataFile.h" +#include "file.h" + +static const CMPIBroker* _cb; + +static CMPIStatus associators( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* resultClass, + const char* role, + const char* resultRole, + const char** properties, + int names) +{ + CMPIStatus st, res; + CMPIInstance *ci; + + /* TODO filtering */ + if (names) { + res = CMReturnObjectPath(cr, cop); + } else { + ci = _cb->bft->getInstance(_cb, cc, cop, properties, &st); + res = CMReturnInstance(cr, ci); + } + + return res; +} + +static CMPIStatus references( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* role, + const char** properties, + int names) +{ + LMI_FileIdentity lmi_fi; + /* SameElement */ + LMI_UnixFile lmi_uf; + /* SystemElement */ + CIM_LogicalFileRef lmi_lfr; + CMPIStatus st; + CMPIData pathd; + CMPIData cnd; + const char *ns = KNameSpace(cop); + CMPIInstance *ci; + + LMI_FileIdentity_Init(&lmi_fi, _cb, ns); + + if (CMClassPathIsA(_cb, cop, LMI_UnixFile_ClassName, &st)) { + /* got SameElement - UnixFile */ + LMI_FileIdentity_SetObjectPath_SameElement(&lmi_fi, cop); + + st = lmi_check_required(_cb, cop, UNIXFILE); + if (st.rc != CMPI_RC_OK) { + return st; + } + + pathd = CMGetKey(cop, "LFName", &st); + cnd = CMGetKey(cop, "LFCreationClassName", &st); + const char *path = KChars(pathd.value.string); + const char *ccname = KChars(cnd.value.string); + + /* SystemElement */ + CIM_LogicalFileRef_Init(&lmi_lfr, _cb, ns); + fill_logicalfile(CIM_LogicalFileRef, &lmi_lfr, path, ccname); + CMPIObjectPath *o = CIM_LogicalFileRef_ToObjectPath(&lmi_lfr, &st); + CMSetClassName(o, ccname); + + if (names) { + LMI_FileIdentity_SetObjectPath_SystemElement(&lmi_fi, o); + } else { + ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); + CMReturnInstance(cr, ci); + } + } else { + /* got SystemElement - LogicalFile */ + LMI_FileIdentity_SetObjectPath_SystemElement(&lmi_fi, cop); + + st = lmi_check_required(_cb, cop, LOGICALFILE); + if (st.rc != CMPI_RC_OK) { + return st; + } + + pathd = CMGetKey(cop, "Name", &st); + cnd = CMGetKey(cop, "CreationClassName", &st); + const char *path = KChars(pathd.value.string); + const char *ccname = KChars(cnd.value.string); + + /* SameElement */ + LMI_UnixFile_Init(&lmi_uf, _cb, ns); + LMI_UnixFile_Set_LFName(&lmi_uf, path); + LMI_UnixFile_Set_CSCreationClassName(&lmi_uf, get_system_creation_class_name()); + LMI_UnixFile_Set_CSName(&lmi_uf, get_system_name()); + LMI_UnixFile_Set_FSCreationClassName(&lmi_uf, FSCREATIONCLASSNAME); + LMI_UnixFile_Set_FSName(&lmi_uf, FSNAME); + LMI_UnixFile_Set_LFCreationClassName(&lmi_uf, ccname); + CMPIObjectPath *o = LMI_UnixFile_ToObjectPath(&lmi_uf, &st); + if (names) { + LMI_FileIdentity_SetObjectPath_SameElement(&lmi_fi, o); + } else { + ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); + CMReturnInstance(cr, ci); + } + } + + if (names) { + return CMReturnObjectPath(cr, LMI_FileIdentity_ToObjectPath(&lmi_fi, &st)); + } + CMReturn(CMPI_RC_OK); +} + +static void LMI_FileIdentityInitialize() +{ +} + +static CMPIStatus LMI_FileIdentityCleanup( + CMPIInstanceMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_FileIdentityEnumInstanceNames( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_FileIdentityEnumInstances( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_FileIdentityGetInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + /* TODO TBI */ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_FileIdentityCreateInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_FileIdentityModifyInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci, + const char**properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_FileIdentityDeleteInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_FileIdentityExecQuery( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* lang, + const char* query) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_FileIdentityAssociationCleanup( + CMPIAssociationMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_FileIdentityAssociators( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* resultClass, + const char* role, + const char* resultRole, + const char** properties) +{ + return associators(mi, cc, cr, cop, assocClass, resultClass, + role, resultRole, properties, 0); +} + +static CMPIStatus LMI_FileIdentityAssociatorNames( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* resultClass, + const char* role, + const char* resultRole) +{ + return associators(mi, cc, cr, cop, assocClass, resultClass, + role, resultRole, NULL, 1); +} + +static CMPIStatus LMI_FileIdentityReferences( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* role, + const char** properties) +{ + return references(mi, cc, cr, cop, assocClass, role, properties, 0); +} + +static CMPIStatus LMI_FileIdentityReferenceNames( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* role) +{ + return references(mi, cc, cr, cop, assocClass, role, NULL, 1); +} + +CMInstanceMIStub( + LMI_FileIdentity, + LMI_FileIdentity, + _cb, + LMI_FileIdentityInitialize()) + +CMAssociationMIStub( + LMI_FileIdentity, + LMI_FileIdentity, + _cb, + LMI_FileIdentityInitialize()) + +KONKRET_REGISTRATION( + "root/cimv2", + "LMI_FileIdentity", + "LMI_FileIdentity", + "instance association") +/* vi: set et: */ diff --git a/src/logicalfile/LMI_SymbolicLinkProvider.c b/src/logicalfile/LMI_SymbolicLinkProvider.c new file mode 100644 index 0000000..0645689 --- /dev/null +++ b/src/logicalfile/LMI_SymbolicLinkProvider.c @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2012 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: Jan Synacek + */ +#include +#include "LMI_SymbolicLink.h" +#include "file.h" + +static const CMPIBroker* _cb = NULL; + +static void LMI_SymbolicLinkInitialize() +{ +} + +static CMPIStatus LMI_SymbolicLinkCleanup( + CMPIInstanceMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_SymbolicLinkEnumInstanceNames( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_SymbolicLinkEnumInstances( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_SymbolicLinkGetInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + LMI_SymbolicLink lmi_file; + const char *path; + char rpath[PATH_MAX]; + + LMI_SymbolicLink_InitFromObjectPath(&lmi_file, _cb, cop); + path = KChars(lmi_file.Name.value); + fill_basic(SymbolicLink, path, S_IFLNK, "No such symlink: %s"); + realpath(path, rpath); + LMI_SymbolicLink_Set_TargetFile(&lmi_file, rpath); + + KReturnInstance(cr, lmi_file); + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_SymbolicLinkCreateInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_SymbolicLinkModifyInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_SymbolicLinkDeleteInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_SymbolicLinkExecQuery( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* lang, + const char* query) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +CMInstanceMIStub( + LMI_SymbolicLink, + LMI_SymbolicLink, + _cb, + LMI_SymbolicLinkInitialize()) + +static CMPIStatus LMI_SymbolicLinkMethodCleanup( + CMPIMethodMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_SymbolicLinkInvokeMethod( + CMPIMethodMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* meth, + const CMPIArgs* in, + CMPIArgs* out) +{ + return LMI_SymbolicLink_DispatchMethod( + _cb, mi, cc, cr, cop, meth, in, out); +} + +CMMethodMIStub( + LMI_SymbolicLink, + LMI_SymbolicLink, + _cb, + LMI_SymbolicLinkInitialize()) + +KONKRET_REGISTRATION( + "root/cimv2", + "LMI_SymbolicLink", + "LMI_SymbolicLink", + "instance method") +/* vi: set et: */ diff --git a/src/logicalfile/LMI_UnixDeviceFileProvider.c b/src/logicalfile/LMI_UnixDeviceFileProvider.c new file mode 100644 index 0000000..22d4486 --- /dev/null +++ b/src/logicalfile/LMI_UnixDeviceFileProvider.c @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2012 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: Jan Synacek + */ +#include +#include "LMI_UnixDeviceFile.h" +#include "file.h" + +static const CMPIBroker* _cb = NULL; + +static void LMI_UnixDeviceFileInitialize() +{ +} + +static CMPIStatus LMI_UnixDeviceFileCleanup( + CMPIInstanceMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_UnixDeviceFileEnumInstanceNames( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixDeviceFileEnumInstances( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixDeviceFileGetInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + LMI_UnixDeviceFile lmi_file; + const char *path; + char tmp[16]; + + LMI_UnixDeviceFile_InitFromObjectPath(&lmi_file, _cb, cop); + path = KChars(lmi_file.Name.value); + fill_basic(UnixDeviceFile, path, S_IFCHR | S_IFBLK, "No such device: %s"); + + sprintf(tmp, "%u", sb.st_rdev); + LMI_UnixDeviceFile_Set_DeviceId(&lmi_file, tmp); + sprintf(tmp, "%u", major(sb.st_rdev)); + LMI_UnixDeviceFile_Set_DeviceMajor(&lmi_file, tmp); + sprintf(tmp, "%u", minor(sb.st_rdev)); + LMI_UnixDeviceFile_Set_DeviceMinor(&lmi_file, tmp); + + KReturnInstance(cr, lmi_file); + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_UnixDeviceFileCreateInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixDeviceFileModifyInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixDeviceFileDeleteInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixDeviceFileExecQuery( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* lang, + const char* query) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +CMInstanceMIStub( + LMI_UnixDeviceFile, + LMI_UnixDeviceFile, + _cb, + LMI_UnixDeviceFileInitialize()) + +static CMPIStatus LMI_UnixDeviceFileMethodCleanup( + CMPIMethodMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_UnixDeviceFileInvokeMethod( + CMPIMethodMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* meth, + const CMPIArgs* in, + CMPIArgs* out) +{ + return LMI_UnixDeviceFile_DispatchMethod( + _cb, mi, cc, cr, cop, meth, in, out); +} + +CMMethodMIStub( + LMI_UnixDeviceFile, + LMI_UnixDeviceFile, + _cb, + LMI_UnixDeviceFileInitialize()) + +KONKRET_REGISTRATION( + "root/cimv2", + "LMI_UnixDeviceFile", + "LMI_UnixDeviceFile", + "instance method") +/* vi: set et: */ diff --git a/src/logicalfile/LMI_UnixDirectoryProvider.c b/src/logicalfile/LMI_UnixDirectoryProvider.c new file mode 100644 index 0000000..d70aae7 --- /dev/null +++ b/src/logicalfile/LMI_UnixDirectoryProvider.c @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2012 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: Jan Synacek + */ +#include +#include "LMI_UnixDirectory.h" +#include "file.h" + +static const CMPIBroker* _cb = NULL; + +static void LMI_UnixDirectoryInitialize() +{ +} + +static CMPIStatus LMI_UnixDirectoryCleanup( + CMPIInstanceMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixDirectoryEnumInstanceNames( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixDirectoryEnumInstances( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixDirectoryGetInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + get_instance(UnixDirectory, S_IFDIR, "No such directory: %s"); + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_UnixDirectoryCreateInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci) +{ + LMI_UnixDirectory lmi_ud; + LMI_UnixDirectory_InitFromInstance(&lmi_ud, _cb, ci); + CMPIStatus st; + CMPIObjectPath *iop = CMGetObjectPath(ci, &st); + CMPIData pathd = CMGetKey(iop, "Name", &st); + const char *path = KChars(pathd.value.string); + + if (mkdir(path, 0777) < 0) { + char errmsg[BUFLEN]; + snprintf(errmsg, BUFLEN, "Can't mkdir: %s", path); + CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, errmsg); + } + + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_UnixDirectoryModifyInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixDirectoryDeleteInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixDirectoryExecQuery( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* lang, + const char* query) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +CMInstanceMIStub( + LMI_UnixDirectory, + LMI_UnixDirectory, + _cb, + LMI_UnixDirectoryInitialize()) + +static CMPIStatus LMI_UnixDirectoryMethodCleanup( + CMPIMethodMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_UnixDirectoryInvokeMethod( + CMPIMethodMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* meth, + const CMPIArgs* in, + CMPIArgs* out) +{ + return LMI_UnixDirectory_DispatchMethod( + _cb, mi, cc, cr, cop, meth, in, out); +} + +CMMethodMIStub( + LMI_UnixDirectory, + LMI_UnixDirectory, + _cb, + LMI_UnixDirectoryInitialize()) + +KONKRET_REGISTRATION( + "root/cimv2", + "LMI_UnixDirectory", + "LMI_UnixDirectory", + "instance method") +/* vi: set et: */ diff --git a/src/logicalfile/LMI_UnixFileProvider.c b/src/logicalfile/LMI_UnixFileProvider.c new file mode 100644 index 0000000..8f47d33 --- /dev/null +++ b/src/logicalfile/LMI_UnixFileProvider.c @@ -0,0 +1,177 @@ +/* + * Copyright (C) 2012 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: Jan Synacek + */ +#include +#include "LMI_UnixFile.h" +#include "file.h" + +static const CMPIBroker* _cb = NULL; + +static void LMI_UnixFileInitialize() +{ +} + +static CMPIStatus LMI_UnixFileCleanup( + CMPIInstanceMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_UnixFileEnumInstanceNames( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixFileEnumInstances( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixFileGetInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + LMI_UnixFile lmi_file; + CMPIStatus st; + struct stat sb; + char aux[BUFLEN]; + const char *path; + + st = lmi_check_required(_cb, cop, UNIXFILE); + if (st.rc != CMPI_RC_OK) { + return st; + } + + LMI_UnixFile_InitFromObjectPath(&lmi_file, _cb, cop); + path = KChars(lmi_file.LFName.value); + + if (stat(path, &sb) < 0) { + snprintf(aux, BUFLEN, "Can't stat file: %s", path); + CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, aux); + } + sprintf(aux, "%u", sb.st_uid); + LMI_UnixFile_Set_UserID(&lmi_file, aux); + sprintf(aux, "%u", sb.st_gid); + LMI_UnixFile_Set_GroupID(&lmi_file, aux); + LMI_UnixFile_Set_SetUid(&lmi_file, sb.st_mode & S_IFMT & S_ISUID); + LMI_UnixFile_Set_SetGid(&lmi_file, sb.st_mode & S_IFMT & S_ISGID); + sprintf(aux, "%u", (unsigned int)sb.st_ino); + LMI_UnixFile_Set_FileInodeNumber(&lmi_file, aux); + LMI_UnixFile_Set_LinkCount(&lmi_file, sb.st_nlink); + /* sticky bit */ + LMI_UnixFile_Set_SaveText(&lmi_file, sb.st_mode & S_IFMT & S_ISVTX); + + KReturnInstance(cr, lmi_file); + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_UnixFileCreateInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixFileModifyInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixFileDeleteInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixFileExecQuery( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* lang, + const char* query) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +CMInstanceMIStub( + LMI_UnixFile, + LMI_UnixFile, + _cb, + LMI_UnixFileInitialize()) + +static CMPIStatus LMI_UnixFileMethodCleanup( + CMPIMethodMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_UnixFileInvokeMethod( + CMPIMethodMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* meth, + const CMPIArgs* in, + CMPIArgs* out) +{ + return LMI_UnixFile_DispatchMethod( + _cb, mi, cc, cr, cop, meth, in, out); +} + +CMMethodMIStub( + LMI_UnixFile, + LMI_UnixFile, + _cb, + LMI_UnixFileInitialize()) + +KONKRET_REGISTRATION( + "root/cimv2", + "LMI_UnixFile", + "LMI_UnixFile", + "instance method") +/* vi: set et: */ diff --git a/src/logicalfile/file.c b/src/logicalfile/file.c new file mode 100644 index 0000000..a9a13a6 --- /dev/null +++ b/src/logicalfile/file.c @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2012 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: Jan Synacek + */ +#include "file.h" + +static const char *LOGICALFILE_REQUIRED_NAMES[] = { + "CSCreationClassName", + "CSName", + "CreationClassName", + "FSCreationClassName", + "FSName", + "Name", + NULL +}; + +static const char *UNIXFILE_REQUIRED_NAMES[] = { + "CSCreationClassName", + "CSName", + "LFCreationClassName", + "FSCreationClassName", + "FSName", + "LFName", + NULL +}; + +CMPIStatus lmi_check_required( + const CMPIBroker *b, + const CMPIObjectPath *o, + const enum RequiredNames rn) +{ + const char **names; + + switch (rn) { + case LOGICALFILE: + names = LOGICALFILE_REQUIRED_NAMES; + break; + case UNIXFILE: + names = UNIXFILE_REQUIRED_NAMES; + break; + default: + /* not possible! */ + assert(0); + break; + } + + for (int i = 0; names[i]; i++) { + if (CMIsNullValue(CMGetKey(o, names[i], NULL))) { + char errmsg[BUFLEN]; + snprintf(errmsg, BUFLEN, "No '%s' specified", names[i]); + CMReturnWithChars(b, CMPI_RC_ERR_FAILED, errmsg); + } + } + CMReturn(CMPI_RC_OK); +} + +void _dump_objectpath(const CMPIObjectPath *o) +{ + printf("OP: %s\n", CMGetCharsPtr(o->ft->toString(o, NULL), NULL)); +} +/* vi: set et: */ diff --git a/src/logicalfile/file.h b/src/logicalfile/file.h new file mode 100644 index 0000000..e59c2ef --- /dev/null +++ b/src/logicalfile/file.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2012 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: Jan Synacek + */ +#ifndef _FILE_H +#define _FILE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "globals.h" + +#ifndef BUFLEN + #define BUFLEN 512 +#endif +#ifndef PATH_MAX + #define PATH_MAX 4096 +#endif + +#define FSCREATIONCLASSNAME "FSCCNToBeAgreedOn" +#define FSNAME "FSNToBeAgreedOn" + +#define sb_permmask(sb) ((sb).st_mode & (S_IRWXU | S_IRWXG | S_IRWXO)) +#define sb_isreadable(sb) ( \ + (sb_permmask(sb) & S_IRUSR) || \ + (sb_permmask(sb) & S_IRGRP) || \ + (sb_permmask(sb) & S_IROTH) \ +) +#define sb_iswriteable(sb) ( \ + (sb_permmask(sb) & S_IWUSR) || \ + (sb_permmask(sb) & S_IWGRP) || \ + (sb_permmask(sb) & S_IWOTH) \ +) +#define sb_isexecutable(sb) ( \ + (sb_permmask(sb) & S_IXUSR) || \ + (sb_permmask(sb) & S_IXGRP) || \ + (sb_permmask(sb) & S_IXOTH) \ +) +#define stoms(t) ((t)*1000000) + +#define fill_logicalfile(type, obj, name, creation_class) \ + type##_Set_Name((obj), (name)); \ + type##_Set_CSCreationClassName((obj), get_system_creation_class_name()); \ + type##_Set_CSName((obj), get_system_name()); \ + type##_Set_FSCreationClassName((obj), FSCREATIONCLASSNAME); \ + type##_Set_FSName((obj), FSNAME); \ + type##_Set_CreationClassName((obj), (creation_class)); + +#define fill_basic(cmpitype, path, stattype, error) \ + struct stat sb; \ + char errmsg[BUFLEN]; \ + \ + if (lstat((path), &sb) < 0 || !(sb.st_mode & S_IFMT & (stattype))) { \ + snprintf(errmsg, BUFLEN, error, (path)); \ + CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, errmsg); \ + } \ + \ + LMI_##cmpitype##_Set_Readable(&lmi_file, sb_isreadable(sb)); \ + 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(_cb, stoms(sb.st_atime), 0, NULL)); \ + LMI_##cmpitype##_Set_LastModified(&lmi_file, CMNewDateTimeFromBinary(_cb, stoms(sb.st_mtime), 0, NULL)); + +#define get_instance(cmpitype, stattype, error) \ + LMI_##cmpitype lmi_file; \ + CMPIStatus st; \ + \ + LMI_##cmpitype##_InitFromObjectPath(&lmi_file, _cb, cop); \ + st = lmi_check_required(_cb, cop, LOGICALFILE); \ + if (st.rc != CMPI_RC_OK) { \ + return st; \ + } \ + fill_basic(cmpitype, KChars(lmi_file.Name.value), stattype, error) \ + KReturnInstance(cr, lmi_file); + +enum RequiredNames { + LOGICALFILE, + UNIXFILE, +}; + +CMPIStatus lmi_check_required(const CMPIBroker *, const CMPIObjectPath *, const enum RequiredNames); +void _dump_objectpath(const CMPIObjectPath *); + +#endif /* _FILE_H */ +/* vi: set et: */ -- cgit From 45dd9c06cba50124e011c87c969752ddf7017b88 Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Tue, 12 Feb 2013 10:05:34 +0100 Subject: Fix some typos --- src/account/test/TestAccount.py | 2 +- src/account/test/TestGroup.py | 2 +- src/account/test/TestMemberOfGroup.py | 2 +- src/account/test/TestService.py | 2 +- src/account/test/common.py | 2 +- src/account/test/methods.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/account/test/TestAccount.py b/src/account/test/TestAccount.py index 7157b52..52cb1b4 100644 --- a/src/account/test/TestAccount.py +++ b/src/account/test/TestAccount.py @@ -15,7 +15,7 @@ # 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: Roman Rakus # from common import AccountBase diff --git a/src/account/test/TestGroup.py b/src/account/test/TestGroup.py index 2cf5228..19e586b 100644 --- a/src/account/test/TestGroup.py +++ b/src/account/test/TestGroup.py @@ -15,7 +15,7 @@ # 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: Roman Rakus # from common import AccountBase diff --git a/src/account/test/TestMemberOfGroup.py b/src/account/test/TestMemberOfGroup.py index 19071ef..1d521f8 100644 --- a/src/account/test/TestMemberOfGroup.py +++ b/src/account/test/TestMemberOfGroup.py @@ -15,7 +15,7 @@ # 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: Roman Rakus # from common import AccountBase diff --git a/src/account/test/TestService.py b/src/account/test/TestService.py index 08a47ee..28b98a4 100644 --- a/src/account/test/TestService.py +++ b/src/account/test/TestService.py @@ -15,7 +15,7 @@ # 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: Roman Rakus # from common import AccountBase diff --git a/src/account/test/common.py b/src/account/test/common.py index 2ffbbcf..ce525b0 100644 --- a/src/account/test/common.py +++ b/src/account/test/common.py @@ -15,7 +15,7 @@ # 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: Roman Rakus # import pywbem diff --git a/src/account/test/methods.py b/src/account/test/methods.py index b40859f..45106ac 100644 --- a/src/account/test/methods.py +++ b/src/account/test/methods.py @@ -15,7 +15,7 @@ # 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: Roman Rakus # import subprocess -- cgit From 806c9b45edf41d54c6673fc04a6e0c06e92af101 Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Wed, 13 Feb 2013 15:26:15 +0100 Subject: LogicalFile: add socket file type and root directory association Add LMI_UnixSocket and LMI_RootDirectory association. LMI_RootDirectory associates the root directory with the computer system on which it resides. --- .../LMI_DirectoryContainsFileProvider.c | 1 + src/logicalfile/LMI_RootDirectoryProvider.c | 311 +++++++++++++++++++++ src/logicalfile/LMI_UnixSocketProvider.c | 147 ++++++++++ 3 files changed, 459 insertions(+) create mode 100644 src/logicalfile/LMI_RootDirectoryProvider.c create mode 100644 src/logicalfile/LMI_UnixSocketProvider.c (limited to 'src') diff --git a/src/logicalfile/LMI_DirectoryContainsFileProvider.c b/src/logicalfile/LMI_DirectoryContainsFileProvider.c index 29bde15..8eb6018 100644 --- a/src/logicalfile/LMI_DirectoryContainsFileProvider.c +++ b/src/logicalfile/LMI_DirectoryContainsFileProvider.c @@ -77,6 +77,7 @@ static CMPIStatus dir_file_objectpaths( (S_ISBLK(sb.st_mode)) ? strcpy(fileclass, "LMI_UnixDeviceFile") : (S_ISLNK(sb.st_mode)) ? strcpy(fileclass, "LMI_SymbolicLink") : (S_ISFIFO(sb.st_mode)) ? strcpy(fileclass, "LMI_FIFOPipeFile") : + (S_ISSOCK(sb.st_mode)) ? strcpy(fileclass, "LMI_UnixSocket") : strcpy(fileclass, "Unknown"); } diff --git a/src/logicalfile/LMI_RootDirectoryProvider.c b/src/logicalfile/LMI_RootDirectoryProvider.c new file mode 100644 index 0000000..4bcedf0 --- /dev/null +++ b/src/logicalfile/LMI_RootDirectoryProvider.c @@ -0,0 +1,311 @@ +/* + * Copyright (C) 2012 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: Jan Synacek + */ +#include +#include "LMI_RootDirectory.h" +#include "LMI_UnixDirectory.h" +#include "file.h" + +static const CMPIBroker* _cb; + +static CMPIStatus associators( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* resultClass, + const char* role, + const char* resultRole, + const char** properties, + const int names) +{ + CMPIObjectPath *o; + CMPIInstance *ci; + CMPIStatus st; + const char *ns = KNameSpace(cop); + const char *comp_ccname = get_system_creation_class_name(); + + + if (CMClassPathIsA(_cb, cop, LMI_UnixDirectory_ClassName, &st)) { + /* got LMI_UnixDirectory */ + CIM_ComputerSystemRef cim_csr; + CIM_ComputerSystemRef_Init(&cim_csr, _cb, ns); + CIM_ComputerSystemRef_Set_Name(&cim_csr, get_system_name()); + CIM_ComputerSystemRef_Set_CreationClassName(&cim_csr, comp_ccname); + o = CIM_ComputerSystemRef_ToObjectPath(&cim_csr, &st); + CMSetClassName(o, comp_ccname); + if (names) { + CMReturnObjectPath(cr, o); + } else { + ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); + CMReturnInstance(cr, ci); + } + } else { + /* got Linux_ComputerSystem */ + LMI_UnixDirectory lmi_ud; + LMI_UnixDirectory_Init(&lmi_ud, _cb, ns); + fill_logicalfile(LMI_UnixDirectory, &lmi_ud, "/", LMI_UnixDirectory_ClassName); + o = LMI_UnixDirectory_ToObjectPath(&lmi_ud, &st); + if (names) { + CMReturnObjectPath(cr, o); + } else { + ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); + CMReturnInstance(cr, ci); + } + } + + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus references( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* role, + const char** properties, + const int names) +{ + LMI_RootDirectory lmi_rd; + CMPIObjectPath *o; + CMPIInstance *ci; + CMPIStatus st; + const char *comp_ccname = get_system_creation_class_name(); + const char *ns = KNameSpace(cop); + + CMPIData pathd; + CMPIData cd; + pathd = CMGetKey(cop, "Name", &st); + cd = CMGetKey(cop, "CreationClassName", &st); + const char *path = KChars(pathd.value.string); + const char *ccname = KChars(cd.value.string); + + LMI_RootDirectory_Init(&lmi_rd, _cb, ns); + + if (!strcmp(ccname, LMI_UnixDirectory_ClassName)) { + /* UnixDirectory */ + /* ignore this association if the directory is not root */ + if (strcmp(path, "/")) { + CMReturn(CMPI_RC_OK); + } + st = lmi_check_required(_cb, cop, LOGICALFILE); + if (st.rc != CMPI_RC_OK) { + return st; + } + + LMI_RootDirectory_SetObjectPath_PartComponent(&lmi_rd, cop); + + CIM_ComputerSystemRef cim_csr; + CIM_ComputerSystemRef_Init(&cim_csr, _cb, ns); + CIM_ComputerSystemRef_Set_Name(&cim_csr, get_system_name()); + CIM_ComputerSystemRef_Set_CreationClassName(&cim_csr, comp_ccname); + o = CIM_ComputerSystemRef_ToObjectPath(&cim_csr, &st); + CMSetClassName(o, comp_ccname); + if (names) { + LMI_RootDirectory_SetObjectPath_GroupComponent(&lmi_rd, o); + o = LMI_RootDirectory_ToObjectPath(&lmi_rd, &st); + CMReturnObjectPath(cr, o); + } else { + ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); + CMReturnInstance(cr, ci); + } + } else { + /* Linux_ComputerSystem */ + LMI_RootDirectory_SetObjectPath_GroupComponent(&lmi_rd, cop); + + LMI_UnixDirectory lmi_ud; + LMI_UnixDirectory_Init(&lmi_ud, _cb, ns); + fill_logicalfile(LMI_UnixDirectory, &lmi_ud, "/", LMI_UnixDirectory_ClassName); + o = LMI_UnixDirectory_ToObjectPath(&lmi_ud, &st); + if (names) { + LMI_RootDirectory_SetObjectPath_PartComponent(&lmi_rd, o); + o = LMI_RootDirectory_ToObjectPath(&lmi_rd, &st); + CMReturnObjectPath(cr, o); + } else { + ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); + CMReturnInstance(cr, ci); + } + } + + CMReturn(CMPI_RC_OK); +} + +static void LMI_RootDirectoryInitialize() +{ +} + +static CMPIStatus LMI_RootDirectoryCleanup( + CMPIInstanceMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_RootDirectoryEnumInstanceNames( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_RootDirectoryEnumInstances( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_RootDirectoryGetInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + /* TODO TBI */ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_RootDirectoryCreateInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_RootDirectoryModifyInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci, + const char**properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_RootDirectoryDeleteInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_RootDirectoryExecQuery( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* lang, + const char* query) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_RootDirectoryAssociationCleanup( + CMPIAssociationMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_RootDirectoryAssociators( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* resultClass, + const char* role, + const char* resultRole, + const char** properties) +{ + return associators(mi, cc, cr, cop, assocClass, resultClass, role, + resultRole, properties, 0); +} + +static CMPIStatus LMI_RootDirectoryAssociatorNames( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* resultClass, + const char* role, + const char* resultRole) +{ + return associators(mi, cc, cr, cop, assocClass, resultClass, role, + resultRole, NULL, 1); +} + +static CMPIStatus LMI_RootDirectoryReferences( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* role, + const char** properties) +{ + return references(mi, cc, cr, cop, assocClass, role, properties, 0); +} + +static CMPIStatus LMI_RootDirectoryReferenceNames( + CMPIAssociationMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* assocClass, + const char* role) +{ + return references(mi, cc, cr, cop, assocClass, role, NULL, 1); +} + +CMInstanceMIStub( + LMI_RootDirectory, + LMI_RootDirectory, + _cb, + LMI_RootDirectoryInitialize()) + +CMAssociationMIStub( + LMI_RootDirectory, + LMI_RootDirectory, + _cb, + LMI_RootDirectoryInitialize()) + +KONKRET_REGISTRATION( + "root/cimv2", + "LMI_RootDirectory", + "LMI_RootDirectory", + "instance association") +/* vi: set et: */ diff --git a/src/logicalfile/LMI_UnixSocketProvider.c b/src/logicalfile/LMI_UnixSocketProvider.c new file mode 100644 index 0000000..c122502 --- /dev/null +++ b/src/logicalfile/LMI_UnixSocketProvider.c @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2012 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: Jan Synacek + */ +#include +#include "LMI_UnixSocket.h" +#include "file.h" + +static const CMPIBroker* _cb = NULL; + +static void LMI_UnixSocketInitialize() +{ +} + +static CMPIStatus LMI_UnixSocketCleanup( + CMPIInstanceMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_UnixSocketEnumInstanceNames( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixSocketEnumInstances( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixSocketGetInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + get_instance(UnixSocket, S_IFSOCK, "No such socket: %s"); + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_UnixSocketCreateInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixSocketModifyInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixSocketDeleteInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_UnixSocketExecQuery( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* lang, + const char* query) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +CMInstanceMIStub( + LMI_UnixSocket, + LMI_UnixSocket, + _cb, + LMI_UnixSocketInitialize()) + +static CMPIStatus LMI_UnixSocketMethodCleanup( + CMPIMethodMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_UnixSocketInvokeMethod( + CMPIMethodMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* meth, + const CMPIArgs* in, + CMPIArgs* out) +{ + return LMI_UnixSocket_DispatchMethod( + _cb, mi, cc, cr, cop, meth, in, out); +} + +CMMethodMIStub( + LMI_UnixSocket, + LMI_UnixSocket, + _cb, + LMI_UnixSocketInitialize()) + +KONKRET_REGISTRATION( + "root/cimv2", + "LMI_UnixSocket", + "LMI_UnixSocket", + "instance method") +/* vi: set et: */ -- cgit From f9800113caf680157b86a7d7e072fb163985e52f Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Wed, 13 Feb 2013 15:31:23 +0100 Subject: LogicalFile: check for valid classes in association methods --- .../LMI_DirectoryContainsFileProvider.c | 30 ++++++++++++++++++++ src/logicalfile/LMI_FileIdentityProvider.c | 32 ++++++++++++++++++++++ 2 files changed, 62 insertions(+) (limited to 'src') diff --git a/src/logicalfile/LMI_DirectoryContainsFileProvider.c b/src/logicalfile/LMI_DirectoryContainsFileProvider.c index 8eb6018..fcc77f3 100644 --- a/src/logicalfile/LMI_DirectoryContainsFileProvider.c +++ b/src/logicalfile/LMI_DirectoryContainsFileProvider.c @@ -93,6 +93,27 @@ static CMPIStatus dir_file_objectpaths( CMReturn(CMPI_RC_OK); } +static int check_valid_classes(const CMPIObjectPath *o) +{ + const char *VALID_CLASSES[] = { + "LMI_DataFile", + "LMI_UnixDeviceFile", + "LMI_UnixDirectory", + "LMI_FIFOPipeFile", + "LMI_SymbolicLink", + "LMI_UnixSocket", + NULL + }; + int found = 0; + for (int i = 0; VALID_CLASSES[i]; i++) { + if (CMClassPathIsA(_cb, o, VALID_CLASSES[i], NULL)) { + found++; + break; + } + } + return found; +} + static CMPIStatus associators( CMPIAssociationMI* mi, const CMPIContext* cc, @@ -115,6 +136,10 @@ static CMPIStatus associators( if (st.rc != CMPI_RC_OK) { return st; } + /* allow only LMI_UnixFile and classes derived from CIM_LogicalFile */ + if (!check_valid_classes(cop)) { + CMReturn(CMPI_RC_OK); + } cd = CMGetKey(cop, "CreationClassName", &st); const char *ccname = KChars(cd.value.string); @@ -182,6 +207,11 @@ static CMPIStatus references( CMPIObjectPath *o; CMPIInstance *ci; + /* allow only LMI_UnixFile and classes derived from CIM_LogicalFile */ + if (!check_valid_classes(cop)) { + CMReturn(CMPI_RC_OK); + } + CIM_DirectoryRef_Init(&lmi_dr, _cb, ns); CIM_LogicalFileRef_Init(&lmi_lfr, _cb, ns); LMI_DirectoryContainsFile_Init(&lmi_dcf, _cb, ns); diff --git a/src/logicalfile/LMI_FileIdentityProvider.c b/src/logicalfile/LMI_FileIdentityProvider.c index 453764e..9e3427c 100644 --- a/src/logicalfile/LMI_FileIdentityProvider.c +++ b/src/logicalfile/LMI_FileIdentityProvider.c @@ -27,6 +27,28 @@ static const CMPIBroker* _cb; +static int check_valid_classes(const CMPIObjectPath *o) +{ + const char *VALID_CLASSES[] = { + "LMI_UnixFile", + "LMI_DataFile", + "LMI_UnixDeviceFile", + "LMI_UnixDirectory", + "LMI_FIFOPipeFile", + "LMI_SymbolicLink", + "LMI_UnixSocket", + NULL + }; + int found = 0; + for (int i = 0; VALID_CLASSES[i]; i++) { + if (CMClassPathIsA(_cb, o, VALID_CLASSES[i], NULL)) { + found++; + break; + } + } + return found; +} + static CMPIStatus associators( CMPIAssociationMI* mi, const CMPIContext* cc, @@ -42,6 +64,11 @@ static CMPIStatus associators( CMPIStatus st, res; CMPIInstance *ci; + /* allow only LMI_UnixFile and classes derived from CIM_LogicalFile */ + if (!check_valid_classes(cop)) { + CMReturn(CMPI_RC_OK); + } + /* TODO filtering */ if (names) { res = CMReturnObjectPath(cr, cop); @@ -74,6 +101,11 @@ static CMPIStatus references( const char *ns = KNameSpace(cop); CMPIInstance *ci; + /* allow only LMI_UnixFile and classes derived from CIM_LogicalFile */ + if (!check_valid_classes(cop)) { + CMReturn(CMPI_RC_OK); + } + LMI_FileIdentity_Init(&lmi_fi, _cb, ns); if (CMClassPathIsA(_cb, cop, LMI_UnixFile_ClassName, &st)) { -- cgit From 01a81cf733f25bbe8d988e557672b539e9fc3c1b Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Thu, 14 Feb 2013 15:23:51 +0100 Subject: LogicalFile: fix FileIdentity LMI_FileIdentity.Associators() was not behaving correctly -- it was returning the object itself instead of the other one. Also, LMI_FileIdentity.References() has been updated. --- src/logicalfile/LMI_FileIdentityProvider.c | 130 +++++++++++++++++++++-------- src/logicalfile/file.c | 26 ++++++ src/logicalfile/file.h | 3 + 3 files changed, 123 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/logicalfile/LMI_FileIdentityProvider.c b/src/logicalfile/LMI_FileIdentityProvider.c index 9e3427c..81371dd 100644 --- a/src/logicalfile/LMI_FileIdentityProvider.c +++ b/src/logicalfile/LMI_FileIdentityProvider.c @@ -63,20 +63,73 @@ static CMPIStatus associators( { CMPIStatus st, res; CMPIInstance *ci; + CMPIObjectPath *o; + const char *ns = KNameSpace(cop); + CMPIData pathd; + CMPIData cd; /* allow only LMI_UnixFile and classes derived from CIM_LogicalFile */ if (!check_valid_classes(cop)) { CMReturn(CMPI_RC_OK); } - /* TODO filtering */ + if (CMClassPathIsA(_cb, cop, LMI_UnixFile_ClassName, &st)) { + /* got UnixFile */ + + st = lmi_check_required(_cb, cop, UNIXFILE); + if (st.rc != CMPI_RC_OK) { + return st; + } + + pathd = CMGetKey(cop, "LFName", &st); + cd = CMGetKey(cop, "LFCreationClassName", &st); + const char *path = KChars(pathd.value.string); + const char *ccname = KChars(cd.value.string); + char fileclass[BUFLEN]; + get_class_from_path(path, fileclass); + + /* TODO is this error necessary? */ + if (strcmp(fileclass, ccname)) { + CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, + "LMCreationClassName is not correct"); + } + + CIM_LogicalFileRef cim_lfr; + CIM_LogicalFileRef_Init(&cim_lfr, _cb, ns); + fill_logicalfile(CIM_LogicalFileRef, &cim_lfr, path, ccname); + o = CIM_LogicalFileRef_ToObjectPath(&cim_lfr, &st); + CMSetClassName(o, fileclass); + } else { + /* got LogicalFile */ + + st = lmi_check_required(_cb, cop, LOGICALFILE); + if (st.rc != CMPI_RC_OK) { + return st; + } + + pathd = CMGetKey(cop, "Name", &st); + cd = CMGetKey(cop, "CreationClassName", &st); + const char *path = KChars(pathd.value.string); + char fileclass[BUFLEN]; + get_class_from_path(path, fileclass); + + LMI_UnixFile lmi_uf; + LMI_UnixFile_Init(&lmi_uf, _cb, ns); + LMI_UnixFile_Set_LFName(&lmi_uf, path); + LMI_UnixFile_Set_CSCreationClassName(&lmi_uf, get_system_creation_class_name()); + LMI_UnixFile_Set_CSName(&lmi_uf, get_system_name()); + LMI_UnixFile_Set_FSCreationClassName(&lmi_uf, FSCREATIONCLASSNAME); + LMI_UnixFile_Set_FSName(&lmi_uf, FSNAME); + LMI_UnixFile_Set_LFCreationClassName(&lmi_uf, fileclass); + o = LMI_UnixFile_ToObjectPath(&lmi_uf, &st); + } + if (names) { - res = CMReturnObjectPath(cr, cop); + res = CMReturnObjectPath(cr, o); } else { - ci = _cb->bft->getInstance(_cb, cc, cop, properties, &st); + ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); res = CMReturnInstance(cr, ci); } - return res; } @@ -91,17 +144,19 @@ static CMPIStatus references( int names) { LMI_FileIdentity lmi_fi; - /* SameElement */ - LMI_UnixFile lmi_uf; - /* SystemElement */ - CIM_LogicalFileRef lmi_lfr; - CMPIStatus st; + CMPIStatus st, res; CMPIData pathd; - CMPIData cnd; + CMPIData cd; const char *ns = KNameSpace(cop); CMPIInstance *ci; - - /* allow only LMI_UnixFile and classes derived from CIM_LogicalFile */ + CMPIObjectPath *o; + + /* + * allow only LMI_UnixFile and classes derived from CIM_LogicalFile + * + * XXX this should not be necessary, but FileIdentity.Refereneces() is + * called when Linux_ComputerSystem.References() is... server bug? + */ if (!check_valid_classes(cop)) { CMReturn(CMPI_RC_OK); } @@ -109,7 +164,7 @@ static CMPIStatus references( LMI_FileIdentity_Init(&lmi_fi, _cb, ns); if (CMClassPathIsA(_cb, cop, LMI_UnixFile_ClassName, &st)) { - /* got SameElement - UnixFile */ + /* got UnixFile */ LMI_FileIdentity_SetObjectPath_SameElement(&lmi_fi, cop); st = lmi_check_required(_cb, cop, UNIXFILE); @@ -118,24 +173,27 @@ static CMPIStatus references( } pathd = CMGetKey(cop, "LFName", &st); - cnd = CMGetKey(cop, "LFCreationClassName", &st); + cd = CMGetKey(cop, "LFCreationClassName", &st); const char *path = KChars(pathd.value.string); - const char *ccname = KChars(cnd.value.string); + const char *ccname = KChars(cd.value.string); + char fileclass[BUFLEN]; + get_class_from_path(path, fileclass); + + /* TODO is this error necessary? */ + if (strcmp(fileclass, ccname)) { + CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, + "LMCreationClassName is not correct"); + } /* SystemElement */ + CIM_LogicalFileRef lmi_lfr; CIM_LogicalFileRef_Init(&lmi_lfr, _cb, ns); fill_logicalfile(CIM_LogicalFileRef, &lmi_lfr, path, ccname); - CMPIObjectPath *o = CIM_LogicalFileRef_ToObjectPath(&lmi_lfr, &st); - CMSetClassName(o, ccname); - - if (names) { - LMI_FileIdentity_SetObjectPath_SystemElement(&lmi_fi, o); - } else { - ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); - CMReturnInstance(cr, ci); - } + o = CIM_LogicalFileRef_ToObjectPath(&lmi_lfr, &st); + CMSetClassName(o, fileclass); + LMI_FileIdentity_SetObjectPath_SystemElement(&lmi_fi, o); } else { - /* got SystemElement - LogicalFile */ + /* got LogicalFile */ LMI_FileIdentity_SetObjectPath_SystemElement(&lmi_fi, cop); st = lmi_check_required(_cb, cop, LOGICALFILE); @@ -144,11 +202,12 @@ static CMPIStatus references( } pathd = CMGetKey(cop, "Name", &st); - cnd = CMGetKey(cop, "CreationClassName", &st); + cd = CMGetKey(cop, "CreationClassName", &st); const char *path = KChars(pathd.value.string); - const char *ccname = KChars(cnd.value.string); + const char *ccname = KChars(cd.value.string); /* SameElement */ + LMI_UnixFile lmi_uf; LMI_UnixFile_Init(&lmi_uf, _cb, ns); LMI_UnixFile_Set_LFName(&lmi_uf, path); LMI_UnixFile_Set_CSCreationClassName(&lmi_uf, get_system_creation_class_name()); @@ -156,19 +215,18 @@ static CMPIStatus references( LMI_UnixFile_Set_FSCreationClassName(&lmi_uf, FSCREATIONCLASSNAME); LMI_UnixFile_Set_FSName(&lmi_uf, FSNAME); LMI_UnixFile_Set_LFCreationClassName(&lmi_uf, ccname); - CMPIObjectPath *o = LMI_UnixFile_ToObjectPath(&lmi_uf, &st); - if (names) { - LMI_FileIdentity_SetObjectPath_SameElement(&lmi_fi, o); - } else { - ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); - CMReturnInstance(cr, ci); - } + o = LMI_UnixFile_ToObjectPath(&lmi_uf, &st); + LMI_FileIdentity_SetObjectPath_SameElement(&lmi_fi, o); } if (names) { - return CMReturnObjectPath(cr, LMI_FileIdentity_ToObjectPath(&lmi_fi, &st)); + o = LMI_FileIdentity_ToObjectPath(&lmi_fi, &st); + res = CMReturnObjectPath(cr, o); + } else { + ci = LMI_FileIdentity_ToInstance(&lmi_fi, &st); + res = CMReturnInstance(cr, ci); } - CMReturn(CMPI_RC_OK); + return res; } static void LMI_FileIdentityInitialize() diff --git a/src/logicalfile/file.c b/src/logicalfile/file.c index a9a13a6..6c482f0 100644 --- a/src/logicalfile/file.c +++ b/src/logicalfile/file.c @@ -69,6 +69,32 @@ CMPIStatus lmi_check_required( 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") : + (S_ISCHR(sb->st_mode)) ? strcpy(fileclass, "LMI_UnixDeviceFile") : + (S_ISBLK(sb->st_mode)) ? strcpy(fileclass, "LMI_UnixDeviceFile") : + (S_ISLNK(sb->st_mode)) ? strcpy(fileclass, "LMI_SymbolicLink") : + (S_ISFIFO(sb->st_mode)) ? strcpy(fileclass, "LMI_FIFOPipeFile") : + (S_ISSOCK(sb->st_mode)) ? strcpy(fileclass, "LMI_UnixSocket") : + strcpy(fileclass, "Unknown"); + assert(strcmp(fileclass, "Unknown") != 0); +} + +int get_class_from_path(const char *path, char *fileclass) +{ + int rc = 0; + struct stat sb; + + if (lstat(path, &sb) < 0) { + rc = 1; + } else { + get_class_from_stat(&sb, fileclass); + } + + return rc; +} + void _dump_objectpath(const CMPIObjectPath *o) { printf("OP: %s\n", CMGetCharsPtr(o->ft->toString(o, NULL), NULL)); diff --git a/src/logicalfile/file.h b/src/logicalfile/file.h index e59c2ef..64a25f3 100644 --- a/src/logicalfile/file.h +++ b/src/logicalfile/file.h @@ -101,6 +101,9 @@ enum RequiredNames { }; CMPIStatus lmi_check_required(const CMPIBroker *, const CMPIObjectPath *, const enum RequiredNames); +void get_class_from_stat(const struct stat *, char *); +int get_class_from_path(const char *, char *); + void _dump_objectpath(const CMPIObjectPath *); #endif /* _FILE_H */ -- cgit From 459197d2c4f39fea944299cdc22994b294d446c5 Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Thu, 14 Feb 2013 15:27:17 +0100 Subject: LogicalFile: update RootDirectory --- src/logicalfile/LMI_RootDirectoryProvider.c | 62 ++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/logicalfile/LMI_RootDirectoryProvider.c b/src/logicalfile/LMI_RootDirectoryProvider.c index 4bcedf0..179d146 100644 --- a/src/logicalfile/LMI_RootDirectoryProvider.c +++ b/src/logicalfile/LMI_RootDirectoryProvider.c @@ -24,6 +24,23 @@ static const CMPIBroker* _cb; +static int check_valid_classes(const CMPIObjectPath *o) +{ + const char *VALID_CLASSES[] = { + "LMI_UnixDirectory", + "Linux_ComputerSystem", + NULL + }; + int found = 0; + for (int i = 0; VALID_CLASSES[i]; i++) { + if (CMClassPathIsA(_cb, o, VALID_CLASSES[i], NULL)) { + found++; + break; + } + } + return found; +} + static CMPIStatus associators( CMPIAssociationMI* mi, const CMPIContext* cc, @@ -42,6 +59,13 @@ static CMPIStatus associators( const char *ns = KNameSpace(cop); const char *comp_ccname = get_system_creation_class_name(); + /* + * allow only LMI_UnixDirectory and Linux_ComputerSystem + * XXX + */ + if (!check_valid_classes(cop)) { + CMReturn(CMPI_RC_OK); + } if (CMClassPathIsA(_cb, cop, LMI_UnixDirectory_ClassName, &st)) { /* got LMI_UnixDirectory */ @@ -98,10 +122,18 @@ static CMPIStatus references( const char *path = KChars(pathd.value.string); const char *ccname = KChars(cd.value.string); + /* + * allow only LMI_UnixDirectory and Linux_ComputerSystem + * XXX + */ + if (!check_valid_classes(cop)) { + CMReturn(CMPI_RC_OK); + } + LMI_RootDirectory_Init(&lmi_rd, _cb, ns); if (!strcmp(ccname, LMI_UnixDirectory_ClassName)) { - /* UnixDirectory */ + /* got UnixDirectory */ /* ignore this association if the directory is not root */ if (strcmp(path, "/")) { CMReturn(CMPI_RC_OK); @@ -110,7 +142,6 @@ static CMPIStatus references( if (st.rc != CMPI_RC_OK) { return st; } - LMI_RootDirectory_SetObjectPath_PartComponent(&lmi_rd, cop); CIM_ComputerSystemRef cim_csr; @@ -119,32 +150,25 @@ static CMPIStatus references( CIM_ComputerSystemRef_Set_CreationClassName(&cim_csr, comp_ccname); o = CIM_ComputerSystemRef_ToObjectPath(&cim_csr, &st); CMSetClassName(o, comp_ccname); - if (names) { - LMI_RootDirectory_SetObjectPath_GroupComponent(&lmi_rd, o); - o = LMI_RootDirectory_ToObjectPath(&lmi_rd, &st); - CMReturnObjectPath(cr, o); - } else { - ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); - CMReturnInstance(cr, ci); - } + LMI_RootDirectory_SetObjectPath_GroupComponent(&lmi_rd, o); } else { - /* Linux_ComputerSystem */ + /* got Linux_ComputerSystem */ LMI_RootDirectory_SetObjectPath_GroupComponent(&lmi_rd, cop); LMI_UnixDirectory lmi_ud; LMI_UnixDirectory_Init(&lmi_ud, _cb, ns); fill_logicalfile(LMI_UnixDirectory, &lmi_ud, "/", LMI_UnixDirectory_ClassName); o = LMI_UnixDirectory_ToObjectPath(&lmi_ud, &st); - if (names) { - LMI_RootDirectory_SetObjectPath_PartComponent(&lmi_rd, o); - o = LMI_RootDirectory_ToObjectPath(&lmi_rd, &st); - CMReturnObjectPath(cr, o); - } else { - ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); - CMReturnInstance(cr, ci); - } + LMI_RootDirectory_SetObjectPath_PartComponent(&lmi_rd, o); } + if (names) { + o = LMI_RootDirectory_ToObjectPath(&lmi_rd, &st); + CMReturnObjectPath(cr, o); + } else { + ci = LMI_RootDirectory_ToInstance(&lmi_rd, &st); + CMReturnInstance(cr, ci); + } CMReturn(CMPI_RC_OK); } -- cgit From fb270dd0e7ee4d5e71300b67c4794b63b02a0df4 Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Thu, 14 Feb 2013 15:55:21 +0100 Subject: LogicalFile: fix DirectoryContainsFile --- .../LMI_DirectoryContainsFileProvider.c | 37 ++++++++++------------ 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/logicalfile/LMI_DirectoryContainsFileProvider.c b/src/logicalfile/LMI_DirectoryContainsFileProvider.c index fcc77f3..86f8b10 100644 --- a/src/logicalfile/LMI_DirectoryContainsFileProvider.c +++ b/src/logicalfile/LMI_DirectoryContainsFileProvider.c @@ -71,14 +71,7 @@ static CMPIStatus dir_file_objectpaths( snprintf(err, BUFLEN, "Can't stat file: %s", rpath); CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, err); } else { - (S_ISREG(sb.st_mode)) ? strcpy(fileclass, "LMI_DataFile") : - (S_ISDIR(sb.st_mode)) ? strcpy(fileclass, "LMI_UnixDirectory") : - (S_ISCHR(sb.st_mode)) ? strcpy(fileclass, "LMI_UnixDeviceFile") : - (S_ISBLK(sb.st_mode)) ? strcpy(fileclass, "LMI_UnixDeviceFile") : - (S_ISLNK(sb.st_mode)) ? strcpy(fileclass, "LMI_SymbolicLink") : - (S_ISFIFO(sb.st_mode)) ? strcpy(fileclass, "LMI_FIFOPipeFile") : - (S_ISSOCK(sb.st_mode)) ? strcpy(fileclass, "LMI_UnixSocket") : - strcpy(fileclass, "Unknown"); + get_class_from_stat(&sb, fileclass); } CIM_LogicalFileRef cim_lfr; @@ -150,7 +143,7 @@ static CMPIStatus associators( unsigned int count; if (CMClassPathIsA(_cb, cop, LMI_UnixDirectory_ClassName, &st)) { - /* UnixDirectory */ + /* got UnixDirectory */ st = dir_file_objectpaths(cc, cr, properties, ns, path, refs, &count); if (st.rc != CMPI_RC_OK) { return st; @@ -167,19 +160,21 @@ static CMPIStatus associators( } } } else { - /* LogicalFile */ - CIM_LogicalFileRef cim_lfr; - CIM_LogicalFileRef_Init(&cim_lfr, _cb, ns); - fill_logicalfile(CIM_LogicalFileRef, &cim_lfr, path, ccname); + /* got LogicalFile */ + CIM_DirectoryRef lmi_dr; + CIM_DirectoryRef_Init(&lmi_dr, _cb, ns); + char *aux = strdup(path); + fill_logicalfile(CIM_DirectoryRef, &lmi_dr, dirname(aux), LMI_UnixDirectory_ClassName); + o = CIM_DirectoryRef_ToObjectPath(&lmi_dr, &st); + CMSetClassName(o, LMI_UnixDirectory_ClassName); - o = CIM_LogicalFileRef_ToObjectPath(&cim_lfr, &st); - CMSetClassName(o, ccname); if (names) { CMReturnObjectPath(cr, o); } else { ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); CMReturnInstance(cr, ci); } + free(aux); } CMReturn(CMPI_RC_OK); } @@ -244,12 +239,12 @@ static CMPIStatus references( CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Too many files in a single directory..."); } for (unsigned int i = 0; i < count; i++) { + LMI_DirectoryContainsFile_SetObjectPath_PartComponent(&lmi_dcf, refs[i]); + o = LMI_DirectoryContainsFile_ToObjectPath(&lmi_dcf, &st); if (names) { - LMI_DirectoryContainsFile_SetObjectPath_PartComponent(&lmi_dcf, refs[i]); - o = LMI_DirectoryContainsFile_ToObjectPath(&lmi_dcf, &st); CMReturnObjectPath(cr, o); } else { - ci = _cb->bft->getInstance(_cb, cc, refs[i], properties, &st); + ci = LMI_DirectoryContainsFile_ToInstance(&lmi_dcf, &st); CMReturnInstance(cr, ci); } } @@ -265,12 +260,12 @@ static CMPIStatus references( fill_logicalfile(CIM_DirectoryRef, &lmi_dr, dirname(aux), LMI_UnixDirectory_ClassName); o = CIM_DirectoryRef_ToObjectPath(&lmi_dr, &st); CMSetClassName(o, LMI_UnixDirectory_ClassName); + LMI_DirectoryContainsFile_SetObjectPath_GroupComponent(&lmi_dcf, o); + o = LMI_DirectoryContainsFile_ToObjectPath(&lmi_dcf, &st); if (names) { - LMI_DirectoryContainsFile_SetObjectPath_GroupComponent(&lmi_dcf, o); - o = LMI_DirectoryContainsFile_ToObjectPath(&lmi_dcf, &st); CMReturnObjectPath(cr, o); } else { - ci = _cb->bft->getInstance(_cb, cc, o, properties, &st); + ci = LMI_DirectoryContainsFile_ToInstance(&lmi_dcf, &st); CMReturnInstance(cr, ci); } free(aux); -- cgit From d73b07787994cf76d85e7363c35f6f8e00cab028 Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Thu, 14 Feb 2013 15:57:35 +0100 Subject: LogicalFile: additional check for root directory in RootDirectory --- src/logicalfile/LMI_RootDirectoryProvider.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/logicalfile/LMI_RootDirectoryProvider.c b/src/logicalfile/LMI_RootDirectoryProvider.c index 179d146..0399ab1 100644 --- a/src/logicalfile/LMI_RootDirectoryProvider.c +++ b/src/logicalfile/LMI_RootDirectoryProvider.c @@ -59,6 +59,10 @@ static CMPIStatus associators( const char *ns = KNameSpace(cop); const char *comp_ccname = get_system_creation_class_name(); + CMPIData pathd; + pathd = CMGetKey(cop, "Name", &st); + const char *path = KChars(pathd.value.string); + /* * allow only LMI_UnixDirectory and Linux_ComputerSystem * XXX @@ -69,6 +73,11 @@ static CMPIStatus associators( if (CMClassPathIsA(_cb, cop, LMI_UnixDirectory_ClassName, &st)) { /* got LMI_UnixDirectory */ + /* ignore this association if the directory is not root */ + if (strcmp(path, "/")) { + CMReturn(CMPI_RC_OK); + } + CIM_ComputerSystemRef cim_csr; CIM_ComputerSystemRef_Init(&cim_csr, _cb, ns); CIM_ComputerSystemRef_Set_Name(&cim_csr, get_system_name()); -- cgit From 72f6010fc7dd68ea2ecd9431f906d077a7c20181 Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Thu, 14 Feb 2013 16:26:20 +0100 Subject: LogicalFile: support deleting directories --- src/logicalfile/LMI_UnixDirectoryProvider.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/logicalfile/LMI_UnixDirectoryProvider.c b/src/logicalfile/LMI_UnixDirectoryProvider.c index d70aae7..47d095a 100644 --- a/src/logicalfile/LMI_UnixDirectoryProvider.c +++ b/src/logicalfile/LMI_UnixDirectoryProvider.c @@ -17,6 +17,8 @@ * * Authors: Jan Synacek */ +#include +#include #include #include "LMI_UnixDirectory.h" #include "file.h" @@ -81,7 +83,7 @@ static CMPIStatus LMI_UnixDirectoryCreateInstance( if (mkdir(path, 0777) < 0) { char errmsg[BUFLEN]; - snprintf(errmsg, BUFLEN, "Can't mkdir: %s", path); + snprintf(errmsg, BUFLEN, "Can't mkdir: %s (%s)", path, strerror(errno)); CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, errmsg); } @@ -105,7 +107,17 @@ static CMPIStatus LMI_UnixDirectoryDeleteInstance( const CMPIResult* cr, const CMPIObjectPath* cop) { - CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); + CMPIStatus st; + CMPIData pathd = CMGetKey(cop, "Name", &st); + const char *path = KChars(pathd.value.string); + + if (rmdir(path) < 0) { + char errmsg[BUFLEN]; + snprintf(errmsg, BUFLEN, "Can't mkdir: %s (%s)", path, strerror(errno)); + CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, errmsg); + } + + CMReturn(CMPI_RC_OK); } static CMPIStatus LMI_UnixDirectoryExecQuery( -- cgit From 7a0b251bcd55a26679bb99480f02948105947d05 Mon Sep 17 00:00:00 2001 From: Peter Schiffer Date: Wed, 6 Mar 2013 13:16:25 +0100 Subject: Created LMI_ProcessorProvider providing basic information about CPU. Main source of information is dmidecode program, with additional information from lscpu program and /proc/cpuinfo file. If no output from dmidecode program is available, fallback with only lscpu and /proc/cpuinfo is used. --- src/hardware/CMakeLists.txt | 11 +- src/hardware/LMI_ProcessorProvider.c | 1153 ++++++++++++++++++++++++++++++++++ src/hardware/cpuinfo.c | 145 +++++ src/hardware/cpuinfo.h | 54 ++ src/hardware/dmidecode.c | 343 ++++++++++ src/hardware/dmidecode.h | 66 ++ src/hardware/lscpu.c | 151 +++++ src/hardware/lscpu.h | 55 ++ src/hardware/utils.c | 382 +++++++++++ src/hardware/utils.h | 111 ++++ 10 files changed, 2467 insertions(+), 4 deletions(-) create mode 100644 src/hardware/LMI_ProcessorProvider.c create mode 100644 src/hardware/cpuinfo.c create mode 100644 src/hardware/cpuinfo.h create mode 100644 src/hardware/dmidecode.c create mode 100644 src/hardware/dmidecode.h create mode 100644 src/hardware/lscpu.c create mode 100644 src/hardware/lscpu.h create mode 100644 src/hardware/utils.c create mode 100644 src/hardware/utils.h (limited to 'src') diff --git a/src/hardware/CMakeLists.txt b/src/hardware/CMakeLists.txt index 27e8df2..ebf79fb 100644 --- a/src/hardware/CMakeLists.txt +++ b/src/hardware/CMakeLists.txt @@ -1,11 +1,14 @@ - set(PROVIDER_NAME Hardware) set(LIBRARY_NAME cmpiLMI_${PROVIDER_NAME}) set(MOF LMI_Hardware.mof) -#set(provider_SRCS -# util/serviceutil.c -#) +set(provider_SRCS + utils.c + dmidecode.c + lscpu.c + cpuinfo.c + LMI_ProcessorProvider.c +) konkretcmpi_generate(${MOF} CIM_PROVIDERS diff --git a/src/hardware/LMI_ProcessorProvider.c b/src/hardware/LMI_ProcessorProvider.c new file mode 100644 index 0000000..8e92fdd --- /dev/null +++ b/src/hardware/LMI_ProcessorProvider.c @@ -0,0 +1,1153 @@ +/* + * Copyright (C) 2013 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: Peter Schiffer + */ + +#include +#include +#include +#include "LMI_Processor.h" +#include "globals.h" +#include "dmidecode.h" +#include "lscpu.h" +#include "cpuinfo.h" + +CMPIUint16 get_family(const char *family); +CMPIUint16 get_cpustatus(const char *status); +CMPIUint16 get_enabledstate(const CMPIUint16 status); +CMPIUint16 get_upgrade_method(const char *dmi_upgrade); +CMPIUint16 get_characteristic(const char *dmi_charact); +CMPIUint16 get_flag(const char *flag, short *stat); + +static const CMPIBroker* _cb = NULL; + +static void LMI_ProcessorInitialize() +{ +} + +static CMPIStatus LMI_ProcessorCleanup( + CMPIInstanceMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_ProcessorEnumInstanceNames( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + return KDefaultEnumerateInstanceNames( + _cb, mi, cc, cr, cop); +} + +static CMPIStatus LMI_ProcessorEnumInstances( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + LMI_Processor lmi_cpu; + const char *ns = KNameSpace(cop); + CMPICount count; + CMPIUint16 cpustatus, enabledstate, family, charact, enabled_cores; + CMPIUint32 current_speed = 0, max_speed = 0, external_clock = 0; + unsigned i, j, cpus_nb = 0; + char *other_family = NULL, *architecture = NULL, *cpu_id = NULL, + *cpu_name = NULL, *stepping = NULL, *error_msg = NULL; + struct utsname utsname_buf; + DmiProcessor *dmi_cpus; + unsigned dmi_cpus_nb; + LscpuProcessor lscpu; + CpuinfoProcessor proc_cpu; + + if (dmi_get_processors(&dmi_cpus, &dmi_cpus_nb) != 0 || dmi_cpus_nb < 1) { + dmi_free_processors(&dmi_cpus, &dmi_cpus_nb); + } + + if (lscpu_get_processor(&lscpu) != 0) { + error_msg = "Unable to get processor information."; + goto done; + } + + if (cpuinfo_get_processor(&proc_cpu) != 0) { + error_msg = "Unable to get processor information."; + goto done; + } + + if (uname(&utsname_buf) == 0) { + architecture = strdup(utsname_buf.machine); + if (!architecture) { + error_msg = "Not enough available memory."; + goto done; + } + } + + if (dmi_cpus_nb > 0) { + cpus_nb = dmi_cpus_nb; + } else if (lscpu.processors > 0) { + cpus_nb = lscpu.processors; + } else { + error_msg = "Unable to get processor information."; + goto done; + } + + for (i = 0; i < cpus_nb; i++) { + LMI_Processor_Init(&lmi_cpu, _cb, ns); + + 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, "LMI_Processor"); + LMI_Processor_Set_Caption(&lmi_cpu, "Processor"); + LMI_Processor_Set_Description(&lmi_cpu, + "This object represents one processor in system."); + + /* do we have output from dmidecode program? */ + if (dmi_cpus_nb > 0) { + family = get_family(dmi_cpus[i].family); + if (family == 1) { + other_family = dmi_cpus[i].family; + } + cpustatus = get_cpustatus(dmi_cpus[i].status); + enabledstate = get_enabledstate(cpustatus); + if (enabledstate == 2) { + current_speed = dmi_cpus[i].current_speed; + max_speed = dmi_cpus[i].max_speed; + external_clock = dmi_cpus[i].external_clock; + } + cpu_name = dmi_cpus[i].name; + enabled_cores = dmi_cpus[i].enabled_cores; + stepping = dmi_cpus[i].stepping; + + LMI_Processor_Set_DeviceID(&lmi_cpu, dmi_cpus[i].id); + LMI_Processor_Set_Family(&lmi_cpu, family); + LMI_Processor_Set_OtherFamilyDescription(&lmi_cpu, other_family); + LMI_Processor_Set_UpgradeMethod(&lmi_cpu, + get_upgrade_method(dmi_cpus[i].upgrade)); + if (dmi_cpus[i].type && strlen(dmi_cpus[i].type)) { + LMI_Processor_Set_Role(&lmi_cpu, dmi_cpus[i].type); + } + /* CPU Characteristics */ + if (dmi_cpus[i].charact_nb > 0) { + count = 0; + LMI_Processor_Init_Characteristics(&lmi_cpu, + dmi_cpus[i].charact_nb); + LMI_Processor_Init_EnabledProcessorCharacteristics(&lmi_cpu, + dmi_cpus[i].charact_nb); + for (j = 0; j < dmi_cpus[i].charact_nb; j++) { + charact = get_characteristic( + dmi_cpus[i].characteristics[j]); + if (charact) { + LMI_Processor_Set_Characteristics(&lmi_cpu, count, + charact); + LMI_Processor_Set_EnabledProcessorCharacteristics( + &lmi_cpu, count, 0); + count++; + } + } + } + } else { + cpu_id = (char *)malloc(10 * sizeof(char)); + if (!cpu_id) { + error_msg = "Not enough available memory."; + goto done; + } + snprintf(cpu_id, 10, "%u", i); + LMI_Processor_Set_DeviceID(&lmi_cpu, cpu_id); + free(cpu_id); + cpu_id = NULL; + + cpustatus = get_cpustatus("Enabled"); + enabledstate = get_enabledstate(cpustatus); + if (enabledstate == 2) { + current_speed = lscpu.current_speed; + } + + cpu_name = proc_cpu.model_name; + enabled_cores = lscpu.cores; + stepping = lscpu.stepping; + } + + LMI_Processor_Set_CPUStatus(&lmi_cpu, cpustatus); + LMI_Processor_Set_EnabledState(&lmi_cpu, enabledstate); + LMI_Processor_Set_NumberOfEnabledCores(&lmi_cpu, enabled_cores); + if (current_speed) { + LMI_Processor_Set_CurrentClockSpeed(&lmi_cpu, current_speed); + } + if (max_speed) { + LMI_Processor_Set_MaxClockSpeed(&lmi_cpu, max_speed); + } + if (external_clock) { + LMI_Processor_Set_ExternalBusClockSpeed(&lmi_cpu, external_clock); + } + if (cpu_name && strlen(cpu_name)) { + LMI_Processor_Set_Name(&lmi_cpu, cpu_name); + LMI_Processor_Set_UniqueID(&lmi_cpu, cpu_name); + LMI_Processor_Set_ElementName(&lmi_cpu, cpu_name); + } + if (stepping && strlen(stepping)) { + LMI_Processor_Set_Stepping(&lmi_cpu, stepping); + } + if (lscpu.data_width) { + LMI_Processor_Set_DataWidth(&lmi_cpu, lscpu.data_width); + } + /* CPU Flags */ + if (proc_cpu.flags_nb > 0) { + short stat = -1; + CMPIUint16 flag; + LMI_Processor_Init_Flags(&lmi_cpu, proc_cpu.flags_nb); + count = 0; + for (j = 0; j < proc_cpu.flags_nb; j++) { + flag = get_flag(proc_cpu.flags[j], &stat); + if (stat == 0) { + LMI_Processor_Set_Flags(&lmi_cpu, count, flag); + count++; + } + } + } + if (proc_cpu.address_size) { + LMI_Processor_Set_AddressWidth(&lmi_cpu, proc_cpu.address_size); + } + if (architecture && strlen(architecture)) { + LMI_Processor_Set_Architecture(&lmi_cpu, architecture); + } + + KReturnInstance(cr, lmi_cpu); + } + +done: + if (architecture) { + free(architecture); + } + architecture = NULL; + + dmi_free_processors(&dmi_cpus, &dmi_cpus_nb); + lscpu_free_processor(&lscpu); + cpuinfo_free_processor(&proc_cpu); + + if (error_msg) { + KReturn2(_cb, ERR_FAILED, error_msg); + } + + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_ProcessorGetInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char** properties) +{ + return KDefaultGetInstance( + _cb, mi, cc, cr, cop, properties); +} + +static CMPIStatus LMI_ProcessorCreateInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_ProcessorModifyInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const CMPIInstance* ci, + const char** properties) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_ProcessorDeleteInstance( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +static CMPIStatus LMI_ProcessorExecQuery( + CMPIInstanceMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* lang, + const char* query) +{ + CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); +} + +CMInstanceMIStub( + LMI_Processor, + LMI_Processor, + _cb, + LMI_ProcessorInitialize()) + +static CMPIStatus LMI_ProcessorMethodCleanup( + CMPIMethodMI* mi, + const CMPIContext* cc, + CMPIBoolean term) +{ + CMReturn(CMPI_RC_OK); +} + +static CMPIStatus LMI_ProcessorInvokeMethod( + CMPIMethodMI* mi, + const CMPIContext* cc, + const CMPIResult* cr, + const CMPIObjectPath* cop, + const char* meth, + const CMPIArgs* in, + CMPIArgs* out) +{ + return LMI_Processor_DispatchMethod( + _cb, mi, cc, cr, cop, meth, in, out); +} + +CMMethodMIStub( + LMI_Processor, + LMI_Processor, + _cb, + LMI_ProcessorInitialize()) + +KUint32 LMI_Processor_RequestStateChange( + const CMPIBroker* cb, + CMPIMethodMI* mi, + const CMPIContext* context, + const LMI_ProcessorRef* self, + const KUint16* RequestedState, + KRef* Job, + const KDateTime* TimeoutPeriod, + CMPIStatus* status) +{ + KUint32 result = KUINT32_INIT; + + KSetStatus(status, ERR_NOT_SUPPORTED); + return result; +} + +KUint32 LMI_Processor_SetPowerState( + const CMPIBroker* cb, + CMPIMethodMI* mi, + const CMPIContext* context, + const LMI_ProcessorRef* self, + const KUint16* PowerState, + const KDateTime* Time, + CMPIStatus* status) +{ + KUint32 result = KUINT32_INIT; + + KSetStatus(status, ERR_NOT_SUPPORTED); + return result; +} + +KUint32 LMI_Processor_Reset( + const CMPIBroker* cb, + CMPIMethodMI* mi, + const CMPIContext* context, + const LMI_ProcessorRef* self, + CMPIStatus* status) +{ + KUint32 result = KUINT32_INIT; + + KSetStatus(status, ERR_NOT_SUPPORTED); + return result; +} + +KUint32 LMI_Processor_EnableDevice( + const CMPIBroker* cb, + CMPIMethodMI* mi, + const CMPIContext* context, + const LMI_ProcessorRef* self, + const KBoolean* Enabled, + CMPIStatus* status) +{ + KUint32 result = KUINT32_INIT; + + KSetStatus(status, ERR_NOT_SUPPORTED); + return result; +} + +KUint32 LMI_Processor_OnlineDevice( + const CMPIBroker* cb, + CMPIMethodMI* mi, + const CMPIContext* context, + const LMI_ProcessorRef* self, + const KBoolean* Online, + CMPIStatus* status) +{ + KUint32 result = KUINT32_INIT; + + KSetStatus(status, ERR_NOT_SUPPORTED); + return result; +} + +KUint32 LMI_Processor_QuiesceDevice( + const CMPIBroker* cb, + CMPIMethodMI* mi, + const CMPIContext* context, + const LMI_ProcessorRef* self, + const KBoolean* Quiesce, + CMPIStatus* status) +{ + KUint32 result = KUINT32_INIT; + + KSetStatus(status, ERR_NOT_SUPPORTED); + return result; +} + +KUint32 LMI_Processor_SaveProperties( + const CMPIBroker* cb, + CMPIMethodMI* mi, + const CMPIContext* context, + const LMI_ProcessorRef* self, + CMPIStatus* status) +{ + KUint32 result = KUINT32_INIT; + + KSetStatus(status, ERR_NOT_SUPPORTED); + return result; +} + +KUint32 LMI_Processor_RestoreProperties( + const CMPIBroker* cb, + CMPIMethodMI* mi, + const CMPIContext* context, + const LMI_ProcessorRef* self, + CMPIStatus* status) +{ + KUint32 result = KUINT32_INIT; + + KSetStatus(status, ERR_NOT_SUPPORTED); + return result; +} + +/* + * Get CPU status according to the dmidecode. + * @param status from dmidecode + * @return CIM id of CPU status + */ +CMPIUint16 get_cpustatus(const char *status) +{ + if (!status) { + return 0; /* Unknown */ + } + + static struct { + CMPIUint16 val; /* CIM value */ + char *stat; /* dmidecode status */ + } statuses[] = { + {0, "Unknown"}, + {1, "Enabled"}, + {2, "Disabled By User"}, + {3, "Disabled By BIOS"}, + {4, "Idle"}, + }; + + size_t i, st_length = sizeof(statuses) / sizeof(statuses[0]); + + for (i = 0; i < st_length; i++) { + if (strcmp(status, statuses[i].stat) == 0) { + return statuses[i].val; + } + } + + return 0; /* Unknown */ +} + +/* + * Get enabled state according to the cpu status. + * @param status by CIM + * @return CIM id of enabled state + */ +CMPIUint16 get_enabledstate(const CMPIUint16 status) +{ + static struct { + CMPIUint16 cpustatus; /* CIM cpu status */ + CMPIUint16 enabledstate; /* CIM enabled state */ + } statuses[] = { + {0, 0}, + {1, 2}, + {2, 3}, + {3, 3}, + {4, 2}, + }; + + size_t i, st_length = sizeof(statuses) / sizeof(statuses[0]); + + for (i = 0; i < st_length; i++) { + if (status == statuses[i].cpustatus) { + return statuses[i].enabledstate; + } + } + + return 0; /* Unknown */ +} + +/* + * Get CPU characteristics according to the dmidecode output. + * @param dmi_charact characteristics from dmidecode + * @return characteristic defined by CIM + */ +CMPIUint16 get_characteristic(const char *dmi_charact) +{ + if (!dmi_charact) { + return 0; /* Unknown */ + } + + /* CIM characteristics based on + cim_schema_2.35.0Final-MOFs/Device/CIM_Processor.mof */ + /* Dmidecode characts based on dmidecode 2.11 */ + static struct { + CMPIUint16 value_map; /* ValueMap defined by CIM */ + char *value; /* Value defined by CIM (just for reference) */ + char *search; /* String used to match the dmidecode charact */ + } characts[] = { + /* + {0, "Unknown", ""}, + {1, "DMTF Reserved", ""}, + */ + {2, "64-bit Capable", "64-bit capable"}, + /* + {3, "32-bit Capable", ""}, + */ + {4, "Enhanced Virtualization", "Enhanced Virtualization"}, + {5, "Hardware Thread", "Hardware Thread"}, + {6, "NX-bit", "Execute Protection"}, + {7, "Power/Performance Control", "Power/Performance Control"}, + /* + {8, "Core Frequency Boosting", ""}, + */ + {32568, "Multi-Core", "Multi-Core"}, + }; + + size_t i, characts_length = sizeof(characts) / sizeof(characts[0]); + + for (i = 0; i < characts_length; i++) { + if (strcmp(dmi_charact, characts[i].search) == 0) { + return characts[i].value_map; + } + } + + return 0; /* Unknown */ +} + +/* + * Get CPU upgrade method according to the dmidecode upgrade. + * @param dmi_upgrade socket string from dmidecode program + * @return upgrade method id defined by CIM + */ +CMPIUint16 get_upgrade_method(const char *dmi_upgrade) +{ + if (!dmi_upgrade) { + return 2; /* Unknown */ + } + + /* CIM upgrade method based on + cim_schema_2.35.0Final-MOFs/Device/CIM_Processor.mof */ + /* Dmidecode upgrade based on dmidecode 2.11 */ + static struct { + CMPIUint16 value_map; /* ValueMap defined by CIM */ + char *value; /* Value defined by CIM (just for reference) */ + char *search; /* String used to match the dmidecode upgrade */ + } sockets[] = { + {1, "Other", "Other"}, + {2, "Unknown", "Unknown"}, + {3, "Daughter Board", "Daughter Board"}, + {4, "ZIF Socket", "ZIF Socket"}, + {5, "Replacement/Piggy Back", "Replaceable Piggy Back"}, + {6, "None", "None"}, + {7, "LIF Socket", "LIF Socket"}, + {8, "Slot 1", "Slot 1"}, + {9, "Slot 2", "Slot 2"}, + {10, "370 Pin Socket", "370-pin Socket"}, + {11, "Slot A", "Slot A"}, + {12, "Slot M", "Slot M"}, + {13, "Socket 423", "Socket 423"}, + {14, "Socket A (Socket 462)", "Socket A (Socket 462)"}, + {15, "Socket 478", "Socket 478"}, + {16, "Socket 754", "Socket 754"}, + {17, "Socket 940", "Socket 940"}, + {18, "Socket 939", "Socket 939"}, + {19, "Socket mPGA604", "Socket mPGA604"}, + {20, "Socket LGA771", "Socket LGA771"}, + {21, "Socket LGA775", "Socket LGA775"}, + {22, "Socket S1", "Socket S1"}, + {23, "Socket AM2", "Socket AM2"}, + {24, "Socket F (1207)", "Socket F (1207)"}, + {25, "Socket LGA1366", "Socket LGA1366"}, + {26, "Socket G34", "Socket G34"}, + {27, "Socket AM3", "Socket AM3"}, + {28, "Socket C32", "Socket C32"}, + {29, "Socket LGA1156", "Socket LGA1156"}, + {30, "Socket LGA1567", "Socket LGA1567"}, + {31, "Socket PGA988A", "Socket PGA988A"}, + {32, "Socket BGA1288", "Socket BGA1288"}, + {33, "rPGA988B", "Socket rPGA988B"}, + {34, "BGA1023", "Socket BGA1023"}, + {35, "BGA1224", "Socket BGA1024"}, + {36, "LGA1155", "Socket BGA1155"}, + {37, "LGA1356", "Socket LGA1356"}, + {38, "LGA2011", "Socket LGA2011"}, + {39, "Socket FS1", "Socket FS1"}, + {40, "Socket FS2", "Socket FS2"}, + {41, "Socket FM1", "Socket FM1"}, + {42, "Socket FM2", "Socket FM2"}, + /* + {43, "Socket LGA2011-3", ""}, + {44, "Socket LGA1356-3", ""}, + */ + }; + + size_t i, sockets_length = sizeof(sockets) / sizeof(sockets[0]); + + for (i = 0; i < sockets_length; i++) { + if (strcmp(dmi_upgrade, sockets[i].search) == 0) { + return sockets[i].value_map; + } + } + + return 1; /* Other */ +} + +/* + * Get CPU flag id. + * @param flag from /proc/cpuinfo file + * @param stat 0 if flag found, negative value otherwise + * @return CIM id of flag + */ +CMPIUint16 get_flag(const char *flag, short *stat) +{ + if (!flag) { + *stat = -1; + return 0; + } + + /* Flag IDs and names are based on: + linux-3.8/arch/x86/include/asm/cpufeature.h */ + static struct { + CMPIUint16 val; /* CIM value */ + char *flag; /* flag name */ + } flags[] = { + /* 0*32 */ + {0, "fpu"}, + {1, "vme"}, + {2, "de"}, + {3, "pse"}, + {4, "tsc"}, + {5, "msr"}, + {6, "pae"}, + {7, "mce"}, + {8, "cx8"}, + {9, "apic"}, + {11, "sep"}, + {12, "mtrr"}, + {13, "pge"}, + {14, "mca"}, + {15, "cmov"}, + {16, "pat"}, + {17, "pse36"}, + {18, "pn"}, + {19, "clflush"}, + {21, "dts"}, + {22, "acpi"}, + {23, "mmx"}, + {24, "fxsr"}, + {25, "sse"}, + {26, "sse2"}, + {27, "ss"}, + {28, "ht"}, + {29, "tm"}, + {30, "ia64"}, + {31, "pbe"}, + /* 1*32 */ + {43, "syscall"}, + {51, "mp"}, + {52, "nx"}, + {54, "mmxext"}, + {57, "fxsr_opt"}, + {58, "pdpe1gb"}, + {59, "rdtscp"}, + {61, "lm"}, + {62, "3dnowext"}, + {63, "3dnow"}, + /* 2*32 */ + {64, "recovery"}, + {65, "longrun"}, + {67, "lrti"}, + /* 3*32 */ + {96, "cxmmx"}, + {97, "k6_mtrr"}, + {98, "cyrix_arr"}, + {99, "centaur_mcr"}, + {100, "k8"}, + {101, "k7"}, + {102, "p3"}, + {103, "p4"}, + {104, "constant_tsc"}, + {105, "up"}, + {106, "fxsave_leak"}, + {107, "arch_perfmon"}, + {108, "pebs"}, + {109, "bts"}, + {110, "syscall32"}, + {111, "sysenter32"}, + {112, "rep_good"}, + {113, "mfence_rdtsc"}, + {114, "lfence_rdtsc"}, + {115, "11ap"}, + {116, "nopl"}, + {118, "xtopology"}, + {119, "tsc_reliable"}, + {120, "nonstop_tsc"}, + {121, "clflush_monitor"}, + {122, "extd_apicid"}, + {123, "amd_dcm"}, + {124, "aperfmperf"}, + {125, "eagerfpu"}, + /* 4*32 */ + {128, "pni"}, + {129, "pclmulqdq"}, + {130, "dtes64"}, + {131, "monitor"}, + {132, "ds_cpl"}, + {133, "vmx"}, + {134, "smx"}, + {135, "est"}, + {136, "tm2"}, + {137, "ssse3"}, + {138, "cid"}, + {140, "fma"}, + {141, "cx16"}, + {142, "xtpr"}, + {143, "pdcm"}, + {145, "pcid"}, + {146, "dca"}, + {147, "sse4_1"}, + {148, "sse4_2"}, + {149, "x2apic"}, + {150, "movbe"}, + {151, "popcnt"}, + {152, "tsc_deadline_timer"}, + {153, "aes"}, + {154, "xsave"}, + {155, "osxsave"}, + {156, "avx"}, + {157, "f16c"}, + {158, "rdrand"}, + {159, "hypervisor"}, + /* 5*32*/ + {162, "rng"}, + {163, "rng_en"}, + {166, "ace"}, + {167, "ace_en"}, + {168, "ace2"}, + {169, "ace2_en"}, + {170, "phe"}, + {171, "phe_en"}, + {172, "pmm"}, + {173, "pmm_en"}, + /* 6*32 */ + {192, "lahf_lm"}, + {193, "cmp_legacy"}, + {194, "svm"}, + {195, "extapic"}, + {196, "cr8_legacy"}, + {197, "abm"}, + {198, "sse4a"}, + {199, "misalignsse"}, + {200, "3dnowprefetch"}, + {201, "osvw"}, + {202, "ibs"}, + {203, "xop"}, + {204, "skinit"}, + {205, "wdt"}, + {207, "lwp"}, + {208, "fma4"}, + {209, "tce"}, + {211, "nodeid_msr"}, + {213, "tbm"}, + {214, "topoext"}, + {215, "perfctr_core"}, + /* 7*32 */ + {224, "ida"}, + {225, "arat"}, + {226, "cpb"}, + {227, "epb"}, + {228, "xsaveopt"}, + {229, "pln"}, + {230, "pts"}, + {231, "dtherm"}, + {232, "hw_pstate"}, + /* 8*32 */ + {256, "tpr_shadow"}, + {257, "vnmi"}, + {258, "flexpriority"}, + {259, "ept"}, + {260, "vpid"}, + {261, "npt"}, + {262, "lbrv"}, + {263, "svm_lock"}, + {264, "nrip_save"}, + {265, "tsc_scale"}, + {266, "vmcb_clean"}, + {267, "flushbyasid"}, + {268, "decodeassists"}, + {269, "pausefilter"}, + {270, "pfthreshold"}, + /* 9*32 */ + {288, "fsgsbase"}, + {289, "tsc_adjust"}, + {291, "bmi1"}, + {292, "hle"}, + {293, "avx2"}, + {295, "smep"}, + {296, "bmi2"}, + {297, "erms"}, + {298, "invpcid"}, + {299, "rtm"}, + {306, "rdseed"}, + {307, "adx"}, + {308, "smap"}, + }; + + size_t i, st_length = sizeof(flags) / sizeof(flags[0]); + + for (i = 0; i < st_length; i++) { + if (strcmp(flag, flags[i].flag) == 0) { + *stat = 0; + return flags[i].val; + } + } + + *stat = -2; + return 0; +} + +/* + * Get CPU family id according to the dmidecode family. + * @param dmi_family family string from dmidecode program + * @return family id defined by CIM + */ +CMPIUint16 get_family(const char *dmi_family) +{ + if (!dmi_family) { + return 2; /* Unknown */ + } + + /* CIM CPU families based on + cim_schema_2.35.0Final-MOFs/Device/CIM_Processor.mof */ + /* Dmidecode families based on dmidecode 2.11 */ + static struct { + CMPIUint16 value_map; /* ValueMap defined by CIM */ + char *value; /* Value defined by CIM (just for reference) */ + char *search; /* String used to match the dmidecode family */ + } fm[] = { + {1, "Other", "Other"}, + {2, "Unknown", "Unknown"}, + {3, "8086", "8086"}, + {4, "80286", "80286"}, + {5, "80386", "80386"}, + {6, "80486", "80486"}, + {7, "8087", "8087"}, + {8, "80287", "80287"}, + {9, "80387", "80387"}, + {10, "80487", "80487"}, + {11, "Pentium(R) brand", "Pentium"}, + {12, "Pentium(R) Pro", "Pentium Pro"}, + {13, "Pentium(R) II", "Pentium II"}, + {14, "Pentium(R) processor with MMX(TM) technology", "Pentium MMX"}, + {15, "Celeron(TM)", "Celeron"}, + {16, "Pentium(R) II Xeon(TM)", "Pentium II Xeon"}, + {17, "Pentium(R) III", "Pentium III"}, + {18, "M1 Family", "M1"}, + {19, "M2 Family", "M2"}, + {20, "Intel(R) Celeron(R) M processor", "Celeron M"}, + {21, "Intel(R) Pentium(R) 4 HT processor", "Pentium 4 HT"}, + + {24, "K5 Family", "K5"}, + {25, "K6 Family", "K6"}, + {26, "K6-2", "K6-2"}, + {27, "K6-3", "K6-3"}, + {28, "AMD Athlon(TM) Processor Family", "Athlon"}, + {29, "AMD(R) Duron(TM) Processor", "Duron"}, + {30, "AMD29000 Family", "AMD29000"}, + {31, "K6-2+", "K6-2+"}, + {32, "Power PC Family", "Power PC"}, + {33, "Power PC 601", "Power PC 601"}, + {34, "Power PC 603", "Power PC 603"}, + {35, "Power PC 603+", "Power PC 603+"}, + {36, "Power PC 604", "Power PC 604"}, + {37, "Power PC 620", "Power PC 620"}, + {38, "Power PC X704", "Power PC x704"}, + {39, "Power PC 750", "Power PC 750"}, + {40, "Intel(R) Core(TM) Duo processor", "Core Duo"}, + {41, "Intel(R) Core(TM) Duo mobile processor", "Core Duo Mobile"}, + {42, "Intel(R) Core(TM) Solo mobile processor", "Core Solo Mobile"}, + {43, "Intel(R) Atom(TM) processor", "Atom"}, + + {48, "Alpha Family", "Alpha"}, + {49, "Alpha 21064", "Alpha 21064"}, + {50, "Alpha 21066", "Alpha 21066"}, + {51, "Alpha 21164", "Alpha 21164"}, + {52, "Alpha 21164PC", "Alpha 21164PC"}, + {53, "Alpha 21164a", "Alpha 21164a"}, + {54, "Alpha 21264", "Alpha 21264"}, + {55, "Alpha 21364", "Alpha 21364"}, + {56, "AMD Turion(TM) II Ultra Dual-Core Mobile M Processor Family", + "Turion II Ultra Dual-Core Mobile M"}, + {57, "AMD Turion(TM) II Dual-Core Mobile M Processor Family", + "Turion II Dual-Core Mobile M"}, + {58, "AMD Athlon(TM) II Dual-Core Mobile M Processor Family", + "Athlon II Dual-Core M"}, + {59, "AMD Opteron(TM) 6100 Series Processor", "Opteron 6100"}, + {60, "AMD Opteron(TM) 4100 Series Processor", "Opteron 4100"}, + {61, "AMD Opteron(TM) 6200 Series Processor", "Opteron 6200"}, + {62, "AMD Opteron(TM) 4200 Series Processor", "Opteron 4200"}, + + /* + {63, "AMD FX(TM) Series Processor", ""}, + */ + {64, "MIPS Family", "MIPS"}, + {65, "MIPS R4000", "MIPS R4000"}, + {66, "MIPS R4200", "MIPS R4200"}, + {67, "MIPS R4400", "MIPS R4400"}, + {68, "MIPS R4600", "MIPS R4600"}, + {69, "MIPS R10000", "MIPS R10000"}, + {70, "AMD C-Series Processor", "C-Series"}, + {71, "AMD E-Series Processor", "E-Series"}, + /* + {72, "AMD A-Series Processor", ""}, + */ + {73, "AMD G-Series Processor", "G-Series"}, + /* + {74, "AMD Z-Series Processor", ""}, + {75, "AMD R-Series Processor", ""}, + {76, "AMD Opteron(TM) 4300 Series Processor", ""}, + {77, "AMD Opteron(TM) 6300 Series Processor", ""}, + {78, "AMD Opteron(TM) 3300 Series Processor", ""}, + {79, "AMD FirePro(TM) Series Processor", ""}, + */ + + {80, "SPARC Family", "SPARC"}, + {81, "SuperSPARC", "SuperSPARC"}, + {82, "microSPARC II", "MicroSPARC II"}, + {83, "microSPARC IIep", "MicroSPARC IIep"}, + {84, "UltraSPARC", "UltraSPARC"}, + {85, "UltraSPARC II", "UltraSPARC II"}, + {86, "UltraSPARC IIi", "UltraSPARC IIi"}, + {87, "UltraSPARC III", "UltraSPARC III"}, + {88, "UltraSPARC IIIi", "UltraSPARC IIIi"}, + + {96, "68040", "68040"}, + {97, "68xxx Family", "68xxx"}, + {98, "68000", "68000"}, + {99, "68010", "68010"}, + {100, "68020", "68020"}, + {101, "68030", "68030"}, + + {112, "Hobbit Family", "Hobbit"}, + + {120, "Crusoe(TM) TM5000 Family", "Crusoe TM5000"}, + {121, "Crusoe(TM) TM3000 Family", "Crusoe TM3000"}, + {122, "Efficeon(TM) TM8000 Family", "Efficeon TM8000"}, + + {128, "Weitek", "Weitek"}, + + {130, "Itanium(TM) Processor", "Itanium"}, + {131, "AMD Athlon(TM) 64 Processor Family", "Athlon 64"}, + {132, "AMD Opteron(TM) Processor Family", "Opteron"}, + {133, "AMD Sempron(TM) Processor Family", "Sempron"}, + {134, "AMD Turion(TM) 64 Mobile Technology", "Turion 64"}, + {135, "Dual-Core AMD Opteron(TM) Processor Family", + "Dual-Core Opteron"}, + {136, "AMD Athlon(TM) 64 X2 Dual-Core Processor Family", + "Athlon 64 X2"}, + {137, "AMD Turion(TM) 64 X2 Mobile Technology", "Turion 64 X2"}, + {138, "Quad-Core AMD Opteron(TM) Processor Family", + "Quad-Core Opteron"}, + {139, "Third-Generation AMD Opteron(TM) Processor Family", + "Third-Generation Opteron"}, + {140, "AMD Phenom(TM) FX Quad-Core Processor Family", "Phenom FX"}, + {141, "AMD Phenom(TM) X4 Quad-Core Processor Family", "Phenom X4"}, + {142, "AMD Phenom(TM) X2 Dual-Core Processor Family", "Phenom X2"}, + {143, "AMD Athlon(TM) X2 Dual-Core Processor Family", "Athlon X2"}, + {144, "PA-RISC Family", "PA-RISC"}, + {145, "PA-RISC 8500", "PA-RISC 8500"}, + {146, "PA-RISC 8000", "PA-RISC 8000"}, + {147, "PA-RISC 7300LC", "PA-RISC 7300LC"}, + {148, "PA-RISC 7200", "PA-RISC 7200"}, + {149, "PA-RISC 7100LC", "PA-RISC 7100LC"}, + {150, "PA-RISC 7100", "PA-RISC 7100"}, + + {161, "Quad-Core Intel(R) Xeon(R) processor 3200 Series", + "Quad-Core Xeon 3200"}, + {162, "Dual-Core Intel(R) Xeon(R) processor 3000 Series", + "Dual-Core Xeon 3000"}, + {163, "Quad-Core Intel(R) Xeon(R) processor 5300 Series", + "Quad-Core Xeon 5300"}, + {164, "Dual-Core Intel(R) Xeon(R) processor 5100 Series", + "Dual-Core Xeon 5100"}, + {165, "Dual-Core Intel(R) Xeon(R) processor 5000 Series", + "Dual-Core Xeon 5000"}, + {166, "Dual-Core Intel(R) Xeon(R) processor LV", "Dual-Core Xeon LV"}, + {167, "Dual-Core Intel(R) Xeon(R) processor ULV", + "Dual-Core Xeon ULV"}, + {168, "Dual-Core Intel(R) Xeon(R) processor 7100 Series", + "Dual-Core Xeon 7100"}, + {169, "Quad-Core Intel(R) Xeon(R) processor 5400 Series", + "Quad-Core Xeon 5400"}, + {170, "Quad-Core Intel(R) Xeon(R) processor", "Quad-Core Xeon"}, + {171, "Dual-Core Intel(R) Xeon(R) processor 5200 Series", + "Dual-Core Xeon 5200"}, + {172, "Dual-Core Intel(R) Xeon(R) processor 7200 Series", + "Dual-Core Xeon 7200"}, + {173, "Quad-Core Intel(R) Xeon(R) processor 7300 Series", + "Quad-Core Xeon 7300"}, + {174, "Quad-Core Intel(R) Xeon(R) processor 7400 Series", + "Quad-Core Xeon 7400"}, + {175, "Multi-Core Intel(R) Xeon(R) processor 7400 Series", + "Multi-Core Xeon 7400"}, + {176, "Pentium(R) III Xeon(TM)", "Pentium III Xeon"}, + {177, "Pentium(R) III Processor with Intel(R) SpeedStep(TM) Technology", + "Pentium III Speedstep"}, + {178, "Pentium(R) 4", "Pentium 4"}, + {179, "Intel(R) Xeon(TM)", "Xeon"}, + {180, "AS400 Family", "AS400"}, + {181, "Intel(R) Xeon(TM) processor MP", "Xeon MP"}, + {182, "AMD Athlon(TM) XP Family", "Athlon XP"}, + {183, "AMD Athlon(TM) MP Family", "Athlon MP"}, + {184, "Intel(R) Itanium(R) 2", "Itanium 2"}, + {185, "Intel(R) Pentium(R) M processor", "Pentium M"}, + {186, "Intel(R) Celeron(R) D processor", "Celeron D"}, + {187, "Intel(R) Pentium(R) D processor", "Pentium D"}, + {188, "Intel(R) Pentium(R) Processor Extreme Edition", "Pentium EE"}, + {189, "Intel(R) Core(TM) Solo Processor", "Core Solo"}, + {190, "K7", "K7"}, + {191, "Intel(R) Core(TM)2 Duo Processor", "Core 2 Duo"}, + {192, "Intel(R) Core(TM)2 Solo processor", "Core 2 Solo"}, + {193, "Intel(R) Core(TM)2 Extreme processor", "Core 2 Extreme"}, + {194, "Intel(R) Core(TM)2 Quad processor", "Core 2 Quad"}, + {195, "Intel(R) Core(TM)2 Extreme mobile processor", + "Core 2 Extreme Mobile"}, + {196, "Intel(R) Core(TM)2 Duo mobile processor", "Core 2 Duo Mobile"}, + {197, "Intel(R) Core(TM)2 Solo mobile processor", + "Core 2 Solo Mobile"}, + {198, "Intel(R) Core(TM) i7 processor", "Core i7"}, + {199, "Dual-Core Intel(R) Celeron(R) Processor", "Dual-Core Celeron"}, + {200, "S/390 and zSeries Family", "IBM390"}, + {201, "ESA/390 G4", "G4"}, + {202, "ESA/390 G5", "G5"}, + {203, "ESA/390 G6", "ESA/390 G6"}, + {204, "z/Architectur base", "z/Architectur"}, /* this is not typo */ + {205, "Intel(R) Core(TM) i5 processor", "Core i5"}, + {206, "Intel(R) Core(TM) i3 processor", "Core i3"}, + + {210, "VIA C7(TM)-M Processor Family", "C7-M"}, + {211, "VIA C7(TM)-D Processor Family", "C7-D"}, + {212, "VIA C7(TM) Processor Family", "C7"}, + {213, "VIA Eden(TM) Processor Family", "Eden"}, + {214, "Multi-Core Intel(R) Xeon(R) processor", "Multi-Core Xeon"}, + {215, "Dual-Core Intel(R) Xeon(R) processor 3xxx Series", + "Dual-Core Xeon 3xxx"}, + {216, "Quad-Core Intel(R) Xeon(R) processor 3xxx Series", + "Quad-Core Xeon 3xxx"}, + {217, "VIA Nano(TM) Processor Family", "Nano"}, + {218, "Dual-Core Intel(R) Xeon(R) processor 5xxx Series", + "Dual-Core Xeon 5xxx"}, + {219, "Quad-Core Intel(R) Xeon(R) processor 5xxx Series", + "Quad-Core Xeon 5xxx"}, + + {221, "Dual-Core Intel(R) Xeon(R) processor 7xxx Series", + "Dual-Core Xeon 7xxx"}, + {222, "Quad-Core Intel(R) Xeon(R) processor 7xxx Series", + "Quad-Core Xeon 7xxx"}, + {223, "Multi-Core Intel(R) Xeon(R) processor 7xxx Series", + "Multi-Core Xeon 7xxx"}, + {224, "Multi-Core Intel(R) Xeon(R) processor 3400 Series", + "Multi-Core Xeon 3400"}, + + /* + {228, "AMD Opteron(TM) 3000 Series Processor", ""}, + {229, "AMD Sempron(TM) II Processor Family", ""}, + */ + {230, "Embedded AMD Opteron(TM) Quad-Core Processor Family", + "Embedded Opteron Quad-Core"}, + {231, "AMD Phenom(TM) Triple-Core Processor Family", + "Phenom Triple-Core"}, + {232, "AMD Turion(TM) Ultra Dual-Core Mobile Processor Family", + "Turion Ultra Dual-Core Mobile"}, + {233, "AMD Turion(TM) Dual-Core Mobile Processor Family", + "Turion Dual-Core Mobile"}, + {234, "AMD Athlon(TM) Dual-Core Processor Family", "Athlon Dual-Core"}, + {235, "AMD Sempron(TM) SI Processor Family", "Sempron SI"}, + {236, "AMD Phenom(TM) II Processor Family", "Phenom II"}, + {237, "AMD Athlon(TM) II Processor Family", "Athlon II"}, + {238, "Six-Core AMD Opteron(TM) Processor Family", "Six-Core Opteron"}, + {239, "AMD Sempron(TM) M Processor Family", "Sempron M"}, + + {250, "i860", "i860"}, + {251, "i960", "i960"}, + + {260, "SH-3", "SH-3"}, + {261, "SH-4", "SH-4"}, + {280, "ARM", "ARM"}, + {281, "StrongARM", "StrongARM"}, + {300, "6x86", "6x86"}, + {301, "MediaGX", "MediaGX"}, + {302, "MII", "MII"}, + {320, "WinChip", "WinChip"}, + {350, "DSP", "DSP"}, + {500, "Video Processor", "Video Processor"}, + + /* + {254, "Reserved (SMBIOS Extension)", ""}, + {255, "Reserved (Un-initialized Flash Content - Lo)", ""}, + + {65534, "Reserved (For Future Special Purpose Assignment)", ""}, + {65535, "Reserved (Un-initialized Flash Content - Hi)", ""}, + */ + }; + + size_t i, fm_length = sizeof(fm) / sizeof(fm[0]); + + for (i = 0; i < fm_length; i++) { + if (strcmp(dmi_family, fm[i].search) == 0) { + return fm[i].value_map; + } + } + + return 1; /* Other */ +} + +KONKRET_REGISTRATION( + "root/cimv2", + "LMI_Processor", + "LMI_Processor", + "instance method") diff --git a/src/hardware/cpuinfo.c b/src/hardware/cpuinfo.c new file mode 100644 index 0000000..d80e1cb --- /dev/null +++ b/src/hardware/cpuinfo.c @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2013 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: Peter Schiffer + */ + +#include "cpuinfo.h" + + +/* + * Initialize CpuinfoProcessor attributes. + * @param cpu + */ +void init_cpuinfoprocessor_struct(CpuinfoProcessor *cpu) +{ + cpu->flags_nb = 0; + cpu->flags = NULL; + cpu->address_size = 0; + cpu->model_name = NULL; +} + +/* + * Check attributes of cpu structure and fill in defaults if needed. + * @param cpu + * @return 0 if success, negative value otherwise + */ +short check_cpuinfoprocessor_attributes(CpuinfoProcessor *cpu) +{ + short ret = -1; + + if (!cpu->model_name) { + if (!(cpu->model_name = strdup(""))) { + ret = -2; + goto done; + } + } + + ret = 0; + +done: + if (ret != 0) { + warn("Failed to allocate memory."); + } + + return ret; +} + +short cpuinfo_get_processor(CpuinfoProcessor *cpu) +{ + short ret = -1; + unsigned i, buffer_size = 0; + char **buffer = NULL, *buf; + + /* read /proc/cpuinfo file */ + if (read_file("/proc/cpuinfo", &buffer, &buffer_size) != 0) { + ret = -2; + goto done; + } + + init_cpuinfoprocessor_struct(cpu); + + /* parse information about processor */ + for (i = 0; i < buffer_size; i++) { + /* CPU Flags */ + buf = copy_string_part_after_delim(buffer[i], "flags\t\t: "); + if (buf) { + if (explode(buf, NULL, &cpu->flags, &cpu->flags_nb) != 0) { + ret = -3; + goto done; + } + free(buf); + buf = NULL; + continue; + } + /* Address Size */ + buf = copy_string_part_after_delim(buffer[i], " bits physical, "); + if (buf) { + sscanf(buf, "%u", &cpu->address_size); + free(buf); + buf = NULL; + continue; + } + /* Model Name */ + buf = copy_string_part_after_delim(buffer[i], "model name\t: "); + if (buf) { + cpu->model_name = buf; + buf = NULL; + continue; + } + } + + if (check_cpuinfoprocessor_attributes(cpu) != 0) { + ret = -4; + goto done; + } + + ret = 0; + +done: + free_2d_buffer(&buffer, &buffer_size); + + if (ret != 0) { + cpuinfo_free_processor(cpu); + } + + return ret; +} + +void cpuinfo_free_processor(CpuinfoProcessor *cpu) +{ + if (cpu) { + if (cpu->flags_nb > 0) { + unsigned i; + for (i = 0; i < cpu->flags_nb; i++) { + if (cpu->flags[i]) { + free(cpu->flags[i]); + } + cpu->flags[i] = NULL; + } + free(cpu->flags); + } + cpu->flags_nb = 0; + cpu->flags = NULL; + if (cpu->model_name) { + free(cpu->model_name); + } + cpu->model_name = NULL; + } + + return; +} diff --git a/src/hardware/cpuinfo.h b/src/hardware/cpuinfo.h new file mode 100644 index 0000000..5ec5dd5 --- /dev/null +++ b/src/hardware/cpuinfo.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2013 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: Peter Schiffer + */ + +#ifndef CPUINFO_H_ +#define CPUINFO_H_ + +#include +#include +#include +#include "globals.h" +#include "utils.h" + + +/* Processor from /proc/cpuinfo file. */ +typedef struct _CpuinfoProcessor { + unsigned flags_nb; /* Number of CPU Flags */ + char **flags; /* CPU Flags */ + unsigned address_size; /* Address Size / Address Width */ + char *model_name; /* Model Name */ +} CpuinfoProcessor; + + +/* + * Get processor structure according to the /proc/cpuinfo file. + * @param cpu + * @return 0 if success, negative value otherwise + */ +short cpuinfo_get_processor(CpuinfoProcessor *cpu); + +/* + * Free attributes in the cpuinfo structure. + * @param cpu structure + */ +void cpuinfo_free_processor(CpuinfoProcessor *cpu); + + +#endif /* CPUINFO_H_ */ diff --git a/src/hardware/dmidecode.c b/src/hardware/dmidecode.c new file mode 100644 index 0000000..6a038fb --- /dev/null +++ b/src/hardware/dmidecode.c @@ -0,0 +1,343 @@ +/* + * Copyright (C) 2013 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: Peter Schiffer + */ + +#include "dmidecode.h" + + +/* + * Initialize DmiProcessor attributes. + * @param cpu + */ +void init_dmiprocessor_struct(DmiProcessor *cpu) +{ + cpu->id = NULL; + cpu->family = NULL; + cpu->status = NULL; + cpu->current_speed = 0; + cpu->max_speed = 0; + cpu->external_clock = 0; + cpu->name = NULL; + cpu->enabled_cores = 1; + cpu->type = NULL; + cpu->stepping = NULL; + cpu->upgrade = NULL; + cpu->charact_nb = 0; + cpu->characteristics = NULL; +} + +/* + * Check attributes of cpu structure and fill in defaults if needed. + * @param cpu + * @return 0 if success, negative value otherwise + */ +short check_dmiprocessor_attributes(DmiProcessor *cpu) +{ + short ret = -1; + + if (!cpu->id) { + if (!(cpu->id = strdup(""))) { + ret = -2; + goto done; + } + } + if (!cpu->family) { + if (!(cpu->family = strdup("Unknown"))) { + ret = -3; + goto done; + } + } + if (!cpu->status) { + if (!(cpu->status = strdup("Unknown"))) { + ret = -4; + goto done; + } + } + if (!cpu->name) { + if (!(cpu->name = strdup(""))) { + ret = -5; + goto done; + } + } + if (!cpu->type) { + if (!(cpu->type = strdup(""))) { + ret = -6; + goto done; + } + } + if (!cpu->stepping) { + if (!(cpu->stepping = strdup(""))) { + ret = -7; + goto done; + } + } + if (!cpu->upgrade) { + if (!(cpu->upgrade = strdup("Unknown"))) { + ret = -8; + goto done; + } + } + + ret = 0; + +done: + if (ret != 0) { + warn("Failed to allocate memory."); + } + + return ret; +} + +short dmi_get_processors(DmiProcessor **cpus, unsigned *cpus_nb) +{ + short ret = -1; + int curr_cpu = -1; + unsigned i, buffer_size = 0; + char **buffer = NULL, *buf; + + *cpus_nb = 0; + + /* get dmidecode output */ + if (run_command("dmidecode -t 4", &buffer, &buffer_size) != 0) { + ret = -2; + goto done; + } + + /* count processors */ + for (i = 0; i < buffer_size; i++) { + if (strncmp(buffer[i], "Handle 0x", 9) == 0) { + (*cpus_nb)++; + } + } + + /* if no processor was found */ + if (*cpus_nb < 1) { + warn("Dmidecode didn't recognize any processor."); + ret = -3; + goto done; + } + + /* allocate memory for processors */ + *cpus = (DmiProcessor *)calloc(*cpus_nb, sizeof(DmiProcessor)); + if (!(*cpus)) { + warn("Failed to allocate memory."); + ret = -4; + goto done; + } + + /* parse information about processors */ + for (i = 0; i < buffer_size; i++) { + if (strncmp(buffer[i], "Handle 0x", 9) == 0) { + curr_cpu++; + init_dmiprocessor_struct(cpus[curr_cpu]); + continue; + } + /* ignore first useless lines */ + if (curr_cpu < 0) { + continue; + } + /* ID */ + buf = copy_string_part_after_delim(buffer[i], "ID: "); + if (buf) { + cpus[curr_cpu]->id = buf; + buf = NULL; + continue; + } + /* Family */ + buf = copy_string_part_after_delim(buffer[i], "Family: "); + if (buf) { + cpus[curr_cpu]->family = buf; + buf = NULL; + continue; + } + /* Status */ + buf = copy_string_part_after_delim(buffer[i], "Status: Populated, "); + if (buf) { + cpus[curr_cpu]->status = buf; + buf = NULL; + continue; + } + /* Current Speed */ + buf = copy_string_part_after_delim(buffer[i], "Current Speed: "); + if (buf && strcmp(buf, "Unknown") != 0) { + sscanf(buf, "%u", &cpus[curr_cpu]->current_speed); + free(buf); + buf = NULL; + continue; + } + /* Max Speed */ + buf = copy_string_part_after_delim(buffer[i], "Max Speed: "); + if (buf && strcmp(buf, "Unknown") != 0) { + sscanf(buf, "%u", &cpus[curr_cpu]->max_speed); + free(buf); + buf = NULL; + continue; + } + /* External Clock Speed */ + buf = copy_string_part_after_delim(buffer[i], "External Clock: "); + if (buf && strcmp(buf, "Unknown") != 0) { + sscanf(buf, "%u", &cpus[curr_cpu]->external_clock); + free(buf); + buf = NULL; + continue; + } + /* CPU Name */ + buf = copy_string_part_after_delim(buffer[i], "Version: "); + if (buf) { + cpus[curr_cpu]->name = buf; + buf = NULL; + continue; + } + /* Enabled Cores */ + buf = copy_string_part_after_delim(buffer[i], "Core Enabled: "); + if (buf) { + sscanf(buf, "%u", &cpus[curr_cpu]->enabled_cores); + free(buf); + buf = NULL; + continue; + } + /* CPU Type/Role */ + buf = copy_string_part_after_delim(buffer[i], "Type: "); + if (buf) { + cpus[curr_cpu]->type = buf; + buf = NULL; + continue; + } + /* Stepping */ + buf = copy_string_part_after_delim(buffer[i], ", Stepping "); + if (buf) { + cpus[curr_cpu]->stepping = buf; + buf = NULL; + continue; + } + /* Upgrade */ + buf = copy_string_part_after_delim(buffer[i], "Upgrade: "); + if (buf) { + cpus[curr_cpu]->upgrade = buf; + buf = NULL; + continue; + } + /* CPU Characteristics */ + if (strstr(buffer[i], "Characteristics:") + && !strstr(buffer[i], "Characteristics: ")) { + /* count characteristics */ + cpus[curr_cpu]->charact_nb = 0; + while (strlen(buffer[i + cpus[curr_cpu]->charact_nb + 1])) { + cpus[curr_cpu]->charact_nb += 1; + } + /* allocate memory */ + cpus[curr_cpu]->characteristics = + (char **)calloc(cpus[curr_cpu]->charact_nb, sizeof(char *)); + if (!cpus[curr_cpu]->characteristics) { + warn("Failed to allocate memory."); + ret = -5; + goto done; + } + unsigned j; + char *tmp_line; + for (j = 0; j < cpus[curr_cpu]->charact_nb; j++) { + tmp_line = trim(buffer[i + j + 1], NULL); + if (tmp_line) { + cpus[curr_cpu]->characteristics[j] = tmp_line; + } else { + cpus[curr_cpu]->characteristics[j] = strdup(""); + if (!cpus[curr_cpu]->characteristics[j]) { + warn("Failed to allocate memory."); + ret = -6; + goto done; + } + } + } + /* skip characteristics and newline after them */ + i += cpus[curr_cpu]->charact_nb + 1; + } + } + + /* fill in default attributes if needed */ + for (i = 0; i < *cpus_nb; i++) { + if (check_dmiprocessor_attributes(cpus[i]) != 0) { + ret = -7; + goto done; + } + } + + ret = 0; + +done: + free_2d_buffer(&buffer, &buffer_size); + + if (ret != 0) { + dmi_free_processors(cpus, cpus_nb); + } + + return ret; +} + +void dmi_free_processors(DmiProcessor **cpus, unsigned *cpus_nb) +{ + unsigned i, j; + + if (*cpus_nb > 0) { + for (i = 0; i < *cpus_nb; i++) { + if (cpus[i]->id) { + free(cpus[i]->id); + } + cpus[i]->id = NULL; + if (cpus[i]->family) { + free(cpus[i]->family); + } + cpus[i]->family = NULL; + if (cpus[i]->status) { + free(cpus[i]->status); + } + cpus[i]->status = NULL; + if (cpus[i]->name) { + free(cpus[i]->name); + } + cpus[i]->name = NULL; + if (cpus[i]->type) { + free(cpus[i]->type); + } + cpus[i]->type = NULL; + if (cpus[i]->stepping) { + free(cpus[i]->stepping); + } + cpus[i]->stepping = NULL; + if (cpus[i]->upgrade) { + free(cpus[i]->upgrade); + } + cpus[i]->upgrade = NULL; + if (cpus[i]->charact_nb > 0) { + for (j = 0; j < cpus[i]->charact_nb; j++) { + if (cpus[i]->characteristics[j]) { + free(cpus[i]->characteristics[j]); + } + cpus[i]->characteristics[j] = NULL; + } + free(cpus[i]->characteristics); + } + cpus[i]->charact_nb = 0; + cpus[i]->characteristics = NULL; + } + free (*cpus); + } + + *cpus_nb = 0; + *cpus = NULL; +} diff --git a/src/hardware/dmidecode.h b/src/hardware/dmidecode.h new file mode 100644 index 0000000..f7e76a9 --- /dev/null +++ b/src/hardware/dmidecode.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2013 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: Peter Schiffer + */ + +#ifndef DMIDECODE_H_ +#define DMIDECODE_H_ + +#include +#include +#include +#include "globals.h" +#include "utils.h" + + +/* Processor from dmidecode. */ +typedef struct _DmiProcessor { + char *id; /* ID */ + char *family; /* Family */ + char *status; /* CPU Status */ + unsigned current_speed; /* Current Speed in MHz */ + unsigned max_speed; /* Max Speed in MHz */ + unsigned external_clock; /* External Clock Speed in MHz */ + char *name; /* CPU name, version in dmidecode */ + unsigned enabled_cores; /* Number of enabled cores */ + char *type; /* CPU Type/Role */ + char *stepping; /* Stepping (revision level within family) */ + char *upgrade; /* CPU upgrade method - socket */ + unsigned charact_nb; /* Number of CPU Characteristics */ + char **characteristics; /* CPU Characteristics */ +} DmiProcessor; + + +/* + * Get array of processors according to the dmidecode program. + * @param cpu array of cpus, this function will allocate necessary memory, + * but caller is responsible for freeing it + * @param cpus_nb number of processors in cpus + * @return 0 if success, negative value otherwise + */ +short dmi_get_processors(DmiProcessor **cpus, unsigned *cpus_nb); + +/* + * Free array of processor structures. + * @param cpus array of cpus + * @param cpus_nb number of cpus + */ +void dmi_free_processors(DmiProcessor **cpus, unsigned *cpus_nb); + + +#endif /* DMIDECODE_H_ */ diff --git a/src/hardware/lscpu.c b/src/hardware/lscpu.c new file mode 100644 index 0000000..124ed7b --- /dev/null +++ b/src/hardware/lscpu.c @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2013 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: Peter Schiffer + */ + +#include "lscpu.h" + + +/* + * Initialize LscpuProcessor attributes. + * @param cpu + */ +void init_lscpuprocessor_struct(LscpuProcessor *cpu) +{ + cpu->data_width = 0; + cpu->processors = 0; + cpu->cores = 0; + cpu->stepping = NULL; + cpu->current_speed = 0; +} + +/* + * Check attributes of cpu structure and fill in defaults if needed. + * @param cpu + * @return 0 if success, negative value otherwise + */ +short check_lscpuprocessor_attributes(LscpuProcessor *cpu) +{ + short ret = -1; + + if (!cpu->stepping) { + if (!(cpu->stepping = strdup(""))) { + ret = -2; + goto done; + } + } + + ret = 0; + +done: + if (ret != 0) { + warn("Failed to allocate memory."); + } + + return ret; +} + +short lscpu_get_processor(LscpuProcessor *cpu) +{ + short ret = -1; + unsigned i, buffer_size = 0; + char **buffer = NULL, *buf; + + /* get lscpu output */ + if (run_command("lscpu", &buffer, &buffer_size) != 0) { + ret = -2; + goto done; + } + + init_lscpuprocessor_struct(cpu); + + /* parse information about processor */ + for (i = 0; i < buffer_size; i++) { + /* Data Width */ + buf = copy_string_part_after_delim(buffer[i], "CPU op-mode(s):"); + if (buf) { + if (strstr(buf, "64")) { + cpu->data_width = 64; + } else if (strstr(buf, "32")) { + cpu->data_width = 32; + } + free(buf); + buf = NULL; + continue; + } + /* Cores per processor */ + buf = copy_string_part_after_delim(buffer[i], "Core(s) per socket:"); + if (buf) { + sscanf(buf, "%u", &cpu->cores); + free(buf); + buf = NULL; + continue; + } + /* Number of processors */ + buf = copy_string_part_after_delim(buffer[i], "Socket(s):"); + if (buf) { + sscanf(buf, "%u", &cpu->processors); + free(buf); + buf = NULL; + continue; + } + /* Stepping */ + buf = copy_string_part_after_delim(buffer[i], "Stepping:"); + if (buf) { + cpu->stepping = buf; + buf = NULL; + continue; + } + /* Current speed in MHz */ + buf = copy_string_part_after_delim(buffer[i], "CPU MHz:"); + if (buf) { + sscanf(buf, "%u", &cpu->current_speed); + free(buf); + buf = NULL; + continue; + } + } + + if (check_lscpuprocessor_attributes(cpu) != 0) { + ret = -3; + goto done; + } + + ret = 0; + +done: + free_2d_buffer(&buffer, &buffer_size); + + if (ret != 0) { + lscpu_free_processor(cpu); + } + + return ret; +} + +void lscpu_free_processor(LscpuProcessor *cpus) +{ + if (cpus) { + if (cpus->stepping) { + free(cpus->stepping); + } + cpus->stepping = NULL; + } + + return; +} diff --git a/src/hardware/lscpu.h b/src/hardware/lscpu.h new file mode 100644 index 0000000..892141e --- /dev/null +++ b/src/hardware/lscpu.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2013 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: Peter Schiffer + */ + +#ifndef LSCPU_H_ +#define LSCPU_H_ + +#include +#include +#include +#include "globals.h" +#include "utils.h" + + +/* Processor from lscpu program. */ +typedef struct _LscpuProcessor { + unsigned data_width; /* Data width */ + unsigned processors; /* Number of processors */ + unsigned cores; /* Cores per processor */ + char *stepping; /* Stepping */ + unsigned current_speed; /* Current speed in MHz */ +} LscpuProcessor; + + +/* + * Get processor structure according to the lscpu program. + * @param cpu + * @return 0 if success, negative value otherwise + */ +short lscpu_get_processor(LscpuProcessor *cpu); + +/* + * Free attributes in the lscpu structure. + * @param cpu + */ +void lscpu_free_processor(LscpuProcessor *cpu); + + +#endif /* LSCPU_H_ */ diff --git a/src/hardware/utils.c b/src/hardware/utils.c new file mode 100644 index 0000000..da7bbfa --- /dev/null +++ b/src/hardware/utils.c @@ -0,0 +1,382 @@ +/* + * Copyright (C) 2013 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: Peter Schiffer + */ + +#include "utils.h" + + +short read_fp_to_2d_buffer(FILE *fp, char ***buffer, unsigned *buffer_size) +{ + short ret = -1; + ssize_t read; + size_t line_len = 0; + unsigned tmp_buffer_lines, lines_read = 0; + char **tmp_buffer, *line = NULL; + + free_2d_buffer(buffer, buffer_size); + + if (!fp) { + warn("Given file pointer is NULL."); + ret = -2; + goto done; + } + + /* allocate buffer */ + tmp_buffer_lines = 128; + tmp_buffer = (char **)calloc(tmp_buffer_lines, sizeof(char *)); + if (!tmp_buffer) { + warn("Failed to allocate memory."); + ret = -3; + goto done; + } + + while ((read = getline(&line, &line_len, fp)) != -1) { + /* filter comment lines */ + if (read > 0 && line[0] == '#') { + continue; + } + + /* reallocate if needed */ + if (lines_read >= tmp_buffer_lines) { + tmp_buffer_lines *= 2; + char **newtmp = (char **)realloc(tmp_buffer, + tmp_buffer_lines * sizeof(char *)); + if (!newtmp) { + warn("Failed to allocate memory."); + ret = -4; + goto done; + } + tmp_buffer = newtmp; + } + + /* copy trimmed line to buffer */ + tmp_buffer[lines_read] = trim(line, NULL); + if (!tmp_buffer[lines_read]) { + tmp_buffer[lines_read] = strdup(""); + if (!tmp_buffer[lines_read]) { + warn("Failed to allocate memory."); + ret = -5; + goto done; + } + } + lines_read++; + } + + if (lines_read < 1) { + warn("No data read from given source."); + ret = -6; + goto done; + } + + /* reallocate buffer to free unused space */ + if (tmp_buffer_lines > lines_read) { + tmp_buffer_lines = lines_read; + char **newtmp = (char **)realloc(tmp_buffer, + tmp_buffer_lines * sizeof(char *)); + if (!newtmp) { + warn("Failed to allocate memory."); + ret = -7; + goto done; + } + tmp_buffer = newtmp; + } + + *buffer_size = tmp_buffer_lines; + *buffer = tmp_buffer; + + ret = 0; + +done: + if (line) { + free(line); + } + line = NULL; + + if (ret != 0) { + free_2d_buffer(&tmp_buffer, &tmp_buffer_lines); + } + + return ret; +} + +void free_2d_buffer(char ***buffer, unsigned *buffer_size) +{ + unsigned i, tmp_buffer_lines = *buffer_size; + char **tmp_buffer = *buffer; + + if (tmp_buffer_lines > 0) { + for (i = 0; i < tmp_buffer_lines; i++) { + if (tmp_buffer[i]) { + free(tmp_buffer[i]); + } + tmp_buffer[i] = NULL; + } + free(tmp_buffer); + } + + tmp_buffer = NULL; + *buffer_size = 0; + *buffer = NULL; +} + +short run_command(const char *command, char ***buffer, unsigned *buffer_size) +{ + FILE *fp; + short ret = -1; + + /* if command is empty */ + if (!command || strlen(command) < 1) { + warn("Given command is empty."); + ret = -2; + goto done; + } + + /* execute command */ + debug("Running command: \"%s\"", command); + fp = popen(command, "r"); + if (!fp) { + warn("Failed to run command: \"%s\"; Error: %s", + command, strerror(errno)); + ret = -3; + goto done; + } + + if (read_fp_to_2d_buffer(fp, buffer, buffer_size) != 0) { + ret = -4; + goto done; + } + + ret = 0; + +done: + if (fp) { + int ret_code = pclose(fp); + if (ret_code == -1) { + warn("Failed to run command: \"%s\"; Error: %s", + command, strerror(errno)); + if (ret == 0) { + ret = -5; + } + } else if (ret_code != 0) { + warn("Command \"%s\" exited unexpectedly.", command); + if (ret == 0) { + ret = -6; + } + } + } + + if (ret != 0) { + free_2d_buffer(buffer, buffer_size); + } + + return ret; +} + +short read_file(const char *filename, char ***buffer, unsigned *buffer_size) +{ + FILE *fp; + short ret = -1; + + /* open file */ + debug("Reading \"%s\" file.", filename); + fp = fopen(filename, "r"); + if (!fp) { + warn("Failed to open \"%s\" file.", filename); + ret = -2; + goto done; + } + + if (read_fp_to_2d_buffer(fp, buffer, buffer_size) != 0) { + ret = -3; + goto done; + } + + ret = 0; + +done: + if (fp) { + fclose(fp); + } + + if (ret != 0) { + free_2d_buffer(buffer, buffer_size); + } + + return ret; +} + +char *copy_string_part_after_delim(const char *str, const char *delim) +{ + if (!str || strlen(str) < 1 || !delim || strlen(delim) < 1) { + return NULL; + } + + char *p, *out = NULL; + size_t delim_len = strlen(delim); + + /* if str contains delim and there is something after it */ + if ((p = strstr(str, delim)) && strlen(p + delim_len) > 0) { + out = trim(p + delim_len, NULL); + } + + return out; +} + +char *trim(const char *str, const char *delims) +{ + char *out; + const char *default_delims = WHITESPACES; + size_t l; + + /* if string is empty */ + if (!str || strlen(str) < 1) { + return NULL; + } + + if (!delims) { + delims = default_delims; + } + + /* trim start of the string */ + while (strchr(delims, str[0]) && str[0] != '\0') { + str++; + } + + l = strlen(str); + + /* if string was only white spaces */ + if (l < 1) { + return NULL; + } + + /* shorten length of string if there are trailing white spaces */ + while (strchr(delims, str[l - 1]) && l != 0) { + l--; + } + + /* sanity check */ + if (l < 1) { + return NULL; + } + + /* copy string */ + out = strndup(str, l); + if (!out) { + warn("Failed to allocate memory."); + } + + return out; +} + +short explode(const char *str, const char *delims, char ***buffer, unsigned *buffer_size) +{ + size_t l; + short ret = -1; + unsigned item = 0, tmp_buffer_size; + char *default_delims = WHITESPACES, *trimmed_str = NULL, *ts, **tmp_buffer; + + free_2d_buffer(buffer, buffer_size); + + if (!str || strlen(str) < 1) { + ret = 0; + goto done; + } + + if (!delims) { + delims = default_delims; + } + + trimmed_str = trim(str, delims); + if (!trimmed_str || strlen(trimmed_str) < 1) { + ret = 0; + goto done; + } + + tmp_buffer_size = 128; + tmp_buffer = (char **)calloc(tmp_buffer_size, sizeof(char *)); + if (!tmp_buffer) { + warn("Failed to allocate memory."); + ret = -2; + goto done; + } + + ts = trimmed_str; + while (ts[0] != '\0') { + /* skip leading delimiters of substring */ + while (strchr(delims, ts[0]) && ts[0] != '\0') { + ts++; + } + /* find length of valid substring */ + l = 0; + while (!strchr(delims, ts[l]) && ts[l] != '\0') { + l++; + } + /* reallocate if needed */ + if (item >= tmp_buffer_size) { + tmp_buffer_size *= 2; + char **new_temp = (char **)realloc(tmp_buffer, + tmp_buffer_size * sizeof(char *)); + if (!new_temp) { + warn("Failed to allocate memory."); + ret = -3; + goto done; + } + tmp_buffer = new_temp; + } + /* copy the substring */ + tmp_buffer[item] = strndup(ts, l); + if (!tmp_buffer[item]) { + warn("Failed to allocate memory."); + ret = -4; + goto done; + } + item++; + ts += l; + } + + /* reallocate to save unused space */ + if (tmp_buffer_size > item) { + tmp_buffer_size = item; + char **new_temp = (char **)realloc(tmp_buffer, + tmp_buffer_size * sizeof(char *)); + if (!new_temp) { + warn("Failed to allocate memory."); + ret = -5; + goto done; + } + tmp_buffer = new_temp; + } + + *buffer_size = tmp_buffer_size; + *buffer = tmp_buffer; + + ret = 0; + +done: + if (trimmed_str) { + free(trimmed_str); + } + trimmed_str = NULL; + + if (ret != 0) { + free_2d_buffer(&tmp_buffer, &tmp_buffer_size); + } + + return ret; +} diff --git a/src/hardware/utils.h b/src/hardware/utils.h new file mode 100644 index 0000000..9f5686f --- /dev/null +++ b/src/hardware/utils.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2013 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: Peter Schiffer + */ + +#ifndef UTILS_H_ +#define UTILS_H_ + +#include +#include +#include +#include +#include "globals.h" + +#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 '#'. + * Every line from output is trimmed. + * Buffer has to be NULL, and buffer_size 0. Function will allocate + * necessary memory, buffer can be freed with free_2d_buffer() function. + * @param fp file pointer to be read + * @param buffer which will be filled in + * @param buffer_size number of lines in buffer + * @return 0 if success, negative value otherwise + */ +short read_fp_to_2d_buffer(FILE *fp, char ***buffer, unsigned *buffer_size); + +/* + * Free 2D buffer. + * @param buffer + * @param buffer_size number of lines in buffer + */ +void free_2d_buffer(char ***buffer, unsigned *buffer_size); + +/* + * Run given command and store its output in buffer. Number of lines in buffer + * is stored in buffer_size. Function skips lines starting with '#'. + * Buffer has to be NULL, and buffer_size 0. Function will allocate necessary + * memory, buffer can be freed with free_2d_buffer() function. + * @param command to be run + * @param buffer + * @param buffer_size number of lines in buffer + * @return 0 if success, negative value otherwise + */ +short run_command(const char *command, char ***buffer, unsigned *buffer_size); + +/* + * Run given file and store its output in buffer. Number of lines in buffer + * is stored in buffer_size. Function skips lines starting with '#'. + * Buffer has to be NULL, and buffer_size 0. Function will allocate necessary + * memory, buffer can be freed with free_2d_buffer() function. + * @param filename + * @param buffer + * @param buffer_size number of lines in buffer + * @return 0 if success, negative value otherwise + */ +short read_file(const char *filename, char ***buffer, unsigned *buffer_size); + +/* + * Copy trimmed part of the given string after delimiter and returns pointer + * to the newly created string, allocated with malloc. + * If delimiter is not part of the string, or the string ends right after + * delimiter, NULL is returned. + * @param str string to be searched + * @param delim delimiter + * @return newly created string or NULL + */ +char *copy_string_part_after_delim(const char *str, const char *delim); + +/* + * Create trimmed copy of given string. Trimmed will be any characters + * found in delims parameter, or, if delims is NULL, any white space characters. + * @param str + * @param delims string containing delimiters. If NULL, white space characters + * are used. + * @return trimmed string allocated with malloc or NULL if allocation failed + * or given string was empty or contained only delimiters + */ +char *trim(const char *str, const char *delims); + +/* + * Explode given string to substrings delimited by delims. + * @param str input string + * @param delims string consisted of delimiters + * @param buffer output 2D buffer. Can be NULL if input string is NULL, empty, + * or only delimiters. + * @param buffer_size number of substrings + * @return 0 if success, negative value otherwise. + */ +short explode(const char *str, const char *delims, char ***buffer, unsigned *buffer_size); + + +#endif /* UTILS_H_ */ -- cgit From 25a2e6e768a12d9506c20011c3e19f57fb3a7846 Mon Sep 17 00:00:00 2001 From: Vitezslav Crhonek Date: Tue, 12 Mar 2013 14:50:40 +0100 Subject: Service: remove unused variable --- src/service/util/serviceutil.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/service/util/serviceutil.c b/src/service/util/serviceutil.c index f5e3b67..c525029 100644 --- a/src/service/util/serviceutil.c +++ b/src/service/util/serviceutil.c @@ -61,7 +61,6 @@ SList * Service_Find_All(void) { char svname[256]; - char cmdbuffer[STATUS_BUFSIZE]; Control *cc = malloc(sizeof(Control)); SList *slist; -- cgit From e34b7108248ee50c3effbd76bdb030aec69a8adb Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Wed, 13 Mar 2013 16:51:20 +0100 Subject: Happy New Year! (better later than never) --- src/account/LMI_AccountCapabilitiesProvider.c | 2 +- src/account/LMI_AccountManagementCapabilitiesProvider.c | 2 +- src/account/LMI_AccountManagementServiceCapabilitiesProvider.c | 2 +- src/account/LMI_AccountManagementServiceProvider.c | 2 +- src/account/LMI_AccountManagementServiceSettingDataProvider.c | 2 +- src/account/LMI_AccountOnSystemProvider.c | 2 +- src/account/LMI_AccountProvider.c | 2 +- src/account/LMI_AccountSettingDataProvider.c | 2 +- src/account/LMI_AssignedAccountIdentityProvider.c | 2 +- src/account/LMI_AssignedGroupIdentityProvider.c | 2 +- src/account/LMI_ElementSettingDateProvider.c | 2 +- src/account/LMI_EnabledAccountCapabilitiesProvider.c | 2 +- src/account/LMI_GroupProvider.c | 2 +- src/account/LMI_HostedAccountManagementServiceProvider.c | 2 +- src/account/LMI_IdentityProvider.c | 2 +- src/account/LMI_MemberOfGroupProvider.c | 2 +- src/account/LMI_OwningGroupProvider.c | 2 +- src/account/LMI_ServiceAffectsIdentityProvider.c | 2 +- src/account/LMI_SettingsDefineAccountCapabilitiesProvider.c | 2 +- src/account/LMI_SettingsDefineManagementCapabilitiesProvider.c | 2 +- src/account/account_globals.c | 2 +- src/account/account_globals.h | 2 +- src/account/aux_lu.c | 2 +- src/account/aux_lu.h | 2 +- src/account/cmpiLMI_Account-cimprovagt | 2 +- src/account/macros.h | 2 +- src/account/test/TestAccount.py | 2 +- src/account/test/TestGroup.py | 2 +- src/account/test/TestMemberOfGroup.py | 2 +- src/account/test/TestService.py | 2 +- src/account/test/common.py | 2 +- src/account/test/methods.py | 2 +- src/fan/LMI_FanAssociatedSensorProvider.c | 2 +- src/fan/LMI_FanProvider.c | 2 +- src/fan/LMI_FanSensorProvider.c | 2 +- src/fan/fan.c | 2 +- src/fan/fan.h | 2 +- src/globals.c | 2 +- src/globals.h | 2 +- src/logicalfile/LMI_DataFileProvider.c | 2 +- src/logicalfile/LMI_DirectoryContainsFileProvider.c | 2 +- src/logicalfile/LMI_FIFOPipeFileProvider.c | 2 +- src/logicalfile/LMI_FileIdentityProvider.c | 2 +- src/logicalfile/LMI_RootDirectoryProvider.c | 2 +- src/logicalfile/LMI_SymbolicLinkProvider.c | 2 +- src/logicalfile/LMI_UnixDeviceFileProvider.c | 2 +- src/logicalfile/LMI_UnixDirectoryProvider.c | 2 +- src/logicalfile/LMI_UnixFileProvider.c | 2 +- src/logicalfile/LMI_UnixSocketProvider.c | 2 +- src/logicalfile/file.c | 2 +- src/logicalfile/file.h | 2 +- src/power/LMI_AssociatedPowerManagementServiceProvider.c | 2 +- src/power/LMI_ConcreteJobProvider.c | 2 +- src/power/LMI_ElementCapabilitiesProvider.c | 2 +- src/power/LMI_HostedPowerManagementServiceProvider.c | 2 +- src/power/LMI_PowerManagementCapabilitiesProvider.c | 2 +- src/power/LMI_PowerManagementServiceProvider.c | 2 +- src/power/power.c | 2 +- src/power/power.h | 2 +- src/python/openlmi/common/__init__.py | 2 +- src/python/openlmi/common/cmpi_logging.py | 2 +- src/service/LMI_ServiceProvider.c | 2 +- src/service/util/servicedisc.sh | 2 +- src/service/util/serviceutil.c | 2 +- src/service/util/serviceutil.h | 2 +- src/service/util/serviceutil.sh | 2 +- src/software/cli/software.py | 2 +- src/software/openlmi/__init__.py | 2 +- src/software/openlmi/software/LMI_SoftwareFileCheck.py | 2 +- src/software/openlmi/software/LMI_SoftwareInstalledPackage.py | 2 +- src/software/openlmi/software/LMI_SoftwarePackage.py | 2 +- src/software/openlmi/software/LMI_SoftwarePackageChecks.py | 2 +- src/software/openlmi/software/__init__.py | 2 +- src/software/openlmi/software/cimom_entry.py | 2 +- src/software/openlmi/software/core/ComputerSystem.py | 2 +- src/software/openlmi/software/core/SoftwareFileCheck.py | 2 +- src/software/openlmi/software/core/SoftwareInstalledPackage.py | 2 +- src/software/openlmi/software/core/SoftwarePackage.py | 2 +- src/software/openlmi/software/core/SoftwarePackageChecks.py | 2 +- src/software/openlmi/software/core/__init__.py | 2 +- src/software/openlmi/software/util/__init__.py | 2 +- src/software/openlmi/software/yumdb/__init__.py | 2 +- src/software/openlmi/software/yumdb/errors.py | 2 +- src/software/openlmi/software/yumdb/jobs.py | 2 +- src/software/openlmi/software/yumdb/packagecheck.py | 2 +- src/software/openlmi/software/yumdb/packageinfo.py | 2 +- src/software/openlmi/software/yumdb/process.py | 2 +- src/software/test/common.py | 2 +- src/software/test/rpmcache.py | 2 +- src/software/test/run.py | 2 +- src/software/test/test_software_file_check.py | 2 +- src/software/test/test_software_installed_package.py | 2 +- src/software/test/test_software_package.py | 2 +- 93 files changed, 93 insertions(+), 93 deletions(-) (limited to 'src') diff --git a/src/account/LMI_AccountCapabilitiesProvider.c b/src/account/LMI_AccountCapabilitiesProvider.c index 60e7bb4..1636ab7 100644 --- a/src/account/LMI_AccountCapabilitiesProvider.c +++ b/src/account/LMI_AccountCapabilitiesProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_AccountManagementCapabilitiesProvider.c b/src/account/LMI_AccountManagementCapabilitiesProvider.c index 377790c..a4499be 100644 --- a/src/account/LMI_AccountManagementCapabilitiesProvider.c +++ b/src/account/LMI_AccountManagementCapabilitiesProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_AccountManagementServiceCapabilitiesProvider.c b/src/account/LMI_AccountManagementServiceCapabilitiesProvider.c index 5ac49d4..febc4f3 100644 --- a/src/account/LMI_AccountManagementServiceCapabilitiesProvider.c +++ b/src/account/LMI_AccountManagementServiceCapabilitiesProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_AccountManagementServiceProvider.c b/src/account/LMI_AccountManagementServiceProvider.c index d671a11..1af6cf4 100644 --- a/src/account/LMI_AccountManagementServiceProvider.c +++ b/src/account/LMI_AccountManagementServiceProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_AccountManagementServiceSettingDataProvider.c b/src/account/LMI_AccountManagementServiceSettingDataProvider.c index dcc3edd..89ae650 100644 --- a/src/account/LMI_AccountManagementServiceSettingDataProvider.c +++ b/src/account/LMI_AccountManagementServiceSettingDataProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_AccountOnSystemProvider.c b/src/account/LMI_AccountOnSystemProvider.c index d018eb2..ab84097 100644 --- a/src/account/LMI_AccountOnSystemProvider.c +++ b/src/account/LMI_AccountOnSystemProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_AccountProvider.c b/src/account/LMI_AccountProvider.c index 11630d0..c4a68f7 100644 --- a/src/account/LMI_AccountProvider.c +++ b/src/account/LMI_AccountProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_AccountSettingDataProvider.c b/src/account/LMI_AccountSettingDataProvider.c index 606ea5f..92d3b28 100644 --- a/src/account/LMI_AccountSettingDataProvider.c +++ b/src/account/LMI_AccountSettingDataProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_AssignedAccountIdentityProvider.c b/src/account/LMI_AssignedAccountIdentityProvider.c index e8f15cf..323a582 100644 --- a/src/account/LMI_AssignedAccountIdentityProvider.c +++ b/src/account/LMI_AssignedAccountIdentityProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_AssignedGroupIdentityProvider.c b/src/account/LMI_AssignedGroupIdentityProvider.c index 09ed28b..a9037f1 100644 --- a/src/account/LMI_AssignedGroupIdentityProvider.c +++ b/src/account/LMI_AssignedGroupIdentityProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_ElementSettingDateProvider.c b/src/account/LMI_ElementSettingDateProvider.c index 6750ccf..9e0ea9d 100644 --- a/src/account/LMI_ElementSettingDateProvider.c +++ b/src/account/LMI_ElementSettingDateProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_EnabledAccountCapabilitiesProvider.c b/src/account/LMI_EnabledAccountCapabilitiesProvider.c index 6d4cf77..7cda823 100644 --- a/src/account/LMI_EnabledAccountCapabilitiesProvider.c +++ b/src/account/LMI_EnabledAccountCapabilitiesProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_GroupProvider.c b/src/account/LMI_GroupProvider.c index 4224abc..a9c5477 100644 --- a/src/account/LMI_GroupProvider.c +++ b/src/account/LMI_GroupProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_HostedAccountManagementServiceProvider.c b/src/account/LMI_HostedAccountManagementServiceProvider.c index c173930..dd03a5f 100644 --- a/src/account/LMI_HostedAccountManagementServiceProvider.c +++ b/src/account/LMI_HostedAccountManagementServiceProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_IdentityProvider.c b/src/account/LMI_IdentityProvider.c index ba70bf8..92c2b01 100644 --- a/src/account/LMI_IdentityProvider.c +++ b/src/account/LMI_IdentityProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_MemberOfGroupProvider.c b/src/account/LMI_MemberOfGroupProvider.c index 2609e7a..dddd2e8 100644 --- a/src/account/LMI_MemberOfGroupProvider.c +++ b/src/account/LMI_MemberOfGroupProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_OwningGroupProvider.c b/src/account/LMI_OwningGroupProvider.c index f5cec0a..317b7b4 100644 --- a/src/account/LMI_OwningGroupProvider.c +++ b/src/account/LMI_OwningGroupProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_ServiceAffectsIdentityProvider.c b/src/account/LMI_ServiceAffectsIdentityProvider.c index e682fb1..64e218b 100644 --- a/src/account/LMI_ServiceAffectsIdentityProvider.c +++ b/src/account/LMI_ServiceAffectsIdentityProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_SettingsDefineAccountCapabilitiesProvider.c b/src/account/LMI_SettingsDefineAccountCapabilitiesProvider.c index eb35202..05e952f 100644 --- a/src/account/LMI_SettingsDefineAccountCapabilitiesProvider.c +++ b/src/account/LMI_SettingsDefineAccountCapabilitiesProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/LMI_SettingsDefineManagementCapabilitiesProvider.c b/src/account/LMI_SettingsDefineManagementCapabilitiesProvider.c index 9c8c76a..c0db7a5 100644 --- a/src/account/LMI_SettingsDefineManagementCapabilitiesProvider.c +++ b/src/account/LMI_SettingsDefineManagementCapabilitiesProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/account_globals.c b/src/account/account_globals.c index 1a7f8b2..e5e90e0 100644 --- a/src/account/account_globals.c +++ b/src/account/account_globals.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/account_globals.h b/src/account/account_globals.h index ddc9561..4226b33 100644 --- a/src/account/account_globals.h +++ b/src/account/account_globals.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/aux_lu.c b/src/account/aux_lu.c index d5b969c..6059665 100644 --- a/src/account/aux_lu.c +++ b/src/account/aux_lu.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/aux_lu.h b/src/account/aux_lu.h index 2e774ff..91383d4 100644 --- a/src/account/aux_lu.h +++ b/src/account/aux_lu.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/cmpiLMI_Account-cimprovagt b/src/account/cmpiLMI_Account-cimprovagt index b31d665..c2024d1 100644 --- a/src/account/cmpiLMI_Account-cimprovagt +++ b/src/account/cmpiLMI_Account-cimprovagt @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/account/macros.h b/src/account/macros.h index 2c89555..513d472 100644 --- a/src/account/macros.h +++ b/src/account/macros.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/account/test/TestAccount.py b/src/account/test/TestAccount.py index 52cb1b4..57925f0 100644 --- a/src/account/test/TestAccount.py +++ b/src/account/test/TestAccount.py @@ -1,5 +1,5 @@ # -*- encoding: utf-8 -*- -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/account/test/TestGroup.py b/src/account/test/TestGroup.py index 19e586b..3111610 100644 --- a/src/account/test/TestGroup.py +++ b/src/account/test/TestGroup.py @@ -1,5 +1,5 @@ # -*- encoding: utf-8 -*- -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/account/test/TestMemberOfGroup.py b/src/account/test/TestMemberOfGroup.py index 1d521f8..2186db3 100644 --- a/src/account/test/TestMemberOfGroup.py +++ b/src/account/test/TestMemberOfGroup.py @@ -1,5 +1,5 @@ # -*- encoding: utf-8 -*- -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/account/test/TestService.py b/src/account/test/TestService.py index 28b98a4..5b45b38 100644 --- a/src/account/test/TestService.py +++ b/src/account/test/TestService.py @@ -1,5 +1,5 @@ # -*- encoding: utf-8 -*- -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/account/test/common.py b/src/account/test/common.py index ce525b0..c56e94d 100644 --- a/src/account/test/common.py +++ b/src/account/test/common.py @@ -1,5 +1,5 @@ # -*- encoding: utf-8 -*- -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/account/test/methods.py b/src/account/test/methods.py index 45106ac..c0407df 100644 --- a/src/account/test/methods.py +++ b/src/account/test/methods.py @@ -1,5 +1,5 @@ # -*- encoding: utf-8 -*- -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/fan/LMI_FanAssociatedSensorProvider.c b/src/fan/LMI_FanAssociatedSensorProvider.c index 5b5f5d5..d75bf5c 100644 --- a/src/fan/LMI_FanAssociatedSensorProvider.c +++ b/src/fan/LMI_FanAssociatedSensorProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/fan/LMI_FanProvider.c b/src/fan/LMI_FanProvider.c index 1e96f97..26af16e 100644 --- a/src/fan/LMI_FanProvider.c +++ b/src/fan/LMI_FanProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/fan/LMI_FanSensorProvider.c b/src/fan/LMI_FanSensorProvider.c index 8e79208..47bd9d5 100644 --- a/src/fan/LMI_FanSensorProvider.c +++ b/src/fan/LMI_FanSensorProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/fan/fan.c b/src/fan/fan.c index 1a988f2..3038503 100644 --- a/src/fan/fan.c +++ b/src/fan/fan.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/fan/fan.h b/src/fan/fan.h index 00d0e84..02c6c5c 100644 --- a/src/fan/fan.h +++ b/src/fan/fan.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/globals.c b/src/globals.c index 21ab375..7e58817 100644 --- a/src/globals.c +++ b/src/globals.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/globals.h b/src/globals.h index 0c20d4b..6cf272c 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/logicalfile/LMI_DataFileProvider.c b/src/logicalfile/LMI_DataFileProvider.c index aa8e9e1..ea410c3 100644 --- a/src/logicalfile/LMI_DataFileProvider.c +++ b/src/logicalfile/LMI_DataFileProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/logicalfile/LMI_DirectoryContainsFileProvider.c b/src/logicalfile/LMI_DirectoryContainsFileProvider.c index 86f8b10..02aa324 100644 --- a/src/logicalfile/LMI_DirectoryContainsFileProvider.c +++ b/src/logicalfile/LMI_DirectoryContainsFileProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/logicalfile/LMI_FIFOPipeFileProvider.c b/src/logicalfile/LMI_FIFOPipeFileProvider.c index 3a4c1ff..8730299 100644 --- a/src/logicalfile/LMI_FIFOPipeFileProvider.c +++ b/src/logicalfile/LMI_FIFOPipeFileProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/logicalfile/LMI_FileIdentityProvider.c b/src/logicalfile/LMI_FileIdentityProvider.c index 81371dd..86f3b7f 100644 --- a/src/logicalfile/LMI_FileIdentityProvider.c +++ b/src/logicalfile/LMI_FileIdentityProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/logicalfile/LMI_RootDirectoryProvider.c b/src/logicalfile/LMI_RootDirectoryProvider.c index 0399ab1..6ced12b 100644 --- a/src/logicalfile/LMI_RootDirectoryProvider.c +++ b/src/logicalfile/LMI_RootDirectoryProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/logicalfile/LMI_SymbolicLinkProvider.c b/src/logicalfile/LMI_SymbolicLinkProvider.c index 0645689..c93c087 100644 --- a/src/logicalfile/LMI_SymbolicLinkProvider.c +++ b/src/logicalfile/LMI_SymbolicLinkProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/logicalfile/LMI_UnixDeviceFileProvider.c b/src/logicalfile/LMI_UnixDeviceFileProvider.c index 22d4486..e8aa7dd 100644 --- a/src/logicalfile/LMI_UnixDeviceFileProvider.c +++ b/src/logicalfile/LMI_UnixDeviceFileProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/logicalfile/LMI_UnixDirectoryProvider.c b/src/logicalfile/LMI_UnixDirectoryProvider.c index 47d095a..6483c43 100644 --- a/src/logicalfile/LMI_UnixDirectoryProvider.c +++ b/src/logicalfile/LMI_UnixDirectoryProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/logicalfile/LMI_UnixFileProvider.c b/src/logicalfile/LMI_UnixFileProvider.c index 8f47d33..937fa04 100644 --- a/src/logicalfile/LMI_UnixFileProvider.c +++ b/src/logicalfile/LMI_UnixFileProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/logicalfile/LMI_UnixSocketProvider.c b/src/logicalfile/LMI_UnixSocketProvider.c index c122502..56fb6bd 100644 --- a/src/logicalfile/LMI_UnixSocketProvider.c +++ b/src/logicalfile/LMI_UnixSocketProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/logicalfile/file.c b/src/logicalfile/file.c index 6c482f0..c17f0fc 100644 --- a/src/logicalfile/file.c +++ b/src/logicalfile/file.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/logicalfile/file.h b/src/logicalfile/file.h index 64a25f3..b1b3358 100644 --- a/src/logicalfile/file.h +++ b/src/logicalfile/file.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/power/LMI_AssociatedPowerManagementServiceProvider.c b/src/power/LMI_AssociatedPowerManagementServiceProvider.c index 3b9847b..fd6ffdb 100644 --- a/src/power/LMI_AssociatedPowerManagementServiceProvider.c +++ b/src/power/LMI_AssociatedPowerManagementServiceProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/power/LMI_ConcreteJobProvider.c b/src/power/LMI_ConcreteJobProvider.c index 67ceccc..4841852 100644 --- a/src/power/LMI_ConcreteJobProvider.c +++ b/src/power/LMI_ConcreteJobProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/power/LMI_ElementCapabilitiesProvider.c b/src/power/LMI_ElementCapabilitiesProvider.c index d7baf24..3a49518 100644 --- a/src/power/LMI_ElementCapabilitiesProvider.c +++ b/src/power/LMI_ElementCapabilitiesProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/power/LMI_HostedPowerManagementServiceProvider.c b/src/power/LMI_HostedPowerManagementServiceProvider.c index 702080c..889dd2c 100644 --- a/src/power/LMI_HostedPowerManagementServiceProvider.c +++ b/src/power/LMI_HostedPowerManagementServiceProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/power/LMI_PowerManagementCapabilitiesProvider.c b/src/power/LMI_PowerManagementCapabilitiesProvider.c index fba267e..be6759f 100644 --- a/src/power/LMI_PowerManagementCapabilitiesProvider.c +++ b/src/power/LMI_PowerManagementCapabilitiesProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/power/LMI_PowerManagementServiceProvider.c b/src/power/LMI_PowerManagementServiceProvider.c index 8017080..655d594 100644 --- a/src/power/LMI_PowerManagementServiceProvider.c +++ b/src/power/LMI_PowerManagementServiceProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/power/power.c b/src/power/power.c index 3423a2a..f5ba71a 100644 --- a/src/power/power.c +++ b/src/power/power.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/power/power.h b/src/power/power.h index ceb0ff2..a52eaef 100644 --- a/src/power/power.h +++ b/src/power/power.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/python/openlmi/common/__init__.py b/src/python/openlmi/common/__init__.py index 9acc604..2d19515 100644 --- a/src/python/openlmi/common/__init__.py +++ b/src/python/openlmi/common/__init__.py @@ -1,6 +1,6 @@ # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/python/openlmi/common/cmpi_logging.py b/src/python/openlmi/common/cmpi_logging.py index 3e59882..c8755f5 100644 --- a/src/python/openlmi/common/cmpi_logging.py +++ b/src/python/openlmi/common/cmpi_logging.py @@ -1,6 +1,6 @@ # -*- Coding:utf-8 -*- # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/service/LMI_ServiceProvider.c b/src/service/LMI_ServiceProvider.c index 1a1b411..7c8ffdb 100644 --- a/src/service/LMI_ServiceProvider.c +++ b/src/service/LMI_ServiceProvider.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/service/util/servicedisc.sh b/src/service/util/servicedisc.sh index 6f95936..8a929a7 100755 --- a/src/service/util/servicedisc.sh +++ b/src/service/util/servicedisc.sh @@ -2,7 +2,7 @@ # # servicedisc.sh # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/service/util/serviceutil.c b/src/service/util/serviceutil.c index c525029..bb8a472 100644 --- a/src/service/util/serviceutil.c +++ b/src/service/util/serviceutil.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/service/util/serviceutil.h b/src/service/util/serviceutil.h index e1318ea..055f43f 100644 --- a/src/service/util/serviceutil.h +++ b/src/service/util/serviceutil.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Red Hat, Inc. All rights reserved. + * Copyright (C) 2012-2013 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 diff --git a/src/service/util/serviceutil.sh b/src/service/util/serviceutil.sh index 5c26651..2172ae2 100755 --- a/src/service/util/serviceutil.sh +++ b/src/service/util/serviceutil.sh @@ -2,7 +2,7 @@ # # serviceutil.sh # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/cli/software.py b/src/software/cli/software.py index 5368e5f..c92a12d 100755 --- a/src/software/cli/software.py +++ b/src/software/cli/software.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/__init__.py b/src/software/openlmi/__init__.py index 085d611..aa4170a 100644 --- a/src/software/openlmi/__init__.py +++ b/src/software/openlmi/__init__.py @@ -1,6 +1,6 @@ # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/LMI_SoftwareFileCheck.py b/src/software/openlmi/software/LMI_SoftwareFileCheck.py index 58470bb..b3a767d 100644 --- a/src/software/openlmi/software/LMI_SoftwareFileCheck.py +++ b/src/software/openlmi/software/LMI_SoftwareFileCheck.py @@ -1,6 +1,6 @@ # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/LMI_SoftwareInstalledPackage.py b/src/software/openlmi/software/LMI_SoftwareInstalledPackage.py index 4206a46..22d214b 100644 --- a/src/software/openlmi/software/LMI_SoftwareInstalledPackage.py +++ b/src/software/openlmi/software/LMI_SoftwareInstalledPackage.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/LMI_SoftwarePackage.py b/src/software/openlmi/software/LMI_SoftwarePackage.py index 17483e8..c2f9d3a 100644 --- a/src/software/openlmi/software/LMI_SoftwarePackage.py +++ b/src/software/openlmi/software/LMI_SoftwarePackage.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/LMI_SoftwarePackageChecks.py b/src/software/openlmi/software/LMI_SoftwarePackageChecks.py index 48faabc..5b898d4 100644 --- a/src/software/openlmi/software/LMI_SoftwarePackageChecks.py +++ b/src/software/openlmi/software/LMI_SoftwarePackageChecks.py @@ -1,6 +1,6 @@ # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/__init__.py b/src/software/openlmi/software/__init__.py index 2ebe827..6ff965f 100644 --- a/src/software/openlmi/software/__init__.py +++ b/src/software/openlmi/software/__init__.py @@ -1,6 +1,6 @@ # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/cimom_entry.py b/src/software/openlmi/software/cimom_entry.py index 9e6e10c..19bd57d 100644 --- a/src/software/openlmi/software/cimom_entry.py +++ b/src/software/openlmi/software/cimom_entry.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/core/ComputerSystem.py b/src/software/openlmi/software/core/ComputerSystem.py index 90699a0..4b83d8f 100644 --- a/src/software/openlmi/software/core/ComputerSystem.py +++ b/src/software/openlmi/software/core/ComputerSystem.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/core/SoftwareFileCheck.py b/src/software/openlmi/software/core/SoftwareFileCheck.py index 409db09..f63e510 100644 --- a/src/software/openlmi/software/core/SoftwareFileCheck.py +++ b/src/software/openlmi/software/core/SoftwareFileCheck.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/core/SoftwareInstalledPackage.py b/src/software/openlmi/software/core/SoftwareInstalledPackage.py index f91fb56..43572a9 100644 --- a/src/software/openlmi/software/core/SoftwareInstalledPackage.py +++ b/src/software/openlmi/software/core/SoftwareInstalledPackage.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/core/SoftwarePackage.py b/src/software/openlmi/software/core/SoftwarePackage.py index 0ef0d31..de652ac 100644 --- a/src/software/openlmi/software/core/SoftwarePackage.py +++ b/src/software/openlmi/software/core/SoftwarePackage.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/core/SoftwarePackageChecks.py b/src/software/openlmi/software/core/SoftwarePackageChecks.py index 6d39294..3b49128 100644 --- a/src/software/openlmi/software/core/SoftwarePackageChecks.py +++ b/src/software/openlmi/software/core/SoftwarePackageChecks.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/core/__init__.py b/src/software/openlmi/software/core/__init__.py index 2ebe827..6ff965f 100644 --- a/src/software/openlmi/software/core/__init__.py +++ b/src/software/openlmi/software/core/__init__.py @@ -1,6 +1,6 @@ # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/util/__init__.py b/src/software/openlmi/software/util/__init__.py index e48ea29..3392b1c 100644 --- a/src/software/openlmi/software/util/__init__.py +++ b/src/software/openlmi/software/util/__init__.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/yumdb/__init__.py b/src/software/openlmi/software/yumdb/__init__.py index 0dc9050..d52b469 100644 --- a/src/software/openlmi/software/yumdb/__init__.py +++ b/src/software/openlmi/software/yumdb/__init__.py @@ -1,6 +1,6 @@ # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/yumdb/errors.py b/src/software/openlmi/software/yumdb/errors.py index 646048e..ae18608 100644 --- a/src/software/openlmi/software/yumdb/errors.py +++ b/src/software/openlmi/software/yumdb/errors.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/yumdb/jobs.py b/src/software/openlmi/software/yumdb/jobs.py index 1fdfbe3..28f4ca3 100644 --- a/src/software/openlmi/software/yumdb/jobs.py +++ b/src/software/openlmi/software/yumdb/jobs.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/yumdb/packagecheck.py b/src/software/openlmi/software/yumdb/packagecheck.py index fbb5b21..3b49164 100644 --- a/src/software/openlmi/software/yumdb/packagecheck.py +++ b/src/software/openlmi/software/yumdb/packagecheck.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/yumdb/packageinfo.py b/src/software/openlmi/software/yumdb/packageinfo.py index b2cd2b8..dd23ac3 100644 --- a/src/software/openlmi/software/yumdb/packageinfo.py +++ b/src/software/openlmi/software/yumdb/packageinfo.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/openlmi/software/yumdb/process.py b/src/software/openlmi/software/yumdb/process.py index c247de7..9c30a29 100644 --- a/src/software/openlmi/software/yumdb/process.py +++ b/src/software/openlmi/software/yumdb/process.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- # Software Management Providers # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/test/common.py b/src/software/test/common.py index d91f236..fbcb5d4 100644 --- a/src/software/test/common.py +++ b/src/software/test/common.py @@ -1,5 +1,5 @@ # -*- encoding: utf-8 -*- -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/test/rpmcache.py b/src/software/test/rpmcache.py index 9a0e98a..e1f15d9 100644 --- a/src/software/test/rpmcache.py +++ b/src/software/test/rpmcache.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- Coding:utf-8 -*- # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/test/run.py b/src/software/test/run.py index 950b0c9..e58945c 100755 --- a/src/software/test/run.py +++ b/src/software/test/run.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- Coding:utf-8 -*- # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/test/test_software_file_check.py b/src/software/test/test_software_file_check.py index 7b97ee9..d41f052 100755 --- a/src/software/test/test_software_file_check.py +++ b/src/software/test/test_software_file_check.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/test/test_software_installed_package.py b/src/software/test/test_software_installed_package.py index 93669f9..c66a941 100755 --- a/src/software/test/test_software_installed_package.py +++ b/src/software/test/test_software_installed_package.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 diff --git a/src/software/test/test_software_package.py b/src/software/test/test_software_package.py index 4cd5da9..b619da7 100755 --- a/src/software/test/test_software_package.py +++ b/src/software/test/test_software_package.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright (C) 2012 Red Hat, Inc. All rights reserved. +# Copyright (C) 2012-2013 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 -- cgit