From Matthew Probert · 1996-04-03 15:20 · #75266 in R25C
FLUSHING SMARTDRV
Matthew Probert
Servile Software
Disk caching is all well and good, but what if your program needs to commit
data to the disk? That is, make sure that the disk cache has written out all
its stored data.
Since SMARTDRV is commonly used on PCs, it is a reasonable bet that the host
computer may be using it. This function detects whether or not SMARTDRV is
loaded into memory by using the SMARTDRV installation check interrupt call:
int SMARTDRV()
{
/*
Return 1 if SMARTDRV active
*/
union REGS inreg,outreg;
inreg.x.ax = 0x4a10;
inreg.x.bx = 0;
inreg.x.cx = 0xEBAB;
int86(0x2f,&inreg,&outreg);
if (outreg.x.ax == 0xBABE)
return 1;
return 0;
}
In the event that SMARTDRV is loaded, you can then flush SMARTDRV, so that at
all cached data is written out use the following code:
/*
Flush smartdrv buffers
*/
union REGS inreg,outreg;
inreg.x.ax = 0x4a10;
inreg.x.bx = 0x0001;
int86(0x2f,&inreg,&outreg);
... [Servile Info Journal]
___ Blue Wave/QWK v2.12
--- WILDMAIL!/WC v4.12
* Origin: Ooh! BBS, London [ MULTILINE ACCESS ] 0181-395-3108 (2:254/233.0)