From: Donggeun Kim Date: Mon, 20 Dec 2010 08:55:26 +0000 (+0900) Subject: fat: change the location of fattable command code X-Git-Tag: v0.2~133 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6aed6ab6883b544ae7613177cdc80062a759e047;p=kernel%2Fu-boot.git fat: change the location of fattable command code Signed-off-by: Donggeun Kim --- diff --git a/common/cmd_fat.c b/common/cmd_fat.c index af78f5e..a28cfb3 100644 --- a/common/cmd_fat.c +++ b/common/cmd_fat.c @@ -185,45 +185,3 @@ U_BOOT_CMD( " - print information about filesystem from 'dev' on 'interface'" ); -int do_fat_table (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) -{ - int dev = 0; - int part = 1; - char *ep; - block_dev_desc_t *dev_desc=NULL; - - if (argc < 2) { - printf("usage: fattable \n"); - return 0; - } - dev = (int)simple_strtoul(argv[2], &ep, 16); - dev_desc = get_dev(argv[1], dev); - if (dev_desc == NULL) { - puts("\n** Invalid boot device **\n"); - return 1; - } - if (*ep) { - if (*ep != ':') { - puts("\n** Invalid boot device, use `dev[:part]' **\n"); - return 1; - } - part = (int)simple_strtoul(++ep, NULL, 16); - } - if (fat_register_device(dev_desc,part)!=0) { - printf("\n** Unable to use %s %d:%d for fattable **\n", - argv[1], dev, part); - return 1; - } - - file_fat_table(); - - return 0; -} - -U_BOOT_CMD( - fattable, 3, 1, do_fat_table, - "print fat range of files ", - " \n" - " - list files from 'dev' on 'interface' in a 'directory'" -); - diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index 1f0b1b3..d68e7a6 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -23,6 +23,7 @@ */ #include +#include #include #include #include @@ -1269,3 +1270,46 @@ void file_fat_table (void) find_directory_entry(mydata, startsect, "", dentptr, 0, 1, 1); } + +int do_fat_table (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + int dev = 0; + int part = 1; + char *ep; + block_dev_desc_t *dev_desc=NULL; + + if (argc < 2) { + printf("usage: fattable \n"); + return 0; + } + dev = (int)simple_strtoul(argv[2], &ep, 16); + dev_desc = get_dev(argv[1], dev); + if (dev_desc == NULL) { + puts("\n** Invalid boot device **\n"); + return 1; + } + if (*ep) { + if (*ep != ':') { + puts("\n** Invalid boot device, use `dev[:part]' **\n"); + return 1; + } + part = (int)simple_strtoul(++ep, NULL, 16); + } + if (fat_register_device(dev_desc,part)!=0) { + printf("\n** Unable to use %s %d:%d for fattable **\n", + argv[1], dev, part); + return 1; + } + + file_fat_table(); + + return 0; +} + +U_BOOT_CMD( + fattable, 3, 1, do_fat_table, + "print fat range of files ", + " \n" + " - list files from 'dev' on 'interface' in a 'directory'" +); +