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