Remove unnecessary buffer fields and clean-up prototypes.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@403 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2002-08-03 02:13:51 +00:00
parent 17d50fff3b
commit c6aa00cce5
3 changed files with 37 additions and 56 deletions

View File

@ -45,25 +45,10 @@ struct buffer {
BYTE b_unit; /* disk for this buffer */ BYTE b_unit; /* disk for this buffer */
BYTE b_flag; /* buffer flags */ BYTE b_flag; /* buffer flags */
ULONG b_blkno; /* block for this buffer */ ULONG b_blkno; /* block for this buffer */
/* DOS-C: 0xffff for huge block numbers */ struct dpb FAR *b_dpbp; /* pointer to DPB */
BYTE b_copies; /* number of copies to write */
#ifdef WITHFAT32
ULONG b_offset; /* span between copies */
#else
UWORD b_offset; /* span between copies */
#endif
#if 0 /*TE*/
union {
struct dpb FAR *_b_dpbp; /* pointer to DPB */
LONG _b_huge_blkno; /* DOS-C: actual block number if >= 0xffff */
} _b;
#endif
UBYTE b_buffer[BUFFERSIZE]; /* 512 byte sectors for now */ UBYTE b_buffer[BUFFERSIZE]; /* 512 byte sectors for now */
}; };
#define b_dpbp _b._b_dpbp
#define b_huge_blkno _b._b_huge_blkno
#define BFR_UNCACHE 0x80 /* indication, not really used */ #define BFR_UNCACHE 0x80 /* indication, not really used */
#define BFR_DIRTY 0x40 /* buffer modified */ #define BFR_DIRTY 0x40 /* buffer modified */
#define BFR_VALID 0x20 /* buffer contains valid data */ #define BFR_VALID 0x20 /* buffer contains valid data */

View File

@ -201,6 +201,7 @@ BOOL DeleteBlockInBufferCache(ULONG blknolow, ULONG blknohigh, COUNT dsk)
return FALSE; return FALSE;
} }
#if TOM
void dumpBufferCache(void) void dumpBufferCache(void)
{ {
struct buffer FAR *bp; struct buffer FAR *bp;
@ -217,7 +218,7 @@ void dumpBufferCache(void)
} }
printf("\n"); printf("\n");
} }
#endif
/* */ /* */
/* Return the address of a buffer structure containing the */ /* Return the address of a buffer structure containing the */
/* requested block. */ /* requested block. */
@ -347,13 +348,22 @@ BOOL flush1(struct buffer FAR * bp)
result = dskxfer(bp->b_unit, getblkno(bp), (VOID FAR *) bp->b_buffer, 1, DSKWRITE); /* BER 9/4/00 */ result = dskxfer(bp->b_unit, getblkno(bp), (VOID FAR *) bp->b_buffer, 1, DSKWRITE); /* BER 9/4/00 */
if (bp->b_flag & BFR_FAT) if (bp->b_flag & BFR_FAT)
{ {
int i = bp->b_copies; struct dpb FAR *dpbp = bp->b_dpbp;
UWORD b_copies = dpbp->dpb_fats;
ULONG b_offset = dpbp->dpb_fatsize;
ULONG blkno = getblkno(bp); ULONG blkno = getblkno(bp);
#ifdef WITHFAT32
while (--i > 0) if (ISFAT32(dpbp))
{ {
blkno += bp->b_offset; if (dpbp->dpb_xflags & FAT_NO_MIRRORING)
result = dskxfer(bp->b_unit, blkno, (VOID FAR *) bp->b_buffer, 1, DSKWRITE); /* BER 9/4/00 */ b_copies = 1;
b_offset = dpbp->dpb_xfatsize;
}
#endif
while (--b_copies > 0)
{
blkno += b_offset;
result = dskxfer(bp->b_unit, blkno, bp->b_buffer, 1, DSKWRITE); /* BER 9/4/00 */
} }
} }
} }
@ -412,7 +422,7 @@ UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks,
{ {
return 0x0201; /* illegal command */ return 0x0201; /* illegal command */
} }
if (!(CDSp->cds_table[dsk].cdsFlags & CDSPHYSDRV)) if ((CDSp->cds_table[dsk].cdsFlags & (CDSPHYSDRV | CDSNETWDRV)) != CDSPHYSDRV)
{ {
return 0x0201; /* illegal command */ return 0x0201; /* illegal command */
} }
@ -480,13 +490,6 @@ UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks,
if (mode >= DSKWRITEINT26) if (mode >= DSKWRITEINT26)
return (IoReqHdr.r_status); return (IoReqHdr.r_status);
/* Changed 9/4/00 BER
return (IoReqHdr.r_status);
*/
/* Skip the abort, retry, fail code...it needs fixed...BER */
/* End of change */
loop: loop:
switch (block_error(&IoReqHdr, dpbp->dpb_unit, dpbp->dpb_device)) switch (block_error(&IoReqHdr, dpbp->dpb_unit, dpbp->dpb_device))
{ {
@ -503,7 +506,7 @@ UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks,
default: default:
goto loop; goto loop;
} }
break;
} /* retry loop */ } /* retry loop */
/* *** Changed 9/4/00 BER */ /* *** Changed 9/4/00 BER */
return 0; /* Success! Return 0 for a successful operation. */ return 0; /* Success! Return 0 for a successful operation. */

View File

@ -70,7 +70,7 @@ extern struct buffer FAR *DOSFAR ASM firstbuf; /* head of buffers linked li
extern struct dpb FAR *DOSFAR ASM DPBp; extern struct dpb FAR *DOSFAR ASM DPBp;
/* First drive Parameter Block */ /* First drive Parameter Block */
extern cdstbl FAR *DOSFAR ASM CDSp; extern struct cds FAR *DOSFAR ASM CDSp;
/* Current Directory Structure */ /* Current Directory Structure */
extern sfttbl FAR *DOSFAR ASM sfthead; extern sfttbl FAR *DOSFAR ASM sfthead;
/* System File Table head */ /* System File Table head */
@ -116,7 +116,7 @@ BYTE FAR *lpBase = 0;
BYTE FAR *upBase = 0; BYTE FAR *upBase = 0;
BYTE FAR *lpTop = 0; BYTE FAR *lpTop = 0;
BYTE FAR *lpOldTop = 0; BYTE FAR *lpOldTop = 0;
STATIC COUNT nCfgLine = 0; STATIC unsigned nCfgLine = 0;
STATIC COUNT nPass = 0; STATIC COUNT nPass = 0;
COUNT UmbState = 0; COUNT UmbState = 0;
STATIC BYTE szLine[256] = { 0 }; STATIC BYTE szLine[256] = { 0 };
@ -172,7 +172,7 @@ VOID config_init_buffers(COUNT anzBuffers); /* from BLOCKIO.C */
STATIC VOID FAR * AlignParagraph(VOID FAR * lpPtr); STATIC VOID FAR * AlignParagraph(VOID FAR * lpPtr);
#ifndef I86 #ifndef I86
#define AlignParagraph(x) (x) #define AlignParagraph(x) ((VOID *)x)
#endif #endif
#define EOF 0x1a #define EOF 0x1a
@ -221,10 +221,6 @@ STATIC struct table commands[] = {
{"", -1, CfgFailure} {"", -1, CfgFailure}
}; };
#ifndef KDB
BYTE FAR * KernelAlloc(WORD nBytes);
#endif
BYTE *pLineStart = 0; BYTE *pLineStart = 0;
BYTE HMAState = 0; BYTE HMAState = 0;
@ -297,10 +293,9 @@ void PreConfig(void)
sfthead->sftt_next->sftt_next = (sfttbl FAR *) - 1; sfthead->sftt_next->sftt_next = (sfttbl FAR *) - 1;
sfthead->sftt_next->sftt_count = Config.cfgFiles - 5; sfthead->sftt_next->sftt_count = Config.cfgFiles - 5;
CDSp = (cdstbl FAR *) KernelAlloc(0x58 * lastdrive); CDSp = KernelAlloc(sizeof(struct cds) * lastdrive);
DPBp = (struct dpb FAR *) DPBp = KernelAlloc(blk_dev.dh_name[0] * sizeof(struct dpb));
KernelAlloc(blk_dev.dh_name[0] * sizeof(struct dpb));
#ifdef DEBUG #ifdef DEBUG
printf("Preliminary:\n f_node 0x%x", f_nodes); printf("Preliminary:\n f_node 0x%x", f_nodes);
@ -369,18 +364,16 @@ void PostConfig(void)
/* sfthead = (sfttbl FAR *)&basesft; */ /* sfthead = (sfttbl FAR *)&basesft; */
/* FCBp = (sfttbl FAR *)&FcbSft; */ /* FCBp = (sfttbl FAR *)&FcbSft; */
/* FCBp = (sfttbl FAR *) /* FCBp = KernelAlloc(sizeof(sftheader)
KernelAlloc(sizeof(sftheader)
+ Config.cfgFiles * sizeof(sft)); */ + Config.cfgFiles * sizeof(sft)); */
sfthead->sftt_next = (sfttbl FAR *) sfthead->sftt_next =
KernelAlloc(sizeof(sftheader) + (Config.cfgFiles - 5) * sizeof(sft)); KernelAlloc(sizeof(sftheader) + (Config.cfgFiles - 5) * sizeof(sft));
sfthead->sftt_next->sftt_next = (sfttbl FAR *) - 1; sfthead->sftt_next->sftt_next = (sfttbl FAR *) - 1;
sfthead->sftt_next->sftt_count = Config.cfgFiles - 5; sfthead->sftt_next->sftt_count = Config.cfgFiles - 5;
CDSp = (cdstbl FAR *) KernelAlloc(0x58 * lastdrive); CDSp = KernelAlloc(sizeof(struct cds) * lastdrive);
DPBp = (struct dpb FAR *) DPBp = KernelAlloc(blk_dev.dh_name[0] * sizeof(struct dpb));
KernelAlloc(blk_dev.dh_name[0] * sizeof(struct dpb));
#ifdef DEBUG #ifdef DEBUG
printf("Final: \n f_node 0x%x\n", f_nodes); printf("Final: \n f_node 0x%x\n", f_nodes);
@ -428,7 +421,7 @@ VOID configDone(VOID)
lastdrive + 'A', nblkdev + 'A' - 1)); lastdrive + 'A', nblkdev + 'A' - 1));
lastdrive = nblkdev; lastdrive = nblkdev;
CDSp = (cdstbl FAR *) KernelAlloc(0x58 * lastdrive); CDSp = KernelAlloc(sizeof(struct cds) * lastdrive);
} }
first_mcb = FP_SEG(lpBase) + ((FP_OFF(lpBase) + 0x0f) >> 4); first_mcb = FP_SEG(lpBase) + ((FP_OFF(lpBase) + 0x0f) >> 4);
@ -693,7 +686,7 @@ UWORD GetBiosKey(int timeout)
if (timeout < 0) if (timeout < 0)
continue; continue;
if (GetBiosTime() - startTime >= timeout * 18) if (GetBiosTime() - startTime >= (unsigned)timeout * 18)
break; break;
} }
return 0xffff; return 0xffff;
@ -836,7 +829,7 @@ STATIC VOID sysScreenMode(BYTE * pLine)
_AX = (0x11 << 8) + nMode; _AX = (0x11 << 8) + nMode;
_BL = 0; _BL = 0;
__int__(0x10); __int__(0x10);
#else #elif defined(I86)
asm asm
{ {
mov al, byte ptr nMode; mov al, byte ptr nMode;
@ -1097,7 +1090,7 @@ STATIC VOID CfgBreak(BYTE * pLine)
STATIC VOID Numlock(BYTE * pLine) STATIC VOID Numlock(BYTE * pLine)
{ {
extern VOID ASMCFUNC keycheck(); extern VOID ASMCFUNC keycheck(void);
/* Format: NUMLOCK = (ON | OFF) */ /* Format: NUMLOCK = (ON | OFF) */
BYTE FAR *keyflags = (BYTE FAR *) MK_FP(0x40, 0x17); BYTE FAR *keyflags = (BYTE FAR *) MK_FP(0x40, 0x17);
@ -1220,7 +1213,7 @@ STATIC VOID CfgFailure(BYTE * pLine)
} }
#ifndef KDB #ifndef KDB
BYTE FAR * KernelAlloc(WORD nBytes) void FAR * KernelAlloc(size_t nBytes)
{ {
BYTE FAR *lpAllocated; BYTE FAR *lpAllocated;
@ -1447,11 +1440,13 @@ STATIC VOID mumcb_init(UCOUNT seg, UWORD size)
} }
#endif #endif
VOID strcat(REG BYTE * d, REG BYTE * s) char *strcat(register char * d, register const char * s)
{ {
char *tmp = d;
while (*d != 0) while (*d != 0)
++d; ++d;
strcpy(d, s); strcpy(d, s);
return tmp;
} }
#if 0 #if 0
@ -1528,7 +1523,7 @@ VOID config_init_buffers(COUNT anzBuffers)
pbuffer = firstbuf; pbuffer = firstbuf;
DebugPrintf(("init_buffers at")); DebugPrintf(("init_buffers (size %u) at", sizeof(struct buffer)));
for (i = 0;; ++i) for (i = 0;; ++i)
{ {
@ -1539,8 +1534,6 @@ VOID config_init_buffers(COUNT anzBuffers)
pbuffer->b_unit = 0; pbuffer->b_unit = 0;
pbuffer->b_flag = 0; pbuffer->b_flag = 0;
pbuffer->b_blkno = 0; pbuffer->b_blkno = 0;
pbuffer->b_copies = 0;
pbuffer->b_offset = 0;
pbuffer->b_next = NULL; pbuffer->b_next = NULL;
DebugPrintf((" (%d,%p)", i, pbuffer)); DebugPrintf((" (%d,%p)", i, pbuffer));