fs: ubifs: code cleanup
authorDonggeun Kim <dg77.kim@samsung.com>
Mon, 4 Oct 2010 11:10:35 +0000 (20:10 +0900)
committerDonggeun Kim <dg77.kim@samsung.com>
Mon, 4 Oct 2010 11:10:35 +0000 (20:10 +0900)
Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
common/cmd_usbd.c
fs/ubifs/mkfs.ubifs.c

index b332adf..787946d 100644 (file)
 static struct part_info *parts[16];
 #endif
 
+#ifdef CONFIG_UBIFS_MK
+#include <mkfs.ubifs.h>
+#endif
+
+#ifdef CONFIG_UBINIZE
+#include <ubinize.h>
+#endif
+
 static const char pszMe[] = "usbd: ";
 
 static struct usbd_ops usbd_ops;
@@ -1150,10 +1158,10 @@ static int process_data(struct usbd_ops *usbd)
                        printf("CSA Clear will be skipped temporary\n");
 
 #ifdef CONFIG_UBIFS_MK
-#include <mkfs.ubifs.h>
                void *dest_addr;
                void *src_addr = (void *) down_ram_addr;
                int leb_size, max_leb_cnt, mkfs_min_io_size;
+               unsigned long ubifs_dest_size, ubi_dest_size;
 #ifdef CONFIG_S5PC110
                mkfs_min_io_size = 4096;
                leb_size = 248 * 1024;
@@ -1163,7 +1171,6 @@ static int process_data(struct usbd_ops *usbd)
                leb_size = 126 * 1024;
                max_leb_cnt = 4096;
 #endif
-               unsigned long ubifs_dest_size, ubi_dest_size;
                printf("Start making ubifs\n");
                ret = mkfs(src_addr, len, &dest_addr, &ubifs_dest_size,
                           mkfs_min_io_size, leb_size, max_leb_cnt);
@@ -1175,7 +1182,6 @@ static int process_data(struct usbd_ops *usbd)
 #endif
 
 #ifdef CONFIG_UBINIZE
-#include <ubinize.h>
                int peb_size, ubi_min_io_size, subpage_size, vid_hdr_offs;
 #ifdef CONFIG_S5PC110
                ubi_min_io_size = 4096;
index 62b9961..2aff5f5 100644 (file)
 
 #define MODEM_IMAGE_SIZE       0xc00000
 
+#define DEFAULT_ROOTDIR_SQNUM  1
+#define DEFAULT_ROOTDIR_NLINK  2
+#define DEFAULT_FILE_SQNUM     2
+#define DEFAULT_FILE_NLINK     1
+#define DEFAULT_TIME_SEC       0x4ca2dfd9
+#define DEFAULT_ROOTDIR_MODE   0x41ed
+#define DEFAULT_FILE_MODE      0x81c0
+#define DEFAULT_UID            1000
+#define DEFAULT_GID            513
+
 /**
  * struct idx_entry - index entry.
  * @next: next index entry (NULL at end of list)
@@ -441,21 +451,21 @@ static int add_inode_with_data(unsigned long file_size, ino_t inum, void *data,
        ino->size       = cpu_to_le64(file_size);
 
        if (inum == UBIFS_ROOT_INO) {
-               ino->creat_sqnum        = cpu_to_le64(1);
-               ino->nlink              = cpu_to_le32(2);
-               ino->atime_sec          = cpu_to_le64(0x4ca2dfd9);
-               ino->ctime_sec          = cpu_to_le64(0x4ca2dfd9);
-               ino->mtime_sec          = cpu_to_le64(0x4ca2dfd9);
-               ino->mode               = cpu_to_le32(0x41ed);
+               ino->creat_sqnum        = cpu_to_le64(DEFAULT_ROOTDIR_SQNUM);
+               ino->nlink              = cpu_to_le32(DEFAULT_ROOTDIR_NLINK);
+               ino->atime_sec          = cpu_to_le64(DEFAULT_TIME_SEC);
+               ino->ctime_sec          = cpu_to_le64(DEFAULT_TIME_SEC);
+               ino->mtime_sec          = cpu_to_le64(DEFAULT_TIME_SEC);
+               ino->mode               = cpu_to_le32(DEFAULT_ROOTDIR_MODE);
        } else {
-               ino->creat_sqnum        = cpu_to_le64(2);
-               ino->nlink              = cpu_to_le32(1);
-               ino->atime_sec          = cpu_to_le64(0x4ca2dfd9);
-               ino->ctime_sec          = cpu_to_le64(0x4ca2dfd9);
-               ino->mtime_sec          = cpu_to_le64(0x4ca2dfd9);
-               ino->uid                = cpu_to_le32(1000);
-               ino->gid                = cpu_to_le32(513);
-               ino->mode               = cpu_to_le32(0x81c0);
+               ino->creat_sqnum        = cpu_to_le64(DEFAULT_FILE_SQNUM);
+               ino->nlink              = cpu_to_le32(DEFAULT_FILE_NLINK);
+               ino->atime_sec          = cpu_to_le64(DEFAULT_TIME_SEC);
+               ino->ctime_sec          = cpu_to_le64(DEFAULT_TIME_SEC);
+               ino->mtime_sec          = cpu_to_le64(DEFAULT_TIME_SEC);
+               ino->uid                = cpu_to_le32(DEFAULT_UID);
+               ino->gid                = cpu_to_le32(DEFAULT_GID);
+               ino->mode               = cpu_to_le32(DEFAULT_FILE_MODE);
        }
 
        ino->flags      = cpu_to_le32(use_flags);