--- Begin Message ---
diff -ruNp old/kernel/dsk.c new/kernel/dsk.c
--- old/kernel/dsk.c 2004-06-11 02:55:18.000000000 +0000
+++ new/kernel/dsk.c 2004-06-11 03:03:52.000000000 +0000
@@ -63,8 +63,6 @@ extern COUNT ASMPASCAL fl_lba_ReadWrite(
STATIC int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer,
ULONG LBA_address, unsigned total, UWORD * transferred);
-#define NENTRY 26 /* total size of dispatch table */
-
#define LBA_READ 0x4200
#define LBA_WRITE 0x4300
UWORD LBA_WRITE_VERIFY = 0x4302;
@@ -110,7 +108,7 @@ typedef WORD dsk_proc(rqptr, ddt*);
STATIC dsk_proc mediachk, bldbpb, blockio, IoctlQueblk,
Genblkdev, Getlogdev, Setlogdev, blk_Open, blk_Close,
- blk_Media, blk_noerr, blk_nondr, blk_error;
+ blk_Media, blk_noerr, blk_nondr;
STATIC WORD getbpb(ddt*);
STATIC WORD dskerr(COUNT);
@@ -119,35 +117,35 @@ STATIC WORD dskerr(COUNT);
/* the function dispatch table */
/* */
-static dsk_proc * const dispatch[NENTRY] =
+static dsk_proc * const dispatch [] =
{
- /* disk init is done in diskinit.c, so this should never be called */
- blk_error, /* Initialize */
- mediachk, /* Media Check */
- bldbpb, /* Build BPB */
- blk_error, /* Ioctl In */
- blockio, /* Input (Read) */
- blk_nondr, /* Non-destructive Read */
- blk_noerr, /* Input Status */
- blk_noerr, /* Input Flush */
- blockio, /* Output (Write) */
- blockio, /* Output with verify */
- blk_noerr, /* Output Status */
- blk_noerr, /* Output Flush */
- blk_error, /* Ioctl Out */
- blk_Open, /* Device Open */
- blk_Close, /* Device Close */
- blk_Media, /* Removable Media */
- blk_noerr, /* Output till busy */
- blk_error, /* undefined */
- blk_error, /* undefined */
- Genblkdev, /* Generic Ioctl Call */
- blk_error, /* undefined */
- blk_error, /* undefined */
- blk_error, /* undefined */
- Getlogdev, /* Get Logical Device */
- Setlogdev, /* Set Logical Device */
- IoctlQueblk /* Ioctl Query */
+ /* disk init is done in initdisk.c, so this should never be called */
+ NULL, /* 0x00 Initialize */
+ mediachk, /* 0x01 Media Check */
+ bldbpb, /* 0x02 Build BPB */
+ NULL, /* 0x03 Ioctl In */
+ blockio, /* 0x04 Input (Read) */
+ blk_nondr, /* 0x05 Non-destructive Read */
+ blk_noerr, /* 0x06 Input Status */
+ blk_noerr, /* 0x07 Input Flush */
+ blockio, /* 0x08 Output (Write) */
+ blockio, /* 0x09 Output with verify */
+ blk_noerr, /* 0x0A Output Status */
+ blk_noerr, /* 0x0B Output Flush */
+ NULL, /* 0x0C Ioctl Out */
+ blk_Open, /* 0x0D Device Open */
+ blk_Close, /* 0x0E Device Close */
+ blk_Media, /* 0x0F Removable Media */
+ blk_noerr, /* 0x10 Output till busy */
+ NULL, /* 0x11 undefined */
+ NULL, /* 0x12 undefined */
+ Genblkdev, /* 0x13 Generic Ioctl Call */
+ NULL, /* 0x14 undefined */
+ NULL, /* 0x15 undefined */
+ NULL, /* 0x16 undefined */
+ Getlogdev, /* 0x17 Get Logical Device */
+ Setlogdev, /* 0x18 Set Logical Device */
+ IoctlQueblk /* 0x19 Ioctl Query */
};
#define hd(x) ((x) & DF_FIXED)
@@ -156,16 +154,21 @@ static dsk_proc * const dispatch[NENTRY]
/* F U N C T I O N S --------------------------------------------------- */
/* ----------------------------------------------------------------------- */
-COUNT ASMCFUNC FAR blk_driver(rqptr rp)
+int ASMCFUNC FAR blk_driver(rqptr rp)
{
- if (rp->r_unit >= blk_dev.dh_name[0] && rp->r_command != C_INIT)
- return failure(E_UNIT);
- if (rp->r_command > NENTRY)
+ if (rp->r_command >= LENGTH (dispatch))
+ return failure(E_FAILURE); /* general failure */
{
- return failure(E_FAILURE); /* general failure */
+ dsk_proc *const proc = dispatch [rp->r_command];
+ if (proc == NULL)
+ {
+ rp->r_count = 0;
+ return failure(E_FAILURE); /* general failure */
+ }
+ if (rp->r_unit >= blk_dev.dh_name[0])
+ return failure(E_UNIT);
+ return proc (rp, getddt(rp->r_unit));
}
- else
- return ((*dispatch[rp->r_command]) (rp, getddt(rp->r_unit)));
}
STATIC char template_string[] =
@@ -779,14 +782,6 @@ STATIC WORD blockio(rqptr rp, ddt * pddt
return S_DONE;
}
-STATIC WORD blk_error(rqptr rp, ddt * pddt)
-{
- UNREFERENCED_PARAMETER(pddt);
-
- rp->r_count = 0;
- return failure(E_FAILURE); /* general failure */
-}
-
STATIC WORD blk_noerr(rqptr rp, ddt * pddt)
{
UNREFERENCED_PARAMETER(rp);
--- End Message ---