return ret;
}
-int read_local_files(struct mkfs_opts *mop)
+int ldiskfs_read_ldd(char *dev, struct lustre_disk_data *mo_ldd)
{
char tmpdir[] = "/tmp/dirXXXXXX";
char cmd[PATH_MAX];
char filepnm[128];
- char *dev;
FILE *filep;
int ret = 0;
int cmdsz = sizeof(cmd);
return errno;
}
- dev = mop->mo_device;
-
/* TODO: it's worth observing the get_mountdata() function that is
in mount_utils.c for getting the mountdata out of the
filesystem */
if (filep) {
size_t num_read;
vprint("Reading %s\n", MOUNT_DATA_FILE);
- num_read = fread(&mop->mo_ldd, sizeof(mop->mo_ldd), 1, filep);
+ num_read = fread(mo_ldd, sizeof(*mo_ldd), 1, filep);
if (num_read < 1 && ferror(filep)) {
fprintf(stderr, "%s: Unable to read from file %s: %s\n",
progname, filepnm, strerror(errno));
}
/* 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
}
/* Build fs according to type */
-int make_lustre_backfs(struct mkfs_opts *mop)
+int ldiskfs_make_lustre(struct mkfs_opts *mop)
{
__u64 device_sz = mop->mo_device_sz, block_count = 0;
char mkfs_cmd[PATH_MAX];