X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=common%2Fcmd_fat.c;h=9576cdf389df838323d32d3c005cc0fdb0d96e3f;hb=5e3dca577b7c1bf58bd2b48449b18b7e7dcd8e04;hp=7bd4b519508430b7beacbaff55133ddb871c6715;hpb=42d1f0394bef0624fc9664714d54bb137931d6a6;p=oweals%2Fu-boot.git diff --git a/common/cmd_fat.c b/common/cmd_fat.c index 7bd4b51950..9576cdf389 100644 --- a/common/cmd_fat.c +++ b/common/cmd_fat.c @@ -29,44 +29,10 @@ #include #include #include - -#if (CONFIG_COMMANDS & CFG_CMD_FAT) - -#undef DEBUG - +#include #include -block_dev_desc_t *get_dev (char* ifname, int dev) -{ -#if (CONFIG_COMMANDS & CFG_CMD_IDE) - if (strncmp(ifname,"ide",3)==0) { - extern block_dev_desc_t * ide_get_dev(int dev); - return(ide_get_dev(dev)); - } -#endif -#if (CONFIG_COMMANDS & CFG_CMD_SCSI) - if (strncmp(ifname,"scsi",4)==0) { - extern block_dev_desc_t * scsi_get_dev(int dev); - return(scsi_get_dev(dev)); - } -#endif -#if ((CONFIG_COMMANDS & CFG_CMD_USB) && defined(CONFIG_USB_STORAGE)) - if (strncmp(ifname,"usb",3)==0) { - extern block_dev_desc_t * usb_stor_get_dev(int dev); - return(usb_stor_get_dev(dev)); - } -#endif -#if defined(CONFIG_MMC) - if (strncmp(ifname,"mmc",3)==0) { - extern block_dev_desc_t * mmc_get_dev(int dev); - return(mmc_get_dev(dev)); - } -#endif - return NULL; -} - - int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { long size; @@ -80,7 +46,7 @@ int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) if (argc < 5) { printf ("usage: fatload [bytes]\n"); - return (0); + return 1; } dev = (int)simple_strtoul (argv[2], &ep, 16); dev_desc=get_dev(argv[1],dev); @@ -108,14 +74,15 @@ int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) if(size==-1) { printf("\n** Unable to read \"%s\" from %s %d:%d **\n",argv[4],argv[1],dev,part); - } else { - printf ("\n%ld bytes read\n", size); - - sprintf(buf, "%lX", size); - setenv("filesize", buf); + return 1; } - return size; + printf ("\n%ld bytes read\n", size); + + sprintf(buf, "%lX", size); + setenv("filesize", buf); + + return 0; } @@ -351,5 +318,3 @@ void hexdump (int cnt, unsigned char *data) } } #endif /* NOT_IMPLEMENTED_YET */ - -#endif /* CFG_CMD_FAT */