diff options
author | Wolfgang Denk <wd@denx.de> | 2012-03-30 20:17:02 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2012-03-30 20:17:02 +0200 |
commit | a939ea3ab459d5fb3d1eaaec289c6ca85f2f74c1 (patch) | |
tree | b343c2aeb1dbfbd9a64cfb9da9f39d70e6d077f9 /fs/fat/fat_write.c | |
parent | bc6f6c87b685bcdcd5bef522982d15209b6b9601 (diff) | |
parent | f3e6110a10b694b3beb1ba7704fb7632cc371844 (diff) | |
download | u-boot-imx-a939ea3ab459d5fb3d1eaaec289c6ca85f2f74c1.zip u-boot-imx-a939ea3ab459d5fb3d1eaaec289c6ca85f2f74c1.tar.gz u-boot-imx-a939ea3ab459d5fb3d1eaaec289c6ca85f2f74c1.tar.bz2 |
Merge branch 'agust@denx.de' of git://git.denx.de/u-boot-staging
* 'agust@denx.de' of git://git.denx.de/u-boot-staging:
lzma: fix printf warnings
Remove CONFIG_SYS_EXTBDINFO from snapper9260.h
cmd_pxe.c: fix strict-aliasing warnings
net: smc91111: use mdelay()
doc: Fix some typos in different files
disk/part.c: Fix device enumeration through API
mkenvimage: Really set the redundant byte when applicable
mkenvimage: Don't try to detect comments in the input file
mkenvimage: Use mmap() when reading from a regular file
mkenvimage: Read/Write from/to stdin/out by default or if the filename is "-"
mkenvimage: More error handling
mkenvimage: Correct an include and add a missing one
mkenvimage: correct and clarify comments and error messages
MAKEALL: display SPL size if present
ARMV7/Vexpress: add missing get_ticks() and get_tbclk()
mkenvimage: fix usage message
cmd_fat: add FAT write command
fs/fat/fat_write.c: Fix GCC 4.6 warnings
FAT write: Fix compile errors
Diffstat (limited to 'fs/fat/fat_write.c')
-rw-r--r-- | fs/fat/fat_write.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index 3bfc1c4..a6181e7 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -41,23 +41,19 @@ static void uppercase(char *str, int len) } static int total_sector; -static int disk_write(__u32 startblock, __u32 getsize, __u8 *bufptr) +static int disk_write(__u32 block, __u32 nr_blocks, void *buf) { - if (cur_dev == NULL) + if (!cur_dev || !cur_dev->block_write) return -1; - if (startblock + getsize > total_sector) { + if (cur_part_info.start + block + nr_blocks > + cur_part_info.start + total_sector) { printf("error: overflow occurs\n"); return -1; } - startblock += part_offset; - - if (cur_dev->block_read) { - return cur_dev->block_write(cur_dev->dev, startblock, getsize, - (unsigned long *) bufptr); - } - return -1; + return cur_dev->block_write(cur_dev->dev, + cur_part_info.start + block, nr_blocks, buf); } /* @@ -797,7 +793,7 @@ static int check_overflow(fsdata *mydata, __u32 clustnum, unsigned long size) if (size % mydata->sect_size) sect_num++; - if (startsect + sect_num > total_sector) + if (startsect + sect_num > cur_part_info.start + total_sector) return -1; return 0; @@ -827,7 +823,6 @@ static dir_entry *empty_dentptr; static dir_entry *find_directory_entry(fsdata *mydata, int startsect, char *filename, dir_entry *retdent, __u32 start) { - __u16 prevcksum = 0xffff; __u32 curclust = (startsect - mydata->data_begin) / mydata->clust_size; debug("get_dentfromdir: %s\n", filename); @@ -861,8 +856,6 @@ static dir_entry *find_directory_entry(fsdata *mydata, int startsect, #ifdef CONFIG_SUPPORT_VFAT if ((dentptr->attr & ATTR_VFAT) && (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) { - prevcksum = - ((dir_slot *)dentptr)->alias_checksum; get_long_file_name(mydata, curclust, get_dentfromdir_block, &dentptr, l_name); @@ -926,7 +919,6 @@ static int do_fat_write(const char *filename, void *buffer, unsigned long size) { dir_entry *dentptr, *retdent; - dir_slot *slotptr; __u32 startsect; __u32 start_cluster; boot_sector bs; @@ -934,7 +926,7 @@ static int do_fat_write(const char *filename, void *buffer, fsdata datablock; fsdata *mydata = &datablock; int cursect; - int root_cluster, ret = -1, name_len; + int ret = -1, name_len; char l_filename[VFAT_MAXLEN_BYTES]; int write_size = size; @@ -947,9 +939,7 @@ static int do_fat_write(const char *filename, void *buffer, total_sector = bs.total_sect; if (total_sector == 0) - total_sector = part_size; - - root_cluster = bs.root_cluster; + total_sector = cur_part_info.size; if (mydata->fatsize == 32) mydata->fatlength = bs.fat32_length; @@ -1051,8 +1041,6 @@ static int do_fat_write(const char *filename, void *buffer, goto exit; } } else { - slotptr = (dir_slot *)empty_dentptr; - /* Set short name to set alias checksum field in dir_slot */ set_name(empty_dentptr, filename); fill_dir_slot(mydata, &empty_dentptr, filename); |