int port;
} network_t;
-int Parser_quit(int argc, char **argv);
+int Parser_quit(int argc, char **argv);
+int Parser_version(int argc, char **argv);
void Parser_init(char *, command_t *); /* Set prompt and load command list */
int Parser_commands(void); /* Start the command parser */
void Parser_qhelp(int, char **); /* Quick help routine */
*
*/
+#include <lustre_ver.h>
#include <libcfs/libcfsutil.h>
static command_t * top_level; /* Top level of commands, initialized by
done = 1;
return 0;
}
+
+int Parser_version(int argc, char **argv)
+{
+ fprintf(stdout, "%s %s\n", program_invocation_short_name,
+ LUSTRE_VERSION_STRING);
+ return 0;
+}
.TP
.B --ignore_errors | ignore_errors
Ignore errors during script processing
+.TP
+.B lustre_build_version
+Output the build version of the Lustre kernel modules
+.TP
+.B --version
+Output the build version of the lctl utility
+.TP
+.B help
+Provides brief help on the various arguments
+.TP
+.B exit/quit
+Quit the interactive lctl session
.SH EXAMPLES
# lctl
.B lfs osts
.RB [ path ]
.br
-.B path2fid <path> ...
+.B lfs path2fid <path> ...
.br
.B lfs pool_list <filesystem>[.<pool>] | <pathname>
.br
.br
.B lfs data_version [-n] \fB<filename>\fR
.br
+.B lfs --version
+.br
.B lfs help
.SH DESCRIPTION
.B lfs
can be used to create a new file with a specific striping pattern, determine the default striping pattern, gather the extended attributes (object numbers and location) for a specific file. It can be invoked interactively without any arguments or in a non-interactive mode with one of the arguements supported.
.SH OPTIONS
-The various options supported by lctl are listed and explained below:
+The various options supported by lfs are listed and explained below:
.TP
.B changelog
Show the metadata changes on an MDT. Start and end points are optional. The --follow option will block on new changes; this option is only valid when run direclty on the MDT node.
intermediate path components on a series different MDTs and become unavailable
if any of the intermediate MDTs are offline.
.TP
+.B --version
+Output the build version of the lfs utility. Use "lctl lustre_build_version" to get the version of the Lustre kernel modules
+.TP
.B help
Provides brief help on the various arguments
.TP
.TP
.BI \--verbose
Print more information.
+.TP
+.BI \--version
+Output build version of the mkfs.lustre utiltiy.
.SH EXAMPLES
.TP
#include <libcfs/libcfsutil.h>
#include <lustre/lustre_idl.h>
-static int jt_quit(int argc, char **argv) {
- Parser_quit(argc, argv);
- return 0;
-}
-
static int jt_noop(int argc, char **argv) {
return 0;
}
{"lustre_build_version", jt_get_version, 0,
"print the build version of lustre\n"
"usage: lustre_build_version"},
- {"exit", jt_quit, 0, "quit"},
- {"quit", jt_quit, 0, "quit"},
+ {"exit", Parser_quit, 0, "quit"},
+ {"quit", Parser_quit, 0, "quit"},
+ {"--version", Parser_version, 0,
+ "output build version of the utility and exit"},
- /* Network configuration commands */
- {"===== network config =====", jt_noop, 0, "network config"},
+ /* Network configuration commands */
+ {"===== network config =====", jt_noop, 0, "network config"},
{"--net", jt_opt_net, 0,"run <command> after setting network to <net>\n"
"usage: --net <tcp/elan/o2ib/...> <command>"},
{"network", jt_ptl_network, 0, "configure LNET"
if (dbg_initialize(argc, argv) < 0)
exit(3);
- Parser_init("lctl > ", cmdlist);
+ Parser_init("lctl > ", cmdlist);
if (argc > 1) {
rc = Parser_execarg(argc - 1, argv + 1, cmdlist);
{"help", Parser_help, 0, "help"},
{"exit", Parser_quit, 0, "quit"},
{"quit", Parser_quit, 0, "quit"},
+ {"--version", Parser_version, 0,
+ "output build version of the utility and exit"},
{ 0, 0, 0, NULL }
};
setlinebuf(stdout);
- Parser_init("lfs > ", cmdlist);
+ Parser_init("lfs > ", cmdlist);
if (argc > 1) {
rc = Parser_execarg(argc - 1, argv + 1, cmdlist);
char *progname;
int verbose = 1;
+int version;
static int print_only = 0;
#ifdef HAVE_LDISKFS_OSD
void usage(FILE *out)
{
- fprintf(out, "%s v"LUSTRE_VERSION_STRING"\n", progname);
fprintf(out, "usage: %s <target type> [--backfstype="FSLIST"] "
"--fsname=<filesystem name>\n"
"\t--index=<target index> [options] <device>\n", progname);
"\t\t--comment=<user comment>: arbitrary string (%d bytes)\n"
"\t\t--dryrun: report what we would do; don't write to disk\n"
"\t\t--verbose: e.g. show mkfs progress\n"
+ "\t\t-V|--version: output build version of the utility and\n"
+ "\t\t\texit\n"
"\t\t--quiet\n",
(int)sizeof(((struct lustre_disk_data *)0)->ldd_userdata));
return;
{ "servicenode", required_argument, NULL, 's' },
{ "network", required_argument, NULL, 't' },
{ "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
{ "writeconf", no_argument, NULL, 'w' },
{ 0, 0, NULL, 0 }
};
- char *optstring = "b:c:C:d:ef:Ghi:k:L:m:MnNo:Op:PqrRs:t:Uu:vw";
+ char *optstring = "b:c:C:d:ef:Ghi:k:L:m:MnNo:Op:PqrRs:t:Uu:vVw";
int opt;
int rc, longidx;
int failnode_set = 0, servicenode_set = 0;
strscpy(mop->mo_ldd.ldd_userdata, optarg,
sizeof(mop->mo_ldd.ldd_userdata));
break;
- case 'v':
- verbose++;
- break;
- case 'w':
- mop->mo_ldd.ldd_flags |= LDD_F_WRITECONF;
- break;
+ case 'v':
+ verbose++;
+ break;
+ case 'V':
+ ++version;
+ fprintf(stdout, "%s %s\n", progname,
+ LUSTRE_VERSION_STRING);
+ return 0;
+ case 'w':
+ mop->mo_ldd.ldd_flags |= LDD_F_WRITECONF;
+ break;
case 'Q':
mop->mo_flags |= MO_QUOTA;
break;
mop.mo_ldd.ldd_flags |= LDD_F_WRITECONF;
}
- if (strstr(mop.mo_ldd.ldd_params, PARAM_MGSNODE))
- mop.mo_mgs_failnodes++;
+ if (strstr(mop.mo_ldd.ldd_params, PARAM_MGSNODE))
+ mop.mo_mgs_failnodes++;
- if (verbose > 0)
- print_ldd("Read previous values", &(mop.mo_ldd));
+ if (verbose > 0)
+ print_ldd("Read previous values", &(mop.mo_ldd));
#endif
- ret = parse_opts(argc, argv, &mop, &mountopts);
- if (ret)
- goto out;
+ ret = parse_opts(argc, argv, &mop, &mountopts);
+ if (ret || version)
+ goto out;
ldd = &mop.mo_ldd;
#define MAXOPT 4096
#define MAX_RETRIES 99
-int verbose = 0;
-char *progname = NULL;
+int verbose;
+int version;
+char *progname;
void usage(FILE *out)
{
- fprintf(out, "%s v"LUSTRE_VERSION_STRING"\n", progname);
- fprintf(out, "\nThis mount helper should only be invoked via the "
- "mount (8) command,\ne.g. mount -t lustre dev dir\n\n");
- fprintf(out, "usage: %s [-fhnv] [-o <mntopt>] <device> <mountpt>\n",
- progname);
- fprintf(out,
- "\t<device>: the disk device, or for a client:\n"
- "\t\t<mgmtnid>[:<altmgtnid>...]:/<filesystem>-client\n"
- "\t<filesystem>: name of the Lustre filesystem (e.g. lustre1)\n"
- "\t<mountpt>: filesystem mountpoint (e.g. /mnt/lustre)\n"
- "\t-f|--fake: fake mount (updates /etc/mtab)\n"
- "\t-o force|--force: force mount even if already in /etc/mtab\n"
- "\t-h|--help: print this usage message\n"
- "\t-n|--nomtab: do not update /etc/mtab after mount\n"
- "\t-v|--verbose: print verbose config settings\n"
- "\t<mntopt>: one or more comma separated of:\n"
- "\t\t(no)flock,(no)user_xattr,(no)acl\n"
- "\t\tabort_recov: abort server recovery handling\n"
- "\t\tnosvc: only start MGC/MGS obds\n"
- "\t\tnomgs: only start target obds, using existing MGS\n"
- "\t\texclude=<ostname>[:<ostname>] : colon-separated list of "
- "inactive OSTs (e.g. lustre-OST0001)\n"
- "\t\tretry=<num>: number of times mount is retried by client\n"
- "\t\tmd_stripe_cache_size=<num>: set the raid stripe cache "
- "size for the underlying raid if present\n"
- );
- exit((out != stdout) ? EINVAL : 0);
+ fprintf(out, "\nThis mount helper should only be invoked via the "
+ "mount (8) command,\ne.g. mount -t lustre dev dir\n\n");
+ fprintf(out, "usage: %s [-fhnvV] [-o <mntopt>] <device> <mountpt>\n",
+ progname);
+ fprintf(out,
+ "\t<device>: the disk device, or for a client:\n"
+ "\t\t<mgmtnid>[:<altmgtnid>...]:/<filesystem>-client\n"
+ "\t<filesystem>: name of the Lustre filesystem (e.g. lustre1)\n"
+ "\t<mountpt>: filesystem mountpoint (e.g. /mnt/lustre)\n"
+ "\t-f|--fake: fake mount (updates /etc/mtab)\n"
+ "\t-o force|--force: force mount even if already in /etc/mtab\n"
+ "\t-h|--help: print this usage message\n"
+ "\t-n|--nomtab: do not update /etc/mtab after mount\n"
+ "\t-v|--verbose: print verbose config settings\n"
+ "\t-V|--version: output build version of the utility and exit\n"
+ "\t<mntopt>: one or more comma separated of:\n"
+ "\t\t(no)flock,(no)user_xattr,(no)acl\n"
+ "\t\tabort_recov: abort server recovery handling\n"
+ "\t\tnosvc: only start MGC/MGS obds\n"
+ "\t\tnomgs: only start target obds, using existing MGS\n"
+ "\t\texclude=<ostname>[:<ostname>] : colon-separated list of "
+ "inactive OSTs (e.g. lustre-OST0001)\n"
+ "\t\tretry=<num>: number of times mount is retried by client\n"
+ "\t\tmd_stripe_cache_size=<num>: set the raid stripe cache "
+ "size for the underlying raid if present\n");
+ exit((out != stdout) ? EINVAL : 0);
}
/* Get rid of symbolic hostnames for tcp, since kernel can't do lookups */
{"nomtab", 0, 0, 'n'},
{"options", 1, 0, 'o'},
{"verbose", 0, 0, 'v'},
+ {"version", 0, 0, 'V'},
{0, 0, 0, 0}
};
char real_path[PATH_MAX] = {'\0'};
char *ptr;
int opt, rc;
- while ((opt = getopt_long(argc, argv, "fhno:v",
+ while ((opt = getopt_long(argc, argv, "fhno:vV",
long_opt, NULL)) != EOF){
switch (opt) {
case 1:
case 'v':
++verbose;
break;
+ case 'V':
+ ++version;
+ fprintf(stdout, "%s %s\n", progname,
+ LUSTRE_VERSION_STRING);
+ return 0;
default:
fprintf(stderr, "%s: unknown option '%c'\n",
progname, opt);
return rc;
rc = parse_opts(argc, argv, &mop);
- if (rc)
+ if (rc || version)
return rc;
if (verbose) {
if (rc)
fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
strerror(-rc));
- else
- printf("Lustre version: %s\n", version);
+ else
+ printf("Lustre version: %s\n", version);
- printf("lctl version: %s\n", BUILD_VERSION);
- return rc;
+ return rc;
}
static void print_obd_line(char *s)