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