#define BUF_SIZE 2048GfsHn gfs; /* file handle */ Sint32 fid; /* File identifier */ Sint32 nsct = 1; /* Number of read sectors */ Uint32 buf[BUF_SIZE/4]; /* Reading area */ gfs = GFS_Open(fid); /* File open */ GFS_Fread(gfs, nsct, buf, BUF_SIZE); /* Read nsct sector into buf */ GFS_Close(gfs); /* Close file */
#define BUF_SIZE 2048*2 GfsHn gfs; /* file handle */ Sint32 nsct = 2; /* Number of read sectors */ Sint32 stat; /* Server status */ Uint32 buf[BUF_SIZE/4]; /* Reading area */ gfs = GFS_Open(fid); /* File open */ /* Request function */ GFS_NwFread(gfs, nsct, buf, BUF_SIZE); /* Read nsct sector into buf */ /* Return immediately */ for (;;) { /* Server function */ stat = GFS_NwExecOne(gfs); /* Execute reading */ if (stat == GFS_SVR_COMPLETED) { /* Is loading complete? */ break; } user(); /* Any user processing */ }GFS_Close(gfs); /* Close file */
/* Number of sectors read from each file */ #define NSCT1 1 #define NSCT2 2 #define NSCT3 3 /* Size of data storage area for each file (unit: bytes) */ #define BSIZE1 2048*NSCT1 #define BSIZE2 2048*NSCT2 #define BSIZE3 2048*NSCT3Sint32 fid1, fid2, fid3; /* File identifier for each file */ GfsHn gfs1, gfs2, gfs3; /* File handle for each file */ Uint32 buf1[BSIZE1/4]; /* Data storage area for each file */ Uint32 buf2[BSIZE2/4]; Uint32 buf3[BSIZE3/4]; GfsHn now_gfs; /* File handle being accessed */ Sint32 stat; /* Server status */ gfs1 = GFS_Open(fid1); /* File open */ gfs2 = GFS_Open(fid2); gfs3 = GFS_Open(fid3); GFS_NwFread(gfs1, NSCT1, buf1, BSIZE1); /* Start read operation */ GFS_NwFread(gfs2, NSCT2, buf2, BSIZE2); GFS_NwFread(gfs3, NSCT3, buf3, BSIZE3); for (;;) { stat = GFS_NwExecServer(&now_gfs); /* Execute reading */ if (stat == GFS_SVR_COMPLETED) { /* No work to do? */ break; } user(); /* Any user processing */ } GFS_Close(gfs1); GFS_Close(gfs2); GFS_Close(gfs3);
#define SECT_SIZE 2048 #define FILE_SECT 1000 #define FILE_SIZE (FILE_SECT*SECT_SIZE) #define RD_UNIT 10 Uint8 *rd_bp, *proc_bp; /* Read buffer and processing buffer */ Uint32 buf1[RD_UNIT*SECT_SIZE/4]; /* Data storage area 1 */ Uint32 buf2[RD_UNIT*SECT_SIZE/4]; /* Data storage area 2 */ GfsHn gfs; Sint32 i, stat, nbyte;gfs = GFS_Open(fid); GFS_NwCdRead(gfs, FILE_SECT); /* Pre-read instruction to CD buffer */ GFS_SetTransPara(gfs, RD_UNIT); /* Extract maximum RD_UNIT sectors at once */ for (i = 0; i< FILE_SECT / RD_UNIT; ++i) { /* Read and process buffer settings */ if (i & 1) { rd_bp = buf1; proc_bp = buf2; } else { rd_bp = buf2; proc_bp = buf1; } /* Execute extraction from CD buffer */ GFS_NwFread(gfs, RD_UNIT, rd_bp, RD_UNIT * SECT_SIZE); do { if (i & 0) { user_process(proc_bp); /* Processing the read data */ } else { user_process0(); /* Processing before data is read */ } GFS_NwExecOne(gfs); GFS_NwGetStat(gfs, &stat, &nbyte); }while (nbyte< RD_UNIT * SECT_SIZE); }