home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 6 File
/
06-File.zip
/
ramfs102.zip
/
src
/
read.c
< prev
next >
Wrap
C/C++ Source or Header
|
2002-09-28
|
1KB
|
50 lines
#include "includes.h"
APIRET EXPENTRY FS_READ (
struct sffsi *psffsi,
struct sffsd *psffsd,
PCHAR pData,
PUSHORT pLen,
USHORT IOflag ) /* not used */
{
int rc;
POPENFILE pOpenfile;
FBLOCK fblkFile;
UtilEnterRamfs();
DEBUG_PRINTF2 ("FS_READ sfn=%d *pLen=%u", psffsi->sfi_selfsfn, *pLen);
pOpenfile = psffsd->pOpenfile;
if (psffsi->sfi_position > psffsi->sfi_size)
*pLen = 0;
else if (*pLen > psffsi->sfi_size - psffsi->sfi_position)
*pLen = psffsi->sfi_size - psffsi->sfi_position;
VMRead (&fblkFile, pOpenfile->flatEntry + FIELDOFFSET(DIRENTRY,fblkFile), sizeof(FBLOCK));
#ifdef DEBUG
if (fblkFile.fSize != psffsi->sfi_size)
{
debugging = TRUE;
DEBUG_PRINTF2 ("\r\n!!! fblkFile.fSize = %lu, sfi_size = %lu\r\n",
fblkFile.fSize, psffsi->sfi_size);
INT3;
}
#endif
read_fblocks(pData, &fblkFile, psffsi->sfi_position, *pLen);
psffsi->sfi_position += *pLen;
psffsi->sfi_tstamp |= (ST_SREAD | ST_PREAD);
rc = NO_ERROR;
DEBUG_PRINTF1 (" => %d\r\n", rc);
UtilExitRamfs();
return rc;
}