xref: /onnv-gate/usr/src/lib/libparted/common/include/parted/filesys.h (revision 9663:ace9a2ac3683)
1*9663SMark.Logan@Sun.COM /*
2*9663SMark.Logan@Sun.COM     libparted - a library for manipulating disk partitions
3*9663SMark.Logan@Sun.COM     Copyright (C) 1999, 2000, 2001, 2006, 2007 Free Software Foundation, Inc.
4*9663SMark.Logan@Sun.COM 
5*9663SMark.Logan@Sun.COM     This program is free software; you can redistribute it and/or modify
6*9663SMark.Logan@Sun.COM     it under the terms of the GNU General Public License as published by
7*9663SMark.Logan@Sun.COM     the Free Software Foundation; either version 3 of the License, or
8*9663SMark.Logan@Sun.COM     (at your option) any later version.
9*9663SMark.Logan@Sun.COM 
10*9663SMark.Logan@Sun.COM     This program is distributed in the hope that it will be useful,
11*9663SMark.Logan@Sun.COM     but WITHOUT ANY WARRANTY; without even the implied warranty of
12*9663SMark.Logan@Sun.COM     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*9663SMark.Logan@Sun.COM     GNU General Public License for more details.
14*9663SMark.Logan@Sun.COM 
15*9663SMark.Logan@Sun.COM     You should have received a copy of the GNU General Public License
16*9663SMark.Logan@Sun.COM     along with this program.  If not, see <http://www.gnu.org/licenses/>.
17*9663SMark.Logan@Sun.COM */
18*9663SMark.Logan@Sun.COM 
19*9663SMark.Logan@Sun.COM /**
20*9663SMark.Logan@Sun.COM  * \addtogroup PedFileSystem
21*9663SMark.Logan@Sun.COM  * @{
22*9663SMark.Logan@Sun.COM  */
23*9663SMark.Logan@Sun.COM 
24*9663SMark.Logan@Sun.COM /** \file filesys.h */
25*9663SMark.Logan@Sun.COM 
26*9663SMark.Logan@Sun.COM #ifndef PED_FILESYS_H_INCLUDED
27*9663SMark.Logan@Sun.COM #define PED_FILESYS_H_INCLUDED
28*9663SMark.Logan@Sun.COM 
29*9663SMark.Logan@Sun.COM typedef struct _PedFileSystem		PedFileSystem;
30*9663SMark.Logan@Sun.COM typedef struct _PedFileSystemType	PedFileSystemType;
31*9663SMark.Logan@Sun.COM typedef const struct _PedFileSystemOps	PedFileSystemOps;
32*9663SMark.Logan@Sun.COM 
33*9663SMark.Logan@Sun.COM #include <parted/geom.h>
34*9663SMark.Logan@Sun.COM #include <parted/disk.h>
35*9663SMark.Logan@Sun.COM #include <parted/exception.h>
36*9663SMark.Logan@Sun.COM #include <parted/constraint.h>
37*9663SMark.Logan@Sun.COM #include <parted/timer.h>
38*9663SMark.Logan@Sun.COM #include <stdio.h>
39*9663SMark.Logan@Sun.COM 
40*9663SMark.Logan@Sun.COM struct _PedFileSystemOps {
41*9663SMark.Logan@Sun.COM 	PedGeometry* (*probe) (PedGeometry* geom);
42*9663SMark.Logan@Sun.COM 	int (*clobber) (PedGeometry* geom);
43*9663SMark.Logan@Sun.COM 
44*9663SMark.Logan@Sun.COM 	PedFileSystem* (*open) (PedGeometry* geom);
45*9663SMark.Logan@Sun.COM 	PedFileSystem* (*create) (PedGeometry* geom, PedTimer* timer);
46*9663SMark.Logan@Sun.COM 	int (*close) (PedFileSystem* fs);
47*9663SMark.Logan@Sun.COM 	int (*check) (PedFileSystem* fs, PedTimer* timer);
48*9663SMark.Logan@Sun.COM 	PedFileSystem* (*copy) (const PedFileSystem* fs, PedGeometry* geom,
49*9663SMark.Logan@Sun.COM 				PedTimer* timer);
50*9663SMark.Logan@Sun.COM 	int (*resize) (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer);
51*9663SMark.Logan@Sun.COM 
52*9663SMark.Logan@Sun.COM 	PedConstraint* (*get_create_constraint) (const PedDevice* dev);
53*9663SMark.Logan@Sun.COM 	PedConstraint* (*get_resize_constraint) (const PedFileSystem* fs);
54*9663SMark.Logan@Sun.COM 	PedConstraint* (*get_copy_constraint) (const PedFileSystem* fs,
55*9663SMark.Logan@Sun.COM 		       			       const PedDevice* dev);
56*9663SMark.Logan@Sun.COM };
57*9663SMark.Logan@Sun.COM 
58*9663SMark.Logan@Sun.COM /**
59*9663SMark.Logan@Sun.COM  * Structure describing type of file system
60*9663SMark.Logan@Sun.COM  */
61*9663SMark.Logan@Sun.COM struct _PedFileSystemType {
62*9663SMark.Logan@Sun.COM 	PedFileSystemType*	next;
63*9663SMark.Logan@Sun.COM 	const char* const	name;		/**< name of the file system type */
64*9663SMark.Logan@Sun.COM         const int*              block_sizes;
65*9663SMark.Logan@Sun.COM 	PedFileSystemOps* const	ops;
66*9663SMark.Logan@Sun.COM };
67*9663SMark.Logan@Sun.COM 
68*9663SMark.Logan@Sun.COM 
69*9663SMark.Logan@Sun.COM /**
70*9663SMark.Logan@Sun.COM  * Structure describing file system
71*9663SMark.Logan@Sun.COM  */
72*9663SMark.Logan@Sun.COM struct _PedFileSystem {
73*9663SMark.Logan@Sun.COM 	PedFileSystemType*	type;		/**< the file system type */
74*9663SMark.Logan@Sun.COM 	PedGeometry*		geom;		/**< where the file system actually is */
75*9663SMark.Logan@Sun.COM 	int			checked;	/**< 1 if the file system has been checked.
76*9663SMark.Logan@Sun.COM 						      0 otherwise. */
77*9663SMark.Logan@Sun.COM 
78*9663SMark.Logan@Sun.COM 	void*			type_specific;
79*9663SMark.Logan@Sun.COM 
80*9663SMark.Logan@Sun.COM };
81*9663SMark.Logan@Sun.COM 
82*9663SMark.Logan@Sun.COM extern void ped_file_system_type_register (PedFileSystemType* type);
83*9663SMark.Logan@Sun.COM extern void ped_file_system_type_unregister (PedFileSystemType* type);
84*9663SMark.Logan@Sun.COM 
85*9663SMark.Logan@Sun.COM extern PedFileSystemType* ped_file_system_type_get (const char* name);
86*9663SMark.Logan@Sun.COM extern PedFileSystemType*
87*9663SMark.Logan@Sun.COM ped_file_system_type_get_next (const PedFileSystemType* fs_type);
88*9663SMark.Logan@Sun.COM 
89*9663SMark.Logan@Sun.COM extern PedFileSystemType* ped_file_system_probe (PedGeometry* geom);
90*9663SMark.Logan@Sun.COM extern PedGeometry* ped_file_system_probe_specific (
91*9663SMark.Logan@Sun.COM 			const PedFileSystemType* fs_type,
92*9663SMark.Logan@Sun.COM 			PedGeometry* geom);
93*9663SMark.Logan@Sun.COM extern int ped_file_system_clobber (PedGeometry* geom);
94*9663SMark.Logan@Sun.COM 
95*9663SMark.Logan@Sun.COM extern PedFileSystem* ped_file_system_open (PedGeometry* geom);
96*9663SMark.Logan@Sun.COM extern PedFileSystem* ped_file_system_create (PedGeometry* geom,
97*9663SMark.Logan@Sun.COM 					      const PedFileSystemType* type,
98*9663SMark.Logan@Sun.COM 					      PedTimer* timer);
99*9663SMark.Logan@Sun.COM extern int ped_file_system_close (PedFileSystem* fs);
100*9663SMark.Logan@Sun.COM extern int ped_file_system_check (PedFileSystem* fs, PedTimer* timer);
101*9663SMark.Logan@Sun.COM extern PedFileSystem* ped_file_system_copy (PedFileSystem* fs,
102*9663SMark.Logan@Sun.COM 					    PedGeometry* geom,
103*9663SMark.Logan@Sun.COM 					    PedTimer* timer);
104*9663SMark.Logan@Sun.COM extern int ped_file_system_resize (PedFileSystem* fs, PedGeometry* geom,
105*9663SMark.Logan@Sun.COM 				   PedTimer* timer);
106*9663SMark.Logan@Sun.COM 
107*9663SMark.Logan@Sun.COM extern PedConstraint* ped_file_system_get_create_constraint (
108*9663SMark.Logan@Sun.COM 		const PedFileSystemType* fs_type, const PedDevice* dev);
109*9663SMark.Logan@Sun.COM extern PedConstraint* ped_file_system_get_resize_constraint (
110*9663SMark.Logan@Sun.COM 		const PedFileSystem* fs);
111*9663SMark.Logan@Sun.COM extern PedConstraint* ped_file_system_get_copy_constraint (
112*9663SMark.Logan@Sun.COM 		const PedFileSystem* fs, const PedDevice* dev);
113*9663SMark.Logan@Sun.COM 
114*9663SMark.Logan@Sun.COM #endif /* PED_FILESYS_H_INCLUDED */
115*9663SMark.Logan@Sun.COM 
116*9663SMark.Logan@Sun.COM /** @} */
117