Changes for kernel and Busybox
[tomato.git] / release / src / router / busybox / e2fsprogs / ext2fs / brel.h
blob87bf72be4588ed88baa6dee27e2231e8ab039623
1 /* vi: set sw=4 ts=4: */
2 /*
3 * brel.h
5 * Copyright (C) 1996, 1997 Theodore Ts'o.
7 * %Begin-Header%
8 * This file may be redistributed under the terms of the GNU Public
9 * License.
10 * %End-Header%
13 struct ext2_block_relocate_entry {
14 blk_t new;
15 __s16 offset;
16 __u16 flags;
17 union {
18 blk_t block_ref;
19 ext2_ino_t inode_ref;
20 } owner;
23 #define RELOCATE_TYPE_REF 0x0007
24 #define RELOCATE_BLOCK_REF 0x0001
25 #define RELOCATE_INODE_REF 0x0002
27 typedef struct ext2_block_relocation_table *ext2_brel;
29 struct ext2_block_relocation_table {
30 __u32 magic;
31 char *name;
32 blk_t current;
33 void *priv_data;
36 * Add a block relocation entry.
38 errcode_t (*put)(ext2_brel brel, blk_t old,
39 struct ext2_block_relocate_entry *ent);
42 * Get a block relocation entry.
44 errcode_t (*get)(ext2_brel brel, blk_t old,
45 struct ext2_block_relocate_entry *ent);
48 * Initialize for iterating over the block relocation entries.
50 errcode_t (*start_iter)(ext2_brel brel);
53 * The iterator function for the inode relocation entries.
54 * Returns an inode number of 0 when out of entries.
56 errcode_t (*next)(ext2_brel brel, blk_t *old,
57 struct ext2_block_relocate_entry *ent);
60 * Move the inode relocation table from one block number to
61 * another.
63 errcode_t (*move)(ext2_brel brel, blk_t old, blk_t new);
66 * Remove a block relocation entry.
68 errcode_t (*delete)(ext2_brel brel, blk_t old);
72 * Free the block relocation table.
74 errcode_t (*free)(ext2_brel brel);
77 errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block,
78 ext2_brel *brel);
80 #define ext2fs_brel_put(brel, old, ent) ((brel)->put((brel), old, ent))
81 #define ext2fs_brel_get(brel, old, ent) ((brel)->get((brel), old, ent))
82 #define ext2fs_brel_start_iter(brel) ((brel)->start_iter((brel)))
83 #define ext2fs_brel_next(brel, old, ent) ((brel)->next((brel), old, ent))
84 #define ext2fs_brel_move(brel, old, new) ((brel)->move((brel), old, new))
85 #define ext2fs_brel_delete(brel, old) ((brel)->delete((brel), old))
86 #define ext2fs_brel_free(brel) ((brel)->free((brel)))