#include <time.h>
#include "obdctl.h"
+#include "lustreapi_internal.h"
#include <lustre/lustre_lfsck_user.h>
#include <lnet/lnetctl.h>
-#include <lustre_ioctl.h>
+#include <linux/lustre_ioctl.h>
/* Needs to be last to avoid clashes */
#include <libcfs/util/ioctl.h>
#include <libcfs/util/param.h>
};
static struct option long_opt_stop[] = {
- {"device", required_argument, 0, 'M'},
- {"all", no_argument, 0, 'A'},
- {"help", no_argument, 0, 'h'},
- {0, 0, 0, 0 }
-};
+ { .val = 'A', .name = "all", .has_arg = no_argument },
+ { .val = 'h', .name = "help", .has_arg = no_argument },
+ { .val = 'M', .name = "device", .has_arg = required_argument },
+ { .name = NULL } };
static struct option long_opt_query[] = {
- {"device", required_argument, 0, 'M'},
- {"type", required_argument, 0, 't'},
- {"help", no_argument, 0, 'h'},
- {"wait", no_argument, 0, 'w'},
- {0, 0, 0, 0 }
-};
+ { .val = 'h', .name = "help", .has_arg = no_argument },
+ { .val = 'M', .name = "device", .has_arg = required_argument },
+ { .val = 't', .name = "type", .has_arg = required_argument },
+ { .val = 'w', .name = "wait", .has_arg = no_argument },
+ { .name = NULL } };
struct lfsck_type_name {
char *ltn_name;
};
static struct lfsck_type_name lfsck_types_names[] = {
- { "scrub", LFSCK_TYPE_SCRUB },
- { "layout", LFSCK_TYPE_LAYOUT },
- { "namespace", LFSCK_TYPE_NAMESPACE },
- { "default", LFSCK_TYPES_DEF },
- { "all", LFSCK_TYPES_SUPPORTED },
- { NULL, 0 }
-};
+ { .ltn_name = "all", .ltn_type = LFSCK_TYPES_SUPPORTED },
+ { .ltn_name = "default", .ltn_type = LFSCK_TYPES_DEF },
+ { .ltn_name = "layout", .ltn_type = LFSCK_TYPE_LAYOUT },
+ { .ltn_name = "namespace", .ltn_type = LFSCK_TYPE_NAMESPACE },
+ { .ltn_name = "scrub", .ltn_type = LFSCK_TYPE_SCRUB },
+ { .ltn_name = NULL } };
static enum lfsck_type lfsck_name2type(const char *name)
{
}
ptr = strrchr(param.gl_pathv[0], '-');
- LASSERT(ptr != NULL);
+ if (ptr == NULL) {
+ rc = -EINVAL;
+ goto out;
+ }
for (i = 1; i < param.gl_pathc; i++) {
char *ptr2 = strrchr(param.gl_pathv[i], '-');
- LASSERT(ptr2 != NULL);
+ if (ptr2 == NULL) {
+ rc = -EINVAL;
+ goto out;
+ }
if ((ptr - param.gl_pathv[0]) != (ptr2 - param.gl_pathv[i]) ||
strncmp(param.gl_pathv[0], param.gl_pathv[i],