From 214989d14a3c62c0f5554e03a74da04e4796390a Mon Sep 17 00:00:00 2001 From: Jan Synacek Date: Wed, 17 Jul 2013 11:09:10 +0200 Subject: LogicalFile: use get_string_property_from_op() where appropriate --- .../LMI_DirectoryContainsFileProvider.c | 12 +++------- src/logicalfile/LMI_FileIdentityProvider.c | 26 ++++++---------------- src/logicalfile/LMI_RootDirectoryProvider.c | 12 +++------- src/logicalfile/LMI_UnixDirectoryProvider.c | 7 ++---- 4 files changed, 15 insertions(+), 42 deletions(-) diff --git a/src/logicalfile/LMI_DirectoryContainsFileProvider.c b/src/logicalfile/LMI_DirectoryContainsFileProvider.c index 1794ea8..46db891 100644 --- a/src/logicalfile/LMI_DirectoryContainsFileProvider.c +++ b/src/logicalfile/LMI_DirectoryContainsFileProvider.c @@ -127,7 +127,6 @@ static CMPIStatus associators( CMPIObjectPath *o; CMPIInstance *ci; CMPIStatus st; - CMPIData pathd; const char *ns = KNameSpace(cop); st = lmi_check_required(_cb, cop, LOGICALFILE); @@ -139,8 +138,7 @@ static CMPIStatus associators( CMReturn(CMPI_RC_OK); } - pathd = CMGetKey(cop, "Name", &st); - const char *path = KChars(pathd.value.string); + const char *path = get_string_property_from_op(cop, "Name"); CMPIObjectPath *refs[MAX_REFS]; unsigned int count; @@ -200,8 +198,6 @@ static CMPIStatus references( { LMI_DirectoryContainsFile lmi_dcf; CMPIStatus st; - CMPIData pathd; - CMPIData cd; const char *ns = KNameSpace(cop); /* GroupComponent */ @@ -225,10 +221,8 @@ static CMPIStatus references( 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); + const char *ccname = get_string_property_from_op(cop, "CreationClassName"); + const char *path = get_string_property_from_op(cop, "Name"); char *fsname; if (get_fsname_from_path(path, &fsname) < 0) { CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, "Can't get filesystem name"); diff --git a/src/logicalfile/LMI_FileIdentityProvider.c b/src/logicalfile/LMI_FileIdentityProvider.c index fe3324f..d31c305 100644 --- a/src/logicalfile/LMI_FileIdentityProvider.c +++ b/src/logicalfile/LMI_FileIdentityProvider.c @@ -65,8 +65,6 @@ static CMPIStatus associators( CMPIInstance *ci; CMPIObjectPath *o; const char *ns = KNameSpace(cop); - CMPIData pathd; - CMPIData cd; char fileclass[BUFLEN]; char *fsname; @@ -83,10 +81,8 @@ static CMPIStatus associators( 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); + const char *path = get_string_property_from_op(cop, "LFName"); + const char *ccname = get_string_property_from_op(cop, "LFCreationClassName"); get_class_from_path(path, fileclass); if (get_fsname_from_path(path, &fsname) < 0) { CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, "Can't get filesystem name"); @@ -111,9 +107,7 @@ static CMPIStatus associators( return st; } - pathd = CMGetKey(cop, "Name", &st); - cd = CMGetKey(cop, "CreationClassName", &st); - const char *path = KChars(pathd.value.string); + const char *path = get_string_property_from_op(cop, "Name"); get_class_from_path(path, fileclass); if (get_fsname_from_path(path, &fsname) < 0) { CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, "Can't get filesystem name"); @@ -152,8 +146,6 @@ static CMPIStatus references( { LMI_FileIdentity lmi_fi; CMPIStatus st, res; - CMPIData pathd; - CMPIData cd; const char *ns = KNameSpace(cop); CMPIInstance *ci; CMPIObjectPath *o; @@ -181,10 +173,8 @@ static CMPIStatus references( 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); + const char *path = get_string_property_from_op(cop, "LFName"); + const char *ccname = get_string_property_from_op(cop, "LFCreationClassName"); get_class_from_path(path, fileclass); if (get_fsname_from_path(path, &fsname) < 0) { CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, "Can't get filesystem name"); @@ -212,10 +202,8 @@ static CMPIStatus references( return st; } - pathd = CMGetKey(cop, "Name", &st); - cd = CMGetKey(cop, "CreationClassName", &st); - const char *path = KChars(pathd.value.string); - const char *ccname = KChars(cd.value.string); + const char *path = get_string_property_from_op(cop, "Name"); + const char *ccname = get_string_property_from_op(cop, "CreationClassName"); if (get_fsname_from_path(path, &fsname) < 0) { CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, "Can't get filesystem name"); } diff --git a/src/logicalfile/LMI_RootDirectoryProvider.c b/src/logicalfile/LMI_RootDirectoryProvider.c index dc6cd6b..600f7a5 100644 --- a/src/logicalfile/LMI_RootDirectoryProvider.c +++ b/src/logicalfile/LMI_RootDirectoryProvider.c @@ -59,9 +59,7 @@ 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); + const char *path = get_string_property_from_op(cop, "Name"); char *fsname; if (get_fsname_from_path("/", &fsname) < 0) { CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, "Can't get filesystem name"); @@ -128,12 +126,8 @@ static CMPIStatus references( 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); + const char *path = get_string_property_from_op(cop, "Name"); + const char *ccname = get_string_property_from_op(cop, "CreationClassName"); char *fsname; if (get_fsname_from_path("/", &fsname) < 0) { CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, "Can't get filesystem name"); diff --git a/src/logicalfile/LMI_UnixDirectoryProvider.c b/src/logicalfile/LMI_UnixDirectoryProvider.c index 2628982..7face91 100644 --- a/src/logicalfile/LMI_UnixDirectoryProvider.c +++ b/src/logicalfile/LMI_UnixDirectoryProvider.c @@ -78,8 +78,7 @@ static CMPIStatus LMI_UnixDirectoryCreateInstance( 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); + const char *path = get_string_property_from_op(iop, "Name"); if (mkdir(path, 0777) < 0) { char errmsg[BUFLEN]; @@ -107,9 +106,7 @@ static CMPIStatus LMI_UnixDirectoryDeleteInstance( const CMPIResult* cr, const CMPIObjectPath* cop) { - CMPIStatus st; - CMPIData pathd = CMGetKey(cop, "Name", &st); - const char *path = KChars(pathd.value.string); + const char *path = get_string_property_from_op(cop, "Name"); if (rmdir(path) < 0) { char errmsg[BUFLEN]; -- cgit