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