1 /* Copyright 2001, 2002, 2003 by Hans Reiser, licensing governed by
4 /* Forward declarations. Thank you Kernighan. */
6 #if !defined(__REISER4_FORWARD_H__)
7 #define __REISER4_FORWARD_H__
10 #include <linux/types.h>
12 typedef struct zlock zlock
;
13 typedef struct lock_stack lock_stack
;
14 typedef struct lock_handle lock_handle
;
15 typedef struct znode znode
;
16 typedef struct flow flow_t
;
17 typedef struct coord coord_t
;
18 typedef struct tree_access_pointer tap_t
;
19 typedef struct reiser4_object_create_data reiser4_object_create_data
;
20 typedef union reiser4_plugin reiser4_plugin
;
21 typedef __u16 reiser4_plugin_id
;
22 typedef __u64 reiser4_plugin_groups
;
23 typedef struct item_plugin item_plugin
;
24 typedef struct jnode_plugin jnode_plugin
;
25 typedef struct reiser4_item_data reiser4_item_data
;
26 typedef union reiser4_key reiser4_key
;
27 typedef struct reiser4_tree reiser4_tree
;
28 typedef struct carry_cut_data carry_cut_data
;
29 typedef struct carry_kill_data carry_kill_data
;
30 typedef struct carry_tree_op carry_tree_op
;
31 typedef struct carry_tree_node carry_tree_node
;
32 typedef struct carry_plugin_info carry_plugin_info
;
33 typedef struct reiser4_journal reiser4_journal
;
34 typedef struct txn_atom txn_atom
;
35 typedef struct txn_handle txn_handle
;
36 typedef struct txn_mgr txn_mgr
;
37 typedef struct reiser4_dir_entry_desc reiser4_dir_entry_desc
;
38 typedef struct reiser4_context reiser4_context
;
39 typedef struct carry_level carry_level
;
40 typedef struct blocknr_set_entry blocknr_set_entry
;
41 /* super_block->s_fs_info points to this */
42 typedef struct reiser4_super_info_data reiser4_super_info_data
;
43 /* next two objects are fields of reiser4_super_info_data */
44 typedef struct reiser4_oid_allocator reiser4_oid_allocator
;
45 typedef struct reiser4_space_allocator reiser4_space_allocator
;
47 typedef struct flush_scan flush_scan
;
48 typedef struct flush_position flush_pos_t
;
50 typedef unsigned short pos_in_node_t
;
51 #define MAX_POS_IN_NODE 65535
53 typedef struct jnode jnode
;
54 typedef struct reiser4_blocknr_hint reiser4_blocknr_hint
;
56 typedef struct uf_coord uf_coord_t
;
57 typedef struct hint hint_t
;
59 typedef struct ktxnmgrd_context ktxnmgrd_context
;
67 /* return values of coord_by_key(). cbk == coord_by_key */
70 CBK_COORD_NOTFOUND
= -ENOENT
,
73 /* results of lookup with directory file */
76 FILE_NAME_NOTFOUND
= -ENOENT
,
77 FILE_IO_ERROR
= -EIO
, /* FIXME: it seems silly to have special OOM,
78 IO_ERROR return codes for each search. */
79 FILE_OOM
= -ENOMEM
/* FIXME: it seems silly to have special OOM,
80 IO_ERROR return codes for each search. */
83 /* behaviors of lookup. If coord we are looking for is actually in a tree,
86 /* search exactly for the coord with key given */
88 /* search for coord with the maximal key not greater than one
90 FIND_MAX_NOT_MORE_THAN
/*LEFT_SLANT_BIAS */
94 /* number of leaf level of the tree
95 The fake root has (tree_level=0). */
98 /* number of level one above leaf level of the tree.
100 It is supposed that internal tree used by reiser4 to store file
101 system data and meta data will have height 2 initially (when
107 /* The "real" maximum ztree height is the 0-origin size of any per-level
108 array, since the zero'th level is not used. */
109 #define REAL_MAX_ZTREE_HEIGHT (REISER4_MAX_ZTREE_HEIGHT-LEAF_LEVEL)
111 /* enumeration of possible mutual position of item and coord. This enum is
112 return type of ->is_in_item() item plugin method which see. */
114 /* coord is on the left of an item */
116 /* coord is inside item */
118 /* coord is inside item, but to the right of the rightmost unit of
121 /* coord is on the right of an item */
125 /* type of lock to acquire on znode before returning it to caller */
129 ZNODE_WRITE_LOCK
= 2,
132 /* type of lock request */
134 ZNODE_LOCK_LOPRI
= 0,
135 ZNODE_LOCK_HIPRI
= (1 << 0),
137 /* By setting the ZNODE_LOCK_NONBLOCK flag in a lock request the call to
138 longterm_lock_znode will not sleep waiting for the lock to become
139 available. If the lock is unavailable, reiser4_znode_lock will
140 immediately return the value -E_REPEAT. */
141 ZNODE_LOCK_NONBLOCK
= (1 << 1),
142 /* An option for longterm_lock_znode which prevents atom fusion */
143 ZNODE_LOCK_DONT_FUSE
= (1 << 2)
144 } znode_lock_request
;
146 typedef enum { READ_OP
= 0, WRITE_OP
= 1 } rw_op
;
148 /* used to specify direction of shift. These must be -1 and 1 */
159 #define round_up(value, order) \
160 ((typeof(value))(((long) (value) + (order) - 1U) & \
163 /* values returned by squalloc_right_neighbor and its auxiliary functions */
165 /* unit of internal item is moved */
167 /* nothing else can be squeezed into left neighbor */
168 SQUEEZE_TARGET_FULL
= 1,
169 /* all content of node is squeezed into its left neighbor */
170 SQUEEZE_SOURCE_EMPTY
= 2,
171 /* one more item is copied (this is only returned by
172 allocate_and_copy_extent to squalloc_twig)) */
176 /* Do not change items ids. If you do - there will be format change */
178 STATIC_STAT_DATA_ID
= 0x0,
179 SIMPLE_DIR_ENTRY_ID
= 0x1,
180 COMPOUND_DIR_ID
= 0x2,
181 NODE_POINTER_ID
= 0x3,
182 EXTENT_POINTER_ID
= 0x5,
189 /* Flags passed to jnode_flush() to allow it to distinguish default settings
190 based on whether commit() was called or VM memory pressure was applied. */
192 /* submit flush queue to disk at jnode_flush completion */
193 JNODE_FLUSH_WRITE_BLOCKS
= 1,
195 /* flush is called for commit */
196 JNODE_FLUSH_COMMIT
= 2,
197 /* not implemented */
198 JNODE_FLUSH_MEMORY_FORMATTED
= 4,
200 /* not implemented */
201 JNODE_FLUSH_MEMORY_UNFORMATTED
= 8,
204 /* Flags to insert/paste carry operations. Currently they only used in
205 flushing code, but in future, they can be used to optimize for repetitive
208 /* carry is not allowed to shift data to the left when trying to find
210 COPI_DONT_SHIFT_LEFT
= (1 << 0),
211 /* carry is not allowed to shift data to the right when trying to find
213 COPI_DONT_SHIFT_RIGHT
= (1 << 1),
214 /* carry is not allowed to allocate new node(s) when trying to find
216 COPI_DONT_ALLOCATE
= (1 << 2),
217 /* try to load left neighbor if its not in a cache */
218 COPI_LOAD_LEFT
= (1 << 3),
219 /* try to load right neighbor if its not in a cache */
220 COPI_LOAD_RIGHT
= (1 << 4),
221 /* shift insertion point to the left neighbor */
222 COPI_GO_LEFT
= (1 << 5),
223 /* shift insertion point to the right neighbor */
224 COPI_GO_RIGHT
= (1 << 6),
225 /* try to step back into original node if insertion into new node
226 fails after shifting data there. */
227 COPI_STEP_BACK
= (1 << 7)
231 SAFE_UNLINK
, /* safe-link for unlink */
232 SAFE_TRUNCATE
/* safe-link for truncate */
233 } reiser4_safe_link_t
;
235 /* this is to show on which list of atom jnode is */
245 /* __REISER4_FORWARD_H__ */
250 c-indentation-style: "K&R"