zdev: use libutil provided path functions

Closes: #20

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Acked-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
This commit is contained in:
Rafael Fonseca
2017-11-23 19:32:48 +01:00
committed by Michael Holzheu
parent df133846b5
commit d542138868
21 changed files with 84 additions and 122 deletions

View File

@@ -12,6 +12,8 @@
#include <string.h>
#include <sys/types.h>
#include "lib/util_path.h"
#include "attrib.h"
#include "misc.h"
#include "module.h"
@@ -34,7 +36,7 @@ bool module_loaded(const char *mod)
char *path = path_get_sys_module(mod);
bool rc;
rc = dir_exists(path);
rc = util_path_is_dir(path);
free(path);
return rc;
@@ -229,7 +231,7 @@ void module_try_load_once(const char *mod, const char *path)
} else
tried_loading = strlist_new();
strlist_add(tried_loading, mod);
if (path && path_exists(path))
if (path && util_path_exists(path))
return;
if (module_loaded(mod))
return;
@@ -275,7 +277,7 @@ bool module_set_params(const char *mod, struct setting_list *settings)
return false;
}
path = path_get_sys_module_param(mod, s->name);
result = file_writable(path);
result = util_path_is_writable(path);
free(path);
if (!result) {
/* Sysfs file is not writable. */