Whamcloud - gitweb
LU-14398 llapi: simplify llapi_fid2path()
[fs/lustre-release.git] / lustre / utils / lshowmount.c
index 89bc3d5..cddc2f9 100644 (file)
 #include <errno.h>
 #include <libgen.h>
 
-#include <lustre/lustre_user.h>
+#include <linux/lustre/lustre_user.h>
 #include "nidlist.h"
-#include "lustreapi_internal.h"
+#include <lustre/lustreapi.h>
+#include <libcfs/util/param.h>
 
 #define PROC_UUID_TMPL         "%s/%s/uuid"
 
@@ -62,13 +63,12 @@ static void read_exports(char *exports, NIDList nidlist);
 char *prog;
 
 #define OPTIONS "ehlv"
-static struct option long_options[] = {
-       {"enumerate", no_argument, 0, 'e'},
-       {"help",      no_argument, 0, 'h'},
-       {"lookup",    no_argument, 0, 'l'},
-       {"verbose",   no_argument, 0, 'v'},
-       {0, 0, 0, 0},
-};
+static struct option long_opts[] = {
+       { .val = 'e',   .name = "enumerate",    .has_arg = no_argument },
+       { .val = 'h',   .name = "help",         .has_arg = no_argument },
+       { .val = 'l',   .name = "lookup",       .has_arg = no_argument },
+       { .val = 'v',   .name = "verbose",      .has_arg = no_argument },
+       { .name = NULL } };
 
 static void usage(void)
 {
@@ -85,7 +85,7 @@ int main(int argc, char **argv)
 
        prog = basename(argv[0]);
 
-       while ((opt = getopt_long(argc, argv, OPTIONS, long_options,
+       while ((opt = getopt_long(argc, argv, OPTIONS, long_opts,
                                  &optidx)) != -1) {
                switch (opt) {
                case 'e':       /* --enumerate */
@@ -156,10 +156,9 @@ static int lshowmount(int lookup, int enumerate, int verbose)
        glob_t exp_list;
        int i;
 
-       i = get_lustre_param_path("{mgs,mdt,obdfilter}", "*",
-                                  FILTER_BY_EXACT, "exports", &exp_list);
+       i = cfs_get_param_paths(&exp_list, "{mgs,mdt,obdfilter}/*/exports");
        if (i < 0)
-               return i;
+               return -errno;
        if (!verbose)
                nidlist = nl_create();
        for (i = 0; i < exp_list.gl_pathc; i++) {