io.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* io.h - Virtual disk input/output */
  2. /* Written 1993 by Werner Almesberger */
  3. /* FAT32, VFAT, Atari format support, and various fixes additions May 1998
  4. * by Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> */
  5. #ifndef _IO_H
  6. #define _IO_H
  7. #include <sys/types.h> /* for loff_t */
  8. /* In earlier versions, an own llseek() was used, but glibc lseek() is
  9. * sufficient (or even better :) for 64 bit offsets in the meantime */
  10. #define llseek lseek
  11. void fs_open(char *path,int rw);
  12. /* Opens the file system PATH. If RW is zero, the file system is opened
  13. read-only, otherwise, it is opened read-write. */
  14. void fs_read(loff_t pos,int size,void *data);
  15. /* Reads SIZE bytes starting at POS into DATA. Performs all applicable
  16. changes. */
  17. int fs_test(loff_t pos,int size);
  18. /* Returns a non-zero integer if SIZE bytes starting at POS can be read without
  19. errors. Otherwise, it returns zero. */
  20. void fs_write(loff_t pos,int size,void *data);
  21. /* If write_immed is non-zero, SIZE bytes are written from DATA to the disk,
  22. starting at POS. If write_immed is zero, the change is added to a list in
  23. memory. */
  24. int fs_close(int write);
  25. /* Closes the file system, performs all pending changes if WRITE is non-zero
  26. and removes the list of changes. Returns a non-zero integer if the file
  27. system has been changed since the last fs_open, zero otherwise. */
  28. int fs_changed(void);
  29. /* Determines whether the file system has changed. See fs_close. */
  30. extern unsigned device_no;
  31. /* Major number of device (0 if file) and size (in 512 byte sectors) */
  32. #endif