summaryrefslogtreecommitdiffstats
path: root/src/logicalfile/LMI_DirectoryContainsFileProvider.c
diff options
context:
space:
mode:
authorJan Synacek <jsynacek@redhat.com>2013-12-17 10:27:15 +0100
committerJan Synacek <jsynacek@redhat.com>2013-12-17 11:11:03 +0100
commit67ae76aecfac0b04f22bea07b87bd7a8ce04a711 (patch)
tree55da46583bc833564ff8a27625dff80565342e9e /src/logicalfile/LMI_DirectoryContainsFileProvider.c
parent9a3adaf677fe49c016774c98e016140055c36afb (diff)
downloadopenlmi-providers-67ae76aecfac0b04f22bea07b87bd7a8ce04a711.tar.gz
openlmi-providers-67ae76aecfac0b04f22bea07b87bd7a8ce04a711.tar.xz
openlmi-providers-67ae76aecfac0b04f22bea07b87bd7a8ce04a711.zip
logicalfile: correctly fill FSCreationClassName and FSName
Files residing on nodevice or remote filesystems now correctly set these properties. FSCreationClassName is set to "LMI_TransientFileSystem" and FSName is set to "PATH=<path to file>". This behavior is consistent with how storage providers set those properties. To check for filesystem, the provider uses udev and checks for ID_FS_UUID_ENC and DEVNAME fields. If these are not found, filesystem is then considered nodevice or remote. Additional test for files on transient filesystems has been added.
Diffstat (limited to 'src/logicalfile/LMI_DirectoryContainsFileProvider.c')
-rw-r--r--src/logicalfile/LMI_DirectoryContainsFileProvider.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/logicalfile/LMI_DirectoryContainsFileProvider.c b/src/logicalfile/LMI_DirectoryContainsFileProvider.c
index a631ec1..6e1ddc5 100644
--- a/src/logicalfile/LMI_DirectoryContainsFileProvider.c
+++ b/src/logicalfile/LMI_DirectoryContainsFileProvider.c
@@ -63,6 +63,7 @@ static CMPIStatus dir_file_objectpaths(
char rpath[BUFLEN + 1]; /* \0 */
char fileclass[BUFLEN];
char *fsname;
+ char *fsclassname;
if (strcmp(de->d_name, "..") == 0) {
/* to get the parent directory, if either role or result role is
@@ -100,7 +101,7 @@ static CMPIStatus dir_file_objectpaths(
} else if (st.rc != CMPI_RC_OK) {
goto done;
}
- st = get_fsname_from_stat(_cb, &sb, &fsname);
+ st = get_fsinfo_from_stat(_cb, &sb, rpath, &fsclassname, &fsname);
if (st.rc != CMPI_RC_OK) {
goto done;
}
@@ -108,7 +109,7 @@ static CMPIStatus dir_file_objectpaths(
CIM_LogicalFileRef cim_lfr;
CIM_LogicalFileRef_Init(&cim_lfr, _cb, namespace);
- fill_logicalfile(CIM_LogicalFileRef, &cim_lfr, rpath, fsname, fileclass);
+ fill_logicalfile(CIM_LogicalFileRef, &cim_lfr, rpath, fsclassname, fsname, fileclass);
o = CIM_LogicalFileRef_ToObjectPath(&cim_lfr, &st);
CMSetClassName(o, fileclass);
@@ -217,14 +218,15 @@ static CMPIStatus associators(
char *aux = strdup(path);
char *dir = dirname(aux);
char *fsname;
+ char *fsclassname;
- st = get_fsname_from_path(_cb, path, &fsname);
+ st = get_fsinfo_from_path(_cb, path, &fsclassname, &fsname);
if (st.rc != CMPI_RC_OK) {
free(aux);
return st;
}
- fill_logicalfile(CIM_DirectoryRef, &lmi_dr, dir, fsname, LMI_UnixDirectory_ClassName);
+ fill_logicalfile(CIM_DirectoryRef, &lmi_dr, dir, fsclassname, fsname, LMI_UnixDirectory_ClassName);
o = CIM_DirectoryRef_ToObjectPath(&lmi_dr, &st);
CMSetClassName(o, LMI_UnixDirectory_ClassName);
@@ -258,6 +260,7 @@ static CMPIStatus references(
const char *ns = KNameSpace(cop);
const char *path;
char *fsname;
+ char *fsclassname;
char ccname[BUFLEN];
/* GroupComponent */
@@ -291,10 +294,10 @@ static CMPIStatus references(
path = get_string_property_from_op(cop, "Name");
if (!path)
CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Cannot find Name property in provided LMI_UnixDirectory");
- st = get_fsname_from_path(_cb, path, &fsname);
+ st = get_fsinfo_from_path(_cb, path, &fsclassname, &fsname);
check_status(st);
/* got GroupComponent - DirectoryRef */
- fill_logicalfile(CIM_DirectoryRef, &lmi_dr, path, fsname, LMI_UnixDirectory_ClassName);
+ fill_logicalfile(CIM_DirectoryRef, &lmi_dr, path, fsclassname, fsname, LMI_UnixDirectory_ClassName);
o = CIM_DirectoryRef_ToObjectPath(&lmi_dr, &st);
CMSetClassName(o, LMI_UnixDirectory_ClassName);
LMI_DirectoryContainsFile_SetObjectPath_GroupComponent(&lmi_dcf, o);
@@ -326,14 +329,14 @@ static CMPIStatus references(
if (!path)
CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Cannot find Name property in provided CIM_LogicalFile");
get_class_from_path(path, ccname);
- st = get_fsname_from_path(_cb, path, &fsname);
+ st = get_fsinfo_from_path(_cb, path, &fsclassname, &fsname);
check_status(st);
/* got PartComponent - LogicalFileRef */
if (group == 1) {
CMReturn(CMPI_RC_OK);
}
- fill_logicalfile(CIM_LogicalFileRef, &lmi_lfr, path, fsname, ccname);
+ fill_logicalfile(CIM_LogicalFileRef, &lmi_lfr, path, fsclassname, fsname, ccname);
o = CIM_LogicalFileRef_ToObjectPath(&lmi_lfr, &st);
CMSetClassName(o, ccname);
LMI_DirectoryContainsFile_SetObjectPath_PartComponent(&lmi_dcf, o);
@@ -341,13 +344,13 @@ static CMPIStatus references(
/* GroupComponent */
char *aux = strdup(path);
char *dir = dirname(aux);
- st = get_fsname_from_path(_cb, dir, &fsname);
+ st = get_fsinfo_from_path(_cb, dir, &fsclassname, &fsname);
if (st.rc != CMPI_RC_OK) {
free(aux);
return st;
}
- fill_logicalfile(CIM_DirectoryRef, &lmi_dr, dir, fsname, LMI_UnixDirectory_ClassName);
+ fill_logicalfile(CIM_DirectoryRef, &lmi_dr, dir, fsclassname, fsname, LMI_UnixDirectory_ClassName);
o = CIM_DirectoryRef_ToObjectPath(&lmi_dr, &st);
CMSetClassName(o, LMI_UnixDirectory_ClassName);
LMI_DirectoryContainsFile_SetObjectPath_GroupComponent(&lmi_dcf, o);