In case of "not sure" if the removable media has changed, the
IBM PCDOS technical reference says to call BLDBPB if there are no used buffers, so we only do it then, instead of flushing the buffers. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1458 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
e597bb20d4
commit
924f6d1bfd
@ -259,6 +259,24 @@ VOID setinvld(REG COUNT dsk)
|
|||||||
while (FP_OFF(bp) != FP_OFF(firstbuf));
|
while (FP_OFF(bp) != FP_OFF(firstbuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if there is at least one dirty buffer */
|
||||||
|
/* */
|
||||||
|
BOOL dirty_buffers(REG COUNT dsk)
|
||||||
|
{
|
||||||
|
struct buffer FAR *bp = firstbuf;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (bp->b_unit == dsk &&
|
||||||
|
(bp->b_flag & (BFR_VALID | BFR_DIRTY)) == (BFR_VALID | BFR_DIRTY))
|
||||||
|
return TRUE;
|
||||||
|
bp = b_next(bp);
|
||||||
|
}
|
||||||
|
while (FP_OFF(bp) != FP_OFF(firstbuf));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* Flush all buffers for a disk */
|
/* Flush all buffers for a disk */
|
||||||
/* */
|
/* */
|
||||||
|
@ -1687,8 +1687,10 @@ COUNT media_check(REG struct dpb FAR * dpbp)
|
|||||||
/* If it is forced or the media may have changed, */
|
/* If it is forced or the media may have changed, */
|
||||||
/* rebuild the bpb */
|
/* rebuild the bpb */
|
||||||
case M_DONT_KNOW:
|
case M_DONT_KNOW:
|
||||||
/* hazard: no error checking! */
|
/* IBM PCDOS technical reference says to call BLDBPB if */
|
||||||
flush_buffers(dpbp->dpb_unit);
|
/* there are no used buffers */
|
||||||
|
if (dirty_buffers(dpbp->dpb_unit))
|
||||||
|
return SUCCESS;
|
||||||
|
|
||||||
/* If it definitely changed, don't know (falls through) */
|
/* If it definitely changed, don't know (falls through) */
|
||||||
/* or has been changed, rebuild the bpb. */
|
/* or has been changed, rebuild the bpb. */
|
||||||
|
@ -38,6 +38,7 @@ struct buffer FAR *getblk(ULONG blkno, COUNT dsk, BOOL overwrite);
|
|||||||
#define getblock(blkno, dsk) getblk(blkno, dsk, FALSE);
|
#define getblock(blkno, dsk) getblk(blkno, dsk, FALSE);
|
||||||
#define getblockOver(blkno, dsk) getblk(blkno, dsk, TRUE);
|
#define getblockOver(blkno, dsk) getblk(blkno, dsk, TRUE);
|
||||||
VOID setinvld(REG COUNT dsk);
|
VOID setinvld(REG COUNT dsk);
|
||||||
|
BOOL dirty_buffers(REG COUNT dsk);
|
||||||
BOOL flush_buffers(REG COUNT dsk);
|
BOOL flush_buffers(REG COUNT dsk);
|
||||||
BOOL flush(void);
|
BOOL flush(void);
|
||||||
BOOL fill(REG struct buffer FAR * bp, ULONG blkno, COUNT dsk);
|
BOOL fill(REG struct buffer FAR * bp, ULONG blkno, COUNT dsk);
|
||||||
|
Loading…
Reference in New Issue
Block a user