From: Ilya Dryomov Date: Thu, 17 Apr 2014 15:03:24 +0000 (+0400) Subject: mount.ceph: switch to module_load() X-Git-Tag: v0.81~104^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2521e73aacef577b58bfa8ee69c5e016a88fd5a9;p=ceph.git mount.ceph: switch to module_load() Implement modprobe() in terms of module_load() from common/module.h Signed-off-by: Ilya Dryomov --- diff --git a/src/mount/mount.ceph.c b/src/mount/mount.ceph.c index 563cd07e7cd..9d4e33b49ef 100644 --- a/src/mount/mount.ceph.c +++ b/src/mount/mount.ceph.c @@ -6,6 +6,7 @@ #include #include +#include "common/module.h" #include "common/secret.h" #include "include/addr_parsing.h" @@ -290,28 +291,13 @@ static int parse_arguments(int argc, char *const *const argv, /* modprobe failing doesn't necessarily prevent from working, so this returns void */ -static void modprobe(void) { - int status; - status = system("/sbin/modprobe ceph"); - if (status < 0) { - char error_buf[80]; - fprintf(stderr, "mount.ceph: cannot run modprobe: %s\n", - strerror_r(errno, error_buf, sizeof(error_buf))); - } else if (WIFEXITED(status)) { - status = WEXITSTATUS(status); - if (status != 0) { - fprintf(stderr, - "mount.ceph: modprobe failed, exit status %d\n", - status); - } - } else if (WIFSIGNALED(status)) { - fprintf(stderr, - "mount.ceph: modprobe failed with signal %d\n", - WTERMSIG(status)); - } else { - fprintf(stderr, "mount.ceph: weird status from modprobe: %d\n", - status); - } +static void modprobe(void) +{ + int r; + + r = module_load("ceph", NULL); + if (r) + printf("failed to load ceph kernel module (%d)\n", r); } static void usage(const char *prog_name)