1 /**** 2 ** Platform-dependent file 3 ****/ 4 5 /* io.h - Virtual disk input/output 6 7 Copyright (C) 1993 Werner Almesberger <werner.almesberger@lrc.di.epfl.ch> 8 Copyright (C) 1998 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> 9 Copyright (C) 2008-2014 Daniel Baumann <mail@daniel-baumann.ch> 10 11 This program is free software: you can redistribute it and/or modify 12 it under the terms of the GNU General Public License as published by 13 the Free Software Foundation, either version 3 of the License, or 14 (at your option) any later version. 15 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program. If not, see <http://www.gnu.org/licenses/>. 23 24 The complete text of the GNU General Public License 25 can be found in /usr/share/common-licenses/GPL-3 file. 26 */ 27 28 /* FAT32, VFAT, Atari format support, and various fixes additions May 1998 29 * by Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> */ 30 31 #ifndef _IO_H 32 #define _IO_H 33 34 //#include <sys/types.h> /* for loff_t */ 35 // #include <fcntl.h> /* for off_t */ 36 37 NTSTATUS fs_open(PUNICODE_STRING DriveRoot, int read_write); 38 39 /* Opens the file system PATH. If RW is zero, the file system is opened 40 read-only, otherwise, it is opened read-write. */ 41 42 BOOLEAN fs_isdirty(void); 43 44 /* Checks if filesystem is dirty */ 45 46 void fs_read(off_t pos, int size, void *data); 47 48 /* Reads SIZE bytes starting at POS into DATA. Performs all applicable 49 changes. */ 50 51 int fs_test(off_t pos, int size); 52 53 /* Returns a non-zero integer if SIZE bytes starting at POS can be read without 54 errors. Otherwise, it returns zero. */ 55 56 void fs_write(off_t pos, int size, void *data); 57 58 /* If write_immed is non-zero, SIZE bytes are written from DATA to the disk, 59 starting at POS. If write_immed is zero, the change is added to a list in 60 memory. */ 61 62 int fs_close(int write); 63 64 /* Closes the filesystem, performs all pending changes if WRITE is non-zero 65 and removes the list of changes. Returns a non-zero integer if the file 66 system has been changed since the last fs_open, zero otherwise. */ 67 68 int fs_changed(void); 69 70 /* Determines whether the filesystem has changed. See fs_close. */ 71 72 NTSTATUS fs_lock(BOOLEAN LockVolume); 73 74 /* Lock or unlocks the volume */ 75 76 void fs_dismount(void); 77 78 /* Dismounts the volume */ 79 80 #endif 81