vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / kernel / file_systems / fat / fat.h
blobedbcb70785f0639f3abd49ae3092c1c875929057
1 /*
2 Copyright 1999-2001, Be Incorporated. All Rights Reserved.
3 This file may be used under the terms of the Be Sample Code License.
4 */
5 #ifndef _DOSFS_FAT_H_
6 #define _DOSFS_FAT_H_
9 #include "dosfs.h"
12 #define vIS_DATA_CLUSTER(vol,cluster) (((cluster) >= 2) && ((cluster) < vol->total_clusters + 2))
13 #define IS_DATA_CLUSTER(cluster) vIS_DATA_CLUSTER(vol,cluster)
15 // cluster 1 represents root directory for fat12 and fat16
16 #define IS_FIXED_ROOT(cluster) ((cluster) == 1)
18 int32 count_free_clusters(nspace *vol);
19 int32 get_nth_fat_entry(nspace *vol, int32 cluster, uint32 n);
20 uint32 count_clusters(nspace *vol, int32 cluster);
22 /* remember to update vnode iteration after calling this function */
23 status_t clear_fat_chain(nspace *vol, uint32 cluster,
24 bool discardBlockCache);
26 /* remember to set end of chain field when merging into a vnode */
27 status_t allocate_n_fat_entries(nspace *vol, int32 n, int32 *start);
29 /* remember to update vnode iteration after calling this function */
30 status_t set_fat_chain_length(nspace *vol, vnode *node, uint32 clusters,
31 bool discardBlockCache);
33 void dump_fat_chain(nspace *vol, uint32 cluster);
35 status_t fragment(nspace *vol, uint32 *pattern);
37 #endif