--- Begin Message ---
diff -ruNp old/kernel/dsk.c new/kernel/dsk.c
--- old/kernel/dsk.c 2004-04-20 10:59:06.000000000 +0000
+++ new/kernel/dsk.c 2004-05-03 05:16:26.000000000 +0000
@@ -97,7 +97,7 @@ extern struct DynS ASM Dyn;
/*TE - array access functions */
ddt *getddt(int dev)
{
- return &(((ddt *) Dyn.Buffer)[dev]);
+ return (ddt*)Dyn.Buffer + dev;
}
STATIC VOID tmark(ddt *pddt)
@@ -364,9 +364,7 @@ STATIC WORD blk_Media(rqptr rp, ddt * pd
STATIC WORD getbpb(ddt * pddt)
{
- ULONG count;
bpb *pbpbarray = &pddt->ddt_bpb;
- unsigned secs_per_cyl;
WORD ret;
/* pddt->ddt_descflags |= DF_NOACCESS;
@@ -431,19 +429,20 @@ STATIC WORD getbpb(ddt * pddt)
printf("BPB_NFSECT = %04x\n", pbpbarray->bpb_nfsect);
#endif
- count =
- pbpbarray->bpb_nsize == 0 ?
- pbpbarray->bpb_huge : pbpbarray->bpb_nsize;
- secs_per_cyl = pbpbarray->bpb_nheads * pbpbarray->bpb_nsecs;
-
- if (secs_per_cyl == 0)
{
- tmark(pddt);
- return failure(E_FAILURE);
+ unsigned secs_per_cyl = pbpbarray->bpb_nheads * pbpbarray->bpb_nsecs;
+
+ if (secs_per_cyl == 0)
+ {
+ tmark(pddt);
+ return failure(E_FAILURE);
+ }
+ /* this field is problematic for partitions > 65535 cylinders,
+ in general > 512 GiB. However: we are not using it ourselves. */
+ pddt->ddt_ncyl = (UWORD)(((pbpbarray->bpb_nsize == 0 ?
+ pbpbarray->bpb_huge : pbpbarray->bpb_nsize)
+ - 1) / secs_per_cyl) + 1;
}
- /* this field is problematic for partitions > 65535 cylinders,
- in general > 512 GiB. However: we are not using it ourselves. */
- pddt->ddt_ncyl = (UWORD)((count + (secs_per_cyl - 1)) / secs_per_cyl);
tmark(pddt);
@@ -1064,15 +1063,8 @@ STATIC int LBA_Transfer(ddt * pddt, UWOR
LBA_address += count;
totaltodo -= count;
- buffer = adjust_far((char FAR *)buffer + count * 512);
+ buffer = adjust_far((char FAR *)buffer + count * 512u);
}
- return (error_code);
+ return error_code;
}
-
-/*
- * Revision 1.17 2001/05/13 tomehlert
- * Added full support for LBA hard drives
- * initcode moved (mostly) to initdisk.c
- * lower interface partly redesigned
- */
-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel
--- End Message ---