xref: /haiku/src/add-ons/kernel/file_systems/fat/vcache.h (revision 342a1b221b5bb385410f758df2c625b70cafdd03)
1 /*
2  * Copyright 1999-2001, Be Incorporated.   All Rights Reserved.
3  * Copyright 2024, Haiku, Inc. All rights reserved.
4  * This file may be used under the terms of the Be Sample Code License.
5 */
6 #ifndef _DOSFS_VCACHE_H_
7 #define _DOSFS_VCACHE_H_
8 
9 
10 #include <sys/mount.h>
11 
12 #include "dosfs.h"
13 
14 
15 void dump_vcache(const mount* vol);
16 
17 status_t init_vcache(mount* vol);
18 status_t uninit_vcache(mount* vol);
19 
20 ino_t generate_unique_vnid(mount *vol);
21 
22 status_t add_to_vcache(mount* vol, ino_t vnid, ino_t loc);
23 status_t remove_from_vcache(mount* vol, ino_t vnid);
24 status_t vcache_vnid_to_loc(mount* vol, ino_t vnid, ino_t* loc);
25 status_t vcache_loc_to_vnid(mount* vol, ino_t loc, ino_t* vnid);
26 
27 status_t vcache_set_entry(mount* vol, ino_t vnid, ino_t loc);
28 status_t vcache_set_constructed(mount* vol, ino_t vnid, bool constructed = true);
29 status_t vcache_get_constructed(mount* vol, ino_t vnid, bool* constructed);
30 
31 status_t sync_all_files(mount* vol);
32 
33 
34 #define find_vnid_in_vcache(vol,vnid) vcache_vnid_to_loc(vol,vnid,NULL)
35 #define find_loc_in_vcache(vol,loc) vcache_loc_to_vnid(vol,loc,NULL)
36 
37 #if DEBUG
38 	status_t vcache_set_node(mount* vol, ino_t vnid, struct vnode* node);
39 	status_t vcache_get_node(mount* vol, ino_t vnid, struct vnode** node);
40 
41 	int debug_dfvnid(int argc, char **argv);
42 	int debug_dfloc(int argc, char **argv);
43 #endif
44 
45 
46 #endif // _DOSFS_VCACHE_H
47