home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_11 / 2n11025a < prev    next >
Text File  |  1991-09-13  |  1KB  |  50 lines

  1. /*
  2.  *  LISTING 4
  3.  *
  4.  *  bfile.h
  5.  *  Header for block-based file i/o interface routines
  6.  *
  7.  *  Source code Copyright (c) 1991 T.W. Nelson. May be
  8.  *  used only for non-commercial purposes with
  9.  *  appropriate acknowledgement of copyright.
  10.  */
  11.  
  12. #ifndef __BFILE_H
  13. #define __BFILE_H
  14.  
  15. #ifndef __BCACHE_H
  16. #include "bcache.h"
  17. #endif
  18.  
  19. #define MAXPATHNAME 80
  20.  
  21. //descriptor object for a block-cached file ...
  22. typedef struct {
  23.     char fname[MAXPATHNAME]; //path, file name
  24.     int     fd;     //DOS file descriptor
  25.     size_t  mode;   //mode and/or status flags
  26.     BCACHE  cac;    //cache descriptor
  27.     } BFILE;
  28.  
  29. //values for 'mode' field in BFILE object .......
  30. #define IS_OPEN       0x0001  //open_b() successful
  31. #define WRITE_THRU    0x0002  //write-thru strategy
  32.  
  33. //prototypes ..........
  34. BFILE *open_b( const char *path, int bmax,
  35.                                 int bsize, int mode );
  36. int read_b ( BFILE *ff, void *buf, ulong blockno );
  37. int write_b( BFILE *ff, void *buf, ulong blockno );
  38. int close_b( BFILE *ff );
  39.  
  40. //prototypes from emm module (emm.c) ....
  41. void emm_setflag( int flag );
  42. void emm_map_pages( BCACHE *cp );
  43. void emm_unmap_pages( BCACHE *cp );
  44. int emm_allocate( BCACHE *cp, int flag );
  45. int emm_check( void );
  46.  
  47. #endif   //__BFILE_H
  48.  
  49. /* ---- End of File -------------------------------- */
  50.