xref: /onnv-gate/usr/src/lib/libparted/common/libparted/fs/fat/count.h (revision 9663:ace9a2ac3683)
1 /*
2     libparted
3     Copyright (C) 1999, 2000, 2007 Free Software Foundation, Inc.
4 
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 3 of the License, or
8     (at your option) any later version.
9 
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU General Public License
16     along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef COUNT_H_INCLUDED
20 #define COUNT_H_INCLUDED
21 
22 typedef enum _FatClusterFlag FatClusterFlag;
23 typedef struct _FatClusterInfo FatClusterInfo;
24 
25 enum _FatClusterFlag {
26 	FAT_FLAG_FREE=0,
27 	FAT_FLAG_FILE=1,
28 	FAT_FLAG_DIRECTORY=2,
29 	FAT_FLAG_BAD=3
30 };
31 
32 #ifdef __sun
33 #define __attribute__(X)	/*nothing*/
34 #endif /* __sun */
35 
36 #ifdef __sun
37 #pragma pack(1)
38 #endif
39 struct __attribute__ ((packed)) _FatClusterInfo {
40 	unsigned int    units_used:6;   /* 1 unit = cluster_size / 64 */
41 	FatClusterFlag  flag:2;
42 } fat16;
43 #ifdef __sun
44 #pragma pack()
45 #endif
46 
47 extern int fat_collect_cluster_info (PedFileSystem *fs);
48 extern FatClusterFlag fat_get_cluster_flag (PedFileSystem* fs,
49 					    FatCluster cluster);
50 extern PedSector fat_get_cluster_usage (PedFileSystem* fs, FatCluster cluster);
51 extern FatClusterFlag fat_get_fragment_flag (PedFileSystem* fs,
52 					     FatFragment frag);
53 extern int fat_is_fragment_active (PedFileSystem* fs, FatFragment frag);
54 
55 #endif /* COUNT_H_INCLUDED */
56