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