blob: 9769985e85d412bb9a5684fa5aa4b3d1f6bfbf7b [file] [log] [blame]
Theodore Ts'o21c84b71997-04-29 16:15:03 +00001\input texinfo @c -*-texinfo-*-
2@c %**start of header
3@setfilename libext2fs.info
4@settitle The EXT2FS Library (version 1.07)
5@synindex tp fn
6@comment %**end of header
7
8@ifinfo
9@format
10START-INFO-DIR-ENTRY
11* libext2fs: (libext2fs.info). The EXT2FS library.
12END-INFO-DIR-ENTRY
13@end format
14@end ifinfo
15
16@c smallbook
17
18@iftex
19@finalout
20@end iftex
21
22@c Note: the edition number is listed in *three* places; please update
23@c all three. Also, update the month and year where appropriate.
24
25@c ==> Update edition number for settitle and subtitle, and in the
26@c ==> following paragraph; update date, too.
27
28
29@ifinfo
30This file documents the ext2fs library, a library for manipulating the
31ext2 filesystem.
32
33Copyright (C) 1997 Theodore Ts'o
34
35Permission is granted to make and distribute verbatim copies of
36this manual provided the copyright notice and this permission notice
37are preserved on all copies.
38
39@ignore
40Permission is granted to process this file through TeX and print the
41results, provided the printed document carries copying permission
42notice identical to this one except for the removal of this paragraph
43(this paragraph not being relevant to the printed manual).
44
45@end ignore
46Permission is granted to copy and distribute modified versions of this
47manual under the conditions for verbatim copying, provided that the entire
48resulting derived work is distributed under the terms of a permission
49notice identical to this one.
50
51Permission is granted to copy and distribute translations of this manual
52into another language, under the above conditions for modified versions,
53except that this permission notice may be stated in a translation approved
54by the author.
55@end ifinfo
56
57@setchapternewpage on
58@titlepage
59@c use the new format for titles
60
61@title The EXT2FS Library
62@subtitle The EXT2FS Library
63@subtitle Version 1.07
64@subtitle February 1997
65
66@author by Theodore Ts'o
67
68@c Include the Distribution inside the titlepage so
69@c that headings are turned off.
70
71@tex
72\global\parindent=0pt
73\global\parskip=8pt
74\global\baselineskip=13pt
75@end tex
76
77@page
78@vskip 0pt plus 1filll
79Copyright @copyright{} 1997 Theodore Ts'o
80
81@sp 2
82
83Permission is granted to make and distribute verbatim copies of
84this manual provided the copyright notice and this permission notice
85are preserved on all copies.
86
87Permission is granted to copy and distribute modified versions of this
88manual under the conditions for verbatim copying, provided that the entire
89resulting derived work is distributed under the terms of a permission
90notice identical to this one.
91
92Permission is granted to copy and distribute translations of this manual
93into another language, under the above conditions for modified versions,
94except that this permission notice may be stated in a translation approved
95by the Foundation.
96@end titlepage
97@headings double
98
99@ifinfo
100@node Top, Introduction to the EXT2FS Library, (dir), (dir)
101
102@top The EXT2FS Library
103
104This manual documents the EXT2FS Library, version 1.07.
105
106@end ifinfo
107
108@menu
109* Introduction to the EXT2FS Library::
110* EXT2FS Library Functions::
111* Concept Index::
112* Function Index::
113@end menu
114
115@c ----------------------------------------------------------------------
116
117@node Introduction to the EXT2FS Library, EXT2FS Library Functions, Top, Top
118@comment node-name, next, previous, up
119@chapter Introduction to the EXT2FS Library
120
121The EXT2FS library is designed to allow user-level programs to
122manipulate an ext2 filesystem.
123
124@node EXT2FS Library Functions, Concept Index, Introduction to the EXT2FS Library, Top
125@comment node-name, next, previous, up
126@chapter EXT2FS Library Functions
127
128@menu
129* Filesystem-level functions::
130* Inode Functions::
131* Directory functions::
132* Bitmap Functions::
133* Badblocks list management::
134* Directory-block list management::
135* Byte-swapping functions::
136* Other functions::
137@end menu
138
139@c ----------------------------------------------------------------------
140
141@node Filesystem-level functions, Inode Functions, EXT2FS Library Functions, EXT2FS Library Functions
142@comment node-name, next, previous, up
143@section Filesystem-level functions
144
145The following functions operate on a filesystem handle. Most EXT2FS
146Library functions require a filesystem handle as their first argument.
147There are two functions which create a filesystem handle,
148@code{ext2fs_open} and @code{ext2fs_initialize}.
149
150The filesystem can also be closed using @code{ext2fs_close}, and any
151changes to the superblock and group descripts can be written out to disk
152using @code{ext2fs_flush}.
153
154@menu
155* Opening an ext2 filesystem::
156* Closing and flushing out changes::
157* Initializing a filesystem::
158* Filesystem flag functions::
159@end menu
160
161@c ----------------------------------------------------------------------
162
163@node Opening an ext2 filesystem, Closing and flushing out changes, Filesystem-level functions, Filesystem-level functions
164@comment node-name, next, previous, up
165@subsection Opening an ext2 filesystem
166
167Most libext2fs functions take a filesystem handle of type
168@code{ext2_filsys}. A filesystem handle is created either by opening
169an existing function using @code{ext2fs_open}, or by initializing a new
170filesystem using @code{ext2fs_initialize}.
171
172@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})
173
174Opens a filesystem named @var{name}, using the the io_manager
175@var{manager} to define the input/output routines needed to read and
176write the filesystem. In the case of the @code{unix_io} io_manager,
177@var{name} is interpreted as the Unix filename of the filesystem image.
178This is often a device file, such as @file{/dev/hda1}.
179
180The @var{superblock} parameter specifies the block number of the
181superblock which should be used when opening the filesystem.
182If @var{superblock} is zero, @code{ext2fs_open} will use the primary
183superblock located at offset 1024 bytes from the start of the filesystem
184image.
185
186The @var{block_size} parameter specifies the block size used by the
187filesystem. Normally this is determined automatically from the
188filesystem uperblock. If @var{block_size} is non-zero, it must match
189the block size found in the superblock, or the error
190@code{EXT2_ET_UNEXPECTED_BLOCK_SIZE} will be returned. The
191@var{block_size} parameter is also used to help fund the superblock when
192@var{superblock} is non-zero.
193
194The @var{flags} argument contains a bitmask of flags which control how
195the filesystem open should be handled.
196
197@table @code
198@item EXT2_FLAG_RW
199Open the filesystem for reading and writing. Without this flag, the
200filesystem is opened for reading only.
201
202@item EXT2_FLAG_FORCE
203Open the filesystem regardless of the feature sets listed in the
204superblock.
205
206@end table
207@end deftypefun
208
209@c ----------------------------------------------------------------------
210
211@node Closing and flushing out changes, Initializing a filesystem, Opening an ext2 filesystem, Filesystem-level functions
212@comment node-name, next, previous, up
213@subsection Closing and flushing out changes
214
215@deftypefun errcode_t ext2fs_flush (ext2_filsys @var{fs})
216
217Write any changes to the high-level filesystem data structures in the
218@var{fs} filesystem. The following data structures will be written out:
219
220@itemize @bullet
221@item The filesystem superblock
222@item The filesystem group descriptors
223@item The filesystem bitmaps, if read in via @code{ext2fs_read_bitmaps}.
224@end itemize
225
226@end deftypefun
227
228@deftypefun void ext2fs_free (ext2_filsys @var{fs})
229
230Close the io_manager abstraction for @var{fs} and release all memory
231associated with the filesystem handle.
232@end deftypefun
233
234@deftypefun errcode_t ext2fs_close (ext2_filsys @var{fs})
235
236Flush out any changes to the high-level filesystem data structures using
237@code{ext2fs_flush} if the filesystem is marked dirty; then close and
238free the filesystem using @code{ext2fs_free}.
239
240@end deftypefun
241
242@c ----------------------------------------------------------------------
243
244@node Initializing a filesystem, Filesystem flag functions, Closing and flushing out changes, Filesystem-level functions
245@comment node-name, next, previous, up
246@subsection Initializing a filesystem
247
248An ext2 filesystem is initializing by the @code{mke2fs} program. The
249two functions described here, @code{ext2fs_initialize} and
250@code{ext2fs_allocate_tables} do much of the initial work for setting up
251a filesystem. However, they don't do the whole job. @code{mke2fs}
252calls @code{ext2fs_initialize} to set up the filesystem superblock, and
253calls @code{ext2fs_allocate_tables} to allocate space for the inode
254table, and the inode and block bitmaps. In addition, @code{mke2fs} must
255also initialize the inode tables by clearing them with zeros, create the
256root and lost+found directories, and reserve the reserved inodes.
257
258@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})
259
260This function is used by the @code{mke2fs} program to initialize a
261filesystem. The @code{ext2fs_initialize} function creates a filesystem
262handle which is returned in @var{ret_fs} that has been properly setup
263for a filesystem to be located in @var{name}, using the io_manager
264@var{manager}. The prototype superblock in @var{param} is used to
265supply parameters such as the number of blocks in the filesystem, the
266block size, etc.
267
268The @code{ext2fs_initialize} function does not actually do any I/O; that
269will be done when the application program calls @code{ext2fs_close} or
270@code{ext2fs_flush}. Also, this function only initializes the
271superblock and group descriptor structures. It does not create the
272inode table or the root directory. This must be done by the calling
273application, such as @code{mke2fs}.
274
275The following values may be set in the @var{param} prototype superblock;
276if a value of 0 is found in a field, @code{ext2fs_initialize} will use a
277default value. The calling application should zero out the prototype
278entire superblock, and then fill in any appropriate values.
279
280@table @code
281
282@item s_blocks_count
283The number of blocks in the filesystem. This parameter is mandatory and
284must be set by the calling application.
285
286@item s_inodes_count
287The number of inodes in the filesystem. The
288default value is determined by calculating the size of the filesystem,
289and creating one inode for every 4096 bytes.
290
291@item s_r_blocks_count
292The number of blocks which should be reserved for the superuser. The
293default value is zero blocks.
294
295@item s_log_block_size
296The blocksize of the filesystem. Valid values are 0 (1024 bytes), 1
297(2048 bytes), or 2 (4096 bytes). The default blocksize is 1024 bytes.
298
299@item s_log_frag_size
300The size of fragments. The ext2 filesystem does not support fragments
301(and may never support fragments). Currently this field must be the
302same as @code{s_log_block_size}.
303
304@item s_first_data_block
305The first data block for the filesystem. For filesystem with a
306blocksize of 1024 bytes, this value must be at least 1, since the
307superblock is located in block number 1. For filesystems with larger
308blocksizes, the superblock is still located at an offset of 1024 bytes,
309so the superblock is located in block number 0. By default, this value
310is set to 1 for filesystems with a block size of 1024 bytes, or 0 for
311filesystems with larger blocksizes.
312
313@item s_max_mnt_count
314This field defines the number of times that the filesystem can be
315mounted before it should be checked using @code{e2fsck}. When
316@code{e2fsck} is run without the @samp{-f} option, @code{e2fsck} will
317skip the filesystem check if the number of times that the filesystem has
318been mounted is less than @code{s_max_mnt_count} and if the interval
319between the last time a filesystem check was performed and the current
320time is less than @code{s_checkinterval} (see below). The default value
321of @code{s_max_mnt_count} is 20.
322
323@item s_checkinterval
324This field defines the minimal interval between filesystem checks. See
325the previous entry for a discussion of how this field is used by
326@code{e2fsck}. The default value of this field is 180 days (six
327months).
328
329@item s_errors
330This field defines the behavior which should be used by the kernel of
331errors are detected in the filesystem. Possible values include:
332
333@table @samp
334@item EXT2_ERRORS_CONTINUE
335Continue execution when errors are detected.
336
337@item EXT2_ERRORS_RO
338Remount the filesystem read-only.
339
340@item EXT2_ERRORS_PANIC
341Panic.
342
343@end table
344
345The default behavior is @samp{EXT2_ERRORS_CONTINUE}.
346
347@end table
348
349@end deftypefun
350
351@deftypefun errcode_t ext2fs_allocate_tables (ext2_filsys @var{fs})
352Allocate space for the inode table and the block and inode bitmaps. The
353inode tables and block and inode bitmaps aren't actually initialized;
354this function just allocates the space for them.
355@end deftypefun
356
357@c ----------------------------------------------------------------------
358
359@node Filesystem flag functions, , Initializing a filesystem, Filesystem-level functions
360@comment node-name, next, previous, up
361@subsection Filesystem flag functions
362
363The filesystem handle has a number of flags which can be manipulated
364using the following function. Some of these flags affect how the
365libext2fs filesystem behaves; others are provided solely for the
366application's convenience.
367
368@deftypefun void ext2fs_mark_changed (ext2_filsys @var{fs})
369@deftypefunx int ext2fs_test_changed (ext2_filsys @var{fs})
370This flag indicates whether or not the filesystem has been changed.
371It is not used by the ext2fs library.
372@end deftypefun
373
374@deftypefun void ext2fs_mark_super_dirty (ext2_filsys @var{fs})
375Mark the filesystem @var{fs} as being dirty; this will cause
376the superblock information to be flushed out when @code{ext2fs_close} is
377called. @code{ext2fs_mark_super_dirty} will also set the filesystem
378changed flag. The dirty flag is automatically cleared by
379@code{ext2fs_flush} when the superblock is written to disk.
380@end deftypefun
381
382@deftypefun void ext2fs_mark_valid (ext2_filsys @var{fs})
383@deftypefunx void ext2fs_unmark_valid (ext2_filsys @var{fs})
384@deftypefunx int ext2fs_test_valid (ext2_filsys @var{fs})
385This flag indicates whether or not the filesystem is free of errors.
386It is not used by libext2fs, and is solely for the application's
387convenience.
388@end deftypefun
389
390@deftypefun void ext2fs_mark_ib_dirty (ext2_filsys @var{fs})
391@deftypefunx void ext2fs_mark_bb_dirty (ext2_filsys @var{fs})
392@deftypefunx int ext2fs_test_ib_dirty (ext2_filsys @var{fs})
393@deftypefunx int ext2fs_test_bb_dirty (ext2_filsys @var{fs})
394These flags indicate whether or not the inode or block bitmaps have been
395modified. If the flag is set, it will cause the appropriate bitmap
396to be written when the filesystem is closed or flushed.
397@end deftypefun
398
399
400
401@c ----------------------------------------------------------------------
402
403@node Inode Functions, Directory functions, Filesystem-level functions, EXT2FS Library Functions
404@comment node-name, next, previous, up
405@section Inode Functions
406
407@menu
408* Reading and writing inodes::
409* Iterating over inodes in a filesystem::
410* Iterating over blocks in an inode::
411* Inode Convenience Functions::
412@end menu
413
414@c ----------------------------------------------------------------------
415
416@node Reading and writing inodes, Iterating over inodes in a filesystem, Inode Functions, Inode Functions
417@comment node-name, next, previous, up
418@subsection Reading and writing inodes
419
420@deftypefun errcode_t ext2fs_read_inode (ext2_filsys @var{fs}, ino_t @var{ino}, struct ext2_inode *@var{inode})
421Read the inode number @var{ino} into @var{inode}.
422@end deftypefun
423
424@deftypefun errcode_t ext2fs_write_inode(ext2_filsys @var{fs}, ino_t @var{ino}, struct ext2_inode *@var{inode})
425Write @var{inode} to inode @var{ino}.
426@end deftypefun
427
428
429@c ----------------------------------------------------------------------
430
431@node Iterating over inodes in a filesystem, Iterating over blocks in an inode, Reading and writing inodes, Inode Functions
432@comment node-name, next, previous, up
433@subsection Iterating over inodes in a filesystem
434
435The inode_scan abstraction is useful for iterating over all the inodes
436in a filesystem.
437
438@deftypefun errcode_t ext2fs_open_inode_scan (ext2_filsys @var{fs}, int @var{buffer_blocks}, ext2_inode_scan *@var{scan})
439Initialize the iteration variable @var{scan}. This variable is used by
440@code{ext2fs_get_next_inode}. The @var{buffer_blocks} parameter
441controls how many blocks of the inode table are read in at a time. A
442large number of blocks requires more memory, but reduces the overhead in
443seeking and reading from the disk. If @var{buffer_blocks} is zero, a
444suitable default value will be used.
445@end deftypefun
446
447@deftypefun void ext2fs_close_inode_scan (ext2_inode_scan @var{scan})
448Release the memory associated with @var{scan} and invalidate it.
449@end deftypefun
450
451@deftypefun errcode_t ext2fs_get_next_inode (ext2_inode_scan @var{scan}, ino_t *@var{ino}, struct ext2_inode *@var{inode})
452
453This function returns the next inode from the filesystem; the inode
454number of the inode is stored in @var{ino}, and the inode is stored in
455@var{inode}.
456
457If the inode is located in a block that has been marked as bad,
458@code{ext2fs_get_next_inode} will return the error
459@code{EXT2_ET_BAD_BLOCK_IN_INODE_TABLE}.
460@end deftypefun
461
462@deftypefun errcode_t ext2fs_inode_scan_goto_blockgroup (ext2_inode_scan @var{scan}, int @var{group})
463Start the inode scan at a particular ext2 blockgroup, @var{group}.
464This function may be safely called at any time while @var{scan} is valid.
465@end deftypefun
466
467@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})
468Register a callback function which will be called by
469@code{ext2_get_next_inode} when all of the inodes in a block group have
470been processed.
471@end deftypefun
472
473@deftypefun int ext2fs_inode_scan_flags (ext2_inode_scan @var{scan}, int @var{set_flags}, int @var{clear_flags})
474
475Set the scan_flags @var{set_flags} and clear the scan_flags @var{clear_flags}.
476The following flags can be set using this interface:
477
478@table @samp
479
480@item EXT2_SF_SKIP_MISSING_ITABLE
481When a block group is missing an inode table, skip it. If this flag is
482not set @code{ext2fs_get_next_inode} will return the error
483EXT2_ET_MISSING_INODE_TABLE.
484
485@end table
486
487@end deftypefun
488
489@c ----------------------------------------------------------------------
490
491@node Iterating over blocks in an inode, Inode Convenience Functions, Iterating over inodes in a filesystem, Inode Functions
492@comment node-name, next, previous, up
493@subsection Iterating over blocks in an inode
494
495@deftypefun errcode_t ext2fs_block_iterate (ext2_filsys @var{fs}, 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})
496@end deftypefun
497
498@deftypefun errcode_t ext2fs_block_iterate2 (ext2_filsys @var{fs}, ino_t @var{ino}, int @var{flags}, char *@var{block}_buf, int (*func)(ext2_filsys @var{fs}, blk_t *@var{blocknr}, int @var{blockcnt}, blk_t @var{ref_blk}, int @var{ref_offset}, void *@var{private}), void *@var{private})
499@end deftypefun
500
501@c ----------------------------------------------------------------------
502
503@node Inode Convenience Functions, , Iterating over blocks in an inode, Inode Functions
504@comment node-name, next, previous, up
505@subsection Convenience functions for Inodes
506
507@deftypefun errcode_t ext2fs_get_blocks (ext2_filsys @var{fs}, ino_t @var{ino}, blk_t *@var{blocks})
508@end deftypefun
509
510@deftypefun errcode_t ext2fs_check_directory (ext2_filsys @var{fs}, ino_t @var{ino})
511@end deftypefun
512
513@c ----------------------------------------------------------------------
514
515@node Directory functions, Bitmap Functions, Inode Functions, EXT2FS Library Functions
516@comment node-name, next, previous, up
517@section Directory functions
518
519@menu
520* Directory block functions::
521* Iterating over a directory::
522* Creating and expanding directories::
523* Creating and removing directory entries::
524* Looking up filenames::
525* Translating inode numbers to filenames::
526@end menu
527
528@c ----------------------------------------------------------------------
529
530@node Directory block functions, Iterating over a directory, Directory functions, Directory functions
531@comment node-name, next, previous, up
532@subsection Directory block functions
533
534@deftypefun errcode_t ext2fs_read_dir_block (ext2_filsys @var{fs}, blk_t @var{block}, void *@var{buf})
535@end deftypefun
536
537@deftypefun errcode_t ext2fs_write_dir_block (ext2_filsys @var{fs}, blk_t @var{block}, void *@var{buf})
538@end deftypefun
539
540@deftypefun errcode_t ext2fs_new_dir_block (ext2_filsys @var{fs}, ino_t @var{dir}_ino, ino_t @var{parent_ino}, char **@var{block})
541@end deftypefun
542
543@c ----------------------------------------------------------------------
544
545@node Iterating over a directory, Creating and expanding directories, Directory block functions, Directory functions
546@comment node-name, next, previous, up
547@subsection Iterating over a directory
548
549@deftypefun errcode_t ext2fs_dir_iterate (ext2_filsys @var{fs}, 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})
550@end deftypefun
551
552@c ----------------------------------------------------------------------
553
554@node Creating and expanding directories, Creating and removing directory entries, Iterating over a directory, Directory functions
555@comment node-name, next, previous, up
556@subsection Creating and expanding directories
557
558@deftypefun errcode_t ext2fs_mkdir (ext2_filsys @var{fs}, ino_t @var{parent}, ino_t @var{inum}, const char *@var{name})
559@end deftypefun
560
561@deftypefun errcode_t ext2fs_expand_dir (ext2_filsys @var{fs}, ino_t @var{dir})
562@end deftypefun
563
564@c ----------------------------------------------------------------------
565
566@node Creating and removing directory entries, Looking up filenames, Creating and expanding directories, Directory functions
567@comment node-name, next, previous, up
568@subsection Creating and removing directory entries
569
570@deftypefun errcode_t ext2fs_link (ext2_filsys @var{fs}, ino_t @var{dir}, const char *@var{name}, ino_t @var{ino}, int flags)
571@end deftypefun
572
573@deftypefun errcode_t ext2fs_unlink (ext2_filsys @var{fs}, ino_t @var{dir}, const char *@var{name}, ino_t @var{ino}, int @var{flags})
574@end deftypefun
575
576@c ----------------------------------------------------------------------
577
578@node Looking up filenames, Translating inode numbers to filenames, Creating and removing directory entries, Directory functions
579@comment node-name, next, previous, up
580@subsection Looking up filenames
581
582@deftypefun errcode_t ext2fs_lookup (ext2_filsys @var{fs}, ino_t @var{dir}, const char *@var{name}, int @var{namelen}, char *@var{buf}, ino_t *@var{inode})
583@end deftypefun
584
585@deftypefun errcode_t ext2fs_namei (ext2_filsys @var{fs}, ino_t @var{root}, ino_t @var{cwd}, const char *@var{name}, ino_t *@var{inode})
586@end deftypefun
587
588@deftypefun errcode_t ext2fs_namei_follow (ext2_filsys @var{fs}, ino_t @var{root}, ino_t @var{cwd}, const char *@var{name}, ino_t *@var{inode})
589@end deftypefun
590
591@deftypefun errcode_t ext2fs_follow_link (ext2_filsys @var{fs}, ino_t @var{root}, ino_t @var{cwd}, ino_t @var{inode}, ino_t *@var{res}_inode)
592@end deftypefun
593
594@c ----------------------------------------------------------------------
595
596@node Translating inode numbers to filenames, , Looking up filenames, Directory functions
597@comment node-name, next, previous, up
598@subsection Translating inode numbers to filenames
599
600@deftypefun errcode_t ext2fs_get_pathname (ext2_filsys @var{fs}, ino_t @var{dir}, ino_t @var{ino}, char **@var{name})
601@end deftypefun
602
603
604@c ----------------------------------------------------------------------
605
606@node Bitmap Functions, Badblocks list management, Directory functions, EXT2FS Library Functions
607@comment node-name, next, previous, up
608@section Bitmap Functions
609
610@menu
611* Reading and Writing Bitmaps::
612* Allocating Bitmaps::
613* Free bitmaps::
614* Bitmap Operations::
615* Comparing bitmaps::
616* Modifying Bitmaps::
617* Resizing Bitmaps::
618* Clearing Bitmaps::
619@end menu
620
621@c ----------------------------------------------------------------------
622
623@node Reading and Writing Bitmaps, Allocating Bitmaps, Bitmap Functions, Bitmap Functions
624@comment node-name, next, previous, up
625@subsection Reading and Writing Bitmaps
626
627@deftypefun errcode_t ext2fs_write_inode_bitmap (ext2_filsys @var{fs})
628@end deftypefun
629
630@deftypefun errcode_t ext2fs_write_block_bitmap (ext2_filsys @var{fs})
631@end deftypefun
632
633@deftypefun errcode_t ext2fs_read_inode_bitmap (ext2_filsys @var{fs})
634@end deftypefun
635
636@deftypefun errcode_t ext2fs_read_block_bitmap (ext2_filsys @var{fs})
637@end deftypefun
638
639@deftypefun errcode_t ext2fs_read_bitmaps (ext2_filsys @var{fs})
640@end deftypefun
641
642@deftypefun errcode_t ext2fs_write_bitmaps (ext2_filsys @var{fs})
643@end deftypefun
644
645@c ----------------------------------------------------------------------
646
647@node Allocating Bitmaps, Free bitmaps, Reading and Writing Bitmaps, Bitmap Functions
648@comment node-name, next, previous, up
649@subsection Allocating Bitmaps
650
651@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})
652@end deftypefun
653
654@deftypefun errcode_t ext2fs_allocate_block_bitmap (ext2_filsys @var{fs}, const char *@var{descr}, ext2fs_block_bitmap *@var{ret})
655@end deftypefun
656
657@deftypefun errcode_t ext2fs_allocate_inode_bitmap (ext2_filsys @var{fs}, const char *@var{descr}, ext2fs_inode_bitmap *@var{ret})
658@end deftypefun
659
660@c ----------------------------------------------------------------------
661
662@node Free bitmaps, Bitmap Operations, Allocating Bitmaps, Bitmap Functions
663@comment node-name, next, previous, up
664@subsection Freeing bitmaps
665
666
667@deftypefun void ext2fs_free_generic_bitmap (ext2fs_inode_bitmap @var{bitmap})
668@end deftypefun
669
670@deftypefun void ext2fs_free_block_bitmap (ext2fs_block_bitmap @var{bitmap})
671@end deftypefun
672
673@deftypefun void ext2fs_free_inode_bitmap (ext2fs_inode_bitmap @var{bitmap})
674@end deftypefun
675
676
677@c ----------------------------------------------------------------------
678
679@node Bitmap Operations, Comparing bitmaps, Free bitmaps, Bitmap Functions
680@comment node-name, next, previous, up
681@subsection Bitmap Operations
682
683@deftypefun void ext2fs_mark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block})
684
685@deftypefunx void ext2fs_unmark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block})
686
687@deftypefunx int ext2fs_test_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block})
688
689These functions set, clear, and test bits in a block bitmap @var{bitmap}.
690@end deftypefun
691
692
693@deftypefun void ext2fs_mark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ino_t @var{inode})
694
695@deftypefunx void ext2fs_unmark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ino_t @var{inode})
696
697@deftypefunx int ext2fs_test_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ino_t @var{inode})
698
699These functions set, clear, and test bits in an inode bitmap @var{bitmap}.
700@end deftypefun
701
702@deftypefun void ext2fs_fast_mark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block})
703
704@deftypefunx void ext2fs_fast_unmark_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block})
705
706@deftypefunx int ext2fs_fast_test_block_bitmap (ext2fs_block_bitmap @var{bitmap}, blk_t @var{block})
707
708@deftypefunx void ext2fs_fast_mark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ino_t @var{inode})
709
710@deftypefunx void ext2fs_fast_unmark_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ino_t @var{inode})
711
712@deftypefunx int ext2fs_fast_test_inode_bitmap (ext2fs_inode_bitmap @var{bitmap}, ino_t @var{inode})
713
714These ``fast'' functions are like their normal counterparts; however,
715they are implemented as inline functions and do not perform bounds
716checks on the inode number or block number; they are assumed to be
717correct. They should only be used in speed-critical applications, where
718the inode or block number has already been validated by other means.
719@end deftypefun
720
721@deftypefun blk_t ext2fs_get_block_bitmap_start (ext2fs_block_bitmap @var{bitmap})
722@deftypefunx ino_t ext2fs_get_inode_bitmap_start (ext2fs_inode_bitmap @var{bitmap})
723Return the first inode or block which is stored in the bitmap.
724@end deftypefun
725
726@deftypefun blk_t ext2fs_get_block_bitmap_end (ext2fs_block_bitmap @var{bitmap})
727@deftypefunx ino_t ext2fs_get_inode_bitmap_end (ext2fs_inode_bitmap @var{bitmap})
728
729Return the first inode or block which is stored in the bitmap.
730@end deftypefun
731
732
733@c ----------------------------------------------------------------------
734
735@node Comparing bitmaps, Modifying Bitmaps, Bitmap Operations, Bitmap Functions
736@comment node-name, next, previous, up
737@subsection Comparing bitmaps
738
739@deftypefun errcode_t ext2fs_compare_block_bitmap (ext2fs_block_bitmap @var{bm1}, ext2fs_block_bitmap @var{bm2})
740@end deftypefun
741
742@deftypefun errcode_t ext2fs_compare_inode_bitmap (ext2fs_inode_bitmap @var{bm1}, ext2fs_inode_bitmap @var{bm2})
743@end deftypefun
744
745
746@c ----------------------------------------------------------------------
747
748@node Modifying Bitmaps, Resizing Bitmaps, Comparing bitmaps, Bitmap Functions
749@comment node-name, next, previous, up
750@subsection Modifying Bitmaps
751
752@deftypefun errcode_t ext2fs_fudge_inode_bitmap_end (ext2fs_inode_bitmap @var{bitmap}, ino_t @var{end}, ino_t *@var{oend})
753@end deftypefun
754
755@deftypefun errcode_t ext2fs_fudge_block_bitmap_end (ext2fs_block_bitmap @var{bitmap}, blk_t @var{end}, blk_t *@var{oend})
756@end deftypefun
757
758@c ----------------------------------------------------------------------
759
760@node Resizing Bitmaps, Clearing Bitmaps, Modifying Bitmaps, Bitmap Functions
761@comment node-name, next, previous, up
762@subsection Resizing Bitmaps
763
764@deftypefun errcode_t ext2fs_resize_generic_bitmap (__u32 @var{new_end}, __u32 @var{new_real_end}, ext2fs_generic_bitmap @var{bmap})
765@end deftypefun
766
767@deftypefun errcode_t ext2fs_resize_inode_bitmap (__u32 @var{new_end}, __u32 @var{new_real_end}, ext2fs_inode_bitmap @var{bmap})
768@end deftypefun
769
770@deftypefun errcode_t ext2fs_resize_block_bitmap (__u32 @var{new_end}, __u32 @var{new_real_end}, ext2fs_block_bitmap @var{bmap})
771@end deftypefun
772
773
774@c ----------------------------------------------------------------------
775
776@node Clearing Bitmaps, , Resizing Bitmaps, Bitmap Functions
777@comment node-name, next, previous, up
778@subsection Clearing Bitmaps
779
780@deftypefun void ext2fs_clear_inode_bitmap (ext2fs_inode_bitmap @var{bitmap})
781@end deftypefun
782
783@deftypefun void ext2fs_clear_block_bitmap (ext2fs_block_bitmap @var{bitmap})
784@end deftypefun
785
786
787@c ----------------------------------------------------------------------
788
789@node Badblocks list management, Directory-block list management, Bitmap Functions, EXT2FS Library Functions
790@comment node-name, next, previous, up
791@section Badblocks list management
792
793
794@deftypefun errcode_t ext2fs_badblocks_list_create (ext2_badblocks_list *@var{ret}, int @var{size})
795@end deftypefun
796
797@deftypefun void ext2fs_badblocks_list_free (ext2_badblocks_list @var{bb})
798@end deftypefun
799
800@deftypefun errcode_t ext2fs_badblocks_list_add (ext2_badblocks_list @var{bb}, blk_t @var{blk})
801@end deftypefun
802
803@deftypefun int ext2fs_badblocks_list_test (ext2_badblocks_list @var{bb}, blk_t @var{blk})
804@end deftypefun
805
806@deftypefun errcode_t ext2fs_badblocks_list_iterate_begin (ext2_badblocks_list @var{bb}, ext2_badblocks_iterate *@var{ret})
807@end deftypefun
808
809@deftypefun int ext2fs_badblocks_list_iterate (ext2_badblocks_iterate iter, blk_t *@var{blk})
810@end deftypefun
811
812@deftypefun void ext2fs_badblocks_list_iterate_end (ext2_badblocks_iterate @var{iter})
813@end deftypefun
814
815@deftypefun errcode_t ext2fs_update_bb_inode (ext2_filsys @var{fs}, ext2_badblocks_list @var{bb_list})
816@end deftypefun
817
818@deftypefun errcode_t ext2fs_read_bb_inode (ext2_filsys @var{fs}, ext2_badblocks_list *@var{bb_list})
819@end deftypefun
820
821@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}))
822@end deftypefun
823
824
825@c ----------------------------------------------------------------------
826
827@node Directory-block list management, Byte-swapping functions, Badblocks list management, EXT2FS Library Functions
828@comment node-name, next, previous, up
829@section Directory-block list management
830
831@deftypefun errcode_t ext2fs_init_dblist (ext2_filsys @var{fs}, ext2_dblist *@var{ret_dblist})
832@end deftypefun
833
834@deftypefun void ext2fs_free_dblist (ext2_dblist @var{dblist})
835@end deftypefun
836
837@deftypefun errcode_t ext2fs_add_dir_block (ext2_dblist dblist, ino_t @var{ino}, blk_t @var{blk}, int @var{blockcnt})
838@end deftypefun
839
840@deftypefun errcode_t ext2fs_dblist_iterate (ext2_dblist dblist, int (*func)(ext2_filsys @var{fs}, struct ext2_db_entry *@var{db_info}, void *@var{private}), void *@var{private})
841@end deftypefun
842
843@deftypefun errcode_t ext2fs_dblist_dir_iterate
844(ext2_dblist dblist, int flags, char *@var{block_buf}, int (*func)(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})
845@end deftypefun
846
847@c ----------------------------------------------------------------------
848
849@node Byte-swapping functions, Other functions, Directory-block list management, EXT2FS Library Functions
850@comment node-name, next, previous, up
851@section Byte-swapping functions
852
853@deftypefun void ext2fs_swap_super (struct ext2_super_block * @var{super})
854@end deftypefun
855
856@deftypefun void ext2fs_swap_group_desc (struct ext2_group_desc *@var{gdp})
857@end deftypefun
858
859@deftypefun void ext2fs_swap_inode (ext2_filsys @var{fs}, struct ext2_inode *@var{to}, struct ext2_inode *@var{from}, int @var{hostorder})
860@end deftypefun
861
862@deftypefun int ext2fs_native_flag (void)
863@end deftypefun
864
865
866@c ----------------------------------------------------------------------
867
868@node Other functions, , Byte-swapping functions, EXT2FS Library Functions
869@comment node-name, next, previous, up
870@section Other functions
871
872/* alloc.c */
873@deftypefun errcode_t ext2fs_new_inode (ext2_filsys @var{fs}, ino_t @var{dir}, int @var{mode}, ext2fs_inode_bitmap @var{map}, ino_t *@var{ret})
874@end deftypefun
875
876@deftypefun errcode_t ext2fs_new_block (ext2_filsys @var{fs}, blk_t @var{goal}, ext2fs_block_bitmap @var{map}, blk_t *@var{ret})
877@end deftypefun
878
879@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})
880@end deftypefun
881
882/* check_desc.c */
883@deftypefun errcode_t ext2fs_check_desc (ext2_filsys @var{fs})
884@end deftypefun
885
886@deftypefun errcode_t ext2_get_num_dirs (ext2_filsys @var{fs}, ino_t *@var{ret_num_dirs})
887@end deftypefun
888
889
890/* getsize.c */
891@deftypefun errcode_t ext2fs_get_device_size (const char *@var{file}, int @var{blocksize}, blk_t *@var{retblocks})
892@end deftypefun
893
894
895/* ismounted.c */
896@deftypefun errcode_t ext2fs_check_if_mounted (const char *@var{file}, int *@var{mount_flags})
897@end deftypefun
898
899
900/* valid_blk.c */
901@deftypefun int ext2_inode_has_valid_blocks (struct ext2_inode *@var{inode})
902@end deftypefun
903
904
905/* inline functions */
906@deftypefun int ext2fs_group_of_blk (ext2_filsys @var{fs}, blk_t @var{blk})
907@end deftypefun
908
909@deftypefun int ext2fs_group_of_ino (ext2_filsys @var{fs}, ino_t @var{ino})
910@end deftypefun
911
912
913@c ----------------------------------------------------------------------
914
915@node Concept Index, Function Index, EXT2FS Library Functions, Top
916@comment node-name, next, previous, up
917@unnumbered Concept Index
918@printindex cp
919
920@c ----------------------------------------------------------------------
921
922@node Function Index, , Concept Index, Top
923@comment node-name, next, previous, up
924@unnumbered Function and Type Index
925@printindex fn
926
927
928@contents
929@bye