Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. #ifndef __EMULAYER_FS_H
  2. #define __EMULAYER_FS_H
  3.  
  4. #include<sys/stat.h>
  5. #include<fcntl.h>
  6.  
  7. #define MAX_EMUFS_HANDLES               64
  8.  
  9. typedef struct __emu_FILE       emu_FILE;
  10.  
  11. typedef struct {
  12.     int (* read)(emu_FILE * filp,unsigned long size,char * buf);
  13.     int (* write)(emu_FILE * filp,unsigned long size,char * buf);
  14.     int (* seek)(emu_FILE * filp,int offset,int whence);
  15.     int (* open)(emu_FILE * filp);
  16.     int (* close)(emu_FILE * filp);
  17.     int (* stat)(emu_FILE * filp,struct stat * statp);
  18.     int (* sync)(emu_FILE * filp);
  19. } emu_FILE_operations_t;
  20.  
  21. struct __emu_FILE
  22. {
  23.  int            f_handle;
  24.  char *         f_path;
  25.  unsigned long  f_pos;
  26.  unsigned long  f_size;
  27.  int            f_flags;
  28.  int            f_mode;
  29.  emu_FILE_operations_t * f_op;
  30.  void *         f_priv;
  31. };
  32.  
  33. struct __emu_VMOUNT
  34. {
  35.  char * mpnt;
  36.  int (* preopen_file)(emu_FILE * filp);
  37.  struct __emu_VMOUNT * m_next;
  38. };
  39.  
  40. void init_emufs(void);
  41. struct __emu_VMOUNT * EMU_find_best_mount(char * fpath);
  42. extern emu_FILE * EMU_file_table[MAX_EMUFS_HANDLES];
  43. emu_FILE * EMU_get_empty_filp(char * forpath);
  44. void EMU_put_filp(int h);
  45. int EMU_open(const char * fname,int mode);
  46. int EMU_close(int handle);
  47. int EMU_read(int handle,char * buf,int count);
  48. int EMU_write(int handle,char * buf,int count);
  49. int EMU_lseek(int handle,int off,int whence);
  50. int EMU_fstat(int handle, struct stat *statbuf);
  51. int EMU_filelength(int fp);
  52. int EMU_flush(int fp);
  53.  
  54. #endif
  55.