io.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* io.h - Virtual disk input/output
  2. Copyright (C) 1993 Werner Almesberger <werner.almesberger@lrc.di.epfl.ch>
  3. Copyright (C) 1998 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
  4. Copyright (C) 2008-2013 Daniel Baumann <mail@daniel-baumann.ch>
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. On Debian systems, the complete text of the GNU General Public License
  16. can be found in /usr/share/common-licenses/GPL-3 file.
  17. */
  18. /* FAT32, VFAT, Atari format support, and various fixes additions May 1998
  19. * by Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> */
  20. #ifndef _IO_H
  21. #define _IO_H
  22. #include <sys/types.h> /* for loff_t */
  23. loff_t llseek(int fd, loff_t offset, int whence);
  24. /* lseek() analogue for large offsets. */
  25. void fs_open(char *path, int rw);
  26. /* Opens the file system PATH. If RW is zero, the file system is opened
  27. read-only, otherwise, it is opened read-write. */
  28. void fs_read(loff_t pos, int size, void *data);
  29. /* Reads SIZE bytes starting at POS into DATA. Performs all applicable
  30. changes. */
  31. int fs_test(loff_t pos, int size);
  32. /* Returns a non-zero integer if SIZE bytes starting at POS can be read without
  33. errors. Otherwise, it returns zero. */
  34. void fs_write(loff_t pos, int size, void *data);
  35. /* If write_immed is non-zero, SIZE bytes are written from DATA to the disk,
  36. starting at POS. If write_immed is zero, the change is added to a list in
  37. memory. */
  38. int fs_close(int write);
  39. /* Closes the file system, performs all pending changes if WRITE is non-zero
  40. and removes the list of changes. Returns a non-zero integer if the file
  41. system has been changed since the last fs_open, zero otherwise. */
  42. int fs_changed(void);
  43. /* Determines whether the file system has changed. See fs_close. */
  44. extern unsigned device_no;
  45. /* Major number of device (0 if file) and size (in 512 byte sectors) */
  46. #endif