Whamcloud - gitweb
LU-1581 utils: osd_write_ldd() wrapper
authorAlex Zhuravlev <bzzz@whamcloud.com>
Tue, 5 Jun 2012 08:54:41 +0000 (12:54 +0400)
committerAndreas Dilger <adilger@whamcloud.com>
Wed, 4 Jul 2012 22:28:30 +0000 (18:28 -0400)
used to write mountdata to backend

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I8cb0275372f00f12f54461ce9afb243283aff4f3
Reviewed-on: http://review.whamcloud.com/3223
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Li Wei <liwei@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/utils/mkfs_lustre.c
lustre/utils/mount_utils.c
lustre/utils/mount_utils.h
lustre/utils/mount_utils_ldiskfs.c

index 25401d3..a7f09f9 100644 (file)
@@ -687,7 +687,7 @@ int main(int argc, char *const argv[])
 #endif
 
         /* Write our config files */
 #endif
 
         /* Write our config files */
-        ret = write_local_files(&mop);
+       ret = osd_write_ldd(&mop);
         if (ret != 0) {
                 fatal();
                 fprintf(stderr, "failed to write local files\n");
         if (ret != 0) {
                 fatal();
                 fprintf(stderr, "failed to write local files\n");
index 8656474..ad71af0 100644 (file)
@@ -376,6 +376,28 @@ int loop_format(struct mkfs_opts *mop)
        return 0;
 }
 
        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)
 {
 /* Read the server config files */
 int osd_read_ldd(char *dev, struct lustre_disk_data *ldd)
 {
index ad2f266..8d99255 100644 (file)
@@ -98,6 +98,7 @@ int loop_setup(struct mkfs_opts *mop);
 int loop_cleanup(struct mkfs_opts *mop);
 
 /* generic target support */
 int loop_cleanup(struct mkfs_opts *mop);
 
 /* generic target support */
+int osd_write_ldd(struct mkfs_opts *mop);
 int osd_read_ldd(char *dev, struct lustre_disk_data *ldd);
 int osd_is_lustre(char *dev, unsigned *mount_type);
 int osd_make_lustre(struct mkfs_opts *mop);
 int osd_read_ldd(char *dev, struct lustre_disk_data *ldd);
 int osd_is_lustre(char *dev, unsigned *mount_type);
 int osd_make_lustre(struct mkfs_opts *mop);
@@ -105,6 +106,7 @@ int osd_prepare_lustre(struct mkfs_opts *mop,
                       char *default_mountopts, int default_len,
                       char *always_mountopts, int always_len);
 
                       char *default_mountopts, int default_len,
                       char *always_mountopts, int always_len);
 
+int ldiskfs_write_ldd(struct mkfs_opts *mop);
 int ldiskfs_read_ldd(char *dev, struct lustre_disk_data *ldd);
 int ldiskfs_is_lustre(char *dev, unsigned *mount_type);
 int ldiskfs_make_lustre(struct mkfs_opts *mop);
 int ldiskfs_read_ldd(char *dev, struct lustre_disk_data *ldd);
 int ldiskfs_is_lustre(char *dev, unsigned *mount_type);
 int ldiskfs_make_lustre(struct mkfs_opts *mop);
index fe8be90..e334f58 100644 (file)
@@ -87,7 +87,7 @@ extern char *progname;
 #define EXT3_DIRENT_SIZE                DUMMY_FILE_NAME_LEN
 
 /* Write the server config files */
 #define EXT3_DIRENT_SIZE                DUMMY_FILE_NAME_LEN
 
 /* Write the server config files */
-int write_local_files(struct mkfs_opts *mop)
+int ldiskfs_write_ldd(struct mkfs_opts *mop)
 {
        char mntpt[] = "/tmp/mntXXXXXX";
        char filepnm[128];
 {
        char mntpt[] = "/tmp/mntXXXXXX";
        char filepnm[128];