mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user