char *mountopts = NULL;
char always_mountopts[512] = "";
char default_mountopts[512] = "";
+ unsigned mount_type;
int ret = 0;
if ((progname = strrchr(argv[0], '/')) != NULL)
new ones. */
/* Check whether the disk has already been formatted by mkfs.lustre */
- ret = is_lustre_target(&mop);
+ ret = osd_is_lustre(mop.mo_device, &mount_type);
if (ret == 0) {
fatal();
fprintf(stderr, "Device %s has not been formatted with "
#ifndef TUNEFS /* mkfs.lustre */
/* Check whether the disk has already been formatted by mkfs.lustre */
if (!(mop.mo_flags & MO_FORCEFORMAT)) {
- ret = is_lustre_target(&mop);
+ ret = osd_is_lustre(mop.mo_device, &mount_type);
if (ret) {
fatal();
fprintf(stderr, "Device %s was previously formatted "
return 0;
}
+/* Was this device formatted for Lustre */
+int osd_is_lustre(char *dev, unsigned *mount_type)
+{
+ vprint("checking for existing Lustre data: ");
+
+ if (ldiskfs_is_lustre(dev, mount_type)) {
+ vprint("found\n");
+ return 1;
+ }
+
+ vprint("not found\n");
+ return 0;
+}
+
int osd_prepare_lustre(struct mkfs_opts *mop,
char *default_mountopts, int default_len,
char *always_mountopts, int always_len)
int loop_cleanup(struct mkfs_opts *mop);
/* generic target support */
+int osd_is_lustre(char *dev, unsigned *mount_type);
int osd_prepare_lustre(struct mkfs_opts *mop,
char *default_mountopts, int default_len,
char *always_mountopts, int always_len);
+int ldiskfs_is_lustre(char *dev, unsigned *mount_type);
int ldiskfs_prepare_lustre(struct mkfs_opts *mop,
char *default_mountopts, int default_len,
char *always_mountopts, int always_len);
}
/* Check whether the device has already been used with lustre */
-int is_lustre_target(struct mkfs_opts *mop)
+int ldiskfs_is_lustre(char *dev, unsigned *mount_type)
{
- int rc;
-
- vprint("checking for existing Lustre data: ");
+ int ret;
- if ((rc = file_in_dev(MOUNT_DATA_FILE, mop->mo_device))) {
- vprint("found %s\n",
- (rc == 1) ? MOUNT_DATA_FILE : "extents");
- /* in the -1 case, 'extents' means this really IS a lustre
- target */
- return rc;
+ ret = file_in_dev(MOUNT_DATA_FILE, dev);
+ if (ret) {
+ /* in the -1 case, 'extents' means IS a lustre target */
+ *mount_type = LDD_MT_LDISKFS;
+ return 1;
}
- if ((rc = file_in_dev(LAST_RCVD, mop->mo_device))) {
- vprint("found %s\n", LAST_RCVD);
- return rc;
+ ret = file_in_dev(LAST_RCVD, dev);
+ if (ret) {
+ *mount_type = LDD_MT_LDISKFS;
+ return 1;
}
- vprint("not found\n");
- return 0; /* The device is not a lustre target. */
+ return 0;
}
-
-
/* Check if a certain feature is supported by e2fsprogs.
* Firstly we try to use "debugfs supported_features" command to check if
* the feature is supported. If this fails we try to set this feature with