OSDN Git Service

ext4_utils: clean up some warnings.
[android-x86/system-extras.git] / ext4_utils / make_ext4fs.c
index e69b473..17b7ae6 100644 (file)
@@ -109,7 +109,7 @@ static u32 build_default_directory_structure()
    if the image were mounted at the specified mount point */
 static u32 build_directory_structure(const char *full_path, const char *dir_path,
                u32 dir_inode, fs_config_func_t fs_config_func,
-               struct selabel_handle *sehnd)
+               struct selabel_handle *sehnd, int verbose)
 {
        int entries = 0;
        struct dentry *dentries;
@@ -183,11 +183,9 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
                        if (selabel_lookup(sehnd, &dentries[i].secon, dentries[i].path, stat.st_mode) < 0) {
                                error("cannot lookup security context for %s", dentries[i].path);
                        }
-#if 0
-                       // TODO make this a debug flag
-                       if (dentries[i].secon)
+
+                       if (dentries[i].secon && verbose)
                                printf("Labeling %s as %s\n", dentries[i].path, dentries[i].secon);
-#endif
                }
 #endif
 
@@ -256,11 +254,11 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
                        if (ret < 0)
                                critical_error_errno("asprintf");
                        entry_inode = build_directory_structure(subdir_full_path,
-                                       subdir_dir_path, inode, fs_config_func, sehnd);
+                                       subdir_dir_path, inode, fs_config_func, sehnd, verbose);
                        free(subdir_full_path);
                        free(subdir_dir_path);
                } else if (dentries[i].file_type == EXT4_FT_SYMLINK) {
-                       entry_inode = make_link(dentries[i].full_path, dentries[i].link);
+                       entry_inode = make_link(dentries[i].link);
                } else {
                        error("unknown file type on %s", dentries[i].path);
                        entry_inode = 0;
@@ -363,7 +361,7 @@ int make_ext4fs_sparse_fd(int fd, long long len,
        reset_ext4fs_info();
        info.len = len;
 
-       return make_ext4fs_internal(fd, NULL, mountpoint, NULL, 0, 1, 0, 0, 0, sehnd);
+       return make_ext4fs_internal(fd, NULL, mountpoint, NULL, 0, 1, 0, 0, sehnd, 0);
 }
 
 int make_ext4fs(const char *filename, long long len,
@@ -381,7 +379,7 @@ int make_ext4fs(const char *filename, long long len,
                return EXIT_FAILURE;
        }
 
-       status = make_ext4fs_internal(fd, NULL, mountpoint, NULL, 0, 0, 0, 1, 0, sehnd);
+       status = make_ext4fs_internal(fd, NULL, mountpoint, NULL, 0, 0, 0, 1, sehnd, 0);
        close(fd);
 
        return status;
@@ -446,14 +444,13 @@ static char *canonicalize_rel_slashes(const char *str)
 
 int make_ext4fs_internal(int fd, const char *_directory,
                          const char *_mountpoint, fs_config_func_t fs_config_func, int gzip,
-                         int sparse, int crc, int wipe, int init_itabs,
-                         struct selabel_handle *sehnd)
+                         int sparse, int crc, int wipe,
+                         struct selabel_handle *sehnd, int verbose)
 {
        u32 root_inode_num;
        u16 root_mode;
        char *mountpoint;
        char *directory = NULL;
-       int ret;
 
        if (setjmp(setjmp_env))
                return EXIT_FAILURE; /* Handle a call to longjmp() */
@@ -509,7 +506,8 @@ int make_ext4fs_internal(int fd, const char *_directory,
 
        info.feat_ro_compat |=
                        EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER |
-                       EXT4_FEATURE_RO_COMPAT_LARGE_FILE;
+                       EXT4_FEATURE_RO_COMPAT_LARGE_FILE |
+                       EXT4_FEATURE_RO_COMPAT_GDT_CSUM;
 
        info.feat_incompat |=
                        EXT4_FEATURE_INCOMPAT_EXTENTS |
@@ -555,7 +553,7 @@ int make_ext4fs_internal(int fd, const char *_directory,
 #else
        if (directory)
                root_inode_num = build_directory_structure(directory, mountpoint, 0,
-                        fs_config_func, sehnd);
+                        fs_config_func, sehnd, verbose);
        else
                root_inode_num = build_default_directory_structure();
 #endif
@@ -571,7 +569,9 @@ int make_ext4fs_internal(int fd, const char *_directory,
                        error("cannot lookup security context for %s", mountpoint);
                }
                if (secontext) {
-                       printf("Labeling %s as %s\n", mountpoint, secontext);
+                       if (verbose) {
+                               printf("Labeling %s as %s\n", mountpoint, secontext);
+                       }
                        inode_set_selinux(root_inode_num, secontext);
                }
                freecon(secontext);
@@ -580,9 +580,6 @@ int make_ext4fs_internal(int fd, const char *_directory,
 
        ext4_update_free();
 
-       if (init_itabs)
-               init_unused_inode_tables();
-
        ext4_queue_sb();
 
        printf("Created filesystem with %d/%d inodes and %d/%d blocks\n",