[Aesop-embedded-devel] u-boot-aesop/fs/fat fat.c file.c
Status: Beta
Brought to you by:
linuxpark
|
From: linux4go <lin...@li...> - 2005-07-07 15:49:35
|
linux4go 2005/07/07 08:49:27
Modified: fs/fat fat.c file.c
Log:
Revision Changes Path
1.2 +21 -6 u-boot-aesop/fs/fat/fat.c
Index: fat.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/fs/fat/fat.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- fat.c 27 Jun 2005 17:03:38 -0000 1.1
+++ fat.c 7 Jul 2005 15:49:27 -0000 1.2
@@ -33,6 +33,8 @@
#if (CONFIG_COMMANDS & CFG_CMD_FAT)
+//#define FAT_DPRINT printf
+
/*
* Convert a string to lowercase.
*/
@@ -59,6 +61,7 @@
if (cur_dev == NULL)
return -1;
if (cur_dev->block_read) {
+ FAT_DPRINT("startblock: %d, getsize: %d, offset: %d\n", startblock, getsize,part_offset);
return cur_dev->block_read (cur_dev->dev, startblock, getsize, (unsigned long *)bufptr);
}
return -1;
@@ -90,7 +93,7 @@
}
else {
#if (CONFIG_COMMANDS & CFG_CMD_IDE) || (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
- (CONFIG_COMMANDS & CFG_CMD_USB) || defined(CONFIG_SYSTEMACE)
+ (CONFIG_COMMANDS & CFG_CMD_USB) || (CONFIG_COMMANDS & CFG_CMD_MMC) ||defined(CONFIG_SYSTEMACE)
disk_partition_t info;
if(!get_partition_info(dev_desc, part_no, &info)) {
part_offset = info.start;
@@ -221,10 +224,12 @@
startblock += mydata->fat_sect; /* Offset from start of disk */
if (getsize > fatlength) getsize = fatlength;
+ //FAT_DPRINT("Before die\n");
if (disk_read(startblock, getsize, bufptr) < 0) {
FAT_DPRINT("Error reading FAT blocks\n");
return ret;
}
+ //FAT_DPRINT("After die\n");
mydata->fatbufnum = bufnum;
}
@@ -291,20 +296,23 @@
startsect = mydata->rootdir_sect;
}
- FAT_DPRINT("gc - clustnum: %d, startsect: %d\n", clustnum, startsect);
+ FAT_DPRINT("gc - clustnum: %d, startsect: %d, size: %d\n", clustnum, startsect, size);
+
if (disk_read(startsect, size/FS_BLOCK_SIZE , buffer) < 0) {
FAT_DPRINT("Error reading data\n");
return -1;
}
+
if(size % FS_BLOCK_SIZE) {
__u8 tmpbuf[FS_BLOCK_SIZE];
idx= size/FS_BLOCK_SIZE;
+ //FAT_DPRINT("Just before Disk reading!!");
if (disk_read(startsect + idx, 1, tmpbuf) < 0) {
FAT_DPRINT("Error reading data\n");
return -1;
}
buffer += idx*FS_BLOCK_SIZE;
-
+ //FAT_DPRINT("Just after Disk reading!!");
memcpy(buffer, tmpbuf, size % FS_BLOCK_SIZE);
return 0;
}
@@ -335,6 +343,7 @@
FAT_DPRINT("Reading: %ld bytes\n", filesize);
actsize=bytesperclust;
+ //FAT_DPRINT("bytesperclust = %d\n",bytesperclust);
endclust=curclust;
do {
/* search for consecutive clusters */
@@ -353,10 +362,13 @@
/* actsize >= file size */
actsize -= bytesperclust;
/* get remaining clusters */
+ if(actsize)
+ {
if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
FAT_ERROR("Error reading cluster\n");
return -1;
}
+ }
/* get remaining bytes */
gotsize += (int)actsize;
filesize -= actsize;
@@ -968,8 +980,11 @@
printf("No current device\n");
return 1;
}
-#if (CONFIG_COMMANDS & CFG_CMD_IDE) || (CONFIG_COMMANDS & CFG_CMD_SCSI) || \
- (CONFIG_COMMANDS & CFG_CMD_USB) || (CONFIG_MMC)
+#if ( (CONFIG_COMMANDS & CFG_CMD_IDE) || \
+ (CONFIG_COMMANDS & CFG_CMD_SCSI)|| \
+ (CONFIG_COMMANDS & CFG_CMD_USB) || \
+ (CONFIG_COMMANDS & CFG_CMD_MMC) || \
+ (CONFIG_COMMANDS & CONFIG_MMC) )
printf("Interface: ");
switch(cur_dev->if_type) {
case IF_TYPE_IDE : printf("IDE"); break;
@@ -1005,7 +1020,7 @@
long
file_fat_read(const char *filename, void *buffer, unsigned long maxsize)
{
- printf("reading %s\n",filename);
+ FAT_DPRINT("reading %s\n",filename);
return do_fat_read(filename, buffer, maxsize, LS_NO);
}
1.2 +2 -0 u-boot-aesop/fs/fat/file.c
Index: file.c
===================================================================
RCS file: /cvsroot/aesop-embedded/u-boot-aesop/fs/fat/file.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- file.c 27 Jun 2005 17:03:38 -0000 1.1
+++ file.c 7 Jul 2005 15:49:27 -0000 1.2
@@ -195,6 +195,8 @@
return -1;
}
+ //printf("File read entry!\n");
+
if (ISDIRDELIM(*filename)) {
arg = filename;
} else {
|