From feb46b92a7619a3bb67b925e24184fe70464d261 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 16 Dec 2010 15:47:40 -0800 Subject: Open up libzfs_run_process/libzfs_load_module Recently helper functions were added to libzfs_util to load a kernel module or execute a process. Initially this functionality was limited to libzfs but it has become clear there will be other consumers. This change opens up the interface so it may be used where appropriate. --- lib/libzfs/libzfs_util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/libzfs/libzfs_util.c') diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 33c440c48..37dba8d39 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -631,7 +631,7 @@ libzfs_module_loaded(const char *module) return result; } -static int +int libzfs_run_process(const char *path, char *argv[]) { pid_t pid; @@ -657,13 +657,14 @@ libzfs_run_process(const char *path, char *argv[]) return -1; } -static int +int libzfs_load_module(const char *module) { char *argv[4] = {"/sbin/modprobe", "-q", (char *)module, (char *)0}; if (libzfs_module_loaded(module)) return 0; + return libzfs_run_process("/sbin/modprobe", argv); } -- cgit v1.2.3