- char *dirs[] = PROC_DIRS;
- char exp[PATH_MAX + 1];
- NIDList nidlist = NULL;
- DIR *topdirp;
- struct dirent *dp;
- int i;
- int opens = 0;
-
- if (!verbose)
- nidlist = nl_create();
- for (i = 0; dirs[i] != NULL; i++) {
- if ((topdirp = opendir(dirs[i])) == NULL)
- continue;
- while ((dp = readdir(topdirp))) {
- if (dp->d_type != DT_DIR)
- continue;
- if (!strcmp(dp->d_name, "."))
- continue;
- if (!strcmp(dp->d_name, ".."))
- continue;
- sprintf(exp, PROC_EXPORTS_TMPL, dirs[i], dp->d_name);
- if (verbose) {
- nidlist = nl_create();
- read_exports(exp, nidlist);
- printf("%s:\n", dp->d_name);
- print_nids(nidlist, lookup, enumerate, 1);
- nl_destroy(nidlist);
- } else
- read_exports(exp, nidlist);
- }
- closedir(topdirp);
- opens++;
- }
- if (!verbose) {
- print_nids(nidlist, lookup, enumerate, 0);
- nl_destroy(nidlist);
- }
- return opens;
+ NIDList nidlist = NULL;
+ glob_t exp_list;
+ int i;
+
+ i = cfs_get_param_paths(&exp_list, "{mgs,mdt,obdfilter}/*/exports");
+ if (i < 0)
+ return -errno;
+ if (!verbose)
+ nidlist = nl_create();
+ for (i = 0; i < exp_list.gl_pathc; i++) {
+ if (verbose) {
+ nidlist = nl_create();
+ read_exports(exp_list.gl_pathv[i], nidlist);
+ print_expname(exp_list.gl_pathv[i]);
+ print_nids(nidlist, lookup, enumerate, 1);
+ nl_destroy(nidlist);
+ } else
+ read_exports(exp_list.gl_pathv[i], nidlist);
+ }
+ if (!verbose) {
+ print_nids(nidlist, lookup, enumerate, 0);
+ nl_destroy(nidlist);
+ }
+ cfs_free_param_data(&exp_list);
+ return i;