blob: a3d3cd35b356204f1712c64f8374d3d10796f446 [file] [log] [blame]
Theodore Ts'o3839e651997-04-26 13:21:57 +00001/*
2 * ext2fs.h --- ext2fs
Theodore Ts'oefc6f622008-08-27 23:07:54 -04003 *
Theodore Ts'o19c78dc1997-04-29 16:17:09 +00004 * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
5 *
6 * %Begin-Header%
Theodore Ts'o543547a2010-05-17 21:31:56 -04007 * This file may be redistributed under the terms of the GNU Library
8 * General Public License, version 2.
Theodore Ts'o19c78dc1997-04-29 16:17:09 +00009 * %End-Header%
Theodore Ts'o3839e651997-04-26 13:21:57 +000010 */
11
Theodore Ts'o9abd2ce1998-02-16 22:00:37 +000012#ifndef _EXT2FS_EXT2FS_H
13#define _EXT2FS_EXT2FS_H
14
Theodore Ts'o54434922003-12-07 01:28:50 -050015#ifdef __GNUC__
16#define EXT2FS_ATTR(x) __attribute__(x)
17#else
18#define EXT2FS_ATTR(x)
19#endif
20
Theodore Ts'ofa7ef712000-05-19 02:11:41 +000021#ifdef __cplusplus
22extern "C" {
23#endif
24
Theodore Ts'o3839e651997-04-26 13:21:57 +000025/*
Theodore Ts'o19c78dc1997-04-29 16:17:09 +000026 * Non-GNU C compilers won't necessarily understand inline
27 */
Theodore Ts'o76f875d1998-04-27 01:41:13 +000028#if (!defined(__GNUC__) && !defined(__WATCOMC__))
Theodore Ts'o19c78dc1997-04-29 16:17:09 +000029#define NO_INLINE_FUNCS
30#endif
31
32/*
Theodore Ts'o3839e651997-04-26 13:21:57 +000033 * Where the master copy of the superblock is located, and how big
34 * superblocks are supposed to be. We define SUPERBLOCK_SIZE because
35 * the size of the superblock structure is not necessarily trustworthy
36 * (some versions have the padding set up so that the superblock is
37 * 1032 bytes long).
38 */
39#define SUPERBLOCK_OFFSET 1024
40#define SUPERBLOCK_SIZE 1024
41
Theodore Ts'of3db3561997-04-26 13:34:30 +000042/*
43 * The last ext2fs revision level that this version of the library is
44 * able to support.
45 */
Theodore Ts'oe5b38a52001-01-01 16:17:12 +000046#define EXT2_LIB_CURRENT_REV EXT2_DYNAMIC_REV
Theodore Ts'of3db3561997-04-26 13:34:30 +000047
Theodore Ts'od40259f1997-10-20 00:44:26 +000048#ifdef HAVE_SYS_TYPES_H
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000049#include <sys/types.h>
Theodore Ts'od40259f1997-10-20 00:44:26 +000050#endif
51
Theodore Ts'o3e699062002-10-13 23:56:28 -040052#include <stdio.h>
Theodore Ts'o5be8dc21997-12-01 18:24:10 +000053#include <stdlib.h>
Theodore Ts'oa82a5702005-11-14 14:49:15 -050054#include <string.h>
Theodore Ts'o5953b9d1998-02-01 13:23:02 +000055
56#if EXT2_FLAT_INCLUDES
57#include "e2_types.h"
Theodore Ts'o3e699062002-10-13 23:56:28 -040058#include "ext2_fs.h"
Theodore Ts'o89dd6572006-11-12 22:54:35 -050059#include "ext3_extents.h"
Theodore Ts'o5953b9d1998-02-01 13:23:02 +000060#else
Theodore Ts'o797f5ef2001-06-01 23:49:46 +000061#include <ext2fs/ext2_types.h>
Theodore Ts'o3e699062002-10-13 23:56:28 -040062#include <ext2fs/ext2_fs.h>
Theodore Ts'o89dd6572006-11-12 22:54:35 -050063#include <ext2fs/ext3_extents.h>
Theodore Ts'oe589f672000-04-03 13:45:40 +000064#endif /* EXT2_FLAT_INCLUDES */
Theodore Ts'o50e1e101997-04-26 13:58:21 +000065
Theodore Ts'o31dbecd2001-01-11 04:54:39 +000066typedef __u32 ext2_ino_t;
Theodore Ts'o50e1e101997-04-26 13:58:21 +000067typedef __u32 blk_t;
Theodore Ts'oeac91b32007-10-14 11:23:20 -040068typedef __u64 blk64_t;
Theodore Ts'o2eb374c1998-09-03 01:22:57 +000069typedef __u32 dgrp_t;
Theodore Ts'o30fab291997-10-25 22:37:42 +000070typedef __u32 ext2_off_t;
Theodore Ts'o03673db1998-06-10 20:39:43 +000071typedef __s64 e2_blkcnt_t;
Theodore Ts'o52783e02002-03-11 15:04:45 -050072typedef __u32 ext2_dirhash_t;
Theodore Ts'o3839e651997-04-26 13:21:57 +000073
Theodore Ts'ob5abe6f1998-01-19 14:47:53 +000074#if EXT2_FLAT_INCLUDES
75#include "com_err.h"
76#include "ext2_io.h"
77#include "ext2_err.h"
Andreas Dilgerfefaef32008-02-02 01:16:32 -070078#include "ext2_ext_attr.h"
Theodore Ts'ob5abe6f1998-01-19 14:47:53 +000079#else
Theodore Ts'o7c2d2562001-05-21 02:54:21 +000080#include <et/com_err.h>
81#include <ext2fs/ext2_io.h>
82#include <ext2fs/ext2_err.h>
Andreas Dilgerfefaef32008-02-02 01:16:32 -070083#include <ext2fs/ext2_ext_attr.h>
Theodore Ts'ob5abe6f1998-01-19 14:47:53 +000084#endif
Theodore Ts'o3839e651997-04-26 13:21:57 +000085
Theodore Ts'o4c77fe51998-04-30 17:35:59 +000086/*
87 * Portability help for Microsoft Visual C++
88 */
89#ifdef _MSC_VER
90#define EXT2_QSORT_TYPE int __cdecl
91#else
92#define EXT2_QSORT_TYPE int
93#endif
94
Theodore Ts'of3db3561997-04-26 13:34:30 +000095typedef struct struct_ext2_filsys *ext2_filsys;
96
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000097#define EXT2FS_MARK_ERROR 0
98#define EXT2FS_UNMARK_ERROR 1
99#define EXT2FS_TEST_ERROR 2
Theodore Ts'of3db3561997-04-26 13:34:30 +0000100
Theodore Ts'o1e3472c1997-04-29 14:53:37 +0000101typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap;
Theodore Ts'o1e3472c1997-04-29 14:53:37 +0000102typedef struct ext2fs_struct_generic_bitmap *ext2fs_inode_bitmap;
Theodore Ts'o1e3472c1997-04-29 14:53:37 +0000103typedef struct ext2fs_struct_generic_bitmap *ext2fs_block_bitmap;
Theodore Ts'of3db3561997-04-26 13:34:30 +0000104
Theodore Ts'o7f88b041997-04-26 14:48:50 +0000105#define EXT2_FIRST_INODE(s) EXT2_FIRST_INO(s)
Andreas Dilger067911a2006-07-15 22:08:20 -0400106
Theodore Ts'o7f88b041997-04-26 14:48:50 +0000107
Theodore Ts'o3839e651997-04-26 13:21:57 +0000108/*
Andreas Dilger067911a2006-07-15 22:08:20 -0400109 * Badblocks list definitions
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000110 */
111
Theodore Ts'ob7a00562002-07-20 00:28:07 -0400112typedef struct ext2_struct_u32_list *ext2_badblocks_list;
113typedef struct ext2_struct_u32_iterate *ext2_badblocks_iterate;
114
115typedef struct ext2_struct_u32_list *ext2_u32_list;
116typedef struct ext2_struct_u32_iterate *ext2_u32_iterate;
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000117
118/* old */
Theodore Ts'ob7a00562002-07-20 00:28:07 -0400119typedef struct ext2_struct_u32_list *badblocks_list;
120typedef struct ext2_struct_u32_iterate *badblocks_iterate;
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000121
122#define BADBLOCKS_FLAG_DIRTY 1
123
124/*
125 * ext2_dblist structure and abstractions (see dblist.c)
126 */
127struct ext2_db_entry {
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000128 ext2_ino_t ino;
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000129 blk_t blk;
130 int blockcnt;
131};
132
133typedef struct ext2_struct_dblist *ext2_dblist;
134
135#define DBLIST_ABORT 1
136
137/*
Theodore Ts'o30fab291997-10-25 22:37:42 +0000138 * ext2_fileio definitions
139 */
140
141#define EXT2_FILE_WRITE 0x0001
142#define EXT2_FILE_CREATE 0x0002
143
144#define EXT2_FILE_MASK 0x00FF
145
146#define EXT2_FILE_BUF_DIRTY 0x4000
147#define EXT2_FILE_BUF_VALID 0x2000
148
149typedef struct ext2_file *ext2_file_t;
150
151#define EXT2_SEEK_SET 0
152#define EXT2_SEEK_CUR 1
153#define EXT2_SEEK_END 2
154
155/*
Theodore Ts'oa1128472001-01-16 06:56:14 +0000156 * Flags for the ext2_filsys structure and for ext2fs_open()
Theodore Ts'o3839e651997-04-26 13:21:57 +0000157 */
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000158#define EXT2_FLAG_RW 0x01
159#define EXT2_FLAG_CHANGED 0x02
160#define EXT2_FLAG_DIRTY 0x04
161#define EXT2_FLAG_VALID 0x08
162#define EXT2_FLAG_IB_DIRTY 0x10
163#define EXT2_FLAG_BB_DIRTY 0x20
Theodore Ts'o5c576471997-04-29 15:29:49 +0000164#define EXT2_FLAG_SWAP_BYTES 0x40
165#define EXT2_FLAG_SWAP_BYTES_READ 0x80
166#define EXT2_FLAG_SWAP_BYTES_WRITE 0x100
167#define EXT2_FLAG_MASTER_SB_ONLY 0x200
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000168#define EXT2_FLAG_FORCE 0x400
Theodore Ts'o43ec8732001-01-03 14:56:46 +0000169#define EXT2_FLAG_SUPER_ONLY 0x800
Theodore Ts'oa1128472001-01-16 06:56:14 +0000170#define EXT2_FLAG_JOURNAL_DEV_OK 0x1000
Theodore Ts'oa78926e2001-05-03 04:02:29 +0000171#define EXT2_FLAG_IMAGE_FILE 0x2000
Theodore Ts'o39c47ce2006-03-18 19:16:10 -0500172#define EXT2_FLAG_EXCLUSIVE 0x4000
Theodore Ts'ocf8272e2006-11-12 23:26:46 -0500173#define EXT2_FLAG_SOFTSUPP_FEATURES 0x8000
Theodore Ts'oab52e122008-02-26 20:45:36 -0500174#define EXT2_FLAG_NOFREE_ON_ERROR 0x10000
Theodore Ts'o3839e651997-04-26 13:21:57 +0000175
Theodore Ts'o7f88b041997-04-26 14:48:50 +0000176/*
177 * Special flag in the ext2 inode i_flag field that means that this is
178 * a new inode. (So that ext2_write_inode() can clear extra fields.)
179 */
180#define EXT2_NEW_INODE_FL 0x80000000
181
Theodore Ts'o4e246702000-12-09 14:39:16 +0000182/*
183 * Flags for mkjournal
184 *
185 * EXT2_MKJOURNAL_V1_SUPER Make a (deprecated) V1 journal superblock
186 */
187#define EXT2_MKJOURNAL_V1_SUPER 0x0000001
188
Theodore Ts'o3839e651997-04-26 13:21:57 +0000189struct struct_ext2_filsys {
Theodore Ts'o4cbe8af1997-08-10 23:07:40 +0000190 errcode_t magic;
Theodore Ts'o3839e651997-04-26 13:21:57 +0000191 io_channel io;
192 int flags;
193 char * device_name;
194 struct ext2_super_block * super;
Theodore Ts'o54434922003-12-07 01:28:50 -0500195 unsigned int blocksize;
Theodore Ts'o3839e651997-04-26 13:21:57 +0000196 int fragsize;
Theodore Ts'o2eb374c1998-09-03 01:22:57 +0000197 dgrp_t group_desc_count;
Theodore Ts'o3839e651997-04-26 13:21:57 +0000198 unsigned long desc_blocks;
199 struct ext2_group_desc * group_desc;
200 int inode_blocks_per_group;
Theodore Ts'of3db3561997-04-26 13:34:30 +0000201 ext2fs_inode_bitmap inode_map;
202 ext2fs_block_bitmap block_map;
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000203 errcode_t (*get_blocks)(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks);
204 errcode_t (*check_directory)(ext2_filsys fs, ext2_ino_t ino);
Theodore Ts'o3839e651997-04-26 13:21:57 +0000205 errcode_t (*write_bitmaps)(ext2_filsys fs);
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000206 errcode_t (*read_inode)(ext2_filsys fs, ext2_ino_t ino,
Theodore Ts'o1e3472c1997-04-29 14:53:37 +0000207 struct ext2_inode *inode);
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000208 errcode_t (*write_inode)(ext2_filsys fs, ext2_ino_t ino,
Theodore Ts'o1e3472c1997-04-29 14:53:37 +0000209 struct ext2_inode *inode);
Theodore Ts'ob7a00562002-07-20 00:28:07 -0400210 ext2_badblocks_list badblocks;
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000211 ext2_dblist dblist;
Theodore Ts'oa29f4d31997-04-29 21:26:48 +0000212 __u32 stride; /* for mke2fs */
Theodore Ts'oc180ac82000-10-26 20:24:43 +0000213 struct ext2_super_block * orig_super;
Theodore Ts'oa78926e2001-05-03 04:02:29 +0000214 struct ext2_image_hdr * image_header;
Theodore Ts'o6a525062001-12-24 09:40:00 -0500215 __u32 umask;
Theodore Ts'o9b9a7802005-12-10 21:50:30 -0500216 time_t now;
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000217 /*
218 * Reserved for future expansion
219 */
Theodore Ts'o32138182005-09-24 20:14:51 -0400220 __u32 reserved[7];
Theodore Ts'o3839e651997-04-26 13:21:57 +0000221
222 /*
Theodore Ts'oa29f4d31997-04-29 21:26:48 +0000223 * Reserved for the use of the calling application.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000224 */
Theodore Ts'ob5abe6f1998-01-19 14:47:53 +0000225 void * priv_data;
Theodore Ts'oa29f4d31997-04-29 21:26:48 +0000226
227 /*
228 * Inode cache
229 */
230 struct ext2_inode_cache *icache;
Theodore Ts'o1ad54a92004-07-28 21:11:48 -0400231 io_channel image_io;
Theodore Ts'of5c562e2008-06-02 17:21:37 -0400232
233 /*
234 * More callback functions
235 */
236 errcode_t (*get_alloc_block)(ext2_filsys fs, blk64_t goal,
237 blk64_t *ret);
238 void (*block_alloc_stats)(ext2_filsys fs, blk64_t blk, int inuse);
Theodore Ts'o3839e651997-04-26 13:21:57 +0000239};
240
Theodore Ts'o5953b9d1998-02-01 13:23:02 +0000241#if EXT2_FLAT_INCLUDES
242#include "e2_bitops.h"
243#else
Theodore Ts'o7c2d2562001-05-21 02:54:21 +0000244#include <ext2fs/bitops.h>
Theodore Ts'o5953b9d1998-02-01 13:23:02 +0000245#endif
Theodore Ts'od40259f1997-10-20 00:44:26 +0000246
Theodore Ts'o3839e651997-04-26 13:21:57 +0000247/*
248 * Return flags for the block iterator functions
249 */
250#define BLOCK_CHANGED 1
251#define BLOCK_ABORT 2
252#define BLOCK_ERROR 4
253
254/*
255 * Block interate flags
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000256 *
257 * BLOCK_FLAG_APPEND, or BLOCK_FLAG_HOLE, indicates that the interator
258 * function should be called on blocks where the block number is zero.
259 * This is used by ext2fs_expand_dir() to be able to add a new block
260 * to an inode. It can also be used for programs that want to be able
261 * to deal with files that contain "holes".
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400262 *
Theodore Ts'o74479212006-03-18 08:26:36 -0500263 * BLOCK_FLAG_DEPTH_TRAVERSE indicates that the iterator function for
264 * the indirect, doubly indirect, etc. blocks should be called after
265 * all of the blocks containined in the indirect blocks are processed.
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000266 * This is useful if you are going to be deallocating blocks from an
267 * inode.
Theodore Ts'o1e3472c1997-04-29 14:53:37 +0000268 *
269 * BLOCK_FLAG_DATA_ONLY indicates that the iterator function should be
270 * called for data blocks only.
Theodore Ts'o674a4ee1998-03-23 02:06:52 +0000271 *
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400272 * BLOCK_FLAG_READ_ONLY is a promise by the caller that it will not
Theodore Ts'o357d1862008-02-02 21:26:54 -0500273 * modify returned block number.
274 *
Theodore Ts'o674a4ee1998-03-23 02:06:52 +0000275 * BLOCK_FLAG_NO_LARGE is for internal use only. It informs
Theodore Ts'o36a43d61998-03-24 16:17:51 +0000276 * ext2fs_block_iterate2 that large files won't be accepted.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000277 */
278#define BLOCK_FLAG_APPEND 1
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000279#define BLOCK_FLAG_HOLE 1
Theodore Ts'o3839e651997-04-26 13:21:57 +0000280#define BLOCK_FLAG_DEPTH_TRAVERSE 2
Theodore Ts'o1e3472c1997-04-29 14:53:37 +0000281#define BLOCK_FLAG_DATA_ONLY 4
Theodore Ts'o357d1862008-02-02 21:26:54 -0500282#define BLOCK_FLAG_READ_ONLY 8
Theodore Ts'o1e3472c1997-04-29 14:53:37 +0000283
Theodore Ts'o674a4ee1998-03-23 02:06:52 +0000284#define BLOCK_FLAG_NO_LARGE 0x1000
285
Theodore Ts'o1e3472c1997-04-29 14:53:37 +0000286/*
287 * Magic "block count" return values for the block iterator function.
288 */
289#define BLOCK_COUNT_IND (-1)
290#define BLOCK_COUNT_DIND (-2)
291#define BLOCK_COUNT_TIND (-3)
292#define BLOCK_COUNT_TRANSLATOR (-4)
Theodore Ts'o3839e651997-04-26 13:21:57 +0000293
Theodore Ts'o4a31c481998-03-30 01:27:25 +0000294#if 0
Theodore Ts'o3839e651997-04-26 13:21:57 +0000295/*
Theodore Ts'o1e1da291997-06-09 14:51:29 +0000296 * Flags for ext2fs_move_blocks
297 */
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400298#define EXT2_BMOVE_GET_DBLIST 0x0001
Theodore Ts'o36f21431997-06-14 07:25:40 +0000299#define EXT2_BMOVE_DEBUG 0x0002
Theodore Ts'o4a31c481998-03-30 01:27:25 +0000300#endif
Theodore Ts'o1e1da291997-06-09 14:51:29 +0000301
302/*
Theodore Ts'o3eb07f62007-10-14 23:04:58 -0400303 * Generic (non-filesystem layout specific) extents structure
304 */
305
306#define EXT2_EXTENT_FLAGS_LEAF 0x0001
307#define EXT2_EXTENT_FLAGS_UNINIT 0x0002
308#define EXT2_EXTENT_FLAGS_SECOND_VISIT 0x0004
309
310struct ext2fs_extent {
311 blk64_t e_pblk; /* first physical block */
312 blk64_t e_lblk; /* first logical block extent covers */
313 __u32 e_len; /* number of blocks covered by extent */
314 __u32 e_flags; /* extent flags */
315};
316
317typedef struct ext2_extent_handle *ext2_extent_handle_t;
318typedef struct ext2_extent_path *ext2_extent_path_t;
319
320/*
321 * Flags used by ext2fs_extent_get()
322 */
323#define EXT2_EXTENT_CURRENT 0x0000
324#define EXT2_EXTENT_MOVE_MASK 0x000F
325#define EXT2_EXTENT_ROOT 0x0001
326#define EXT2_EXTENT_LAST_LEAF 0x0002
327#define EXT2_EXTENT_FIRST_SIB 0x0003
328#define EXT2_EXTENT_LAST_SIB 0x0004
329#define EXT2_EXTENT_NEXT_SIB 0x0005
330#define EXT2_EXTENT_PREV_SIB 0x0006
331#define EXT2_EXTENT_NEXT_LEAF 0x0007
332#define EXT2_EXTENT_PREV_LEAF 0x0008
333#define EXT2_EXTENT_NEXT 0x0009
334#define EXT2_EXTENT_PREV 0x000A
335#define EXT2_EXTENT_UP 0x000B
336#define EXT2_EXTENT_DOWN 0x000C
337#define EXT2_EXTENT_DOWN_AND_LAST 0x000D
338
339/*
340 * Flags used by ext2fs_extent_insert()
341 */
Eric Sandeen01229db2008-05-20 10:15:27 -0500342#define EXT2_EXTENT_INSERT_AFTER 0x0001 /* insert after handle loc'n */
343#define EXT2_EXTENT_INSERT_NOSPLIT 0x0002 /* insert may not cause split */
Theodore Ts'o3eb07f62007-10-14 23:04:58 -0400344
345/*
Eric Sandeenc802ad92008-05-20 16:13:41 -0500346 * Flags used by ext2fs_extent_delete()
347 */
348#define EXT2_EXTENT_DELETE_KEEP_EMPTY 0x001 /* keep node if last extnt gone */
349
350/*
Eric Sandeenf4e99632008-05-20 10:17:46 -0500351 * Flags used by ext2fs_extent_set_bmap()
352 */
353#define EXT2_EXTENT_SET_BMAP_UNINIT 0x0001
354
355/*
Theodore Ts'o3eb07f62007-10-14 23:04:58 -0400356 * Data structure returned by ext2fs_extent_get_info()
357 */
358struct ext2_extent_info {
359 int curr_entry;
360 int curr_level;
361 int num_entries;
362 int max_entries;
363 int max_depth;
364 int bytes_avail;
365 blk64_t max_lblk;
366 blk64_t max_pblk;
367 __u32 max_len;
368 __u32 max_uninit_len;
369};
370
371/*
Theodore Ts'of9190c82002-03-12 01:05:06 -0500372 * Flags for directory block reading and writing functions
373 */
374#define EXT2_DIRBLOCK_V2_STRUCT 0x0001
375
376/*
Theodore Ts'o3839e651997-04-26 13:21:57 +0000377 * Return flags for the directory iterator functions
378 */
379#define DIRENT_CHANGED 1
380#define DIRENT_ABORT 2
381#define DIRENT_ERROR 3
382
383/*
384 * Directory iterator flags
385 */
386
387#define DIRENT_FLAG_INCLUDE_EMPTY 1
Theodore Ts'o8bd0c952002-01-03 03:29:19 -0500388#define DIRENT_FLAG_INCLUDE_REMOVED 2
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000389
390#define DIRENT_DOT_FILE 1
391#define DIRENT_DOT_DOT_FILE 2
392#define DIRENT_OTHER_FILE 3
Theodore Ts'o8bd0c952002-01-03 03:29:19 -0500393#define DIRENT_DELETED_FILE 4
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000394
Theodore Ts'o3839e651997-04-26 13:21:57 +0000395/*
396 * Inode scan definitions
397 */
Theodore Ts'of3db3561997-04-26 13:34:30 +0000398typedef struct ext2_struct_inode_scan *ext2_inode_scan;
399
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000400/*
401 * ext2fs_scan flags
402 */
403#define EXT2_SF_CHK_BADBLOCKS 0x0001
404#define EXT2_SF_BAD_INODE_BLK 0x0002
405#define EXT2_SF_BAD_EXTRA_BYTES 0x0004
406#define EXT2_SF_SKIP_MISSING_ITABLE 0x0008
Theodore Ts'of5fa2002006-05-08 20:17:26 -0400407#define EXT2_SF_DO_LAZY 0x0010
Theodore Ts'o3839e651997-04-26 13:21:57 +0000408
Theodore Ts'of3db3561997-04-26 13:34:30 +0000409/*
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000410 * ext2fs_check_if_mounted flags
411 */
412#define EXT2_MF_MOUNTED 1
413#define EXT2_MF_ISROOT 2
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000414#define EXT2_MF_READONLY 4
Theodore Ts'o07cefe72001-12-24 15:20:22 -0500415#define EXT2_MF_SWAP 8
Theodore Ts'o2fa8f372005-06-05 16:05:22 -0400416#define EXT2_MF_BUSY 16
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000417
418/*
419 * Ext2/linux mode flags. We define them here so that we don't need
420 * to depend on the OS's sys/stat.h, since we may be compiling on a
421 * non-Linux system.
422 */
423#define LINUX_S_IFMT 00170000
424#define LINUX_S_IFSOCK 0140000
425#define LINUX_S_IFLNK 0120000
426#define LINUX_S_IFREG 0100000
427#define LINUX_S_IFBLK 0060000
428#define LINUX_S_IFDIR 0040000
429#define LINUX_S_IFCHR 0020000
430#define LINUX_S_IFIFO 0010000
431#define LINUX_S_ISUID 0004000
432#define LINUX_S_ISGID 0002000
433#define LINUX_S_ISVTX 0001000
434
Theodore Ts'o1e3472c1997-04-29 14:53:37 +0000435#define LINUX_S_IRWXU 00700
436#define LINUX_S_IRUSR 00400
437#define LINUX_S_IWUSR 00200
438#define LINUX_S_IXUSR 00100
439
440#define LINUX_S_IRWXG 00070
441#define LINUX_S_IRGRP 00040
442#define LINUX_S_IWGRP 00020
443#define LINUX_S_IXGRP 00010
444
445#define LINUX_S_IRWXO 00007
446#define LINUX_S_IROTH 00004
447#define LINUX_S_IWOTH 00002
448#define LINUX_S_IXOTH 00001
449
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000450#define LINUX_S_ISLNK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFLNK)
451#define LINUX_S_ISREG(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFREG)
452#define LINUX_S_ISDIR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFDIR)
453#define LINUX_S_ISCHR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFCHR)
454#define LINUX_S_ISBLK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFBLK)
455#define LINUX_S_ISFIFO(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFIFO)
456#define LINUX_S_ISSOCK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFSOCK)
457
458/*
Theodore Ts'o819157d2003-01-22 18:25:39 -0500459 * ext2 size of an inode
460 */
461#define EXT2_I_SIZE(i) ((i)->i_size | ((__u64) (i)->i_size_high << 32))
462
463/*
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000464 * ext2_icount_t abstraction
465 */
466#define EXT2_ICOUNT_OPT_INCREMENT 0x01
467
468typedef struct ext2_icount *ext2_icount_t;
469
470/*
Theodore Ts'o30fab291997-10-25 22:37:42 +0000471 * Flags for ext2fs_bmap
472 */
Theodore Ts'o1d667532004-12-23 13:55:34 -0500473#define BMAP_ALLOC 0x0001
474#define BMAP_SET 0x0002
Theodore Ts'o30fab291997-10-25 22:37:42 +0000475
476/*
Theodore Ts'occ9bf5d2008-02-18 14:59:45 -0500477 * Returned flags from ext2fs_bmap
478 */
479#define BMAP_RET_UNINIT 0x0001
480
481/*
Theodore Ts'o72ed1262000-11-12 19:32:20 +0000482 * Flags for imager.c functions
483 */
484#define IMAGER_FLAG_INODEMAP 1
485#define IMAGER_FLAG_SPARSEWRITE 2
486
487/*
Theodore Ts'of3db3561997-04-26 13:34:30 +0000488 * For checking structure magic numbers...
489 */
Theodore Ts'o3839e651997-04-26 13:21:57 +0000490
Theodore Ts'of3db3561997-04-26 13:34:30 +0000491#define EXT2_CHECK_MAGIC(struct, code) \
492 if ((struct)->magic != (code)) return (code)
Theodore Ts'o1e3472c1997-04-29 14:53:37 +0000493
494
495/*
Theodore Ts'oe5b38a52001-01-01 16:17:12 +0000496 * For ext2 compression support
Theodore Ts'o1e3472c1997-04-29 14:53:37 +0000497 */
Valerie Clement5d38ef12007-08-30 17:33:40 +0200498#define EXT2FS_COMPRESSED_BLKADDR ((blk_t) -1)
Theodore Ts'o5a63dd22000-02-11 15:44:08 +0000499#define HOLE_BLKADDR(_b) ((_b) == 0 || (_b) == EXT2FS_COMPRESSED_BLKADDR)
500
Theodore Ts'o521e3681997-04-29 17:48:10 +0000501/*
Theodore Ts'o426d7342001-01-13 01:29:05 +0000502 * Features supported by this version of the library
Theodore Ts'o521e3681997-04-29 17:48:10 +0000503 */
Theodore Ts'o3a5f8ea1999-09-14 20:21:26 +0000504#define EXT2_LIB_FEATURE_COMPAT_SUPP (EXT2_FEATURE_COMPAT_DIR_PREALLOC|\
505 EXT2_FEATURE_COMPAT_IMAGIC_INODES|\
Theodore Ts'o342d8472001-07-02 11:54:09 -0400506 EXT3_FEATURE_COMPAT_HAS_JOURNAL|\
Theodore Ts'od323f8f2004-12-15 14:39:16 -0500507 EXT2_FEATURE_COMPAT_RESIZE_INODE|\
Theodore Ts'o52783e02002-03-11 15:04:45 -0500508 EXT2_FEATURE_COMPAT_DIR_INDEX|\
Theodore Ts'o342d8472001-07-02 11:54:09 -0400509 EXT2_FEATURE_COMPAT_EXT_ATTR)
Theodore Ts'o2fe1efe2000-12-31 13:39:17 +0000510
Theodore Ts'o5a63dd22000-02-11 15:44:08 +0000511/* This #ifdef is temporary until compression is fully supported */
512#ifdef ENABLE_COMPRESSION
Theodore Ts'oe589f672000-04-03 13:45:40 +0000513#ifndef I_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL
514/* If the below warning bugs you, then have
515 `CPPFLAGS=-DI_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL' in your
516 environment at configure time. */
Theodore Ts'ocdaf1fa2001-01-05 22:23:22 +0000517 #warning "Compression support is experimental"
Theodore Ts'oe589f672000-04-03 13:45:40 +0000518#endif
Theodore Ts'o5a63dd22000-02-11 15:44:08 +0000519#define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\
Theodore Ts'oab146762000-07-07 04:37:35 +0000520 EXT2_FEATURE_INCOMPAT_COMPRESSION|\
Theodore Ts'oa1128472001-01-16 06:56:14 +0000521 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
Theodore Ts'oc046ac72002-10-20 00:38:57 -0400522 EXT2_FEATURE_INCOMPAT_META_BG|\
Jose R. Santosc2d43002007-08-13 23:32:57 -0500523 EXT3_FEATURE_INCOMPAT_RECOVER|\
Theodore Ts'o15d482b2007-08-20 21:31:11 -0400524 EXT3_FEATURE_INCOMPAT_EXTENTS|\
Jose R. Santosc2d43002007-08-13 23:32:57 -0500525 EXT4_FEATURE_INCOMPAT_FLEX_BG)
Theodore Ts'o5a63dd22000-02-11 15:44:08 +0000526#else
Theodore Ts'oab146762000-07-07 04:37:35 +0000527#define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\
Theodore Ts'oa1128472001-01-16 06:56:14 +0000528 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
Theodore Ts'oc046ac72002-10-20 00:38:57 -0400529 EXT2_FEATURE_INCOMPAT_META_BG|\
Jose R. Santosc2d43002007-08-13 23:32:57 -0500530 EXT3_FEATURE_INCOMPAT_RECOVER|\
Theodore Ts'o15d482b2007-08-20 21:31:11 -0400531 EXT3_FEATURE_INCOMPAT_EXTENTS|\
Jose R. Santosc2d43002007-08-13 23:32:57 -0500532 EXT4_FEATURE_INCOMPAT_FLEX_BG)
Theodore Ts'o5a63dd22000-02-11 15:44:08 +0000533#endif
Theodore Ts'o674a4ee1998-03-23 02:06:52 +0000534#define EXT2_LIB_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\
Theodore Ts'o1ca10592008-04-09 11:39:11 -0400535 EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\
Andreas Dilgera7c9cb72008-02-02 01:25:03 -0700536 EXT2_FEATURE_RO_COMPAT_LARGE_FILE|\
Jose R. Santosd4f34d42007-10-21 21:03:25 -0500537 EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\
Theodore Ts'o2be8fe42008-07-10 10:49:59 -0400538 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|\
Jose R. Santosd4f34d42007-10-21 21:03:25 -0500539 EXT4_FEATURE_RO_COMPAT_GDT_CSUM)
Theodore Ts'ocf8272e2006-11-12 23:26:46 -0500540
541/*
542 * These features are only allowed if EXT2_FLAG_SOFTSUPP_FEATURES is passed
543 * to ext2fs_openfs()
544 */
Theodore Ts'o1ca10592008-04-09 11:39:11 -0400545#define EXT2_LIB_SOFTSUPP_INCOMPAT (0)
Theodore Ts'o2be8fe42008-07-10 10:49:59 -0400546#define EXT2_LIB_SOFTSUPP_RO_COMPAT (0)
Theodore Ts'ocf8272e2006-11-12 23:26:46 -0500547
Theodore Ts'o3839e651997-04-26 13:21:57 +0000548/*
549 * function prototypes
550 */
551
552/* alloc.c */
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000553extern errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode,
554 ext2fs_inode_bitmap map, ext2_ino_t *ret);
Theodore Ts'o3839e651997-04-26 13:21:57 +0000555extern errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal,
Theodore Ts'of3db3561997-04-26 13:34:30 +0000556 ext2fs_block_bitmap map, blk_t *ret);
Theodore Ts'o3839e651997-04-26 13:21:57 +0000557extern errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start,
Theodore Ts'of3db3561997-04-26 13:34:30 +0000558 blk_t finish, int num,
559 ext2fs_block_bitmap map,
Theodore Ts'o3839e651997-04-26 13:21:57 +0000560 blk_t *ret);
Theodore Ts'o30fab291997-10-25 22:37:42 +0000561extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal,
562 char *block_buf, blk_t *ret);
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400563extern void ext2fs_set_alloc_block_callback(ext2_filsys fs,
Theodore Ts'of5c562e2008-06-02 17:21:37 -0400564 errcode_t (*func)(ext2_filsys fs,
565 blk64_t goal,
566 blk64_t *ret),
567 errcode_t (**old)(ext2_filsys fs,
568 blk64_t goal,
569 blk64_t *ret));
Theodore Ts'o3839e651997-04-26 13:21:57 +0000570
Theodore Ts'oef344e12003-11-21 09:02:21 -0500571/* alloc_sb.c */
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400572extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
Theodore Ts'oef344e12003-11-21 09:02:21 -0500573 dgrp_t group,
574 ext2fs_block_bitmap bmap);
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400575extern void ext2fs_set_block_alloc_stats_callback(ext2_filsys fs,
Theodore Ts'of5c562e2008-06-02 17:21:37 -0400576 void (*func)(ext2_filsys fs,
577 blk64_t blk,
578 int inuse),
579 void (**old)(ext2_filsys fs,
580 blk64_t blk,
581 int inuse));
Theodore Ts'oef344e12003-11-21 09:02:21 -0500582
Theodore Ts'o8bd0c952002-01-03 03:29:19 -0500583/* alloc_stats.c */
584void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse);
Theodore Ts'o7f961d42002-02-03 01:28:52 -0500585void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino,
586 int inuse, int isdir);
Theodore Ts'o8bd0c952002-01-03 03:29:19 -0500587void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse);
588
Theodore Ts'o1e1da291997-06-09 14:51:29 +0000589/* alloc_tables.c */
590extern errcode_t ext2fs_allocate_tables(ext2_filsys fs);
Theodore Ts'o2eb374c1998-09-03 01:22:57 +0000591extern errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
Theodore Ts'o1e1da291997-06-09 14:51:29 +0000592 ext2fs_block_bitmap bmap);
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000593
Theodore Ts'o3839e651997-04-26 13:21:57 +0000594/* badblocks.c */
Theodore Ts'ob7a00562002-07-20 00:28:07 -0400595extern errcode_t ext2fs_u32_list_create(ext2_u32_list *ret, int size);
596extern errcode_t ext2fs_u32_list_add(ext2_u32_list bb, __u32 blk);
Theodore Ts'o54434922003-12-07 01:28:50 -0500597extern int ext2fs_u32_list_find(ext2_u32_list bb, __u32 blk);
Theodore Ts'ob7a00562002-07-20 00:28:07 -0400598extern int ext2fs_u32_list_test(ext2_u32_list bb, blk_t blk);
599extern errcode_t ext2fs_u32_list_iterate_begin(ext2_u32_list bb,
600 ext2_u32_iterate *ret);
601extern int ext2fs_u32_list_iterate(ext2_u32_iterate iter, blk_t *blk);
602extern void ext2fs_u32_list_iterate_end(ext2_u32_iterate iter);
603extern errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest);
604extern int ext2fs_u32_list_equal(ext2_u32_list bb1, ext2_u32_list bb2);
605
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000606extern errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret,
607 int size);
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000608extern errcode_t ext2fs_badblocks_list_add(ext2_badblocks_list bb,
609 blk_t blk);
610extern int ext2fs_badblocks_list_test(ext2_badblocks_list bb,
611 blk_t blk);
Theodore Ts'o7d7bdd52003-06-24 17:34:02 -0400612extern int ext2fs_u32_list_del(ext2_u32_list bb, __u32 blk);
613extern void ext2fs_badblocks_list_del(ext2_u32_list bb, __u32 blk);
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000614extern errcode_t
615 ext2fs_badblocks_list_iterate_begin(ext2_badblocks_list bb,
616 ext2_badblocks_iterate *ret);
617extern int ext2fs_badblocks_list_iterate(ext2_badblocks_iterate iter,
618 blk_t *blk);
619extern void ext2fs_badblocks_list_iterate_end(ext2_badblocks_iterate iter);
Theodore Ts'oa29f4d31997-04-29 21:26:48 +0000620extern errcode_t ext2fs_badblocks_copy(ext2_badblocks_list src,
621 ext2_badblocks_list *dest);
Theodore Ts'o57dca852000-07-04 19:20:25 +0000622extern int ext2fs_badblocks_equal(ext2_badblocks_list bb1,
623 ext2_badblocks_list bb2);
Theodore Ts'o220c0042003-03-14 00:59:42 -0500624extern int ext2fs_u32_list_count(ext2_u32_list bb);
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000625
626/* bb_compat */
Theodore Ts'o3839e651997-04-26 13:21:57 +0000627extern errcode_t badblocks_list_create(badblocks_list *ret, int size);
Theodore Ts'o3839e651997-04-26 13:21:57 +0000628extern errcode_t badblocks_list_add(badblocks_list bb, blk_t blk);
629extern int badblocks_list_test(badblocks_list bb, blk_t blk);
630extern errcode_t badblocks_list_iterate_begin(badblocks_list bb,
631 badblocks_iterate *ret);
632extern int badblocks_list_iterate(badblocks_iterate iter, blk_t *blk);
633extern void badblocks_list_iterate_end(badblocks_iterate iter);
Theodore Ts'oa29f4d31997-04-29 21:26:48 +0000634extern void badblocks_list_free(badblocks_list bb);
Theodore Ts'o3839e651997-04-26 13:21:57 +0000635
636/* bb_inode.c */
637extern errcode_t ext2fs_update_bb_inode(ext2_filsys fs,
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000638 ext2_badblocks_list bb_list);
Theodore Ts'o3839e651997-04-26 13:21:57 +0000639
640/* bitmaps.c */
Theodore Ts'oa0553c92007-07-22 22:59:50 -0400641extern void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap);
642extern void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap);
Theodore Ts'of1f115a2007-07-23 04:32:48 -0400643extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src,
644 ext2fs_generic_bitmap *dest);
Theodore Ts'o3839e651997-04-26 13:21:57 +0000645extern errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs);
646extern errcode_t ext2fs_write_block_bitmap (ext2_filsys fs);
647extern errcode_t ext2fs_read_inode_bitmap (ext2_filsys fs);
648extern errcode_t ext2fs_read_block_bitmap(ext2_filsys fs);
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000649extern errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
650 const char *descr,
651 ext2fs_block_bitmap *ret);
652extern errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs,
653 const char *descr,
654 ext2fs_inode_bitmap *ret);
655extern errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap,
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000656 ext2_ino_t end, ext2_ino_t *oend);
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000657extern errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap,
658 blk_t end, blk_t *oend);
659extern void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap);
660extern void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap);
Theodore Ts'o3839e651997-04-26 13:21:57 +0000661extern errcode_t ext2fs_read_bitmaps(ext2_filsys fs);
662extern errcode_t ext2fs_write_bitmaps(ext2_filsys fs);
Theodore Ts'o50448d32007-07-22 23:42:14 -0400663extern errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end,
664 ext2fs_inode_bitmap bmap);
665extern errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end,
666 ext2fs_block_bitmap bmap);
667extern errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1,
668 ext2fs_block_bitmap bm2);
669extern errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1,
670 ext2fs_inode_bitmap bm2);
Theodore Ts'of1f115a2007-07-23 04:32:48 -0400671extern errcode_t ext2fs_set_inode_bitmap_range(ext2fs_inode_bitmap bmap,
672 ext2_ino_t start, unsigned int num,
673 void *in);
674extern errcode_t ext2fs_get_inode_bitmap_range(ext2fs_inode_bitmap bmap,
675 ext2_ino_t start, unsigned int num,
676 void *out);
677extern errcode_t ext2fs_set_block_bitmap_range(ext2fs_block_bitmap bmap,
678 blk_t start, unsigned int num,
679 void *in);
680extern errcode_t ext2fs_get_block_bitmap_range(ext2fs_block_bitmap bmap,
681 blk_t start, unsigned int num,
682 void *out);
Theodore Ts'o50448d32007-07-22 23:42:14 -0400683
Theodore Ts'o3839e651997-04-26 13:21:57 +0000684
685/* block.c */
686extern errcode_t ext2fs_block_iterate(ext2_filsys fs,
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000687 ext2_ino_t ino,
Theodore Ts'o3839e651997-04-26 13:21:57 +0000688 int flags,
689 char *block_buf,
690 int (*func)(ext2_filsys fs,
691 blk_t *blocknr,
692 int blockcnt,
Theodore Ts'ob5abe6f1998-01-19 14:47:53 +0000693 void *priv_data),
694 void *priv_data);
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000695errcode_t ext2fs_block_iterate2(ext2_filsys fs,
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000696 ext2_ino_t ino,
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000697 int flags,
698 char *block_buf,
699 int (*func)(ext2_filsys fs,
700 blk_t *blocknr,
Theodore Ts'o03673db1998-06-10 20:39:43 +0000701 e2_blkcnt_t blockcnt,
Theodore Ts'o674a4ee1998-03-23 02:06:52 +0000702 blk_t ref_blk,
703 int ref_offset,
704 void *priv_data),
705 void *priv_data);
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000706
Theodore Ts'o30fab291997-10-25 22:37:42 +0000707/* bmap.c */
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000708extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino,
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400709 struct ext2_inode *inode,
Theodore Ts'o30fab291997-10-25 22:37:42 +0000710 char *block_buf, int bmap_flags,
711 blk_t block, blk_t *phys_blk);
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400712extern errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino,
Theodore Ts'occ9bf5d2008-02-18 14:59:45 -0500713 struct ext2_inode *inode,
714 char *block_buf, int bmap_flags, blk64_t block,
715 int *ret_flags, blk64_t *phys_blk);
Theodore Ts'o30fab291997-10-25 22:37:42 +0000716
Theodore Ts'o4a31c481998-03-30 01:27:25 +0000717#if 0
Theodore Ts'o1e1da291997-06-09 14:51:29 +0000718/* bmove.c */
719extern errcode_t ext2fs_move_blocks(ext2_filsys fs,
720 ext2fs_block_bitmap reserve,
Theodore Ts'o9941fb71997-06-11 22:27:41 +0000721 ext2fs_block_bitmap alloc_map,
Theodore Ts'o1e1da291997-06-09 14:51:29 +0000722 int flags);
Theodore Ts'o4a31c481998-03-30 01:27:25 +0000723#endif
Theodore Ts'o1e1da291997-06-09 14:51:29 +0000724
Theodore Ts'of3db3561997-04-26 13:34:30 +0000725/* check_desc.c */
726extern errcode_t ext2fs_check_desc(ext2_filsys fs);
727
Theodore Ts'o3839e651997-04-26 13:21:57 +0000728/* closefs.c */
729extern errcode_t ext2fs_close(ext2_filsys fs);
730extern errcode_t ext2fs_flush(ext2_filsys fs);
Theodore Ts'o1b4cd9c2004-12-15 18:06:52 -0500731extern int ext2fs_bg_has_super(ext2_filsys fs, int group_block);
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400732extern int ext2fs_super_and_bgd_loc(ext2_filsys fs,
Theodore Ts'oef344e12003-11-21 09:02:21 -0500733 dgrp_t group,
734 blk_t *ret_super_blk,
735 blk_t *ret_old_desc_blk,
736 blk_t *ret_new_desc_blk,
737 int *ret_meta_bg);
Theodore Ts'o1b4cd9c2004-12-15 18:06:52 -0500738extern void ext2fs_update_dynamic_rev(ext2_filsys fs);
Theodore Ts'o3839e651997-04-26 13:21:57 +0000739
Jose R. Santosca2634a2007-10-21 21:03:19 -0500740/* csum.c */
741extern void ext2fs_group_desc_csum_set(ext2_filsys fs, dgrp_t group);
742extern int ext2fs_group_desc_csum_verify(ext2_filsys fs, dgrp_t group);
Andreas Dilgerf628ace2008-03-31 10:50:19 -0400743extern errcode_t ext2fs_set_gdt_csum(ext2_filsys fs);
Jose R. Santosca2634a2007-10-21 21:03:19 -0500744
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000745/* dblist.c */
746
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000747extern errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs);
Theodore Ts'oa29f4d31997-04-29 21:26:48 +0000748extern errcode_t ext2fs_init_dblist(ext2_filsys fs, ext2_dblist *ret_dblist);
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000749extern errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino,
Theodore Ts'oa29f4d31997-04-29 21:26:48 +0000750 blk_t blk, int blockcnt);
Theodore Ts'oea1959f2002-08-31 02:32:41 -0400751extern void ext2fs_dblist_sort(ext2_dblist dblist,
752 EXT2_QSORT_TYPE (*sortfunc)(const void *,
753 const void *));
Theodore Ts'oa29f4d31997-04-29 21:26:48 +0000754extern errcode_t ext2fs_dblist_iterate(ext2_dblist dblist,
755 int (*func)(ext2_filsys fs, struct ext2_db_entry *db_info,
Theodore Ts'ob5abe6f1998-01-19 14:47:53 +0000756 void *priv_data),
757 void *priv_data);
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000758extern errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino,
Theodore Ts'oa29f4d31997-04-29 21:26:48 +0000759 blk_t blk, int blockcnt);
760extern errcode_t ext2fs_copy_dblist(ext2_dblist src,
761 ext2_dblist *dest);
Theodore Ts'o549860c1997-06-17 03:55:00 +0000762extern int ext2fs_dblist_count(ext2_dblist dblist);
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400763extern errcode_t ext2fs_dblist_get_last(ext2_dblist dblist,
Theodore Ts'o52b1dd52008-03-13 00:34:16 -0400764 struct ext2_db_entry **entry);
765extern errcode_t ext2fs_dblist_drop_last(ext2_dblist dblist);
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000766
767/* dblist_dir.c */
768extern errcode_t
769 ext2fs_dblist_dir_iterate(ext2_dblist dblist,
770 int flags,
771 char *block_buf,
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000772 int (*func)(ext2_ino_t dir,
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000773 int entry,
774 struct ext2_dir_entry *dirent,
775 int offset,
776 int blocksize,
777 char *buf,
Theodore Ts'ob5abe6f1998-01-19 14:47:53 +0000778 void *priv_data),
779 void *priv_data);
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000780
781/* dirblock.c */
782extern errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
783 void *buf);
Theodore Ts'of9190c82002-03-12 01:05:06 -0500784extern errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block,
785 void *buf, int flags);
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000786extern errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block,
787 void *buf);
Theodore Ts'of9190c82002-03-12 01:05:06 -0500788extern errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block,
789 void *buf, int flags);
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000790
Theodore Ts'o52783e02002-03-11 15:04:45 -0500791/* dirhash.c */
792extern errcode_t ext2fs_dirhash(int version, const char *name, int len,
Theodore Ts'ob33278c2002-08-17 10:52:51 -0400793 const __u32 *seed,
Theodore Ts'o503f9e72002-06-26 16:52:10 -0400794 ext2_dirhash_t *ret_hash,
795 ext2_dirhash_t *ret_minor_hash);
Theodore Ts'o52783e02002-03-11 15:04:45 -0500796
797
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000798/* dir_iterate.c */
Theodore Ts'o8a480352009-06-21 21:07:38 -0400799extern errcode_t ext2fs_get_rec_len(ext2_filsys fs,
800 struct ext2_dir_entry *dirent,
801 unsigned int *rec_len);
802extern errcode_t ext2fs_set_rec_len(ext2_filsys fs,
803 unsigned int len,
804 struct ext2_dir_entry *dirent);
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400805extern errcode_t ext2fs_dir_iterate(ext2_filsys fs,
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000806 ext2_ino_t dir,
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000807 int flags,
808 char *block_buf,
809 int (*func)(struct ext2_dir_entry *dirent,
810 int offset,
811 int blocksize,
812 char *buf,
Theodore Ts'ob5abe6f1998-01-19 14:47:53 +0000813 void *priv_data),
814 void *priv_data);
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400815extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs,
Theodore Ts'o8bd0c952002-01-03 03:29:19 -0500816 ext2_ino_t dir,
817 int flags,
818 char *block_buf,
819 int (*func)(ext2_ino_t dir,
820 int entry,
821 struct ext2_dir_entry *dirent,
822 int offset,
823 int blocksize,
824 char *buf,
825 void *priv_data),
826 void *priv_data);
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000827
Theodore Ts'oa29f4d31997-04-29 21:26:48 +0000828/* dupfs.c */
829extern errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest);
Theodore Ts'o19c78dc1997-04-29 16:17:09 +0000830
Theodore Ts'o3839e651997-04-26 13:21:57 +0000831/* expanddir.c */
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000832extern errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir);
Theodore Ts'o3839e651997-04-26 13:21:57 +0000833
Theodore Ts'o342d8472001-07-02 11:54:09 -0400834/* ext_attr.c */
Andreas Dilgerfefaef32008-02-02 01:16:32 -0700835extern __u32 ext2fs_ext_attr_hash_entry(struct ext2_ext_attr_entry *entry,
836 void *data);
Theodore Ts'o342d8472001-07-02 11:54:09 -0400837extern errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf);
Theodore Ts'o0684a4f2002-08-17 10:19:44 -0400838extern errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block,
839 void *buf);
840extern errcode_t ext2fs_adjust_ea_refcount(ext2_filsys fs, blk_t blk,
841 char *block_buf,
842 int adjust, __u32 *newcount);
843
Theodore Ts'o3eb07f62007-10-14 23:04:58 -0400844/* extent.c */
845extern errcode_t ext2fs_extent_header_verify(void *ptr, int size);
846extern errcode_t ext2fs_extent_open(ext2_filsys fs, ext2_ino_t ino,
847 ext2_extent_handle_t *handle);
number965284b239a2009-05-19 13:34:12 -0700848extern errcode_t ext2fs_extent_open2(ext2_filsys fs, ext2_ino_t ino,
849 struct ext2_inode *inode,
850 ext2_extent_handle_t *ret_handle);
Theodore Ts'o2d328bb2008-03-17 23:17:13 -0400851extern void ext2fs_extent_free(ext2_extent_handle_t handle);
Theodore Ts'o3eb07f62007-10-14 23:04:58 -0400852extern errcode_t ext2fs_extent_get(ext2_extent_handle_t handle,
853 int flags, struct ext2fs_extent *extent);
854extern errcode_t ext2fs_extent_replace(ext2_extent_handle_t handle, int flags,
855 struct ext2fs_extent *extent);
856extern errcode_t ext2fs_extent_insert(ext2_extent_handle_t handle, int flags,
857 struct ext2fs_extent *extent);
Eric Sandeenf4e99632008-05-20 10:17:46 -0500858extern errcode_t ext2fs_extent_set_bmap(ext2_extent_handle_t handle,
859 blk64_t logical, blk64_t physical,
860 int flags);
Theodore Ts'o3eb07f62007-10-14 23:04:58 -0400861extern errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, int flags);
862extern errcode_t ext2fs_extent_get_info(ext2_extent_handle_t handle,
863 struct ext2_extent_info *info);
864extern errcode_t ext2fs_extent_goto(ext2_extent_handle_t handle,
865 blk64_t blk);
866
Theodore Ts'o30fab291997-10-25 22:37:42 +0000867/* fileio.c */
Theodore Ts'oa435ec32003-08-21 00:40:26 -0400868extern errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino,
869 struct ext2_inode *inode,
870 int flags, ext2_file_t *ret);
Theodore Ts'o31dbecd2001-01-11 04:54:39 +0000871extern errcode_t ext2fs_file_open(ext2_filsys fs, ext2_ino_t ino,
Theodore Ts'o30fab291997-10-25 22:37:42 +0000872 int flags, ext2_file_t *ret);
Theodore Ts'o79a90bd1997-11-03 19:16:55 +0000873extern ext2_filsys ext2fs_file_get_fs(ext2_file_t file);
Theodore Ts'o30fab291997-10-25 22:37:42 +0000874extern errcode_t ext2fs_file_close(ext2_file_t file);
Theodore Ts'of12e2852002-02-20 01:06:25 -0500875extern errcode_t ext2fs_file_flush(ext2_file_t file);
Theodore Ts'o30fab291997-10-25 22:37:42 +0000876extern errcode_t ext2fs_file_read(ext2_file_t file, void *buf,
Theodore Ts'o79a90bd1997-11-03 19:16:55 +0000877 unsigned int wanted, unsigned int *got);
Theodore Ts'of12e2852002-02-20 01:06:25 -0500878extern errcode_t ext2fs_file_write(ext2_file_t file, const void *buf,
Theodore Ts'o79a90bd1997-11-03 19:16:55 +0000879 unsigned int nbytes, unsigned int *written);
Theodore Ts'o819157d2003-01-22 18:25:39 -0500880extern errcode_t ext2fs_file_llseek(ext2_file_t file, __u64 offset,
881 int whence, __u64 *ret_pos);
Theodore Ts'o674a4ee1998-03-23 02:06:52 +0000882extern errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset,
883 int whence, ext2_off_t *ret_pos);
Theodore Ts'o819157d2003-01-22 18:25:39 -0500884errcode_t ext2fs_file_get_lsize(ext2_file_t file, __u64 *ret_size);
Theodore Ts'o79a90bd1997-11-03 19:16:55 +0000885extern ext2_off_t ext2fs_file_get_size(ext2_file_t file);
886extern errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size);
Theodore Ts'o30fab291997-10-25 22:37:42 +0000887
Theodore Ts'ode23aa12000-08-19 17:00:47 +0000888/* finddev.c */
889extern char *ext2fs_find_block_device(dev_t device);
890
Theodore Ts'o4d0f3e12001-01-11 15:48:50 +0000891/* flushb.c */
892extern errcode_t ext2fs_sync_device(int fd, int flushb);
893
Theodore Ts'o3839e651997-04-26 13:21:57 +0000894/* freefs.c */
895extern void ext2fs_free(ext2_filsys fs);
Theodore Ts'oa29f4d31997-04-29 21:26:48 +0000896extern void ext2fs_free_dblist(ext2_dblist dblist);
Theodore Ts'ob7a00562002-07-20 00:28:07 -0400897extern void ext2fs_badblocks_list_free(ext2_badblocks_list bb);
898extern void ext2fs_u32_list_free(ext2_u32_list bb);
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000899
Theodore Ts'oa0553c92007-07-22 22:59:50 -0400900/* gen_bitmap.c */
901extern void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap bitmap);
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400902extern errcode_t ext2fs_make_generic_bitmap(errcode_t magic, ext2_filsys fs,
903 __u32 start, __u32 end,
Theodore Ts'oa0553c92007-07-22 22:59:50 -0400904 __u32 real_end,
905 const char *descr, char *init_map,
906 ext2fs_generic_bitmap *ret);
907extern errcode_t ext2fs_allocate_generic_bitmap(__u32 start,
908 __u32 end,
909 __u32 real_end,
910 const char *descr,
911 ext2fs_generic_bitmap *ret);
912extern errcode_t ext2fs_copy_generic_bitmap(ext2fs_generic_bitmap src,
913 ext2fs_generic_bitmap *dest);
914extern void ext2fs_clear_generic_bitmap(ext2fs_generic_bitmap bitmap);
915extern errcode_t ext2fs_fudge_generic_bitmap_end(ext2fs_inode_bitmap bitmap,
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400916 errcode_t magic,
Theodore Ts'oa0553c92007-07-22 22:59:50 -0400917 errcode_t neq,
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400918 ext2_ino_t end,
Theodore Ts'oa0553c92007-07-22 22:59:50 -0400919 ext2_ino_t *oend);
920extern void ext2fs_set_generic_bitmap_padding(ext2fs_generic_bitmap map);
Theodore Ts'o50448d32007-07-22 23:42:14 -0400921extern errcode_t ext2fs_resize_generic_bitmap(errcode_t magic,
922 __u32 new_end,
923 __u32 new_real_end,
924 ext2fs_generic_bitmap bmap);
925extern errcode_t ext2fs_compare_generic_bitmap(errcode_t magic, errcode_t neq,
926 ext2fs_generic_bitmap bm1,
927 ext2fs_generic_bitmap bm2);
Theodore Ts'of1f115a2007-07-23 04:32:48 -0400928extern errcode_t ext2fs_get_generic_bitmap_range(ext2fs_generic_bitmap bmap,
929 errcode_t magic,
930 __u32 start, __u32 num,
931 void *out);
932extern errcode_t ext2fs_set_generic_bitmap_range(ext2fs_generic_bitmap bmap,
933 errcode_t magic,
934 __u32 start, __u32 num,
935 void *in);
Theodore Ts'oa0553c92007-07-22 22:59:50 -0400936
Theodore Ts'o50e1e101997-04-26 13:58:21 +0000937/* getsize.c */
938extern errcode_t ext2fs_get_device_size(const char *file, int blocksize,
939 blk_t *retblocks);
Jose R. Santosbeab8de2008-08-20 12:34:07 -0500940extern errcode_t ext2fs_get_device_size2(const char *file, int blocksize,
941 blk64_t *retblocks);
Theodore Ts'o3839e651997-04-26 13:21:57 +0000942
Theodore Ts'o93d5c382003-05-21 17:28:29 -0400943/* getsectsize.c */
944errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize);
945
Theodore Ts'o1ca10592008-04-09 11:39:11 -0400946/* i_block.c */
947errcode_t ext2fs_iblk_add_blocks(ext2_filsys fs, struct ext2_inode *inode,
948 blk64_t num_blocks);
949errcode_t ext2fs_iblk_sub_blocks(ext2_filsys fs, struct ext2_inode *inode,
950 blk64_t num_blocks);
951errcode_t ext2fs_iblk_set(ext2_filsys fs, struct ext2_inode *inode, blk64_t b);
952
Theodore Ts'o72ed1262000-11-12 19:32:20 +0000953/* imager.c */
954extern errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags);
955extern errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, int flags);
956extern errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, int flags);
957extern errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, int flags);
958extern errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags);
959extern errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags);
960
Theodore Ts'odc8ce342005-01-06 00:04:24 -0500961/* ind_block.c */
962errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf);
963errcode_t ext2fs_write_ind_block(ext2_filsys fs, blk_t blk, void *buf);
964
Theodore Ts'o3839e651997-04-26 13:21:57 +0000965/* initialize.c */
966extern errcode_t ext2fs_initialize(const char *name, int flags,
967 struct ext2_super_block *param,
968 io_manager manager, ext2_filsys *ret_fs);
969
Theodore Ts'of12e2852002-02-20 01:06:25 -0500970/* icount.c */
971extern void ext2fs_free_icount(ext2_icount_t icount);
Theodore Ts'o1b9d8cb2007-04-06 14:30:39 -0400972extern errcode_t ext2fs_create_icount_tdb(ext2_filsys fs, char *tdb_dir,
973 int flags, ext2_icount_t *ret);
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400974extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags,
Theodore Ts'o54434922003-12-07 01:28:50 -0500975 unsigned int size,
Theodore Ts'of12e2852002-02-20 01:06:25 -0500976 ext2_icount_t hint, ext2_icount_t *ret);
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400977extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags,
Theodore Ts'o54434922003-12-07 01:28:50 -0500978 unsigned int size,
Theodore Ts'of12e2852002-02-20 01:06:25 -0500979 ext2_icount_t *ret);
980extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino,
981 __u16 *ret);
982extern errcode_t ext2fs_icount_increment(ext2_icount_t icount, ext2_ino_t ino,
983 __u16 *ret);
984extern errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino,
985 __u16 *ret);
986extern errcode_t ext2fs_icount_store(ext2_icount_t icount, ext2_ino_t ino,
987 __u16 count);
988extern ext2_ino_t ext2fs_get_icount_size(ext2_icount_t icount);
989errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *);
990
Theodore Ts'o3839e651997-04-26 13:21:57 +0000991/* inode.c */
Theodore Ts'o72ed1262000-11-12 19:32:20 +0000992extern errcode_t ext2fs_flush_icache(ext2_filsys fs);
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400993extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan,
Theodore Ts'o73311962005-01-25 23:42:56 -0500994 ext2_ino_t *ino,
Theodore Ts'oefc6f622008-08-27 23:07:54 -0400995 struct ext2_inode *inode,
Theodore Ts'o73311962005-01-25 23:42:56 -0500996 int bufsize);
Theodore Ts'o3839e651997-04-26 13:21:57 +0000997extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks,
998 ext2_inode_scan *ret_scan);
999extern void ext2fs_close_inode_scan(ext2_inode_scan scan);
Theodore Ts'o31dbecd2001-01-11 04:54:39 +00001000extern errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino,
Theodore Ts'o3839e651997-04-26 13:21:57 +00001001 struct ext2_inode *inode);
Theodore Ts'o19c78dc1997-04-29 16:17:09 +00001002extern errcode_t ext2fs_inode_scan_goto_blockgroup(ext2_inode_scan scan,
1003 int group);
1004extern void ext2fs_set_inode_callback
1005 (ext2_inode_scan scan,
1006 errcode_t (*done_group)(ext2_filsys fs,
1007 ext2_inode_scan scan,
1008 dgrp_t group,
Theodore Ts'ob5abe6f1998-01-19 14:47:53 +00001009 void * priv_data),
Theodore Ts'o19c78dc1997-04-29 16:17:09 +00001010 void *done_group_data);
1011extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags,
1012 int clear_flags);
Theodore Ts'o73311962005-01-25 23:42:56 -05001013extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
Theodore Ts'oefc6f622008-08-27 23:07:54 -04001014 struct ext2_inode * inode,
Theodore Ts'o73311962005-01-25 23:42:56 -05001015 int bufsize);
Theodore Ts'o31dbecd2001-01-11 04:54:39 +00001016extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino,
Theodore Ts'o3839e651997-04-26 13:21:57 +00001017 struct ext2_inode * inode);
Theodore Ts'o73311962005-01-25 23:42:56 -05001018extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
Theodore Ts'oefc6f622008-08-27 23:07:54 -04001019 struct ext2_inode * inode,
Theodore Ts'o73311962005-01-25 23:42:56 -05001020 int bufsize);
Theodore Ts'o31dbecd2001-01-11 04:54:39 +00001021extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino,
Theodore Ts'o3839e651997-04-26 13:21:57 +00001022 struct ext2_inode * inode);
Theodore Ts'o030970e2005-03-20 20:05:22 -05001023extern errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino,
1024 struct ext2_inode * inode);
Theodore Ts'o31dbecd2001-01-11 04:54:39 +00001025extern errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks);
1026extern errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino);
Theodore Ts'o3839e651997-04-26 13:21:57 +00001027
Theodore Ts'of12e2852002-02-20 01:06:25 -05001028/* inode_io.c */
1029extern io_manager inode_io_manager;
Theodore Ts'oefc6f622008-08-27 23:07:54 -04001030extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino,
Theodore Ts'o546a1ff2002-03-07 23:52:56 -05001031 char **name);
Theodore Ts'oa435ec32003-08-21 00:40:26 -04001032extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino,
1033 struct ext2_inode *inode,
1034 char **name);
Theodore Ts'oefc6f622008-08-27 23:07:54 -04001035
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001036/* ismounted.c */
1037extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags);
Theodore Ts'o43ec8732001-01-03 14:56:46 +00001038extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
1039 char *mtpt, int mtlen);
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001040
Theodore Ts'o3839e651997-04-26 13:21:57 +00001041/* namei.c */
Theodore Ts'o31dbecd2001-01-11 04:54:39 +00001042extern errcode_t ext2fs_lookup(ext2_filsys fs, ext2_ino_t dir, const char *name,
1043 int namelen, char *buf, ext2_ino_t *inode);
1044extern errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
1045 const char *name, ext2_ino_t *inode);
1046errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
1047 const char *name, ext2_ino_t *inode);
1048extern errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
1049 ext2_ino_t inode, ext2_ino_t *res_inode);
Theodore Ts'o1e3472c1997-04-29 14:53:37 +00001050
1051/* native.c */
1052int ext2fs_native_flag(void);
Theodore Ts'o3839e651997-04-26 13:21:57 +00001053
1054/* newdir.c */
Theodore Ts'o31dbecd2001-01-11 04:54:39 +00001055extern errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino,
1056 ext2_ino_t parent_ino, char **block);
Theodore Ts'o3839e651997-04-26 13:21:57 +00001057
1058/* mkdir.c */
Theodore Ts'o31dbecd2001-01-11 04:54:39 +00001059extern errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum,
Theodore Ts'o3839e651997-04-26 13:21:57 +00001060 const char *name);
1061
Theodore Ts'od3cd93c2000-10-24 18:33:16 +00001062/* mkjournal.c */
Theodore Ts'oc8608502008-04-27 16:10:32 -04001063extern errcode_t ext2fs_zero_blocks(ext2_filsys fs, blk_t blk, int num,
1064 blk_t *ret_blk, int *ret_count);
Theodore Ts'oa1128472001-01-16 06:56:14 +00001065extern errcode_t ext2fs_create_journal_superblock(ext2_filsys fs,
1066 __u32 size, int flags,
1067 char **ret_jsb);
1068extern errcode_t ext2fs_add_journal_device(ext2_filsys fs,
1069 ext2_filsys journal_dev);
Theodore Ts'o31a17b32001-01-03 13:04:12 +00001070extern errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size,
1071 int flags);
Theodore Ts'o56d12362007-06-21 11:59:06 -04001072extern int ext2fs_default_journal_size(__u64 blocks);
Theodore Ts'od3cd93c2000-10-24 18:33:16 +00001073
Theodore Ts'o3839e651997-04-26 13:21:57 +00001074/* openfs.c */
1075extern errcode_t ext2fs_open(const char *name, int flags, int superblock,
Theodore Ts'o54434922003-12-07 01:28:50 -05001076 unsigned int block_size, io_manager manager,
Theodore Ts'o3839e651997-04-26 13:21:57 +00001077 ext2_filsys *ret_fs);
Theodore Ts'oefc6f622008-08-27 23:07:54 -04001078extern errcode_t ext2fs_open2(const char *name, const char *io_options,
1079 int flags, int superblock,
Theodore Ts'o2e8ca9a2004-11-30 14:07:11 -05001080 unsigned int block_size, io_manager manager,
1081 ext2_filsys *ret_fs);
Theodore Ts'oefc6f622008-08-27 23:07:54 -04001082extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block,
Theodore Ts'oc046ac72002-10-20 00:38:57 -04001083 dgrp_t i);
Theodore Ts'o1ad54a92004-07-28 21:11:48 -04001084errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io);
1085errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io);
1086errcode_t ext2fs_rewrite_to_io(ext2_filsys fs, io_channel new_io);
Theodore Ts'o3839e651997-04-26 13:21:57 +00001087
1088/* get_pathname.c */
Theodore Ts'o31dbecd2001-01-11 04:54:39 +00001089extern errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino,
Theodore Ts'o3839e651997-04-26 13:21:57 +00001090 char **name);
1091
1092/* link.c */
Theodore Ts'o31dbecd2001-01-11 04:54:39 +00001093errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name,
1094 ext2_ino_t ino, int flags);
1095errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir, const char *name,
1096 ext2_ino_t ino, int flags);
Theodore Ts'o3839e651997-04-26 13:21:57 +00001097
1098/* read_bb.c */
Theodore Ts'o19c78dc1997-04-29 16:17:09 +00001099extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs,
1100 ext2_badblocks_list *bb_list);
Theodore Ts'o3839e651997-04-26 13:21:57 +00001101
1102/* read_bb_file.c */
Theodore Ts'oefc6f622008-08-27 23:07:54 -04001103extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f,
Theodore Ts'o57dca852000-07-04 19:20:25 +00001104 ext2_badblocks_list *bb_list,
Theodore Ts'o50cd7e02002-07-14 16:00:50 -04001105 void *priv_data,
Theodore Ts'o57dca852000-07-04 19:20:25 +00001106 void (*invalid)(ext2_filsys fs,
1107 blk_t blk,
1108 char *badstr,
Theodore Ts'o50cd7e02002-07-14 16:00:50 -04001109 void *priv_data));
Theodore Ts'oefc6f622008-08-27 23:07:54 -04001110extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f,
Theodore Ts'o19c78dc1997-04-29 16:17:09 +00001111 ext2_badblocks_list *bb_list,
Theodore Ts'o3839e651997-04-26 13:21:57 +00001112 void (*invalid)(ext2_filsys fs,
1113 blk_t blk));
1114
Theodore Ts'od323f8f2004-12-15 14:39:16 -05001115/* res_gdt.c */
1116extern errcode_t ext2fs_create_resize_inode(ext2_filsys fs);
1117
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001118/* swapfs.c */
Theodore Ts'oefc6f622008-08-27 23:07:54 -04001119extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize,
Theodore Ts'o73311962005-01-25 23:42:56 -05001120 int has_header);
Andreas Dilgerfefaef32008-02-02 01:16:32 -07001121extern void ext2fs_swap_ext_attr_header(struct ext2_ext_attr_header *to_header,
1122 struct ext2_ext_attr_header *from_hdr);
1123extern void ext2fs_swap_ext_attr_entry(struct ext2_ext_attr_entry *to_entry,
1124 struct ext2_ext_attr_entry *from_entry);
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001125extern void ext2fs_swap_super(struct ext2_super_block * super);
1126extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp);
Theodore Ts'o73311962005-01-25 23:42:56 -05001127extern void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
1128 struct ext2_inode_large *f, int hostorder,
1129 int bufsize);
Theodore Ts'o1e3472c1997-04-29 14:53:37 +00001130extern void ext2fs_swap_inode(ext2_filsys fs,struct ext2_inode *t,
1131 struct ext2_inode *f, int hostorder);
1132
Theodore Ts'o19c78dc1997-04-29 16:17:09 +00001133/* valid_blk.c */
Theodore Ts'o521e3681997-04-29 17:48:10 +00001134extern int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode);
1135
1136/* version.c */
1137extern int ext2fs_parse_version_string(const char *ver_string);
1138extern int ext2fs_get_library_version(const char **ver_string,
1139 const char **date_string);
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001140
Theodore Ts'o31dbecd2001-01-11 04:54:39 +00001141/* write_bb_file.c */
1142extern errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list,
1143 unsigned int flags,
1144 FILE *f);
1145
1146
Theodore Ts'o3839e651997-04-26 13:21:57 +00001147/* inline functions */
Theodore Ts'oc4e3d3f2003-08-01 09:41:07 -04001148extern errcode_t ext2fs_get_mem(unsigned long size, void *ptr);
Theodore Ts'oee010792007-11-09 19:01:06 -05001149extern errcode_t ext2fs_get_array(unsigned long count, unsigned long size, void *ptr);
Theodore Ts'oc4e3d3f2003-08-01 09:41:07 -04001150extern errcode_t ext2fs_free_mem(void *ptr);
Theodore Ts'o76f875d1998-04-27 01:41:13 +00001151extern errcode_t ext2fs_resize_mem(unsigned long old_size,
Theodore Ts'oc4e3d3f2003-08-01 09:41:07 -04001152 unsigned long size, void *ptr);
Theodore Ts'o3839e651997-04-26 13:21:57 +00001153extern void ext2fs_mark_super_dirty(ext2_filsys fs);
1154extern void ext2fs_mark_changed(ext2_filsys fs);
1155extern int ext2fs_test_changed(ext2_filsys fs);
1156extern void ext2fs_mark_valid(ext2_filsys fs);
1157extern void ext2fs_unmark_valid(ext2_filsys fs);
1158extern int ext2fs_test_valid(ext2_filsys fs);
1159extern void ext2fs_mark_ib_dirty(ext2_filsys fs);
1160extern void ext2fs_mark_bb_dirty(ext2_filsys fs);
1161extern int ext2fs_test_ib_dirty(ext2_filsys fs);
1162extern int ext2fs_test_bb_dirty(ext2_filsys fs);
1163extern int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk);
Theodore Ts'o31dbecd2001-01-11 04:54:39 +00001164extern int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino);
Eric Sandeenabf23432006-09-12 14:56:16 -04001165extern blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group);
1166extern blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group);
Theodore Ts'o0684a4f2002-08-17 10:19:44 -04001167extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
1168 struct ext2_inode *inode);
Theodore Ts'o69022e02006-08-30 01:57:00 -04001169extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b);
Theodore Ts'o3839e651997-04-26 13:21:57 +00001170
1171/*
1172 * The actual inlined functions definitions themselves...
1173 *
1174 * If NO_INLINE_FUNCS is defined, then we won't try to do inline
1175 * functions at all!
1176 */
1177#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
1178#ifdef INCLUDE_INLINE_FUNCS
1179#define _INLINE_ extern
1180#else
Theodore Ts'o76f875d1998-04-27 01:41:13 +00001181#ifdef __GNUC__
Theodore Ts'o3839e651997-04-26 13:21:57 +00001182#define _INLINE_ extern __inline__
Theodore Ts'o76f875d1998-04-27 01:41:13 +00001183#else /* For Watcom C */
1184#define _INLINE_ extern inline
1185#endif
Theodore Ts'o3839e651997-04-26 13:21:57 +00001186#endif
1187
Theodore Ts'o7b4e4531997-10-26 03:41:24 +00001188#ifndef EXT2_CUSTOM_MEMORY_ROUTINES
Matthias Andree68a7f952005-09-06 05:59:52 -04001189#include <string.h>
Theodore Ts'o7b4e4531997-10-26 03:41:24 +00001190/*
1191 * Allocate memory
1192 */
Theodore Ts'oc4e3d3f2003-08-01 09:41:07 -04001193_INLINE_ errcode_t ext2fs_get_mem(unsigned long size, void *ptr)
Theodore Ts'o7b4e4531997-10-26 03:41:24 +00001194{
Theodore Ts'o2694f312006-11-14 00:34:34 -05001195 void *pp;
Theodore Ts'oc4e3d3f2003-08-01 09:41:07 -04001196
Theodore Ts'o2694f312006-11-14 00:34:34 -05001197 pp = malloc(size);
1198 if (!pp)
Theodore Ts'o291c9041997-10-31 06:17:08 +00001199 return EXT2_ET_NO_MEMORY;
Theodore Ts'o2694f312006-11-14 00:34:34 -05001200 memcpy(ptr, &pp, sizeof (pp));
Theodore Ts'o7b4e4531997-10-26 03:41:24 +00001201 return 0;
1202}
Theodore Ts'oe5aace92007-12-27 10:08:13 -05001203
Theodore Ts'oee010792007-11-09 19:01:06 -05001204_INLINE_ errcode_t ext2fs_get_array(unsigned long count, unsigned long size, void *ptr)
1205{
1206 if (count && (-1UL)/count<size)
1207 return EXT2_ET_NO_MEMORY; //maybe define EXT2_ET_OVERFLOW ?
1208 return ext2fs_get_mem(count*size, ptr);
1209}
Theodore Ts'o7b4e4531997-10-26 03:41:24 +00001210
1211/*
1212 * Free memory
1213 */
Theodore Ts'oc4e3d3f2003-08-01 09:41:07 -04001214_INLINE_ errcode_t ext2fs_free_mem(void *ptr)
Theodore Ts'o7b4e4531997-10-26 03:41:24 +00001215{
Theodore Ts'o2694f312006-11-14 00:34:34 -05001216 void *p;
Theodore Ts'oc4e3d3f2003-08-01 09:41:07 -04001217
Theodore Ts'o2694f312006-11-14 00:34:34 -05001218 memcpy(&p, ptr, sizeof(p));
1219 free(p);
1220 p = 0;
1221 memcpy(ptr, &p, sizeof(p));
Theodore Ts'o7b4e4531997-10-26 03:41:24 +00001222 return 0;
1223}
Theodore Ts'oefc6f622008-08-27 23:07:54 -04001224
Theodore Ts'o7b4e4531997-10-26 03:41:24 +00001225/*
1226 * Resize memory
1227 */
Theodore Ts'oe47fd842004-02-21 21:04:30 -05001228_INLINE_ errcode_t ext2fs_resize_mem(unsigned long EXT2FS_ATTR((unused)) old_size,
Theodore Ts'oc4e3d3f2003-08-01 09:41:07 -04001229 unsigned long size, void *ptr)
Theodore Ts'o7b4e4531997-10-26 03:41:24 +00001230{
1231 void *p;
1232
Stephen Tweedie39c191f2005-06-27 11:47:21 -04001233 /* Use "memcpy" for pointer assignments here to avoid problems
1234 * with C99 strict type aliasing rules. */
Theodore Ts'o2694f312006-11-14 00:34:34 -05001235 memcpy(&p, ptr, sizeof(p));
Stephen Tweedie39c191f2005-06-27 11:47:21 -04001236 p = realloc(p, size);
Theodore Ts'o7b4e4531997-10-26 03:41:24 +00001237 if (!p)
Theodore Ts'o291c9041997-10-31 06:17:08 +00001238 return EXT2_ET_NO_MEMORY;
Theodore Ts'o2694f312006-11-14 00:34:34 -05001239 memcpy(ptr, &p, sizeof(p));
Theodore Ts'o7b4e4531997-10-26 03:41:24 +00001240 return 0;
1241}
1242#endif /* Custom memory routines */
1243
Theodore Ts'o3839e651997-04-26 13:21:57 +00001244/*
1245 * Mark a filesystem superblock as dirty
1246 */
1247_INLINE_ void ext2fs_mark_super_dirty(ext2_filsys fs)
1248{
1249 fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_CHANGED;
1250}
1251
1252/*
1253 * Mark a filesystem as changed
1254 */
1255_INLINE_ void ext2fs_mark_changed(ext2_filsys fs)
1256{
1257 fs->flags |= EXT2_FLAG_CHANGED;
1258}
1259
1260/*
1261 * Check to see if a filesystem has changed
1262 */
1263_INLINE_ int ext2fs_test_changed(ext2_filsys fs)
1264{
1265 return (fs->flags & EXT2_FLAG_CHANGED);
1266}
1267
1268/*
1269 * Mark a filesystem as valid
1270 */
1271_INLINE_ void ext2fs_mark_valid(ext2_filsys fs)
1272{
1273 fs->flags |= EXT2_FLAG_VALID;
1274}
1275
1276/*
1277 * Mark a filesystem as NOT valid
1278 */
1279_INLINE_ void ext2fs_unmark_valid(ext2_filsys fs)
1280{
1281 fs->flags &= ~EXT2_FLAG_VALID;
1282}
1283
1284/*
1285 * Check to see if a filesystem is valid
1286 */
1287_INLINE_ int ext2fs_test_valid(ext2_filsys fs)
1288{
1289 return (fs->flags & EXT2_FLAG_VALID);
1290}
1291
1292/*
1293 * Mark the inode bitmap as dirty
1294 */
1295_INLINE_ void ext2fs_mark_ib_dirty(ext2_filsys fs)
1296{
1297 fs->flags |= EXT2_FLAG_IB_DIRTY | EXT2_FLAG_CHANGED;
1298}
1299
1300/*
1301 * Mark the block bitmap as dirty
1302 */
1303_INLINE_ void ext2fs_mark_bb_dirty(ext2_filsys fs)
1304{
1305 fs->flags |= EXT2_FLAG_BB_DIRTY | EXT2_FLAG_CHANGED;
1306}
1307
1308/*
1309 * Check to see if a filesystem's inode bitmap is dirty
1310 */
1311_INLINE_ int ext2fs_test_ib_dirty(ext2_filsys fs)
1312{
1313 return (fs->flags & EXT2_FLAG_IB_DIRTY);
1314}
1315
1316/*
1317 * Check to see if a filesystem's block bitmap is dirty
1318 */
1319_INLINE_ int ext2fs_test_bb_dirty(ext2_filsys fs)
1320{
1321 return (fs->flags & EXT2_FLAG_BB_DIRTY);
1322}
1323
1324/*
1325 * Return the group # of a block
1326 */
1327_INLINE_ int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk)
1328{
1329 return (blk - fs->super->s_first_data_block) /
1330 fs->super->s_blocks_per_group;
1331}
1332
1333/*
1334 * Return the group # of an inode number
1335 */
Theodore Ts'o31dbecd2001-01-11 04:54:39 +00001336_INLINE_ int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino)
Theodore Ts'o3839e651997-04-26 13:21:57 +00001337{
1338 return (ino - 1) / fs->super->s_inodes_per_group;
1339}
Theodore Ts'o0684a4f2002-08-17 10:19:44 -04001340
Eric Sandeenabf23432006-09-12 14:56:16 -04001341/*
1342 * Return the first block (inclusive) in a group
1343 */
1344_INLINE_ blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group)
1345{
1346 return fs->super->s_first_data_block +
1347 (group * fs->super->s_blocks_per_group);
1348}
1349
1350/*
1351 * Return the last block (inclusive) in a group
1352 */
1353_INLINE_ blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group)
1354{
1355 return (group == fs->group_desc_count - 1 ?
1356 fs->super->s_blocks_count - 1 :
1357 ext2fs_group_first_block(fs, group) +
1358 (fs->super->s_blocks_per_group - 1));
1359}
1360
Theodore Ts'o0684a4f2002-08-17 10:19:44 -04001361_INLINE_ blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
1362 struct ext2_inode *inode)
1363{
1364 return inode->i_blocks -
1365 (inode->i_file_acl ? fs->blocksize >> 9 : 0);
1366}
Theodore Ts'o69022e02006-08-30 01:57:00 -04001367
1368/*
1369 * This is an efficient, overflow safe way of calculating ceil((1.0 * a) / b)
1370 */
1371_INLINE_ unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b)
1372{
1373 if (!a)
1374 return 0;
1375 return ((a - 1) / b) + 1;
1376}
Theodore Ts'o3839e651997-04-26 13:21:57 +00001377#undef _INLINE_
1378#endif
1379
Theodore Ts'ofa7ef712000-05-19 02:11:41 +00001380#ifdef __cplusplus
1381}
1382#endif
1383
Theodore Ts'o9abd2ce1998-02-16 22:00:37 +00001384#endif /* _EXT2FS_EXT2FS_H */