Whamcloud - gitweb
LU-1581 utils: osd_write_ldd() wrapper
[fs/lustre-release.git] / lustre / utils / mount_utils.c
index 4fb5ee0..ad71af0 100644 (file)
@@ -376,6 +376,28 @@ int loop_format(struct mkfs_opts *mop)
        return 0;
 }
 
+/* Write the server config files */
+int osd_write_ldd(struct mkfs_opts *mop)
+{
+       struct lustre_disk_data *ldd = &mop->mo_ldd;
+       int ret;
+
+       switch (ldd->ldd_mount_type) {
+       case LDD_MT_LDISKFS:
+       case LDD_MT_LDISKFS2:
+               ret = ldiskfs_write_ldd(mop);
+               break;
+       default:
+               fatal();
+               fprintf(stderr, "unknown fs type %d '%s'\n",
+                       ldd->ldd_mount_type, MT_STR(ldd));
+               ret = EINVAL;
+               break;
+       }
+
+       return ret;
+}
+
 /* Read the server config files */
 int osd_read_ldd(char *dev, struct lustre_disk_data *ldd)
 {
@@ -411,6 +433,28 @@ int osd_is_lustre(char *dev, unsigned *mount_type)
        return 0;
 }
 
+/* Build fs according to type */
+int osd_make_lustre(struct mkfs_opts *mop)
+{
+       struct lustre_disk_data *ldd = &mop->mo_ldd;
+       int ret;
+
+       switch (ldd->ldd_mount_type) {
+       case LDD_MT_LDISKFS:
+       case LDD_MT_LDISKFS2:
+               ret = ldiskfs_make_lustre(mop);
+               break;
+       default:
+               fatal();
+               fprintf(stderr, "unknown fs type %d '%s'\n",
+                       ldd->ldd_mount_type, MT_STR(ldd));
+               ret = EINVAL;
+               break;
+       }
+
+       return ret;
+}
+
 int osd_prepare_lustre(struct mkfs_opts *mop,
                char *default_mountopts, int default_len,
                char *always_mountopts, int always_len)