summaryrefslogtreecommitdiffstats
path: root/src/logicalfile/LMI_UnixDirectoryProvider.c
diff options
context:
space:
mode:
authorJan Synacek <jsynacek@redhat.com>2013-09-18 08:33:03 +0200
committerJan Synacek <jsynacek@redhat.com>2013-09-18 15:19:30 +0200
commitcd13c983a49ce3685a3813e66001bd3ea8f796c8 (patch)
treec79386678dbfdbfbdbbccb48d690f7cd3f475c50 /src/logicalfile/LMI_UnixDirectoryProvider.c
parent2746832524f5e5d022b13ffa0890f895ab82355c (diff)
downloadopenlmi-providers-cd13c983a49ce3685a3813e66001bd3ea8f796c8.tar.gz
openlmi-providers-cd13c983a49ce3685a3813e66001bd3ea8f796c8.tar.xz
openlmi-providers-cd13c983a49ce3685a3813e66001bd3ea8f796c8.zip
logicalfile: code cleanup and rewrite
GetInstance() calls were rewritten using cleaner code. Also, the macros that were used before were either rewritten to functions, or cleaned up so they wouldn't return or do anything unexpected. Helper functions now use CMPIStatus more consistently. Some memory leaks were fixed.
Diffstat (limited to 'src/logicalfile/LMI_UnixDirectoryProvider.c')
-rw-r--r--src/logicalfile/LMI_UnixDirectoryProvider.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/logicalfile/LMI_UnixDirectoryProvider.c b/src/logicalfile/LMI_UnixDirectoryProvider.c
index bdd1245..df51fb5 100644
--- a/src/logicalfile/LMI_UnixDirectoryProvider.c
+++ b/src/logicalfile/LMI_UnixDirectoryProvider.c
@@ -63,8 +63,18 @@ static CMPIStatus LMI_UnixDirectoryGetInstance(
const CMPIObjectPath* cop,
const char** properties)
{
- get_instance(UnixDirectory, S_IFDIR, "No such directory: %s");
- CMReturn(CMPI_RC_OK);
+ CMPIStatus st = {.rc = CMPI_RC_OK};
+ logicalfile_t logicalfile;
+
+ st = lmi_check_required(_cb, cop);
+ check_status(st);
+
+ LMI_UnixDirectory_InitFromObjectPath(&logicalfile.lf.unixdirectory, _cb, cop);
+ st = stat_logicalfile_and_fill(_cb, &logicalfile, S_IFDIR, "Not a directory: %s");
+ check_status(st);
+
+ KReturnInstance(cr, logicalfile.lf.unixdirectory);
+ return st;
}
static CMPIStatus LMI_UnixDirectoryCreateInstance(
@@ -167,3 +177,6 @@ KONKRET_REGISTRATION(
"LMI_UnixDirectory",
"instance method")
/* vi: set et: */
+/* Local Variables: */
+/* indent-tabs-mode: nil */
+/* End: */