summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiu Aleaxander <Aleaxander@gmail.com>2009-07-20 08:46:16 +0800
committerLiu Aleaxander <Aleaxander@gmail.com>2009-07-20 08:46:16 +0800
commitc401b53dd8e60a4dd4e913fb472af223cb5d6c48 (patch)
treedfebff7cf55698fefe6b3496a0210d2507ada31c
parent927069c1099f4beb4d0cc6b8972beb6801c03f84 (diff)
downloadsyslinux-c401b53dd8e60a4dd4e913fb472af223cb5d6c48.tar.gz
Core: some bugs fixed
-rw-r--r--core/diskio.c13
-rw-r--r--core/ext2.c4
-rw-r--r--core/fat.c12
3 files changed, 16 insertions, 13 deletions
diff --git a/core/diskio.c b/core/diskio.c
index cbd93050..bf222203 100644
--- a/core/diskio.c
+++ b/core/diskio.c
@@ -57,7 +57,7 @@ static int chs_rdwr_sectors(struct disk *disk, void *buf,
t = xlba / disk->s;
h = t % disk->h;
c = t / disk->h;
-
+
ireg.eax.b[0] = chunk;
ireg.ecx.b[1] = c;
ireg.ecx.b[0] = ((c & 0x300) >> 2) | (s+1);
@@ -66,8 +66,8 @@ static int chs_rdwr_sectors(struct disk *disk, void *buf,
ireg.es = SEG(tptr);
retry = RETRY_COUNT;
-
- for (;;) {
+
+ for (;;) {
__intcall(0x13, &ireg, &oreg);
if (!(oreg.eflags.l & EFLAGS_CF))
break;
@@ -76,10 +76,11 @@ static int chs_rdwr_sectors(struct disk *disk, void *buf,
/* if we are reading ONE sector and go here, just make it _faile_ */
chunk = chunk == 1 ? 0 : ((chunk+1) >> 1);
- if (chunk) {
+ if (chunk) {
MaxTransfer = chunk;
retry = RETRY_COUNT;
- continue;
+ ireg.eax.b[0] = chunk;
+ continue;
}
return done; /* Failure */
}
@@ -94,6 +95,7 @@ static int chs_rdwr_sectors(struct disk *disk, void *buf,
count -= chunk;
done += chunk;
}
+
return done;
}
@@ -165,6 +167,7 @@ static int edd_rdwr_sectors(struct disk *disk, void *buf,
if (chunk) {
MaxTransfer = chunk;
retry = RETRY_COUNT;
+ pkt.blocks = chunk;
continue;
}
/*** XXX: Consider falling back to CHS here?! ***/
diff --git a/core/ext2.c b/core/ext2.c
index 3f55c1ef..115ed218 100644
--- a/core/ext2.c
+++ b/core/ext2.c
@@ -513,10 +513,10 @@ uint32_t ext2_getfssec(struct fs_info *fs, char *buf,
sector_idx ++;
next_sector ++;
- }while(next_sector == linsector(fs, sectors));
+ }while(next_sector == linsector(fs, sector_idx));
#if 0
- printf("You are reading stores at sector --0x%x--0x%x\n",
+ printf("You are reading data stored at sector --0x%x--0x%x\n",
frag_start, frag_start + con_sec_cnt -1);
#endif
getlinsec_ext(fs, buf, frag_start, con_sec_cnt);
diff --git a/core/fat.c b/core/fat.c
index 3e792fe7..df249a08 100644
--- a/core/fat.c
+++ b/core/fat.c
@@ -15,9 +15,9 @@
/* file structure. This holds the information for each currently open file */
struct open_file_t {
- sector_t file_sector; /* sector pointer ( 0 = structure free ) */
- uint32_t file_bytesleft; /* number of bytes left */
- uint32_t file_left; /* number of sectors left */
+ sector_t file_sector; /* sector pointer ( 0 = structure free ) */
+ uint32_t file_bytesleft; /* number of bytes left */
+ uint32_t file_left; /* number of sectors left */
};
extern char Files[MAX_OPEN * sizeof(struct open_file_t)];
@@ -291,10 +291,10 @@ static void __getfssec(struct fs_info *fs, char *buf, struct open_file_t *file,
break;
}while( next_sector == (++curr_sector) );
-#if 0 /* Debug message */
- printf("You are reading stores at sector --0x%x--0x%x\n",
+#if 0
+ printf("You are reading data stored at sector --0x%x--0x%x\n",
frag_start, frag_start + con_sec_cnt -1);
-#endif
+#endif
/* do read */
disk->rdwr_sectors(disk, buf, frag_start, con_sec_cnt, 0);