]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_fat.c
ARM: imx6: clocks: remove function local definitions of mxc_ccm_reg and anatop_regs
[karo-tx-uboot.git] / common / cmd_fat.c
index a4780174480ef858a17a9d804214bc518c9b7f44..aae993d2b9a486c7ca1bdc16c10f7c84e9c817b9 100644 (file)
 #include <net.h>
 #include <ata.h>
 #include <asm/io.h>
+#include <mapmem.h>
 #include <part.h>
 #include <fat.h>
 #include <fs.h>
 
+int do_fat_size(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       return do_size(cmdtp, flag, argc, argv, FS_TYPE_FAT);
+}
+
+U_BOOT_CMD(
+       fatsize,        4,      0,      do_fat_size,
+       "determine a file's size",
+       "<interface> <dev[:part]> <filename>\n"
+       "    - Find file 'filename' from 'dev' on 'interface'\n"
+       "      and determine its size."
+);
+
 int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        return do_load(cmdtp, flag, argc, argv, FS_TYPE_FAT);
@@ -87,7 +101,8 @@ U_BOOT_CMD(
 static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag,
                int argc, char * const argv[])
 {
-       long size;
+       loff_t size;
+       int ret;
        unsigned long addr;
        unsigned long count;
        block_dev_desc_t *dev_desc = NULL;
@@ -114,15 +129,15 @@ static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag,
        count = simple_strtoul(argv[5], NULL, 16);
 
        buf = map_sysmem(addr, count);
-       size = file_fat_write(argv[4], buf, count);
+       ret = file_fat_write(argv[4], buf, 0, count, &size);
        unmap_sysmem(buf);
-       if (size == -1) {
+       if (ret < 0) {
                printf("\n** Unable to write \"%s\" from %s %d:%d **\n",
                        argv[4], argv[1], dev, part);
                return 1;
        }
 
-       printf("%ld bytes written\n", size);
+       printf("%llu bytes written\n", size);
 
        return 0;
 }