Skip to content
Snippets Groups Projects
Commit 7084161e authored by komaln's avatar komaln
Browse files

b=14471

i=nathan, andreas
To add -N option in lctl get_param which will print only path names.
parent 0672bb3c
No related merge requests found
...@@ -120,9 +120,10 @@ command_t cmdlist[] = { ...@@ -120,9 +120,10 @@ command_t cmdlist[] = {
{"local_param", jt_lcfg_param, 0, "set a temporary, local param\n" {"local_param", jt_lcfg_param, 0, "set a temporary, local param\n"
"usage: local_param <target.keyword=val> ...\n"}, "usage: local_param <target.keyword=val> ...\n"},
{"get_param", jt_lcfg_getparam, 0, "get the Lustre or LNET parameter\n" {"get_param", jt_lcfg_getparam, 0, "get the Lustre or LNET parameter\n"
"usage: get_param [-n] path/to/param/file \n" "usage: get_param [-n | -N] path/to/param/file \n"
"Get the value of Lustre or LNET parameter from the specified path\n" "Get the value of Lustre or LNET parameter from the specified path\n"
"Use '-n' to disable printing of the key name when printing values."}, "Use '-n' to disable printing of the key name when printing values.\n"
"Use '-N' to print only path names and not the values."},
{"set_param", jt_lcfg_setparam, 0, "set the Lustre or LNET parameter\n" {"set_param", jt_lcfg_setparam, 0, "set the Lustre or LNET parameter\n"
"usage: set_param [-n] path/to/param/file value\n" "usage: set_param [-n] path/to/param/file value\n"
"Set the value of the Lustre or LNET parameter at the specified path\n" "Set the value of the Lustre or LNET parameter at the specified path\n"
......
...@@ -547,13 +547,18 @@ static char *strnchr(const char *p, char c, size_t n) ...@@ -547,13 +547,18 @@ static char *strnchr(const char *p, char c, size_t n)
int jt_lcfg_getparam(int argc, char **argv) int jt_lcfg_getparam(int argc, char **argv)
{ {
int fp; int fp;
int rc = 0, i, show_path = 0; int rc = 0, i, show_path = 0, only_path = 0;
char pattern[PATH_MAX]; char pattern[PATH_MAX];
char *path, *tmp, *buf; char *path, *tmp, *buf;
glob_t glob_info; glob_t glob_info;
if (argc == 3 && strcmp(argv[1], "-n") == 0) { if (argc == 3 && (strcmp(argv[1], "-n") == 0 ||
strcmp(argv[1], "-N") == 0)) {
path = argv[2]; path = argv[2];
if (strcmp(argv[1], "-N") == 0) {
only_path = 1;
show_path = 1;
}
} else if (argc == 2) { } else if (argc == 2) {
show_path = 1; show_path = 1;
path = argv[1]; path = argv[1];
...@@ -596,6 +601,10 @@ int jt_lcfg_getparam(int argc, char **argv) ...@@ -596,6 +601,10 @@ int jt_lcfg_getparam(int argc, char **argv)
char *filename; char *filename;
filename = strdup(glob_info.gl_pathv[i]); filename = strdup(glob_info.gl_pathv[i]);
valuename = display_name(filename); valuename = display_name(filename);
if (valuename && only_path) {
printf("%s\n", valuename);
continue;
}
} }
/* Write the contents of file to stdout */ /* Write the contents of file to stdout */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment