extern int op_find(char *path, struct obd_uuid *obduuid, int recursive,
int verbose, int quiet);
extern int op_check(int type_num, char **obd_type_p, char *dir);
+extern int op_catinfo(char *dir, char *keyword, char *node_name);
/* all functions */
static int lfs_setstripe(int argc, char **argv);
static int lfs_getstripe(int argc, char **argv);
static int lfs_osts(int argc, char **argv);
static int lfs_check(int argc, char **argv);
+static int lfs_catinfo(int argc, char **argv);
/* all avaialable commands */
command_t cmdlist[] = {
{"check", lfs_check, 0,
"blah...\n"
"usage: check <osts|mds|servers>"},
+ {"catinfo", lfs_catinfo, 0,
+ "Show information of specified type logs.\n"
+ "usage: catinfo <keyword> [node name]"
+ "keywords are one of followings: config, deletions.\n"
+ "client node name must be provided when use keyword config."},
{"osts", lfs_osts, 0, "osts"},
{"help", Parser_help, 0, "help"},
{"exit", Parser_quit, 0, "quit"},
}
+static int lfs_catinfo(int argc, char **argv)
+{
+ FILE *fp;
+ struct mntent *mnt = NULL;
+ int rc;
+
+ if (argc < 2 || (!strcmp(argv[1],"config") && argc < 3))
+ return CMD_HELP;
+
+ if (strcmp(argv[1], "config") && strcmp(argv[1], "deletions"))
+ return CMD_HELP;
+
+ fp = setmntent(MOUNTED, "r");
+ if (fp == NULL) {
+ fprintf(stderr, "setmntent(%s): %s:", MOUNTED,
+ strerror(errno));
+ } else {
+ mnt = getmntent(fp);
+ while (feof(fp) == 0 && ferror(fp) == 0) {
+ if (strcmp(mnt->mnt_type, "lustre_lite") == 0)
+ break;
+ mnt = getmntent(fp);
+ }
+ endmntent(fp);
+ }
+
+ if (mnt) {
+ if (argc == 3)
+ rc = op_catinfo(mnt->mnt_dir, argv[1], argv[2]);
+ else
+ rc = op_catinfo(mnt->mnt_dir, argv[1], NULL);
+ } else {
+ fprintf(stderr, "no lustre_lite mounted.\n");
+ rc = -1;
+ }
+
+ return rc;
+}
+
int main(int argc, char **argv)
{
int rc;