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_ 7 8 9#include "dosfs.h" 10 11 12#define vIS_DATA_CLUSTER(vol,cluster) (((cluster) >= 2) && ((uint32)(cluster) < vol->total_clusters + 2)) 13#define IS_DATA_CLUSTER(cluster) vIS_DATA_CLUSTER(vol,cluster) 14 15// cluster 1 represents root directory for fat12 and fat16 16#define IS_FIXED_ROOT(cluster) ((cluster) == 1) 17 18int32 count_free_clusters(nspace *vol); 19int32 get_nth_fat_entry(nspace *vol, int32 cluster, uint32 n); 20uint32 count_clusters(nspace *vol, int32 cluster); 21 22/* remember to update vnode iteration after calling this function */ 23status_t clear_fat_chain(nspace *vol, uint32 cluster, 24 bool discardBlockCache); 25 26/* remember to set end of chain field when merging into a vnode */ 27status_t allocate_n_fat_entries(nspace *vol, int32 n, int32 *start); 28 29/* remember to update vnode iteration after calling this function */ 30status_t set_fat_chain_length(nspace *vol, vnode *node, uint32 clusters, 31 bool discardBlockCache); 32 33void dump_fat_chain(nspace *vol, uint32 cluster); 34 35status_t fragment(nspace *vol, uint32 *pattern); 36 37#endif 38