xref: /aosp_15_r20/external/e2fsprogs/doc/libext2fs.texinfo (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1*6a54128fSAndroid Build Coastguard Worker\input texinfo    @c -*-texinfo-*-
2*6a54128fSAndroid Build Coastguard Worker@c %**start of header
3*6a54128fSAndroid Build Coastguard Worker@setfilename libext2fs.info
4*6a54128fSAndroid Build Coastguard Worker@settitle The EXT2FS Library (version 1.46.6)
5*6a54128fSAndroid Build Coastguard Worker@synindex tp fn
6*6a54128fSAndroid Build Coastguard Worker@comment %**end of header
7*6a54128fSAndroid Build Coastguard Worker
8*6a54128fSAndroid Build Coastguard Worker@ifinfo
9*6a54128fSAndroid Build Coastguard Worker@dircategory Development
10*6a54128fSAndroid Build Coastguard Worker@direntry
11*6a54128fSAndroid Build Coastguard Worker* libext2fs: (libext2fs).                  The EXT2FS library.
12*6a54128fSAndroid Build Coastguard Worker@end direntry
13*6a54128fSAndroid Build Coastguard Worker@end ifinfo
14*6a54128fSAndroid Build Coastguard Worker
15*6a54128fSAndroid Build Coastguard Worker@c smallbook
16*6a54128fSAndroid Build Coastguard Worker
17*6a54128fSAndroid Build Coastguard Worker@iftex
18*6a54128fSAndroid Build Coastguard Worker@finalout
19*6a54128fSAndroid Build Coastguard Worker@end iftex
20*6a54128fSAndroid Build Coastguard Worker
21*6a54128fSAndroid Build Coastguard Worker@c Note: the edition number is listed in *three* places; please update
22*6a54128fSAndroid Build Coastguard Worker@c all three.  Also, update the month and year where appropriate.
23*6a54128fSAndroid Build Coastguard Worker
24*6a54128fSAndroid Build Coastguard Worker@c ==> Update edition number for settitle and subtitle, and in the
25*6a54128fSAndroid Build Coastguard Worker@c ==> following paragraph; update date, too.
26*6a54128fSAndroid Build Coastguard Worker
27*6a54128fSAndroid Build Coastguard Worker
28*6a54128fSAndroid Build Coastguard Worker@ifinfo
29*6a54128fSAndroid Build Coastguard WorkerThis file documents the ext2fs library, a library for manipulating the
30*6a54128fSAndroid Build Coastguard Workerext2 filesystem.
31*6a54128fSAndroid Build Coastguard Worker
32*6a54128fSAndroid Build Coastguard WorkerCopyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
33*6a54128fSAndroid Build Coastguard Worker2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 by Theodore Ts'o
34*6a54128fSAndroid Build Coastguard Worker
35*6a54128fSAndroid Build Coastguard WorkerPermission is granted to make and distribute verbatim copies of
36*6a54128fSAndroid Build Coastguard Workerthis manual provided the copyright notice and this permission notice
37*6a54128fSAndroid Build Coastguard Workerare preserved on all copies.
38*6a54128fSAndroid Build Coastguard Worker
39*6a54128fSAndroid Build Coastguard Worker@ignore
40*6a54128fSAndroid Build Coastguard WorkerPermission is granted to process this file through TeX and print the
41*6a54128fSAndroid Build Coastguard Workerresults, provided the printed document carries copying permission
42*6a54128fSAndroid Build Coastguard Workernotice identical to this one except for the removal of this paragraph
43*6a54128fSAndroid Build Coastguard Worker(this paragraph not being relevant to the printed manual).
44*6a54128fSAndroid Build Coastguard Worker
45*6a54128fSAndroid Build Coastguard Worker@end ignore
46*6a54128fSAndroid Build Coastguard WorkerPermission is granted to copy and distribute modified versions of this
47*6a54128fSAndroid Build Coastguard Workermanual under the conditions for verbatim copying, provided that the entire
48*6a54128fSAndroid Build Coastguard Workerresulting derived work is distributed under the terms of a permission
49*6a54128fSAndroid Build Coastguard Workernotice identical to this one.
50*6a54128fSAndroid Build Coastguard Worker
51*6a54128fSAndroid Build Coastguard WorkerPermission is granted to copy and distribute translations of this manual
52*6a54128fSAndroid Build Coastguard Workerinto another language, under the above conditions for modified versions,
53*6a54128fSAndroid Build Coastguard Workerexcept that this permission notice may be stated in a translation approved
54*6a54128fSAndroid Build Coastguard Workerby the author.
55*6a54128fSAndroid Build Coastguard Worker@end ifinfo
56*6a54128fSAndroid Build Coastguard Worker
57*6a54128fSAndroid Build Coastguard Worker@setchapternewpage on
58*6a54128fSAndroid Build Coastguard Worker@titlepage
59*6a54128fSAndroid Build Coastguard Worker@c  use the new format for titles
60*6a54128fSAndroid Build Coastguard Worker
61*6a54128fSAndroid Build Coastguard Worker@title The EXT2FS Library
62*6a54128fSAndroid Build Coastguard Worker@subtitle The EXT2FS Library
63*6a54128fSAndroid Build Coastguard Worker@subtitle Version 1.46.6
64*6a54128fSAndroid Build Coastguard Worker@subtitle February 2023
65*6a54128fSAndroid Build Coastguard Worker
66*6a54128fSAndroid Build Coastguard Worker@author by Theodore Ts'o
67*6a54128fSAndroid Build Coastguard Worker
68*6a54128fSAndroid Build Coastguard Worker@c Include the Distribution inside the titlepage so
69*6a54128fSAndroid Build Coastguard Worker@c that headings are turned off.
70*6a54128fSAndroid Build Coastguard Worker
71*6a54128fSAndroid Build Coastguard Worker@tex
72*6a54128fSAndroid Build Coastguard Worker\global\parindent=0pt
73*6a54128fSAndroid Build Coastguard Worker\global\parskip=8pt
74*6a54128fSAndroid Build Coastguard Worker\global\baselineskip=13pt
75*6a54128fSAndroid Build Coastguard Worker@end tex
76*6a54128fSAndroid Build Coastguard Worker
77*6a54128fSAndroid Build Coastguard Worker@page
78*6a54128fSAndroid Build Coastguard Worker@vskip 0pt plus 1filll
79*6a54128fSAndroid Build Coastguard WorkerCopyright @copyright{} 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
80*6a54128fSAndroid Build Coastguard Worker2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Theodore Ts'o
81*6a54128fSAndroid Build Coastguard Worker
82*6a54128fSAndroid Build Coastguard Worker@sp 2
83*6a54128fSAndroid Build Coastguard Worker
84*6a54128fSAndroid Build Coastguard WorkerPermission is granted to make and distribute verbatim copies of
85*6a54128fSAndroid Build Coastguard Workerthis manual provided the copyright notice and this permission notice
86*6a54128fSAndroid Build Coastguard Workerare preserved on all copies.
87*6a54128fSAndroid Build Coastguard Worker
88*6a54128fSAndroid Build Coastguard WorkerPermission is granted to copy and distribute modified versions of this
89*6a54128fSAndroid Build Coastguard Workermanual under the conditions for verbatim copying, provided that the entire
90*6a54128fSAndroid Build Coastguard Workerresulting derived work is distributed under the terms of a permission
91*6a54128fSAndroid Build Coastguard Workernotice identical to this one.
92*6a54128fSAndroid Build Coastguard Worker
93*6a54128fSAndroid Build Coastguard WorkerPermission is granted to copy and distribute translations of this manual
94*6a54128fSAndroid Build Coastguard Workerinto another language, under the above conditions for modified versions,
95*6a54128fSAndroid Build Coastguard Workerexcept that this permission notice may be stated in a translation approved
96*6a54128fSAndroid Build Coastguard Workerby the Foundation.
97*6a54128fSAndroid Build Coastguard Worker@end titlepage
98*6a54128fSAndroid Build Coastguard Worker@headings double
99*6a54128fSAndroid Build Coastguard Worker
100*6a54128fSAndroid Build Coastguard Worker@node Top, Introduction to the EXT2FS Library, (dir), (dir)
101*6a54128fSAndroid Build Coastguard Worker
102*6a54128fSAndroid Build Coastguard Worker@top The EXT2FS Library
103*6a54128fSAndroid Build Coastguard Worker
104*6a54128fSAndroid Build Coastguard WorkerThis manual documents the EXT2FS Library, version 1.46.6.
105*6a54128fSAndroid Build Coastguard Worker
106*6a54128fSAndroid Build Coastguard Worker@menu
107*6a54128fSAndroid Build Coastguard Worker* Introduction to the EXT2FS Library::
108*6a54128fSAndroid Build Coastguard Worker* EXT2FS Library Functions::
109*6a54128fSAndroid Build Coastguard Worker* Concept Index::
110*6a54128fSAndroid Build Coastguard Worker* Function Index::
111*6a54128fSAndroid Build Coastguard Worker@end menu
112*6a54128fSAndroid Build Coastguard Worker
113*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
114*6a54128fSAndroid Build Coastguard Worker
115*6a54128fSAndroid Build Coastguard Worker@node Introduction to the EXT2FS Library, EXT2FS Library Functions, Top, Top
116*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
117*6a54128fSAndroid Build Coastguard Worker@chapter Introduction to the EXT2FS Library
118*6a54128fSAndroid Build Coastguard Worker
119*6a54128fSAndroid Build Coastguard WorkerThe EXT2FS library is designed to allow user-level programs to
120*6a54128fSAndroid Build Coastguard Workermanipulate an ext2 filesystem.
121*6a54128fSAndroid Build Coastguard Worker
122*6a54128fSAndroid Build Coastguard Worker@node EXT2FS Library Functions, Concept Index, Introduction to the EXT2FS Library, Top
123*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
124*6a54128fSAndroid Build Coastguard Worker@chapter EXT2FS Library Functions
125*6a54128fSAndroid Build Coastguard Worker
126*6a54128fSAndroid Build Coastguard Worker@menu
127*6a54128fSAndroid Build Coastguard Worker* Filesystem-level functions::
128*6a54128fSAndroid Build Coastguard Worker* File I/O Functions::
129*6a54128fSAndroid Build Coastguard Worker* Inode Functions::
130*6a54128fSAndroid Build Coastguard Worker* Directory functions::
131*6a54128fSAndroid Build Coastguard Worker* Bitmap Functions::
132*6a54128fSAndroid Build Coastguard Worker* EXT2 data abstractions::
133*6a54128fSAndroid Build Coastguard Worker* Byte-swapping functions::
134*6a54128fSAndroid Build Coastguard Worker* Other functions::
135*6a54128fSAndroid Build Coastguard Worker@end menu
136*6a54128fSAndroid Build Coastguard Worker
137*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
138*6a54128fSAndroid Build Coastguard Worker
139*6a54128fSAndroid Build Coastguard Worker@node Filesystem-level functions, File I/O Functions, EXT2FS Library Functions, EXT2FS Library Functions
140*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
141*6a54128fSAndroid Build Coastguard Worker@section Filesystem-level functions
142*6a54128fSAndroid Build Coastguard Worker
143*6a54128fSAndroid Build Coastguard WorkerThe following functions operate on a filesystem handle.  Most EXT2FS
144*6a54128fSAndroid Build Coastguard WorkerLibrary functions require a filesystem handle as their first argument.
145*6a54128fSAndroid Build Coastguard WorkerThere are two functions which create a filesystem handle,
146*6a54128fSAndroid Build Coastguard Worker@code{ext2fs_open} and @code{ext2fs_initialize}.
147*6a54128fSAndroid Build Coastguard Worker
148*6a54128fSAndroid Build Coastguard WorkerThe filesystem can also be closed using @code{ext2fs_close}, and any
149*6a54128fSAndroid Build Coastguard Workerchanges to the superblock and group descriptors can be written out to disk
150*6a54128fSAndroid Build Coastguard Workerusing @code{ext2fs_flush}.
151*6a54128fSAndroid Build Coastguard Worker
152*6a54128fSAndroid Build Coastguard Worker@menu
153*6a54128fSAndroid Build Coastguard Worker* Opening an ext2 filesystem::
154*6a54128fSAndroid Build Coastguard Worker* Closing and flushing out changes::
155*6a54128fSAndroid Build Coastguard Worker* Initializing a filesystem::
156*6a54128fSAndroid Build Coastguard Worker* Filesystem flag functions::
157*6a54128fSAndroid Build Coastguard Worker@end menu
158*6a54128fSAndroid Build Coastguard Worker
159*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
160*6a54128fSAndroid Build Coastguard Worker
161*6a54128fSAndroid Build Coastguard Worker@node Opening an ext2 filesystem, Closing and flushing out changes, Filesystem-level functions, Filesystem-level functions
162*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
163*6a54128fSAndroid Build Coastguard Worker@subsection Opening an ext2 filesystem
164*6a54128fSAndroid Build Coastguard Worker
165*6a54128fSAndroid Build Coastguard WorkerMost libext2fs functions take a filesystem handle of type
166*6a54128fSAndroid Build Coastguard Worker@code{ext2_filsys}.  A filesystem handle is created either by opening
167*6a54128fSAndroid Build Coastguard Workeran existing filesystem using @code{ext2fs_open}, or by initializing a new
168*6a54128fSAndroid Build Coastguard Workerfilesystem using @code{ext2fs_initialize}.
169*6a54128fSAndroid Build Coastguard Worker
170*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_open (const char *@var{name}, int @var{flags}, int @var{superblock}, int @var{block_size}, io_manager @var{manager}, ext2_filsys *@var{ret_fs})
171*6a54128fSAndroid Build Coastguard Worker
172*6a54128fSAndroid Build Coastguard WorkerOpens a filesystem named @var{name}, using the the io_manager
173*6a54128fSAndroid Build Coastguard Worker@var{manager} to define the input/output routines needed to read and
174*6a54128fSAndroid Build Coastguard Workerwrite the filesystem.  In the case of the @code{unix_io} io_manager,
175*6a54128fSAndroid Build Coastguard Worker@var{name} is interpreted as the Unix filename of the filesystem image.
176*6a54128fSAndroid Build Coastguard WorkerThis is often a device file, such as @file{/dev/hda1}.
177*6a54128fSAndroid Build Coastguard Worker
178*6a54128fSAndroid Build Coastguard WorkerThe @var{superblock} parameter specifies the block number of the
179*6a54128fSAndroid Build Coastguard Workersuperblock which should be used when opening the filesystem.
180*6a54128fSAndroid Build Coastguard WorkerIf @var{superblock} is zero, @code{ext2fs_open} will use the primary
181*6a54128fSAndroid Build Coastguard Workersuperblock located at offset 1024 bytes from the start of the filesystem
182*6a54128fSAndroid Build Coastguard Workerimage.
183*6a54128fSAndroid Build Coastguard Worker
184*6a54128fSAndroid Build Coastguard WorkerThe @var{block_size} parameter specifies the block size used by the
185*6a54128fSAndroid Build Coastguard Workerfilesystem.  Normally this is determined automatically from the
186*6a54128fSAndroid Build Coastguard Workerfilesystem superblock.  If @var{block_size} is non-zero, it must match
187*6a54128fSAndroid Build Coastguard Workerthe block size found in the superblock, or the error
188*6a54128fSAndroid Build Coastguard Worker@code{EXT2_ET_UNEXPECTED_BLOCK_SIZE} will be returned.  The
189*6a54128fSAndroid Build Coastguard Worker@var{block_size} parameter is also used to help find the superblock when
190*6a54128fSAndroid Build Coastguard Worker@var{superblock} is non-zero.
191*6a54128fSAndroid Build Coastguard Worker
192*6a54128fSAndroid Build Coastguard WorkerThe @var{flags} argument contains a bitmask of flags which control how
193*6a54128fSAndroid Build Coastguard Workerthe filesystem open should be handled.
194*6a54128fSAndroid Build Coastguard Worker
195*6a54128fSAndroid Build Coastguard Worker@table @code
196*6a54128fSAndroid Build Coastguard Worker@item EXT2_FLAG_RW
197*6a54128fSAndroid Build Coastguard WorkerOpen the filesystem for reading and writing.  Without this flag, the
198*6a54128fSAndroid Build Coastguard Workerfilesystem is opened for reading only.
199*6a54128fSAndroid Build Coastguard Worker
200*6a54128fSAndroid Build Coastguard Worker@item EXT2_FLAG_FORCE
201*6a54128fSAndroid Build Coastguard WorkerOpen the filesystem regardless of the feature sets listed in the
202*6a54128fSAndroid Build Coastguard Workersuperblock.
203*6a54128fSAndroid Build Coastguard Worker
204*6a54128fSAndroid Build Coastguard Worker@end table
205*6a54128fSAndroid Build Coastguard Worker@end deftypefun
206*6a54128fSAndroid Build Coastguard Worker
207*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
208*6a54128fSAndroid Build Coastguard Worker
209*6a54128fSAndroid Build Coastguard Worker@node Closing and flushing out changes, Initializing a filesystem, Opening an ext2 filesystem, Filesystem-level functions
210*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
211*6a54128fSAndroid Build Coastguard Worker@subsection Closing and flushing out changes
212*6a54128fSAndroid Build Coastguard Worker
213*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_flush (ext2_filsys @var{fs})
214*6a54128fSAndroid Build Coastguard Worker
215*6a54128fSAndroid Build Coastguard WorkerWrite any changes to the high-level filesystem data structures in the
216*6a54128fSAndroid Build Coastguard Worker@var{fs} filesystem.  The following data structures will be written out:
217*6a54128fSAndroid Build Coastguard Worker
218*6a54128fSAndroid Build Coastguard Worker@itemize @bullet
219*6a54128fSAndroid Build Coastguard Worker@item The filesystem superblock
220*6a54128fSAndroid Build Coastguard Worker@item The filesystem group descriptors
221*6a54128fSAndroid Build Coastguard Worker@item The filesystem bitmaps, if read in via @code{ext2fs_read_bitmaps}.
222*6a54128fSAndroid Build Coastguard Worker@end itemize
223*6a54128fSAndroid Build Coastguard Worker
224*6a54128fSAndroid Build Coastguard Worker@end deftypefun
225*6a54128fSAndroid Build Coastguard Worker
226*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_free (ext2_filsys @var{fs})
227*6a54128fSAndroid Build Coastguard Worker
228*6a54128fSAndroid Build Coastguard WorkerClose the io_manager abstraction for @var{fs} and release all memory
229*6a54128fSAndroid Build Coastguard Workerassociated with the filesystem handle.
230*6a54128fSAndroid Build Coastguard Worker@end deftypefun
231*6a54128fSAndroid Build Coastguard Worker
232*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_close (ext2_filsys @var{fs})
233*6a54128fSAndroid Build Coastguard Worker
234*6a54128fSAndroid Build Coastguard WorkerFlush out any changes to the high-level filesystem data structures using
235*6a54128fSAndroid Build Coastguard Worker@code{ext2fs_flush} if the filesystem is marked dirty; then close and
236*6a54128fSAndroid Build Coastguard Workerfree the filesystem using @code{ext2fs_free}.
237*6a54128fSAndroid Build Coastguard Worker
238*6a54128fSAndroid Build Coastguard Worker@end deftypefun
239*6a54128fSAndroid Build Coastguard Worker
240*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
241*6a54128fSAndroid Build Coastguard Worker
242*6a54128fSAndroid Build Coastguard Worker@node Initializing a filesystem, Filesystem flag functions, Closing and flushing out changes, Filesystem-level functions
243*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
244*6a54128fSAndroid Build Coastguard Worker@subsection Initializing a filesystem
245*6a54128fSAndroid Build Coastguard Worker
246*6a54128fSAndroid Build Coastguard WorkerAn ext2 filesystem is initializing by the @code{mke2fs} program.  The
247*6a54128fSAndroid Build Coastguard Workertwo functions described here, @code{ext2fs_initialize} and
248*6a54128fSAndroid Build Coastguard Worker@code{ext2fs_allocate_tables} do much of the initial work for setting up
249*6a54128fSAndroid Build Coastguard Workera filesystem.  However, they don't do the whole job.  @code{mke2fs}
250*6a54128fSAndroid Build Coastguard Workercalls @code{ext2fs_initialize} to set up the filesystem superblock, and
251*6a54128fSAndroid Build Coastguard Workercalls @code{ext2fs_allocate_tables} to allocate space for the inode
252*6a54128fSAndroid Build Coastguard Workertable, and the inode and block bitmaps.  In addition, @code{mke2fs} must
253*6a54128fSAndroid Build Coastguard Workeralso initialize the inode tables by clearing them with zeros, create the
254*6a54128fSAndroid Build Coastguard Workerroot and lost+found directories, and reserve the reserved inodes.
255*6a54128fSAndroid Build Coastguard Worker
256*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_initialize (const char *@var{name}, int @var{flags}, struct ext2_super_block *@var{param}, io_manager @var{manager}, ext2_filsys *@var{ret_fs})
257*6a54128fSAndroid Build Coastguard Worker
258*6a54128fSAndroid Build Coastguard WorkerThis function is used by the @code{mke2fs} program to initialize a
259*6a54128fSAndroid Build Coastguard Workerfilesystem.  The @code{ext2fs_initialize} function creates a filesystem
260*6a54128fSAndroid Build Coastguard Workerhandle which is returned in @var{ret_fs} that has been properly setup
261*6a54128fSAndroid Build Coastguard Workerfor a filesystem to be located in @var{name}, using the io_manager
262*6a54128fSAndroid Build Coastguard Worker@var{manager}.  The prototype superblock in @var{param} is used to
263*6a54128fSAndroid Build Coastguard Workersupply parameters such as the number of blocks in the filesystem, the
264*6a54128fSAndroid Build Coastguard Workerblock size, etc.
265*6a54128fSAndroid Build Coastguard Worker
266*6a54128fSAndroid Build Coastguard WorkerThe @code{ext2fs_initialize} function does not actually do any I/O; that
267*6a54128fSAndroid Build Coastguard Workerwill be done when the application program calls @code{ext2fs_close} or
268*6a54128fSAndroid Build Coastguard Worker@code{ext2fs_flush}.  Also, this function only initializes the
269*6a54128fSAndroid Build Coastguard Workersuperblock and group descriptor structures.  It does not create the
270*6a54128fSAndroid Build Coastguard Workerinode table or the root directory.  This must be done by the calling
271*6a54128fSAndroid Build Coastguard Workerapplication, such as @code{mke2fs}.
272*6a54128fSAndroid Build Coastguard Worker
273*6a54128fSAndroid Build Coastguard WorkerThe following values may be set in the @var{param} prototype superblock;
274*6a54128fSAndroid Build Coastguard Workerif a value of 0 is found in a field, @code{ext2fs_initialize} will use a
275*6a54128fSAndroid Build Coastguard Workerdefault value.  The calling application should zero out the prototype
276*6a54128fSAndroid Build Coastguard Workerentire superblock, and then fill in any appropriate values.
277*6a54128fSAndroid Build Coastguard Worker
278*6a54128fSAndroid Build Coastguard Worker@table @code
279*6a54128fSAndroid Build Coastguard Worker
280*6a54128fSAndroid Build Coastguard Worker@item s_blocks_count
281*6a54128fSAndroid Build Coastguard WorkerThe number of blocks in the filesystem.  This parameter is mandatory and
282*6a54128fSAndroid Build Coastguard Workermust be set by the calling application.
283*6a54128fSAndroid Build Coastguard Worker
284*6a54128fSAndroid Build Coastguard Worker@item s_inodes_count
285*6a54128fSAndroid Build Coastguard WorkerThe number of inodes in the filesystem.  The
286*6a54128fSAndroid Build Coastguard Workerdefault value is determined by calculating the size of the filesystem,
287*6a54128fSAndroid Build Coastguard Workerand creating one inode for every 4096 bytes.
288*6a54128fSAndroid Build Coastguard Worker
289*6a54128fSAndroid Build Coastguard Worker@item s_r_blocks_count
290*6a54128fSAndroid Build Coastguard WorkerThe number of blocks which should be reserved for the superuser.  The
291*6a54128fSAndroid Build Coastguard Workerdefault value is zero blocks.
292*6a54128fSAndroid Build Coastguard Worker
293*6a54128fSAndroid Build Coastguard Worker@item s_log_block_size
294*6a54128fSAndroid Build Coastguard WorkerThe blocksize of the filesystem.  Valid values are 0 (1024 bytes), 1
295*6a54128fSAndroid Build Coastguard Worker(2048 bytes), or 2 (4096 bytes).  The default blocksize is 1024 bytes.
296*6a54128fSAndroid Build Coastguard Worker
297*6a54128fSAndroid Build Coastguard Worker@item s_log_frag_size
298*6a54128fSAndroid Build Coastguard WorkerThe size of fragments.  The ext2 filesystem does not support fragments
299*6a54128fSAndroid Build Coastguard Worker(and may never support fragments).  Currently this field must be the
300*6a54128fSAndroid Build Coastguard Workersame as @code{s_log_block_size}.
301*6a54128fSAndroid Build Coastguard Worker
302*6a54128fSAndroid Build Coastguard Worker@item s_first_data_block
303*6a54128fSAndroid Build Coastguard WorkerThe first data block for the filesystem.  For filesystem with a
304*6a54128fSAndroid Build Coastguard Workerblocksize of 1024 bytes, this value must be at least 1, since the
305*6a54128fSAndroid Build Coastguard Workersuperblock is located in block number 1.  For filesystems with larger
306*6a54128fSAndroid Build Coastguard Workerblocksizes, the superblock is still located at an offset of 1024 bytes,
307*6a54128fSAndroid Build Coastguard Workerso the superblock is located in block number 0.  By default, this value
308*6a54128fSAndroid Build Coastguard Workeris set to 1 for filesystems with a block size of 1024 bytes, or 0 for
309*6a54128fSAndroid Build Coastguard Workerfilesystems with larger blocksizes.
310*6a54128fSAndroid Build Coastguard Worker
311*6a54128fSAndroid Build Coastguard Worker@item s_max_mnt_count
312*6a54128fSAndroid Build Coastguard WorkerThis field defines the number of times that the filesystem can be
313*6a54128fSAndroid Build Coastguard Workermounted before it should be checked using @code{e2fsck}.  When
314*6a54128fSAndroid Build Coastguard Worker@code{e2fsck} is run without the @samp{-f} option, @code{e2fsck} will
315*6a54128fSAndroid Build Coastguard Workerskip the filesystem check if the number of times that the filesystem has
316*6a54128fSAndroid Build Coastguard Workerbeen mounted is less than @code{s_max_mnt_count} and if the interval
317*6a54128fSAndroid Build Coastguard Workerbetween the last time a filesystem check was performed and the current
318*6a54128fSAndroid Build Coastguard Workertime is less than @code{s_checkinterval} (see below).  The default value
319*6a54128fSAndroid Build Coastguard Workerof @code{s_max_mnt_count} is 20.
320*6a54128fSAndroid Build Coastguard Worker
321*6a54128fSAndroid Build Coastguard Worker@item s_checkinterval
322*6a54128fSAndroid Build Coastguard WorkerThis field defines the minimal interval between filesystem checks.  See
323*6a54128fSAndroid Build Coastguard Workerthe previous entry for a discussion of how this field is used by
324*6a54128fSAndroid Build Coastguard Worker@code{e2fsck}.  The default value of this field is 180 days (six
325*6a54128fSAndroid Build Coastguard Workermonths).
326*6a54128fSAndroid Build Coastguard Worker
327*6a54128fSAndroid Build Coastguard Worker@item s_errors
328*6a54128fSAndroid Build Coastguard WorkerThis field defines the behavior which should be used by the kernel of
329*6a54128fSAndroid Build Coastguard Workererrors are detected in the filesystem.  Possible values include:
330*6a54128fSAndroid Build Coastguard Worker
331*6a54128fSAndroid Build Coastguard Worker@table @samp
332*6a54128fSAndroid Build Coastguard Worker@item EXT2_ERRORS_CONTINUE
333*6a54128fSAndroid Build Coastguard WorkerContinue execution when errors are detected.
334*6a54128fSAndroid Build Coastguard Worker
335*6a54128fSAndroid Build Coastguard Worker@item EXT2_ERRORS_RO
336*6a54128fSAndroid Build Coastguard WorkerRemount the filesystem read-only.
337*6a54128fSAndroid Build Coastguard Worker
338*6a54128fSAndroid Build Coastguard Worker@item EXT2_ERRORS_PANIC
339*6a54128fSAndroid Build Coastguard WorkerPanic.
340*6a54128fSAndroid Build Coastguard Worker
341*6a54128fSAndroid Build Coastguard Worker@end table
342*6a54128fSAndroid Build Coastguard Worker
343*6a54128fSAndroid Build Coastguard WorkerThe default behavior is @samp{EXT2_ERRORS_CONTINUE}.
344*6a54128fSAndroid Build Coastguard Worker
345*6a54128fSAndroid Build Coastguard Worker@end table
346*6a54128fSAndroid Build Coastguard Worker
347*6a54128fSAndroid Build Coastguard Worker@end deftypefun
348*6a54128fSAndroid Build Coastguard Worker
349*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_allocate_tables (ext2_filsys @var{fs})
350*6a54128fSAndroid Build Coastguard WorkerAllocate space for the inode table and the block and inode bitmaps.  The
351*6a54128fSAndroid Build Coastguard Workerinode tables and block and inode bitmaps aren't actually initialized;
352*6a54128fSAndroid Build Coastguard Workerthis function just allocates the space for them.
353*6a54128fSAndroid Build Coastguard Worker@end deftypefun
354*6a54128fSAndroid Build Coastguard Worker
355*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
356*6a54128fSAndroid Build Coastguard Worker
357*6a54128fSAndroid Build Coastguard Worker@node Filesystem flag functions,  , Initializing a filesystem, Filesystem-level functions
358*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
359*6a54128fSAndroid Build Coastguard Worker@subsection Filesystem flag functions
360*6a54128fSAndroid Build Coastguard Worker
361*6a54128fSAndroid Build Coastguard WorkerThe filesystem handle has a number of flags which can be manipulated
362*6a54128fSAndroid Build Coastguard Workerusing the following function.  Some of these flags affect how the
363*6a54128fSAndroid Build Coastguard Workerlibext2fs filesystem behaves; others are provided solely for the
364*6a54128fSAndroid Build Coastguard Workerapplication's convenience.
365*6a54128fSAndroid Build Coastguard Worker
366*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_mark_changed (ext2_filsys @var{fs})
367*6a54128fSAndroid Build Coastguard Worker@deftypefunx int ext2fs_test_changed (ext2_filsys @var{fs})
368*6a54128fSAndroid Build Coastguard WorkerThis flag indicates whether or not the filesystem has been changed.
369*6a54128fSAndroid Build Coastguard WorkerIt is not used by the ext2fs library.
370*6a54128fSAndroid Build Coastguard Worker@end deftypefun
371*6a54128fSAndroid Build Coastguard Worker
372*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_mark_super_dirty (ext2_filsys @var{fs})
373*6a54128fSAndroid Build Coastguard WorkerMark the filesystem @var{fs} as being dirty; this will cause
374*6a54128fSAndroid Build Coastguard Workerthe superblock information to be flushed out when @code{ext2fs_close} is
375*6a54128fSAndroid Build Coastguard Workercalled.  @code{ext2fs_mark_super_dirty} will also set the filesystem
376*6a54128fSAndroid Build Coastguard Workerchanged flag.  The dirty flag is automatically cleared by
377*6a54128fSAndroid Build Coastguard Worker@code{ext2fs_flush} when the superblock is written to disk.
378*6a54128fSAndroid Build Coastguard Worker@end deftypefun
379*6a54128fSAndroid Build Coastguard Worker
380*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_mark_valid (ext2_filsys @var{fs})
381*6a54128fSAndroid Build Coastguard Worker@deftypefunx void ext2fs_unmark_valid (ext2_filsys @var{fs})
382*6a54128fSAndroid Build Coastguard Worker@deftypefunx int ext2fs_test_valid (ext2_filsys @var{fs})
383*6a54128fSAndroid Build Coastguard WorkerThis flag indicates whether or not the filesystem is free of errors.
384*6a54128fSAndroid Build Coastguard WorkerIt is not used by libext2fs, and is solely for the application's
385*6a54128fSAndroid Build Coastguard Workerconvenience.
386*6a54128fSAndroid Build Coastguard Worker@end deftypefun
387*6a54128fSAndroid Build Coastguard Worker
388*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_mark_ib_dirty (ext2_filsys @var{fs})
389*6a54128fSAndroid Build Coastguard Worker@deftypefunx void ext2fs_mark_bb_dirty (ext2_filsys @var{fs})
390*6a54128fSAndroid Build Coastguard Worker@deftypefunx int ext2fs_test_ib_dirty (ext2_filsys @var{fs})
391*6a54128fSAndroid Build Coastguard Worker@deftypefunx int ext2fs_test_bb_dirty (ext2_filsys @var{fs})
392*6a54128fSAndroid Build Coastguard WorkerThese flags indicate whether or not the inode or block bitmaps have been
393*6a54128fSAndroid Build Coastguard Workermodified.   If the flag is set, it will cause the appropriate bitmap
394*6a54128fSAndroid Build Coastguard Workerto be written when the filesystem is closed or flushed.
395*6a54128fSAndroid Build Coastguard Worker@end deftypefun
396*6a54128fSAndroid Build Coastguard Worker
397*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
398*6a54128fSAndroid Build Coastguard Worker
399*6a54128fSAndroid Build Coastguard Worker@node File I/O Functions, Inode Functions, Filesystem-level functions, EXT2FS Library Functions
400*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
401*6a54128fSAndroid Build Coastguard Worker@section File I/O Functions
402*6a54128fSAndroid Build Coastguard Worker
403*6a54128fSAndroid Build Coastguard WorkerThe following functions provide a convenient abstraction to read or
404*6a54128fSAndroid Build Coastguard Workerwrite a file in an filesystem.  The interface is similar in spirit to
405*6a54128fSAndroid Build Coastguard Workerthe Linux/POSIX file I/O system calls.
406*6a54128fSAndroid Build Coastguard Worker
407*6a54128fSAndroid Build Coastguard Worker@menu
408*6a54128fSAndroid Build Coastguard Worker* File handle manipulation::
409*6a54128fSAndroid Build Coastguard Worker* Reading and writing data::
410*6a54128fSAndroid Build Coastguard Worker* Changing the file offset ::
411*6a54128fSAndroid Build Coastguard Worker* Getting the file size::
412*6a54128fSAndroid Build Coastguard Worker@end menu
413*6a54128fSAndroid Build Coastguard Worker
414*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
415*6a54128fSAndroid Build Coastguard Worker
416*6a54128fSAndroid Build Coastguard Worker@node File handle manipulation, Reading and writing data, File I/O Functions, File I/O Functions
417*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
418*6a54128fSAndroid Build Coastguard Worker@subsection File handle manipulation
419*6a54128fSAndroid Build Coastguard Worker
420*6a54128fSAndroid Build Coastguard WorkerThe file handle functions much like a file descriptor in the Linux/POSIX
421*6a54128fSAndroid Build Coastguard Workerfile I/O system calls.  Unlike the Linux/POSIX system calls, files are
422*6a54128fSAndroid Build Coastguard Workeropened via inode numbers instead of via pathnames.  To resolve a
423*6a54128fSAndroid Build Coastguard Workerpathname to an inode number, use the function @code{ext2fs_namei} or to
424*6a54128fSAndroid Build Coastguard Workercreate a new file, use @code{ext2fs_new_inode} and @code{ext2fs_link}.
425*6a54128fSAndroid Build Coastguard Worker
426*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_file_open2 (ext2_filsys @var{fs}, ext2_ino_t @var{ino}, struct ext2_inode *@var{inode}, int @var{flags}, ext2_file_t *@var{ret})
427*6a54128fSAndroid Build Coastguard Worker@deftypefunx errcode_t ext2fs_file_open (ext2_filsys @var{fs}, ext2_ino_t @var{ino}, int @var{flags}, ext2_file_t *@var{ret})
428*6a54128fSAndroid Build Coastguard Worker
429*6a54128fSAndroid Build Coastguard WorkerOpens a file identified by inode number @var{ino} in filesystem @var{fs}
430*6a54128fSAndroid Build Coastguard Workerand returns a file handle in @var{ret}.  If an inode structure is
431*6a54128fSAndroid Build Coastguard Workerprovided in @var{inode}, then it is used instead of reading the inode
432*6a54128fSAndroid Build Coastguard Workerfrom the filesystem.
433*6a54128fSAndroid Build Coastguard Worker
434*6a54128fSAndroid Build Coastguard WorkerThe @var{flags} argument contains a bitmask of flags which control how
435*6a54128fSAndroid Build Coastguard Workerthe file should be opened.
436*6a54128fSAndroid Build Coastguard Worker
437*6a54128fSAndroid Build Coastguard Worker@table @code
438*6a54128fSAndroid Build Coastguard Worker@item EXT2_FILE_WRITE
439*6a54128fSAndroid Build Coastguard WorkerOpen the file for reading and writing.  Without this flag, the file is
440*6a54128fSAndroid Build Coastguard Workeropened for writing only.
441*6a54128fSAndroid Build Coastguard Worker
442*6a54128fSAndroid Build Coastguard Worker@item EXT2_FILE_CREATE
443*6a54128fSAndroid Build Coastguard WorkerCreate the file if it is not already present.
444*6a54128fSAndroid Build Coastguard Worker
445*6a54128fSAndroid Build Coastguard Worker@end table
446*6a54128fSAndroid Build Coastguard Worker@end deftypefun
447*6a54128fSAndroid Build Coastguard Worker
448*6a54128fSAndroid Build Coastguard Worker@deftypefun ext2_filsys ext2fs_file_get_fs (ext2_file_t @var{file})
449*6a54128fSAndroid Build Coastguard WorkerReturn the filesystem handle where the open file @var{file} was opened.
450*6a54128fSAndroid Build Coastguard Worker@end deftypefun
451*6a54128fSAndroid Build Coastguard Worker
452*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_file_close (ext2_file_t @var{file})
453*6a54128fSAndroid Build Coastguard WorkerClose the file handle @var{file}.
454*6a54128fSAndroid Build Coastguard Worker@end deftypefun
455*6a54128fSAndroid Build Coastguard Worker
456*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_file_flush (ext2_file_t @var{file})
457*6a54128fSAndroid Build Coastguard WorkerForce any data written via @code{ext2fs_file_write} to disk.
458*6a54128fSAndroid Build Coastguard Worker@end deftypefun
459*6a54128fSAndroid Build Coastguard Worker
460*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
461*6a54128fSAndroid Build Coastguard Worker
462*6a54128fSAndroid Build Coastguard Worker@node Reading and writing data, Changing the file offset , File handle manipulation, File I/O Functions
463*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
464*6a54128fSAndroid Build Coastguard Worker@subsection Reading and writing data
465*6a54128fSAndroid Build Coastguard Worker
466*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_file_read (ext2_file_t @var{file}, void *@var{buf}, unsigned int @var{wanted}, unsigned int *@var{got})
467*6a54128fSAndroid Build Coastguard WorkerRead @var{wanted} bytes of data from @var{file} store it in the buffer
468*6a54128fSAndroid Build Coastguard Worker@var{buf}.  The number of bytes that was actually read is returned
469*6a54128fSAndroid Build Coastguard Workervia @var{got}.
470*6a54128fSAndroid Build Coastguard Worker@end deftypefun
471*6a54128fSAndroid Build Coastguard Worker
472*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_file_write (ext2_file_t @var{file}, const void *@var{buf}, unsigned int @var{nbytes}, unsigned int *@var{written})
473*6a54128fSAndroid Build Coastguard WorkerWrite @var{wanted} bytes of data from the buffer @var{buf} to the
474*6a54128fSAndroid Build Coastguard Workercurrent file position of @var{file}.  The number of bytes that was
475*6a54128fSAndroid Build Coastguard Workeractually written is returned via @var{written}.
476*6a54128fSAndroid Build Coastguard Worker@end deftypefun
477*6a54128fSAndroid Build Coastguard Worker
478*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
479*6a54128fSAndroid Build Coastguard Worker
480*6a54128fSAndroid Build Coastguard Worker@node Changing the file offset , Getting the file size, Reading and writing data, File I/O Functions
481*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
482*6a54128fSAndroid Build Coastguard Worker@subsection Changing the file offset
483*6a54128fSAndroid Build Coastguard Worker
484*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_file_llseek (ext2_file_t @var{file}, __u64 @var{offset}, int @var{whence}, __u64 *@var{ret_pos})
485*6a54128fSAndroid Build Coastguard Worker@deftypefunx errcode_t ext2fs_file_lseek (ext2_file_t @var{file}, ext2_off_t @var{offset}, int @var{whence}, ext2_off_t *@var{ret_pos})
486*6a54128fSAndroid Build Coastguard WorkerChange the current file position of @var{file} according to the
487*6a54128fSAndroid Build Coastguard Workerdirective @var{whence} as follows:
488*6a54128fSAndroid Build Coastguard Worker
489*6a54128fSAndroid Build Coastguard Worker@table @code
490*6a54128fSAndroid Build Coastguard Worker@item EXT2_SEEK_SET
491*6a54128fSAndroid Build Coastguard WorkerThe file position is set to @var{offset} bytes from the beginning of the
492*6a54128fSAndroid Build Coastguard Workerfile.
493*6a54128fSAndroid Build Coastguard Worker
494*6a54128fSAndroid Build Coastguard Worker@item EXT2_SEEK_CUR
495*6a54128fSAndroid Build Coastguard WorkerThe file position set to its current location plus @var{offset} bytes.
496*6a54128fSAndroid Build Coastguard Worker
497*6a54128fSAndroid Build Coastguard Worker@item EXT2_SEEK_END
498*6a54128fSAndroid Build Coastguard WorkerThe file position is set to the size of the file plus @var{offset}
499*6a54128fSAndroid Build Coastguard Workerbytes.
500*6a54128fSAndroid Build Coastguard Worker@end table
501*6a54128fSAndroid Build Coastguard Worker
502*6a54128fSAndroid Build Coastguard WorkerThe current offset is returned via @var{ret_pos}.
503*6a54128fSAndroid Build Coastguard Worker@end deftypefun
504*6a54128fSAndroid Build Coastguard Worker
505*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
506*6a54128fSAndroid Build Coastguard Worker
507*6a54128fSAndroid Build Coastguard Worker@node Getting the file size,  , Changing the file offset , File I/O Functions
508*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
509*6a54128fSAndroid Build Coastguard Worker@subsection Getting the file size
510*6a54128fSAndroid Build Coastguard Worker
511*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_file_get_lsize (ext2_file_t @var{file}, __u64 *@var{ret_size})
512*6a54128fSAndroid Build Coastguard WorkerReturn the size of the file @var{file} in @var{ret_size}.
513*6a54128fSAndroid Build Coastguard Worker@end deftypefun
514*6a54128fSAndroid Build Coastguard Worker
515*6a54128fSAndroid Build Coastguard Worker@deftypefun ext2_off_t ext2fs_file_get_size (ext2_file_t @var{file})
516*6a54128fSAndroid Build Coastguard WorkerReturn the size of the file @var{file}.
517*6a54128fSAndroid Build Coastguard Worker@end deftypefun
518*6a54128fSAndroid Build Coastguard Worker
519*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
520*6a54128fSAndroid Build Coastguard Worker
521*6a54128fSAndroid Build Coastguard Worker@node Inode Functions, Directory functions, File I/O Functions, EXT2FS Library Functions
522*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
523*6a54128fSAndroid Build Coastguard Worker@section Inode Functions
524*6a54128fSAndroid Build Coastguard Worker
525*6a54128fSAndroid Build Coastguard Worker@menu
526*6a54128fSAndroid Build Coastguard Worker* Reading and writing inodes::
527*6a54128fSAndroid Build Coastguard Worker* Iterating over inodes in a filesystem::
528*6a54128fSAndroid Build Coastguard Worker* Iterating over blocks in an inode::
529*6a54128fSAndroid Build Coastguard Worker* Inode Convenience Functions::
530*6a54128fSAndroid Build Coastguard Worker@end menu
531*6a54128fSAndroid Build Coastguard Worker
532*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
533*6a54128fSAndroid Build Coastguard Worker
534*6a54128fSAndroid Build Coastguard Worker@node Reading and writing inodes, Iterating over inodes in a filesystem, Inode Functions, Inode Functions
535*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
536*6a54128fSAndroid Build Coastguard Worker@subsection Reading and writing inodes
537*6a54128fSAndroid Build Coastguard Worker
538*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_read_inode (ext2_filsys @var{fs}, ext2_ino_t @var{ino}, struct ext2_inode *@var{inode})
539*6a54128fSAndroid Build Coastguard WorkerRead the inode number @var{ino} into @var{inode}.
540*6a54128fSAndroid Build Coastguard Worker@end deftypefun
541*6a54128fSAndroid Build Coastguard Worker
542*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_write_inode (ext2_filsys @var{fs}, ext2_ino_t @var{ino}, struct ext2_inode *@var{inode})
543*6a54128fSAndroid Build Coastguard WorkerWrite @var{inode} to inode @var{ino}.
544*6a54128fSAndroid Build Coastguard Worker@end deftypefun
545*6a54128fSAndroid Build Coastguard Worker
546*6a54128fSAndroid Build Coastguard Worker
547*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
548*6a54128fSAndroid Build Coastguard Worker
549*6a54128fSAndroid Build Coastguard Worker@node Iterating over inodes in a filesystem, Iterating over blocks in an inode, Reading and writing inodes, Inode Functions
550*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
551*6a54128fSAndroid Build Coastguard Worker@subsection Iterating over inodes in a filesystem
552*6a54128fSAndroid Build Coastguard Worker
553*6a54128fSAndroid Build Coastguard WorkerThe inode_scan abstraction is useful for iterating over all the inodes
554*6a54128fSAndroid Build Coastguard Workerin a filesystem.
555*6a54128fSAndroid Build Coastguard Worker
556*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_open_inode_scan (ext2_filsys @var{fs}, int @var{buffer_blocks}, ext2_inode_scan *@var{scan})
557*6a54128fSAndroid Build Coastguard WorkerInitialize the iteration variable @var{scan}.  This variable is used by
558*6a54128fSAndroid Build Coastguard Worker@code{ext2fs_get_next_inode}.  The @var{buffer_blocks} parameter
559*6a54128fSAndroid Build Coastguard Workercontrols how many blocks of the inode table are read in at a time.  A
560*6a54128fSAndroid Build Coastguard Workerlarge number of blocks requires more memory, but reduces the overhead in
561*6a54128fSAndroid Build Coastguard Workerseeking and reading from the disk.  If @var{buffer_blocks} is zero, a
562*6a54128fSAndroid Build Coastguard Workersuitable default value will be used.
563*6a54128fSAndroid Build Coastguard Worker@end deftypefun
564*6a54128fSAndroid Build Coastguard Worker
565*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_close_inode_scan (ext2_inode_scan @var{scan})
566*6a54128fSAndroid Build Coastguard WorkerRelease the memory associated with @var{scan} and invalidate it.
567*6a54128fSAndroid Build Coastguard Worker@end deftypefun
568*6a54128fSAndroid Build Coastguard Worker
569*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_get_next_inode (ext2_inode_scan @var{scan}, ext2_ino_t *@var{ino}, struct ext2_inode *@var{inode})
570*6a54128fSAndroid Build Coastguard Worker
571*6a54128fSAndroid Build Coastguard WorkerThis function returns the next inode from the filesystem; the inode
572*6a54128fSAndroid Build Coastguard Workernumber of the inode is stored in @var{ino}, and the inode is stored in
573*6a54128fSAndroid Build Coastguard Worker@var{inode}.
574*6a54128fSAndroid Build Coastguard Worker
575*6a54128fSAndroid Build Coastguard WorkerIf the inode is located in a block that has been marked as bad,
576*6a54128fSAndroid Build Coastguard Worker@code{ext2fs_get_next_inode} will return the error
577*6a54128fSAndroid Build Coastguard Worker@code{EXT2_ET_BAD_BLOCK_IN_INODE_TABLE}.
578*6a54128fSAndroid Build Coastguard Worker@end deftypefun
579*6a54128fSAndroid Build Coastguard Worker
580*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_inode_scan_goto_blockgroup (ext2_inode_scan @var{scan}, int @var{group})
581*6a54128fSAndroid Build Coastguard WorkerStart the inode scan at a particular ext2 blockgroup, @var{group}.
582*6a54128fSAndroid Build Coastguard WorkerThis function may be safely called at any time while @var{scan} is valid.
583*6a54128fSAndroid Build Coastguard Worker@end deftypefun
584*6a54128fSAndroid Build Coastguard Worker
585*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_set_inode_callback (ext2_inode_scan @var{scan}, errcode_t (*done_group)(ext2_filsys @var{fs}, ext2_inode_scan @var{scan}, dgrp_t @var{group}, void * @var{private}), void *@var{done_group_data})
586*6a54128fSAndroid Build Coastguard WorkerRegister a callback function which will be called by
587*6a54128fSAndroid Build Coastguard Worker@code{ext2_get_next_inode} when all of the inodes in a block group have
588*6a54128fSAndroid Build Coastguard Workerbeen processed.
589*6a54128fSAndroid Build Coastguard Worker@end deftypefun
590*6a54128fSAndroid Build Coastguard Worker
591*6a54128fSAndroid Build Coastguard Worker@deftypefun int ext2fs_inode_scan_flags (ext2_inode_scan @var{scan}, int @var{set_flags}, int @var{clear_flags})
592*6a54128fSAndroid Build Coastguard Worker
593*6a54128fSAndroid Build Coastguard WorkerSet the scan_flags @var{set_flags} and clear the scan_flags @var{clear_flags}.
594*6a54128fSAndroid Build Coastguard WorkerThe following flags can be set using this interface:
595*6a54128fSAndroid Build Coastguard Worker
596*6a54128fSAndroid Build Coastguard Worker@table @samp
597*6a54128fSAndroid Build Coastguard Worker
598*6a54128fSAndroid Build Coastguard Worker@item EXT2_SF_SKIP_MISSING_ITABLE
599*6a54128fSAndroid Build Coastguard WorkerWhen a block group is missing an inode table, skip it.  If this flag is
600*6a54128fSAndroid Build Coastguard Workernot set @code{ext2fs_get_next_inode} will return the error
601*6a54128fSAndroid Build Coastguard WorkerEXT2_ET_MISSING_INODE_TABLE.
602*6a54128fSAndroid Build Coastguard Worker
603*6a54128fSAndroid Build Coastguard Worker@end table
604*6a54128fSAndroid Build Coastguard Worker
605*6a54128fSAndroid Build Coastguard Worker@end deftypefun
606*6a54128fSAndroid Build Coastguard Worker
607*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
608*6a54128fSAndroid Build Coastguard Worker
609*6a54128fSAndroid Build Coastguard Worker@node Iterating over blocks in an inode, Inode Convenience Functions, Iterating over inodes in a filesystem, Inode Functions
610*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
611*6a54128fSAndroid Build Coastguard Worker@subsection Iterating over blocks in an inode
612*6a54128fSAndroid Build Coastguard Worker
613*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_block_iterate (ext2_filsys @var{fs}, ext2_ino_t @var{ino}, int @var{flags}, char *block_buf, int (*func)(ext2_filsys @var{fs}, blk_t *@var{blocknr}, int @var{blockcnt}, void *@var{private}), void *@var{private})
614*6a54128fSAndroid Build Coastguard Worker
615*6a54128fSAndroid Build Coastguard WorkerIterate over all of the blocks in inode number @var{ino} in filesystem
616*6a54128fSAndroid Build Coastguard Worker@var{fs}, by calling the function @var{func} for each block in the
617*6a54128fSAndroid Build Coastguard Workerinode.  The @var{block_buf} parameter should either be NULL, or if the
618*6a54128fSAndroid Build Coastguard Worker@code{ext2fs_block_iterate} function is called repeatedly, the overhead
619*6a54128fSAndroid Build Coastguard Workerof allocating and freeing scratch memory can be avoided by passing a
620*6a54128fSAndroid Build Coastguard Workerpointer to a scratch buffer which must be at least as big as three times the
621*6a54128fSAndroid Build Coastguard Workerfilesystem's blocksize.
622*6a54128fSAndroid Build Coastguard Worker
623*6a54128fSAndroid Build Coastguard WorkerThe @var{flags} parameter controls how the iterator will function:
624*6a54128fSAndroid Build Coastguard Worker
625*6a54128fSAndroid Build Coastguard Worker@table @samp
626*6a54128fSAndroid Build Coastguard Worker
627*6a54128fSAndroid Build Coastguard Worker@item BLOCK_FLAG_HOLE
628*6a54128fSAndroid Build Coastguard WorkerThis flag indicates that the iterator function should be called on
629*6a54128fSAndroid Build Coastguard Workerblocks where the block number is zero (also known as ``holes''.)  It is
630*6a54128fSAndroid Build Coastguard Workeralso known as BLOCK_FLAG_APPEND, since it is also used by functions
631*6a54128fSAndroid Build Coastguard Workersuch as ext2fs_expand_dir() to add a new block to an inode.
632*6a54128fSAndroid Build Coastguard Worker
633*6a54128fSAndroid Build Coastguard Worker@item BLOCK_FLAG_DEPTH_TRAVERSE
634*6a54128fSAndroid Build Coastguard WorkerThis flag indicates that the iterator function for the
635*6a54128fSAndroid Build Coastguard Workerindirect, doubly indirect, etc. blocks should be called after all
636*6a54128fSAndroid Build Coastguard Workerof the blocks contained in the indirect blocks are processed.
637*6a54128fSAndroid Build Coastguard WorkerThis is useful if you are going to be deallocating blocks from an
638*6a54128fSAndroid Build Coastguard Workerinode.
639*6a54128fSAndroid Build Coastguard Worker
640*6a54128fSAndroid Build Coastguard Worker@item BLOCK_FLAG_DATA_ONLY
641*6a54128fSAndroid Build Coastguard WorkerThis flag indicates that the iterator function should be
642*6a54128fSAndroid Build Coastguard Workercalled for data blocks only.
643*6a54128fSAndroid Build Coastguard Worker
644*6a54128fSAndroid Build Coastguard Worker@end table
645*6a54128fSAndroid Build Coastguard Worker
646*6a54128fSAndroid Build Coastguard WorkerThe callback function @var{func} is called with a number of parameters;
647*6a54128fSAndroid Build Coastguard Workerthe @var{fs} and @var{private} parameters are self-explanatory, and
648*6a54128fSAndroid Build Coastguard Workertheir values are taken from the parameters to
649*6a54128fSAndroid Build Coastguard Worker@code{ext2fs_block_iterate}.  (The @var{private} data structure is
650*6a54128fSAndroid Build Coastguard Workergenerally used by callers to @code{ext2fs_block_iterate} so that some
651*6a54128fSAndroid Build Coastguard Workerprivate data structure can be passed to the callback function.  The
652*6a54128fSAndroid Build Coastguard Worker@var{blockcnt} parameter, if non-negative, indicates the logical block
653*6a54128fSAndroid Build Coastguard Workernumber of a data block in the inode.  If @var{blockcnt} is less than
654*6a54128fSAndroid Build Coastguard Workerzero, then @var{func} was called on a metadata block, and @var{blockcnt}
655*6a54128fSAndroid Build Coastguard Workerwill be one of the following values:  BLOCK_COUNT_IND, BLOCK_COUNT_DIND,
656*6a54128fSAndroid Build Coastguard WorkerBLOCK_COUNT_TIND, or BLOCK_COUNT_TRANSLATOR.  The @var{blocknr} is a
657*6a54128fSAndroid Build Coastguard Workerpointer to the inode or indirect block entry listing physical block
658*6a54128fSAndroid Build Coastguard Workernumber.  The callback function may modify the physical block number, if
659*6a54128fSAndroid Build Coastguard Workerit returns the @var{BLOCK_CHANGED} flag.
660*6a54128fSAndroid Build Coastguard Worker
661*6a54128fSAndroid Build Coastguard Worker
662*6a54128fSAndroid Build Coastguard WorkerThe callback function @var{func} returns a result code which is composed of
663*6a54128fSAndroid Build Coastguard Workerthe logical OR of the following flags:
664*6a54128fSAndroid Build Coastguard Worker
665*6a54128fSAndroid Build Coastguard Worker@table @samp
666*6a54128fSAndroid Build Coastguard Worker
667*6a54128fSAndroid Build Coastguard Worker@item BLOCK_CHANGED
668*6a54128fSAndroid Build Coastguard Worker
669*6a54128fSAndroid Build Coastguard WorkerThis flag indicates that callback function has modified the physical
670*6a54128fSAndroid Build Coastguard Workerblock number pointed to by @var{blocknr}.
671*6a54128fSAndroid Build Coastguard Worker
672*6a54128fSAndroid Build Coastguard Worker@item BLOCK_ABORT
673*6a54128fSAndroid Build Coastguard Worker
674*6a54128fSAndroid Build Coastguard WorkerThis flag requests that @code{ext2fs_block_iterate} to stop immediately
675*6a54128fSAndroid Build Coastguard Workerand return to the caller.
676*6a54128fSAndroid Build Coastguard Worker
677*6a54128fSAndroid Build Coastguard Worker@end table
678*6a54128fSAndroid Build Coastguard Worker
679*6a54128fSAndroid Build Coastguard Worker@end deftypefun
680*6a54128fSAndroid Build Coastguard Worker
681*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_block_iterate2 (ext2_filsys @var{fs}, ext2_ino_t @var{ino}, int @var{flags}, char *@var{block}_buf, int (*func)(ext2_filsys @var{fs}, blk_t *@var{blocknr}, e2_blkcnt_t @var{blockcnt}, blk_t @var{ref_blk}, int  @var{ref_offset}, void *@var{private}), void *@var{private})
682*6a54128fSAndroid Build Coastguard Worker
683*6a54128fSAndroid Build Coastguard WorkerThis function is much like @code{ext2fs_block_iterate}, except that the
684*6a54128fSAndroid Build Coastguard Worker@var{blockcnt} type is a 64-bit signed quantity, to support larger
685*6a54128fSAndroid Build Coastguard Workerfiles, and the addition of the @var{ref_blk} and @var{ref_offset}
686*6a54128fSAndroid Build Coastguard Workerarguments passed to the callback function, which identify the location
687*6a54128fSAndroid Build Coastguard Workerof the physical block pointed to by pointer @var{blocknr}.  If
688*6a54128fSAndroid Build Coastguard Worker@var{ref_blk} is zero, then @var{ref_offset} contains the offset into
689*6a54128fSAndroid Build Coastguard Workerthe @code{i_blocks} array.  If @var{ref_blk} is non-zero, then the physical
690*6a54128fSAndroid Build Coastguard Workerblock location is contained inside an indirect block group, and
691*6a54128fSAndroid Build Coastguard Worker@var{ref_offset} contains the offset into the indirect block.
692*6a54128fSAndroid Build Coastguard Worker
693*6a54128fSAndroid Build Coastguard Worker@end deftypefun
694*6a54128fSAndroid Build Coastguard Worker
695*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
696*6a54128fSAndroid Build Coastguard Worker
697*6a54128fSAndroid Build Coastguard Worker@node Inode Convenience Functions,  , Iterating over blocks in an inode, Inode Functions
698*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
699*6a54128fSAndroid Build Coastguard Worker@subsection Convenience functions for Inodes
700*6a54128fSAndroid Build Coastguard Worker
701*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_get_blocks (ext2_filsys @var{fs}, ext2_ino_t @var{ino}, blk_t *@var{blocks})
702*6a54128fSAndroid Build Coastguard Worker
703*6a54128fSAndroid Build Coastguard WorkerReturns an array of blocks corresponding to the direct,
704*6a54128fSAndroid Build Coastguard Workerindirect, doubly indirect, and triply indirect blocks as stored in the
705*6a54128fSAndroid Build Coastguard Workerinode structure.
706*6a54128fSAndroid Build Coastguard Worker@end deftypefun
707*6a54128fSAndroid Build Coastguard Worker
708*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_check_directory (ext2_filsys @var{fs}, ext2_ino_t @var{ino})
709*6a54128fSAndroid Build Coastguard WorkerReturns 0 if @var{ino} is a directory, and @code{ENOTDIR} if it is not.
710*6a54128fSAndroid Build Coastguard Worker@end deftypefun
711*6a54128fSAndroid Build Coastguard Worker
712*6a54128fSAndroid Build Coastguard Worker@deftypefun int ext2fs_inode_has_valid_blocks (struct ext2_inode *@var{inode})
713*6a54128fSAndroid Build Coastguard Worker
714*6a54128fSAndroid Build Coastguard WorkerReturns 1 if the inode's block entries actually valid block entries, and
715*6a54128fSAndroid Build Coastguard Worker0 if not.  Inodes which represent devices and fast symbolic links do not
716*6a54128fSAndroid Build Coastguard Workercontain valid block entries.
717*6a54128fSAndroid Build Coastguard Worker@end deftypefun
718*6a54128fSAndroid Build Coastguard Worker
719*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
720*6a54128fSAndroid Build Coastguard Worker
721*6a54128fSAndroid Build Coastguard Worker@node Directory functions, Bitmap Functions, Inode Functions, EXT2FS Library Functions
722*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
723*6a54128fSAndroid Build Coastguard Worker@section Directory functions
724*6a54128fSAndroid Build Coastguard Worker
725*6a54128fSAndroid Build Coastguard Worker@menu
726*6a54128fSAndroid Build Coastguard Worker* Directory block functions::
727*6a54128fSAndroid Build Coastguard Worker* Iterating over a directory::
728*6a54128fSAndroid Build Coastguard Worker* Creating and expanding directories::
729*6a54128fSAndroid Build Coastguard Worker* Creating and removing directory entries::
730*6a54128fSAndroid Build Coastguard Worker* Looking up filenames::
731*6a54128fSAndroid Build Coastguard Worker* Translating inode numbers to filenames::
732*6a54128fSAndroid Build Coastguard Worker@end menu
733*6a54128fSAndroid Build Coastguard Worker
734*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
735*6a54128fSAndroid Build Coastguard Worker
736*6a54128fSAndroid Build Coastguard Worker@node Directory block functions, Iterating over a directory, Directory functions, Directory functions
737*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
738*6a54128fSAndroid Build Coastguard Worker@subsection Directory block functions
739*6a54128fSAndroid Build Coastguard Worker
740*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_read_dir_block (ext2_filsys @var{fs}, blk_t @var{block}, void *@var{buf})
741*6a54128fSAndroid Build Coastguard Worker
742*6a54128fSAndroid Build Coastguard WorkerThis function reads a directory block, performing
743*6a54128fSAndroid Build Coastguard Workerbyte swapping if necessary.
744*6a54128fSAndroid Build Coastguard Worker@end deftypefun
745*6a54128fSAndroid Build Coastguard Worker
746*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_write_dir_block (ext2_filsys @var{fs}, blk_t @var{block}, void *@var{buf})
747*6a54128fSAndroid Build Coastguard Worker
748*6a54128fSAndroid Build Coastguard WorkerThis function writes a directory block, performing
749*6a54128fSAndroid Build Coastguard Workerbyte swapping if necessary.
750*6a54128fSAndroid Build Coastguard Worker@end deftypefun
751*6a54128fSAndroid Build Coastguard Worker
752*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_new_dir_block (ext2_filsys @var{fs}, ext2_ino_t @var{dir_ino}, ext2_ino_t @var{parent_ino}, char **@var{block})
753*6a54128fSAndroid Build Coastguard Worker
754*6a54128fSAndroid Build Coastguard WorkerThis function creates a new directory block in @var{block}.  If
755*6a54128fSAndroid Build Coastguard Worker@var{dir_ino} is non-zero, then @var{dir_ino} and @var{parent_ino} are used
756*6a54128fSAndroid Build Coastguard Workerto initialize directory entries for @file{.} and @file{..}, respectively.
757*6a54128fSAndroid Build Coastguard Worker@end deftypefun
758*6a54128fSAndroid Build Coastguard Worker
759*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
760*6a54128fSAndroid Build Coastguard Worker
761*6a54128fSAndroid Build Coastguard Worker@node Iterating over a directory, Creating and expanding directories, Directory block functions, Directory functions
762*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
763*6a54128fSAndroid Build Coastguard Worker@subsection Iterating over a directory
764*6a54128fSAndroid Build Coastguard Worker
765*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_dir_iterate (ext2_filsys @var{fs}, ext2_ino_t @var{dir}, int @var{flags}, char *@var{block_buf}, int (*@var{func})(struct ext2_dir_entry *@var{dirent}, int @var{offset}, int @var{blocksize}, char *@var{buf}, void *@var{private}), void *@var{private})
766*6a54128fSAndroid Build Coastguard Worker
767*6a54128fSAndroid Build Coastguard WorkerThis function iterates over all of the directory entries in the
768*6a54128fSAndroid Build Coastguard Workerdirectory @var{dir}, calling the callback function @var{func} for each
769*6a54128fSAndroid Build Coastguard Workerdirectory entry in the directory.  The @var{block_buf} parameter should
770*6a54128fSAndroid Build Coastguard Workereither be NULL, or if the @code{ext2fs_dir_iterate} function is
771*6a54128fSAndroid Build Coastguard Workercalled repeatedly, the overhead of allocating and freeing
772*6a54128fSAndroid Build Coastguard Workerscratch memory can be avoided by passing a pointer to a scratch buffer
773*6a54128fSAndroid Build Coastguard Workerwhich must be at least as big as the filesystem's blocksize.
774*6a54128fSAndroid Build Coastguard Worker
775*6a54128fSAndroid Build Coastguard WorkerThe @var{flags} parameter controls how the iterator will function:
776*6a54128fSAndroid Build Coastguard Worker
777*6a54128fSAndroid Build Coastguard Worker@table @samp
778*6a54128fSAndroid Build Coastguard Worker
779*6a54128fSAndroid Build Coastguard Worker@item DIRENT_FLAG_INCLUDE_EMPTY
780*6a54128fSAndroid Build Coastguard Worker
781*6a54128fSAndroid Build Coastguard WorkerThis flag indicates that the callback function should be called even
782*6a54128fSAndroid Build Coastguard Workerfor deleted or empty directory entries.
783*6a54128fSAndroid Build Coastguard Worker
784*6a54128fSAndroid Build Coastguard Worker@end table
785*6a54128fSAndroid Build Coastguard Worker
786*6a54128fSAndroid Build Coastguard Worker@end deftypefun
787*6a54128fSAndroid Build Coastguard Worker
788*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
789*6a54128fSAndroid Build Coastguard Worker
790*6a54128fSAndroid Build Coastguard Worker@node Creating and expanding directories, Creating and removing directory entries, Iterating over a directory, Directory functions
791*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
792*6a54128fSAndroid Build Coastguard Worker@subsection Creating and expanding directories
793*6a54128fSAndroid Build Coastguard Worker
794*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_mkdir (ext2_filsys @var{fs}, ext2_ino_t @var{parent}, ext2_ino_t @var{inum}, const char *@var{name})
795*6a54128fSAndroid Build Coastguard Worker
796*6a54128fSAndroid Build Coastguard WorkerThis function creates a new directory.  If @var{inum} is zero, then a
797*6a54128fSAndroid Build Coastguard Workernew inode will be allocated; otherwise, the directory will be created in
798*6a54128fSAndroid Build Coastguard Workerthe inode specified by @var{inum}.  If @var{name} specifies the name of
799*6a54128fSAndroid Build Coastguard Workerthe new directory; if it is non-NULL, then the new directory will be
800*6a54128fSAndroid Build Coastguard Workerlinked into the parent directory @var{parent}.
801*6a54128fSAndroid Build Coastguard Worker@end deftypefun
802*6a54128fSAndroid Build Coastguard Worker
803*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_expand_dir (ext2_filsys @var{fs}, ext2_ino_t @var{dir})
804*6a54128fSAndroid Build Coastguard Worker
805*6a54128fSAndroid Build Coastguard WorkerThis function adds a new empty directory block and appends it to
806*6a54128fSAndroid Build Coastguard Workerthe directory @var{dir}.  This allows functions such as
807*6a54128fSAndroid Build Coastguard Worker@code{ext2fs_link} to add new directory entries to a directory which is full.
808*6a54128fSAndroid Build Coastguard Worker
809*6a54128fSAndroid Build Coastguard Worker@end deftypefun
810*6a54128fSAndroid Build Coastguard Worker
811*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
812*6a54128fSAndroid Build Coastguard Worker
813*6a54128fSAndroid Build Coastguard Worker@node Creating and removing directory entries, Looking up filenames, Creating and expanding directories, Directory functions
814*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
815*6a54128fSAndroid Build Coastguard Worker@subsection Creating and removing directory entries
816*6a54128fSAndroid Build Coastguard Worker
817*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_link (ext2_filsys @var{fs}, ext2_ino_t @var{dir}, const char *@var{name}, ext2_ino_t @var{ino}, int flags)
818*6a54128fSAndroid Build Coastguard Worker
819*6a54128fSAndroid Build Coastguard WorkerThis function adds a new directory entry to the directory @var{dir},
820*6a54128fSAndroid Build Coastguard Workerwith @var{name} and @var{ino} specifying the name and inode number in
821*6a54128fSAndroid Build Coastguard Workerthe directory entry, respectively.
822*6a54128fSAndroid Build Coastguard Worker
823*6a54128fSAndroid Build Coastguard WorkerThe low 3 bits of the flags field is used to specify the file type of
824*6a54128fSAndroid Build Coastguard Workerinode:   (No other flags are currently defined.)
825*6a54128fSAndroid Build Coastguard Worker
826*6a54128fSAndroid Build Coastguard Worker@table @samp
827*6a54128fSAndroid Build Coastguard Worker
828*6a54128fSAndroid Build Coastguard Worker@item EXT2_FT_UNKNOWN
829*6a54128fSAndroid Build Coastguard Worker
830*6a54128fSAndroid Build Coastguard WorkerThe file type is unknown.
831*6a54128fSAndroid Build Coastguard Worker
832*6a54128fSAndroid Build Coastguard Worker@item EXT2_FT_REG_FILE
833*6a54128fSAndroid Build Coastguard Worker
834*6a54128fSAndroid Build Coastguard WorkerThe file type is a normal file.
835*6a54128fSAndroid Build Coastguard Worker
836*6a54128fSAndroid Build Coastguard Worker@item EXT2_FT_DIR
837*6a54128fSAndroid Build Coastguard Worker
838*6a54128fSAndroid Build Coastguard WorkerThe file type is a directory.
839*6a54128fSAndroid Build Coastguard Worker
840*6a54128fSAndroid Build Coastguard Worker@item EXT2_FT_CHRDEV
841*6a54128fSAndroid Build Coastguard Worker
842*6a54128fSAndroid Build Coastguard WorkerThe file type is a character device.
843*6a54128fSAndroid Build Coastguard Worker
844*6a54128fSAndroid Build Coastguard Worker@item EXT2_FT_BLKDEV
845*6a54128fSAndroid Build Coastguard Worker
846*6a54128fSAndroid Build Coastguard WorkerThe file type is a block device.
847*6a54128fSAndroid Build Coastguard Worker
848*6a54128fSAndroid Build Coastguard Worker@item EXT2_FT_FIFO
849*6a54128fSAndroid Build Coastguard Worker
850*6a54128fSAndroid Build Coastguard WorkerThe file type is a named pipe.
851*6a54128fSAndroid Build Coastguard Worker
852*6a54128fSAndroid Build Coastguard Worker@item EXT2_FT_SOCK
853*6a54128fSAndroid Build Coastguard Worker
854*6a54128fSAndroid Build Coastguard WorkerThe file type is a unix domain socket.
855*6a54128fSAndroid Build Coastguard Worker
856*6a54128fSAndroid Build Coastguard Worker@item EXT2_FT_SYMLINK
857*6a54128fSAndroid Build Coastguard Worker
858*6a54128fSAndroid Build Coastguard WorkerThe file type is a symbolic link.
859*6a54128fSAndroid Build Coastguard Worker@end table
860*6a54128fSAndroid Build Coastguard Worker
861*6a54128fSAndroid Build Coastguard Worker@end deftypefun
862*6a54128fSAndroid Build Coastguard Worker
863*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_unlink (ext2_filsys @var{fs}, ext2_ino_t @var{dir}, const char *@var{name}, ext2_ino_t @var{ino}, int @var{flags})
864*6a54128fSAndroid Build Coastguard Worker
865*6a54128fSAndroid Build Coastguard WorkerThis function removes a directory entry from @var{dir}.
866*6a54128fSAndroid Build Coastguard WorkerThe directory entry to be removed is the first one which is
867*6a54128fSAndroid Build Coastguard Workermatched by @var{name} and @var{ino}.  If @var{name} is non-NULL,
868*6a54128fSAndroid Build Coastguard Workerthe directory entry's name must match @var{name}.  If @var{ino} is
869*6a54128fSAndroid Build Coastguard Workernon-zero, the directory entry's inode number must match @var{ino}.
870*6a54128fSAndroid Build Coastguard WorkerNo flags are currently defined for @code{ext2fs_unlink}; callers should
871*6a54128fSAndroid Build Coastguard Workerpass in zero to this parameter.
872*6a54128fSAndroid Build Coastguard Worker
873*6a54128fSAndroid Build Coastguard Worker@end deftypefun
874*6a54128fSAndroid Build Coastguard Worker
875*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
876*6a54128fSAndroid Build Coastguard Worker
877*6a54128fSAndroid Build Coastguard Worker@node Looking up filenames, Translating inode numbers to filenames, Creating and removing directory entries, Directory functions
878*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
879*6a54128fSAndroid Build Coastguard Worker@subsection Looking up filenames
880*6a54128fSAndroid Build Coastguard Worker
881*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_lookup (ext2_filsys @var{fs}, ext2_ino_t @var{dir}, const char *@var{name}, int @var{namelen}, char *@var{buf}, ext2_ino_t *@var{inode})
882*6a54128fSAndroid Build Coastguard Worker@end deftypefun
883*6a54128fSAndroid Build Coastguard Worker
884*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_namei (ext2_filsys @var{fs}, ext2_ino_t @var{root}, ext2_ino_t @var{cwd}, const char *@var{name}, ext2_ino_t *@var{inode})
885*6a54128fSAndroid Build Coastguard Worker@end deftypefun
886*6a54128fSAndroid Build Coastguard Worker
887*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_namei_follow (ext2_filsys @var{fs}, ext2_ino_t @var{root}, ext2_ino_t @var{cwd}, const char *@var{name}, ext2_ino_t *@var{inode})
888*6a54128fSAndroid Build Coastguard Worker@end deftypefun
889*6a54128fSAndroid Build Coastguard Worker
890*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_follow_link (ext2_filsys @var{fs}, ext2_ino_t @var{root}, ext2_ino_t @var{cwd}, ext2_ino_t @var{inode}, ext2_ino_t *@var{res}_inode)
891*6a54128fSAndroid Build Coastguard Worker@end deftypefun
892*6a54128fSAndroid Build Coastguard Worker
893*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
894*6a54128fSAndroid Build Coastguard Worker
895*6a54128fSAndroid Build Coastguard Worker@node Translating inode numbers to filenames,  , Looking up filenames, Directory functions
896*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
897*6a54128fSAndroid Build Coastguard Worker@subsection Translating inode numbers to filenames
898*6a54128fSAndroid Build Coastguard Worker
899*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_get_pathname (ext2_filsys @var{fs}, ext2_ino_t @var{dir}, ext2_ino_t @var{ino}, char **@var{name})
900*6a54128fSAndroid Build Coastguard Worker@end deftypefun
901*6a54128fSAndroid Build Coastguard Worker
902*6a54128fSAndroid Build Coastguard Worker
903*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
904*6a54128fSAndroid Build Coastguard Worker
905*6a54128fSAndroid Build Coastguard Worker@node Bitmap Functions, EXT2 data abstractions, Directory functions, EXT2FS Library Functions
906*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
907*6a54128fSAndroid Build Coastguard Worker@section Bitmap Functions
908*6a54128fSAndroid Build Coastguard Worker
909*6a54128fSAndroid Build Coastguard Worker@menu
910*6a54128fSAndroid Build Coastguard Worker* Reading and Writing Bitmaps::
911*6a54128fSAndroid Build Coastguard Worker* Allocating Bitmaps::
912*6a54128fSAndroid Build Coastguard Worker* Free bitmaps::
913*6a54128fSAndroid Build Coastguard Worker* Bitmap Operations::
914*6a54128fSAndroid Build Coastguard Worker* Comparing bitmaps::
915*6a54128fSAndroid Build Coastguard Worker* Modifying Bitmaps::
916*6a54128fSAndroid Build Coastguard Worker* Resizing Bitmaps::
917*6a54128fSAndroid Build Coastguard Worker* Clearing Bitmaps::
918*6a54128fSAndroid Build Coastguard Worker@end menu
919*6a54128fSAndroid Build Coastguard Worker
920*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
921*6a54128fSAndroid Build Coastguard Worker
922*6a54128fSAndroid Build Coastguard Worker@node Reading and Writing Bitmaps, Allocating Bitmaps, Bitmap Functions, Bitmap Functions
923*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
924*6a54128fSAndroid Build Coastguard Worker@subsection Reading and Writing Bitmaps
925*6a54128fSAndroid Build Coastguard Worker
926*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_write_inode_bitmap (ext2_filsys @var{fs})
927*6a54128fSAndroid Build Coastguard Worker@end deftypefun
928*6a54128fSAndroid Build Coastguard Worker
929*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_write_block_bitmap (ext2_filsys @var{fs})
930*6a54128fSAndroid Build Coastguard Worker@end deftypefun
931*6a54128fSAndroid Build Coastguard Worker
932*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_read_inode_bitmap (ext2_filsys @var{fs})
933*6a54128fSAndroid Build Coastguard Worker@end deftypefun
934*6a54128fSAndroid Build Coastguard Worker
935*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_read_block_bitmap (ext2_filsys @var{fs})
936*6a54128fSAndroid Build Coastguard Worker@end deftypefun
937*6a54128fSAndroid Build Coastguard Worker
938*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_read_bitmaps (ext2_filsys @var{fs})
939*6a54128fSAndroid Build Coastguard Worker@end deftypefun
940*6a54128fSAndroid Build Coastguard Worker
941*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_write_bitmaps (ext2_filsys @var{fs})
942*6a54128fSAndroid Build Coastguard Worker@end deftypefun
943*6a54128fSAndroid Build Coastguard Worker
944*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
945*6a54128fSAndroid Build Coastguard Worker
946*6a54128fSAndroid Build Coastguard Worker@node Allocating Bitmaps, Free bitmaps, Reading and Writing Bitmaps, Bitmap Functions
947*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
948*6a54128fSAndroid Build Coastguard Worker@subsection Allocating Bitmaps
949*6a54128fSAndroid Build Coastguard Worker
950*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_allocate_generic_bitmap (__u32 @var{start}, __u32 @var{end}, _u32 @var{real_end}, const char *@var{descr}, ext2fs_generic_bitmap *@var{ret})
951*6a54128fSAndroid Build Coastguard Worker@end deftypefun
952*6a54128fSAndroid Build Coastguard Worker
953*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_allocate_block_bitmap (ext2_filsys @var{fs}, const char *@var{descr}, ext2fs_block_bitmap *@var{ret})
954*6a54128fSAndroid Build Coastguard Worker@end deftypefun
955*6a54128fSAndroid Build Coastguard Worker
956*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_allocate_inode_bitmap (ext2_filsys @var{fs}, const char *@var{descr}, ext2fs_inode_bitmap *@var{ret})
957*6a54128fSAndroid Build Coastguard Worker@end deftypefun
958*6a54128fSAndroid Build Coastguard Worker
959*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
960*6a54128fSAndroid Build Coastguard Worker
961*6a54128fSAndroid Build Coastguard Worker@node Free bitmaps, Bitmap Operations, Allocating Bitmaps, Bitmap Functions
962*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
963*6a54128fSAndroid Build Coastguard Worker@subsection Freeing bitmaps
964*6a54128fSAndroid Build Coastguard Worker
965*6a54128fSAndroid Build Coastguard Worker
966*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_free_generic_bitmap (ext2fs_inode_bitmap @var{bitmap})
967*6a54128fSAndroid Build Coastguard Worker@end deftypefun
968*6a54128fSAndroid Build Coastguard Worker
969*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_free_block_bitmap (ext2fs_block_bitmap @var{bitmap})
970*6a54128fSAndroid Build Coastguard Worker@end deftypefun
971*6a54128fSAndroid Build Coastguard Worker
972*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_free_inode_bitmap (ext2fs_inode_bitmap @var{bitmap})
973*6a54128fSAndroid Build Coastguard Worker@end deftypefun
974*6a54128fSAndroid Build Coastguard Worker
975*6a54128fSAndroid Build Coastguard Worker
976*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
977*6a54128fSAndroid Build Coastguard Worker
978*6a54128fSAndroid Build Coastguard Worker@node Bitmap Operations, Comparing bitmaps, Free bitmaps, Bitmap Functions
979*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
980*6a54128fSAndroid Build Coastguard Worker@subsection Bitmap Operations
981*6a54128fSAndroid Build Coastguard Worker
982*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_mark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block})
983*6a54128fSAndroid Build Coastguard Worker
984*6a54128fSAndroid Build Coastguard Worker@deftypefunx void ext2fs_unmark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block})
985*6a54128fSAndroid Build Coastguard Worker
986*6a54128fSAndroid Build Coastguard Worker@deftypefunx int ext2fs_test_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block})
987*6a54128fSAndroid Build Coastguard Worker
988*6a54128fSAndroid Build Coastguard WorkerThese functions set, clear, and test bits in a block bitmap @var{bitmap}.
989*6a54128fSAndroid Build Coastguard Worker@end deftypefun
990*6a54128fSAndroid Build Coastguard Worker
991*6a54128fSAndroid Build Coastguard Worker
992*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_mark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ext2_ino_t @var{inode})
993*6a54128fSAndroid Build Coastguard Worker
994*6a54128fSAndroid Build Coastguard Worker@deftypefunx void ext2fs_unmark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ext2_ino_t @var{inode})
995*6a54128fSAndroid Build Coastguard Worker
996*6a54128fSAndroid Build Coastguard Worker@deftypefunx int ext2fs_test_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ext2_ino_t @var{inode})
997*6a54128fSAndroid Build Coastguard Worker
998*6a54128fSAndroid Build Coastguard WorkerThese functions set, clear, and test bits in an inode bitmap @var{bitmap}.
999*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1000*6a54128fSAndroid Build Coastguard Worker
1001*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_fast_mark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block})
1002*6a54128fSAndroid Build Coastguard Worker
1003*6a54128fSAndroid Build Coastguard Worker@deftypefunx void ext2fs_fast_unmark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block})
1004*6a54128fSAndroid Build Coastguard Worker
1005*6a54128fSAndroid Build Coastguard Worker@deftypefunx int ext2fs_fast_test_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block})
1006*6a54128fSAndroid Build Coastguard Worker
1007*6a54128fSAndroid Build Coastguard Worker@deftypefunx void ext2fs_fast_mark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ext2_ino_t @var{inode})
1008*6a54128fSAndroid Build Coastguard Worker
1009*6a54128fSAndroid Build Coastguard Worker@deftypefunx void ext2fs_fast_unmark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ext2_ino_t @var{inode})
1010*6a54128fSAndroid Build Coastguard Worker
1011*6a54128fSAndroid Build Coastguard Worker@deftypefunx int ext2fs_fast_test_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ext2_ino_t @var{inode})
1012*6a54128fSAndroid Build Coastguard Worker
1013*6a54128fSAndroid Build Coastguard WorkerThese ``fast'' functions are like their normal counterparts; however,
1014*6a54128fSAndroid Build Coastguard Workerthey are implemented as inline functions and do not perform bounds
1015*6a54128fSAndroid Build Coastguard Workerchecks on the inode number or block number; they are assumed to be
1016*6a54128fSAndroid Build Coastguard Workercorrect.  They should only be used in speed-critical applications, where
1017*6a54128fSAndroid Build Coastguard Workerthe inode or block number has already been validated by other means.
1018*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1019*6a54128fSAndroid Build Coastguard Worker
1020*6a54128fSAndroid Build Coastguard Worker@deftypefun blk_t ext2fs_get_block_bitmap_start (ext2fs_block_bitmap @var{bitmap})
1021*6a54128fSAndroid Build Coastguard Worker@deftypefunx ext2_ino_t ext2fs_get_inode_bitmap_start (ext2fs_inode_bitmap @var{bitmap})
1022*6a54128fSAndroid Build Coastguard WorkerReturn the first inode or block which is stored in the bitmap.
1023*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1024*6a54128fSAndroid Build Coastguard Worker
1025*6a54128fSAndroid Build Coastguard Worker@deftypefun blk_t ext2fs_get_block_bitmap_end (ext2fs_block_bitmap @var{bitmap})
1026*6a54128fSAndroid Build Coastguard Worker@deftypefunx ext2_ino_t ext2fs_get_inode_bitmap_end (ext2fs_inode_bitmap @var{bitmap})
1027*6a54128fSAndroid Build Coastguard Worker
1028*6a54128fSAndroid Build Coastguard WorkerReturn the last inode or block which is stored in the bitmap.
1029*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1030*6a54128fSAndroid Build Coastguard Worker
1031*6a54128fSAndroid Build Coastguard Worker
1032*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
1033*6a54128fSAndroid Build Coastguard Worker
1034*6a54128fSAndroid Build Coastguard Worker@node Comparing bitmaps, Modifying Bitmaps, Bitmap Operations, Bitmap Functions
1035*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
1036*6a54128fSAndroid Build Coastguard Worker@subsection Comparing bitmaps
1037*6a54128fSAndroid Build Coastguard Worker
1038*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_compare_block_bitmap (ext2fs_block_bitmap @var{bm1}, ext2fs_block_bitmap @var{bm2})
1039*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1040*6a54128fSAndroid Build Coastguard Worker
1041*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_compare_inode_bitmap (ext2fs_inode_bitmap @var{bm1}, ext2fs_inode_bitmap @var{bm2})
1042*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1043*6a54128fSAndroid Build Coastguard Worker
1044*6a54128fSAndroid Build Coastguard Worker
1045*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
1046*6a54128fSAndroid Build Coastguard Worker
1047*6a54128fSAndroid Build Coastguard Worker@node Modifying Bitmaps, Resizing Bitmaps, Comparing bitmaps, Bitmap Functions
1048*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
1049*6a54128fSAndroid Build Coastguard Worker@subsection Modifying Bitmaps
1050*6a54128fSAndroid Build Coastguard Worker
1051*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_fudge_inode_bitmap_end (ext2fs_inode_bitmap @var{bitmap}, ext2_ino_t @var{end}, ext2_ino_t *@var{oend})
1052*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1053*6a54128fSAndroid Build Coastguard Worker
1054*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_fudge_block_bitmap_end (ext2fs_block_bitmap @var{bitmap}, blk_t @var{end}, blk_t *@var{oend})
1055*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1056*6a54128fSAndroid Build Coastguard Worker
1057*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
1058*6a54128fSAndroid Build Coastguard Worker
1059*6a54128fSAndroid Build Coastguard Worker@node Resizing Bitmaps, Clearing Bitmaps, Modifying Bitmaps, Bitmap Functions
1060*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
1061*6a54128fSAndroid Build Coastguard Worker@subsection Resizing Bitmaps
1062*6a54128fSAndroid Build Coastguard Worker
1063*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_resize_generic_bitmap (__u32 @var{new_end}, __u32 @var{new_real_end}, ext2fs_generic_bitmap @var{bmap})
1064*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1065*6a54128fSAndroid Build Coastguard Worker
1066*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_resize_inode_bitmap (__u32 @var{new_end}, __u32 @var{new_real_end}, ext2fs_inode_bitmap @var{bmap})
1067*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1068*6a54128fSAndroid Build Coastguard Worker
1069*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_resize_block_bitmap (__u32 @var{new_end}, __u32 @var{new_real_end}, ext2fs_block_bitmap @var{bmap})
1070*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1071*6a54128fSAndroid Build Coastguard Worker
1072*6a54128fSAndroid Build Coastguard Worker
1073*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
1074*6a54128fSAndroid Build Coastguard Worker
1075*6a54128fSAndroid Build Coastguard Worker@node Clearing Bitmaps,  , Resizing Bitmaps, Bitmap Functions
1076*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
1077*6a54128fSAndroid Build Coastguard Worker@subsection Clearing Bitmaps
1078*6a54128fSAndroid Build Coastguard Worker
1079*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_clear_inode_bitmap (ext2fs_inode_bitmap @var{bitmap})
1080*6a54128fSAndroid Build Coastguard Worker
1081*6a54128fSAndroid Build Coastguard WorkerThis function sets all of the bits in the inode bitmap @var{bitmap} to
1082*6a54128fSAndroid Build Coastguard Workerbe zero.
1083*6a54128fSAndroid Build Coastguard Worker
1084*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1085*6a54128fSAndroid Build Coastguard Worker
1086*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_clear_block_bitmap (ext2fs_block_bitmap @var{bitmap})
1087*6a54128fSAndroid Build Coastguard Worker
1088*6a54128fSAndroid Build Coastguard WorkerThis function sets all of the bits in the block bitmap @var{bitmap} to
1089*6a54128fSAndroid Build Coastguard Workerbe zero.
1090*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1091*6a54128fSAndroid Build Coastguard Worker
1092*6a54128fSAndroid Build Coastguard Worker
1093*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
1094*6a54128fSAndroid Build Coastguard Worker
1095*6a54128fSAndroid Build Coastguard Worker@node EXT2 data abstractions, Byte-swapping functions, Bitmap Functions, EXT2FS Library Functions
1096*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
1097*6a54128fSAndroid Build Coastguard Worker@section EXT2 data abstractions
1098*6a54128fSAndroid Build Coastguard Worker
1099*6a54128fSAndroid Build Coastguard WorkerThe ext2 library has a number of abstractions which are useful for ext2
1100*6a54128fSAndroid Build Coastguard Workerutility programs.
1101*6a54128fSAndroid Build Coastguard Worker
1102*6a54128fSAndroid Build Coastguard Worker@menu
1103*6a54128fSAndroid Build Coastguard Worker* Badblocks list management::
1104*6a54128fSAndroid Build Coastguard Worker* Directory-block list management::
1105*6a54128fSAndroid Build Coastguard Worker* Inode count functions::
1106*6a54128fSAndroid Build Coastguard Worker@end menu
1107*6a54128fSAndroid Build Coastguard Worker
1108*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
1109*6a54128fSAndroid Build Coastguard Worker
1110*6a54128fSAndroid Build Coastguard Worker@node Badblocks list management, Directory-block list management, EXT2 data abstractions, EXT2 data abstractions
1111*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
1112*6a54128fSAndroid Build Coastguard Worker@subsection Badblocks list management
1113*6a54128fSAndroid Build Coastguard Worker
1114*6a54128fSAndroid Build Coastguard Worker
1115*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_badblocks_list_create (ext2_badblocks_list *@var{ret}, int @var{size})
1116*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1117*6a54128fSAndroid Build Coastguard Worker
1118*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_badblocks_list_free (ext2_badblocks_list @var{bb})
1119*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1120*6a54128fSAndroid Build Coastguard Worker
1121*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_badblocks_list_add (ext2_badblocks_list @var{bb}, blk_t @var{blk})
1122*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1123*6a54128fSAndroid Build Coastguard Worker
1124*6a54128fSAndroid Build Coastguard Worker@deftypefun int ext2fs_badblocks_list_test (ext2_badblocks_list @var{bb}, blk_t @var{blk})
1125*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1126*6a54128fSAndroid Build Coastguard Worker
1127*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_badblocks_list_iterate_begin (ext2_badblocks_list @var{bb}, ext2_badblocks_iterate *@var{ret})
1128*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1129*6a54128fSAndroid Build Coastguard Worker
1130*6a54128fSAndroid Build Coastguard Worker@deftypefun int ext2fs_badblocks_list_iterate (ext2_badblocks_iterate iter, blk_t *@var{blk})
1131*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1132*6a54128fSAndroid Build Coastguard Worker
1133*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_badblocks_list_iterate_end (ext2_badblocks_iterate @var{iter})
1134*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1135*6a54128fSAndroid Build Coastguard Worker
1136*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_update_bb_inode (ext2_filsys @var{fs}, ext2_badblocks_list @var{bb_list})
1137*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1138*6a54128fSAndroid Build Coastguard Worker
1139*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_read_bb_inode (ext2_filsys @var{fs}, ext2_badblocks_list *@var{bb_list})
1140*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1141*6a54128fSAndroid Build Coastguard Worker
1142*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_read_bb_FILE (ext2_filsys @var{fs}, FILE *f, ext2_badblocks_list *@var{bb_list}, void (*invalid)(ext2_filsys @var{fs}, blk_t @var{blk}))
1143*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1144*6a54128fSAndroid Build Coastguard Worker
1145*6a54128fSAndroid Build Coastguard Worker
1146*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
1147*6a54128fSAndroid Build Coastguard Worker
1148*6a54128fSAndroid Build Coastguard Worker@node Directory-block list management, Inode count functions, Badblocks list management, EXT2 data abstractions
1149*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
1150*6a54128fSAndroid Build Coastguard Worker@subsection Directory-block list management
1151*6a54128fSAndroid Build Coastguard Worker
1152*6a54128fSAndroid Build Coastguard WorkerThe dblist abstraction stores a list of blocks belonging to
1153*6a54128fSAndroid Build Coastguard Workerdirectories.  This list can be useful when a program needs to iterate
1154*6a54128fSAndroid Build Coastguard Workerover all directory entries in a filesystem; @code{e2fsck} does this in
1155*6a54128fSAndroid Build Coastguard Workerpass 2 of its operations, and @code{debugfs} needs to do this when it is
1156*6a54128fSAndroid Build Coastguard Workertrying to turn an inode number into a pathname.
1157*6a54128fSAndroid Build Coastguard Worker
1158*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_init_dblist (ext2_filsys @var{fs}, ext2_dblist *@var{ret_dblist})
1159*6a54128fSAndroid Build Coastguard Worker
1160*6a54128fSAndroid Build Coastguard WorkerCreates a dblist data structure and returns it in @var{ret_dblist}.
1161*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1162*6a54128fSAndroid Build Coastguard Worker
1163*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_free_dblist (ext2_dblist @var{dblist})
1164*6a54128fSAndroid Build Coastguard Worker
1165*6a54128fSAndroid Build Coastguard WorkerFree a dblist data structure.
1166*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1167*6a54128fSAndroid Build Coastguard Worker
1168*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_add_dir_block (ext2_dblist @var{dblist}, ext2_ino_t @var{ino}, blk_t @var{blk}, int @var{blockcnt})
1169*6a54128fSAndroid Build Coastguard Worker
1170*6a54128fSAndroid Build Coastguard WorkerAdd an entry to the dblist data structure.  This call records the fact
1171*6a54128fSAndroid Build Coastguard Workerthat block number @var{blockcnt} of directory inode @var{ino} is stored
1172*6a54128fSAndroid Build Coastguard Workerin block @var{blk}.
1173*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1174*6a54128fSAndroid Build Coastguard Worker
1175*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_set_dir_block (ext2_dblist @var{dblist}, ext2_ino_t @var{ino}, blk_t @var{blk}, int @var{blockcnt})
1176*6a54128fSAndroid Build Coastguard Worker
1177*6a54128fSAndroid Build Coastguard WorkerChange an entry in the dblist data structure; this changes the location
1178*6a54128fSAndroid Build Coastguard Workerof block number @var{blockcnt} of directory inode @var{ino} to be block
1179*6a54128fSAndroid Build Coastguard Worker@var{blk}.
1180*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1181*6a54128fSAndroid Build Coastguard Worker
1182*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_dblist_iterate (ext2_dblist @var{dblist}, int (*func)(ext2_filsys @var{fs}, struct ext2_db_entry *@var{db_info}, void *@var{private}), void *@var{private})
1183*6a54128fSAndroid Build Coastguard Worker
1184*6a54128fSAndroid Build Coastguard WorkerThis iterator calls @var{func} for every entry in the dblist data structure.
1185*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1186*6a54128fSAndroid Build Coastguard Worker
1187*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_dblist_dir_iterate (ext2_dblist @var{dblist}, int flags, char *@var{block_buf}, int (*func)(ext2_ino_t @var{dir}, int  @var{entry}, struct ext2_dir_entry *@var{dirent}, int @var{offset}, int @var{blocksize}, char *@var{buf}, void *@var{private}), void *@var{private})
1188*6a54128fSAndroid Build Coastguard Worker
1189*6a54128fSAndroid Build Coastguard WorkerThis iterator takes reads in the directory block indicated in each
1190*6a54128fSAndroid Build Coastguard Workerdblist entry, and calls @var{func} for each directory entry in each
1191*6a54128fSAndroid Build Coastguard Workerdirectory block.  If @var{dblist} contains all the directory blocks in a
1192*6a54128fSAndroid Build Coastguard Workerfilesystem, this function provides a convenient way to iterate over all
1193*6a54128fSAndroid Build Coastguard Workerdirectory entries for that filesystem.
1194*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1195*6a54128fSAndroid Build Coastguard Worker
1196*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
1197*6a54128fSAndroid Build Coastguard Worker
1198*6a54128fSAndroid Build Coastguard Worker@node Inode count functions,  , Directory-block list management, EXT2 data abstractions
1199*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
1200*6a54128fSAndroid Build Coastguard Worker@subsection Inode count functions
1201*6a54128fSAndroid Build Coastguard Worker
1202*6a54128fSAndroid Build Coastguard WorkerThe icount abstraction is a specialized data type used by @code{e2fsck}
1203*6a54128fSAndroid Build Coastguard Workerto store how many times a particular inode is referenced by the
1204*6a54128fSAndroid Build Coastguard Workerfilesystem.  This is used twice; once to store the actual number of times
1205*6a54128fSAndroid Build Coastguard Workerthat the inode is reference; and once to store the claimed number of times
1206*6a54128fSAndroid Build Coastguard Workerthe inode is referenced according to the inode structure.
1207*6a54128fSAndroid Build Coastguard Worker
1208*6a54128fSAndroid Build Coastguard WorkerThis abstraction is designed to be extremely efficient for storing this
1209*6a54128fSAndroid Build Coastguard Workersort of information, by taking advantage of the following properties of
1210*6a54128fSAndroid Build Coastguard Workerinode counts, namely (1) inode counts are very often zero (because
1211*6a54128fSAndroid Build Coastguard Workerthe inode is currently not in use), and (2) many files have a inode
1212*6a54128fSAndroid Build Coastguard Workercount of 1 (because they are a file which has no additional hard links).
1213*6a54128fSAndroid Build Coastguard Worker
1214*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_create_icount2 (ext2_filsys @var{fs}, int @var{flags}, int @var{size}, ext2_icount_t @var{hint}, ext2_icount_t *@var{ret})
1215*6a54128fSAndroid Build Coastguard Worker
1216*6a54128fSAndroid Build Coastguard WorkerCreates an icount structure for a filesystem @var{fs}, with initial space
1217*6a54128fSAndroid Build Coastguard Workerfor @var{size} inodes whose count is greater than 1.  The @var{flags}
1218*6a54128fSAndroid Build Coastguard Workerparameter is either 0 or @code{EXT2_ICOUNT_OPT_INCREMENT}, which
1219*6a54128fSAndroid Build Coastguard Workerindicates that icount structure should be able to increment inode counts
1220*6a54128fSAndroid Build Coastguard Workerquickly.  The icount structure is returned in @var{ret}.  The returned
1221*6a54128fSAndroid Build Coastguard Workericount structure initially has a count of zero for all inodes.
1222*6a54128fSAndroid Build Coastguard Worker
1223*6a54128fSAndroid Build Coastguard WorkerThe @var{hint} parameter allows the caller to optionally pass in another
1224*6a54128fSAndroid Build Coastguard Workericount structure which is used to initialize the array of inodes whose
1225*6a54128fSAndroid Build Coastguard Workercount is greater than 1.  It is used purely as a speed optimization so
1226*6a54128fSAndroid Build Coastguard Workerthat the icount structure can determine in advance which inodes are
1227*6a54128fSAndroid Build Coastguard Workerlikely to contain a count grater than 1.
1228*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1229*6a54128fSAndroid Build Coastguard Worker
1230*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_free_icount (ext2_icount_t @var{icount})
1231*6a54128fSAndroid Build Coastguard Worker
1232*6a54128fSAndroid Build Coastguard WorkerFrees an icount structure.
1233*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1234*6a54128fSAndroid Build Coastguard Worker
1235*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_icount_fetch (ext2_icount_t @var{icount}, ext2_ino_t @var{ino}, __u16 *@var{ret})
1236*6a54128fSAndroid Build Coastguard Worker
1237*6a54128fSAndroid Build Coastguard WorkerReturns in @var{ret} the count for a particular inode @var{ino}.
1238*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1239*6a54128fSAndroid Build Coastguard Worker
1240*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_icount_increment (ext2_icount_t @var{icount}, ext2_ino_t @var{ino}, __u16 *@var{ret})
1241*6a54128fSAndroid Build Coastguard Worker
1242*6a54128fSAndroid Build Coastguard WorkerIncrements the ref count for inode @var{ino}.
1243*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1244*6a54128fSAndroid Build Coastguard Worker
1245*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_icount_decrement (ext2_icount_t @var{icount}, ext2_ino_t @var{ino}, __u16 *@var{ret})
1246*6a54128fSAndroid Build Coastguard Worker
1247*6a54128fSAndroid Build Coastguard WorkerDecrements the ref count for inode @var{ino}.
1248*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1249*6a54128fSAndroid Build Coastguard Worker
1250*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_icount_store (ext2_icount_t @var{icount}, ext2_ino_t @var{ino}, __u16 @var{count})
1251*6a54128fSAndroid Build Coastguard Worker
1252*6a54128fSAndroid Build Coastguard WorkerSets the reference count for inode @var{ino} to be @var{count}.
1253*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1254*6a54128fSAndroid Build Coastguard Worker
1255*6a54128fSAndroid Build Coastguard Worker@deftypefun ext2_ino_t ext2fs_get_icount_size (ext2_icount_t @var{icount})
1256*6a54128fSAndroid Build Coastguard Worker
1257*6a54128fSAndroid Build Coastguard WorkerReturns the current number of inodes in @var{icount} which has a count
1258*6a54128fSAndroid Build Coastguard Workergreater than 1.
1259*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1260*6a54128fSAndroid Build Coastguard Worker
1261*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_icount_validate (ext2_icount_t @var{icount}, FILE *@var{f})
1262*6a54128fSAndroid Build Coastguard Worker
1263*6a54128fSAndroid Build Coastguard WorkerValidates the internal rep invariant of @var{icount}; if there are any
1264*6a54128fSAndroid Build Coastguard Workerproblems, print out debugging information to @var{f}.  This function is
1265*6a54128fSAndroid Build Coastguard Workerintended for debugging and testing use only.
1266*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1267*6a54128fSAndroid Build Coastguard Worker
1268*6a54128fSAndroid Build Coastguard Worker
1269*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
1270*6a54128fSAndroid Build Coastguard Worker
1271*6a54128fSAndroid Build Coastguard Worker@node Byte-swapping functions, Other functions, EXT2 data abstractions, EXT2FS Library Functions
1272*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
1273*6a54128fSAndroid Build Coastguard Worker@section Byte-swapping functions
1274*6a54128fSAndroid Build Coastguard Worker
1275*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_swap_super (struct ext2_super_block * @var{super})
1276*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1277*6a54128fSAndroid Build Coastguard Worker
1278*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_swap_group_desc (struct ext2_group_desc *@var{gdp})
1279*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1280*6a54128fSAndroid Build Coastguard Worker
1281*6a54128fSAndroid Build Coastguard Worker@deftypefun void ext2fs_swap_inode (ext2_filsys @var{fs}, struct ext2_inode *@var{to}, struct ext2_inode *@var{from}, int @var{hostorder})
1282*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1283*6a54128fSAndroid Build Coastguard Worker
1284*6a54128fSAndroid Build Coastguard Worker@deftypefun int ext2fs_native_flag (void)
1285*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1286*6a54128fSAndroid Build Coastguard Worker
1287*6a54128fSAndroid Build Coastguard Worker
1288*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
1289*6a54128fSAndroid Build Coastguard Worker
1290*6a54128fSAndroid Build Coastguard Worker@node Other functions,  , Byte-swapping functions, EXT2FS Library Functions
1291*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
1292*6a54128fSAndroid Build Coastguard Worker@section Other functions
1293*6a54128fSAndroid Build Coastguard Worker
1294*6a54128fSAndroid Build Coastguard Worker/* alloc.c */
1295*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_new_inode (ext2_filsys @var{fs}, ext2_ino_t @var{dir}, int @var{mode}, ext2fs_inode_bitmap @var{map}, ext2_ino_t *@var{ret})
1296*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1297*6a54128fSAndroid Build Coastguard Worker
1298*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_new_block (ext2_filsys @var{fs}, blk_t @var{goal}, ext2fs_block_bitmap @var{map}, blk_t *@var{ret})
1299*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1300*6a54128fSAndroid Build Coastguard Worker
1301*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_get_free_blocks (ext2_filsys @var{fs}, blk_t @var{start}, blk_t @var{finish}, int @var{num}, ext2fs_block_bitmap @var{map}, blk_t *@var{ret})
1302*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1303*6a54128fSAndroid Build Coastguard Worker
1304*6a54128fSAndroid Build Coastguard Worker/* check_desc.c */
1305*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_check_desc (ext2_filsys @var{fs})
1306*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1307*6a54128fSAndroid Build Coastguard Worker
1308*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_get_num_dirs (ext2_filsys @var{fs}, ext2_ino_t *@var{ret_num_dirs})
1309*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1310*6a54128fSAndroid Build Coastguard Worker
1311*6a54128fSAndroid Build Coastguard Worker
1312*6a54128fSAndroid Build Coastguard Worker/* getsize.c */
1313*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_get_device_size (const char *@var{file}, int @var{blocksize}, blk_t *@var{retblocks})
1314*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1315*6a54128fSAndroid Build Coastguard Worker
1316*6a54128fSAndroid Build Coastguard Worker
1317*6a54128fSAndroid Build Coastguard Worker/* ismounted.c */
1318*6a54128fSAndroid Build Coastguard Worker@deftypefun errcode_t ext2fs_check_if_mounted (const char *@var{file}, int *@var{mount_flags})
1319*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1320*6a54128fSAndroid Build Coastguard Worker
1321*6a54128fSAndroid Build Coastguard Worker/* version.c */
1322*6a54128fSAndroid Build Coastguard Worker
1323*6a54128fSAndroid Build Coastguard Worker@deftypefun int ext2fs_get_library_version (const char **@var{ver_string}, const char **@var{date_string})
1324*6a54128fSAndroid Build Coastguard Worker
1325*6a54128fSAndroid Build Coastguard WorkerThis function returns the current version of the ext2 library.  The
1326*6a54128fSAndroid Build Coastguard Workerreturn value contains an integer version code, which consists of the
1327*6a54128fSAndroid Build Coastguard Workermajor version number of the library multiplied by 100, plus the minor
1328*6a54128fSAndroid Build Coastguard Workerversion number of the library.  Hence, if the library version is 1.08,
1329*6a54128fSAndroid Build Coastguard Workerthe returned value will be 108.
1330*6a54128fSAndroid Build Coastguard Worker
1331*6a54128fSAndroid Build Coastguard WorkerIf @var{ver_string} and/or @var{date_string} are non-NULL, they will be
1332*6a54128fSAndroid Build Coastguard Workerset to point at a constant string containing the library version and/or
1333*6a54128fSAndroid Build Coastguard Workerrelease date, respectively.
1334*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1335*6a54128fSAndroid Build Coastguard Worker
1336*6a54128fSAndroid Build Coastguard Worker@deftypefun int ext2fs_parse_version_string (const char *@var{ver_string})
1337*6a54128fSAndroid Build Coastguard Worker
1338*6a54128fSAndroid Build Coastguard WorkerThis function takes a version string which may included in an
1339*6a54128fSAndroid Build Coastguard Workerapplication and returns a version code using the same algorithm used by
1340*6a54128fSAndroid Build Coastguard Worker@code{ext2fs_get_library_version}.  It can be used by programs included
1341*6a54128fSAndroid Build Coastguard Workerin the @code{e2fsprogs} distribution to assure that they are using an
1342*6a54128fSAndroid Build Coastguard Workerup-to-date ext2 shared library.
1343*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1344*6a54128fSAndroid Build Coastguard Worker
1345*6a54128fSAndroid Build Coastguard Worker/* inline functions */
1346*6a54128fSAndroid Build Coastguard Worker@deftypefun int ext2fs_group_of_blk (ext2_filsys @var{fs}, blk_t @var{blk})
1347*6a54128fSAndroid Build Coastguard Worker
1348*6a54128fSAndroid Build Coastguard WorkerThis function returns the block group which contains the block @var{blk}.
1349*6a54128fSAndroid Build Coastguard Worker
1350*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1351*6a54128fSAndroid Build Coastguard Worker
1352*6a54128fSAndroid Build Coastguard Worker@deftypefun int ext2fs_group_of_ino (ext2_filsys @var{fs}, ext2_ino_t @var{ino})
1353*6a54128fSAndroid Build Coastguard Worker
1354*6a54128fSAndroid Build Coastguard WorkerThis function returns the block group which contains the inode @var{ino}.
1355*6a54128fSAndroid Build Coastguard Worker@end deftypefun
1356*6a54128fSAndroid Build Coastguard Worker
1357*6a54128fSAndroid Build Coastguard Worker
1358*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
1359*6a54128fSAndroid Build Coastguard Worker
1360*6a54128fSAndroid Build Coastguard Worker@node Concept Index, Function Index, EXT2FS Library Functions, Top
1361*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
1362*6a54128fSAndroid Build Coastguard Worker@unnumbered Concept Index
1363*6a54128fSAndroid Build Coastguard Worker@printindex cp
1364*6a54128fSAndroid Build Coastguard Worker
1365*6a54128fSAndroid Build Coastguard Worker@c ----------------------------------------------------------------------
1366*6a54128fSAndroid Build Coastguard Worker
1367*6a54128fSAndroid Build Coastguard Worker@node Function Index,  , Concept Index, Top
1368*6a54128fSAndroid Build Coastguard Worker@comment  node-name,  next,  previous,  up
1369*6a54128fSAndroid Build Coastguard Worker@unnumbered Function and Type Index
1370*6a54128fSAndroid Build Coastguard Worker@printindex fn
1371*6a54128fSAndroid Build Coastguard Worker
1372*6a54128fSAndroid Build Coastguard Worker
1373*6a54128fSAndroid Build Coastguard Worker@contents
1374*6a54128fSAndroid Build Coastguard Worker@bye
1375