xref: /onnv-gate/usr/src/lib/libparted/common/libparted/fs/fat/context.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 PED_FAT_CONTEXT_H_INCLUDED
20 #define PED_FAT_CONTEXT_H_INCLUDED
21 
22 #include "count.h"
23 
24 enum _FatDirection {
25 	FAT_DIR_FORWARD,
26 	FAT_DIR_BACKWARD
27 };
28 typedef enum _FatDirection FatDirection;
29 
30 struct _FatOpContext {
31 	PedFileSystem*		old_fs;
32 	PedFileSystem*		new_fs;
33 
34 	PedSector		frag_sectors;	/* should equal old_fs and
35 						   new_fs's frag_sectors */
36 
37 	FatDirection		start_move_dir;
38 	FatFragment		start_move_delta;
39 
40 	FatFragment		buffer_offset;
41 	FatFragment		buffer_frags;
42 	FatFragment*		buffer_map;
43 
44 	FatFragment		frags_duped;
45 
46 	FatFragment*		remap;
47 
48 	FatCluster		new_root_dir [32];
49 };
50 typedef struct _FatOpContext FatOpContext;
51 
52 extern FatOpContext* fat_op_context_new (PedFileSystem* new_fs,
53 					 PedFileSystem* old_fs);
54 
55 extern void fat_op_context_destroy (FatOpContext* ctx);
56 
57 extern FatFragment fat_op_context_map_static_fragment (const FatOpContext* ctx,
58 						       FatFragment frag);
59 extern FatCluster fat_op_context_map_static_cluster (const FatOpContext* ctx,
60 						     FatCluster clst);
61 
62 extern FatFragment fat_op_context_map_fragment (const FatOpContext* ctx,
63 					        FatFragment frag);
64 extern FatCluster fat_op_context_map_cluster (const FatOpContext* ctx,
65 					      FatCluster clst);
66 
67 extern int fat_op_context_create_initial_fat (FatOpContext* ctx);
68 
69 #endif /* PED_FAT_CONTEXT_H_INCLUDED */
70