2 * Copyright 2000 Hans Reiser
3 * See README for licensing and copyright details
5 * Ported to FreeBSD by Jean-Sébastien Pédron <jspedron@club-internet.fr>
10 #include <gnu/fs/reiserfs/reiserfs_fs.h>
12 /* -------------------------------------------------------------------
14 * -------------------------------------------------------------------*/
17 sd_bytes_number(struct item_head *ih, int block_size)
23 struct item_operations stat_data_ops = {
24 .bytes_number = sd_bytes_number,
25 //.decrement_key = sd_decrement_key,
26 //.is_left_mergeable = sd_is_left_mergeable,
27 //.print_item = sd_print_item,
28 //.check_item = sd_check_item,
30 //.create_vi = sd_create_vi,
31 //.check_left = sd_check_left,
32 //.check_right = sd_check_right,
33 //.part_size = sd_part_size,
34 //.unit_num = sd_unit_num,
35 //.print_vi = sd_print_vi
38 /* -------------------------------------------------------------------
39 * Direct item functions
40 * -------------------------------------------------------------------*/
43 direct_bytes_number(struct item_head *ih, int block_size)
46 return (ih_item_len(ih));
49 struct item_operations direct_ops = {
50 .bytes_number = direct_bytes_number,
51 //.decrement_key = direct_decrement_key,
52 //.is_left_mergeable = direct_is_left_mergeable,
53 //.print_item = direct_print_item,
54 //.check_item = direct_check_item,
56 //.create_vi = direct_create_vi,
57 //.check_left = direct_check_left,
58 //.check_right = direct_check_right,
59 //.part_size = direct_part_size,
60 //.unit_num = direct_unit_num,
61 //.print_vi = direct_print_vi
64 /* -------------------------------------------------------------------
65 * Indirect item functions
66 * -------------------------------------------------------------------*/
69 indirect_bytes_number(struct item_head *ih, int block_size)
72 return (ih_item_len(ih) / UNFM_P_SIZE * block_size);
75 struct item_operations indirect_ops = {
76 .bytes_number = indirect_bytes_number,
77 //.decrement_key = indirect_decrement_key,
78 //.is_left_mergeable = indirect_is_left_mergeable,
79 //.print_item = indirect_print_item,
80 //.check_item = indirect_check_item,
82 //.create_vi = indirect_create_vi,
83 //.check_left = indirect_check_left,
84 //.check_right = indirect_check_right,
85 //.part_size = indirect_part_size,
86 //.unit_num = indirect_unit_num,
87 //.print_vi = indirect_print_vi
90 /* -------------------------------------------------------------------
92 * -------------------------------------------------------------------*/
95 direntry_bytes_number(struct item_head *ih, int block_size)
98 reiserfs_log(LOG_WARNING, "bytes number is asked for direntry\n");
102 struct item_operations direntry_ops = {
103 .bytes_number = direntry_bytes_number,
104 //.decrement_key = direntry_decrement_key,
105 //.is_left_mergeable = direntry_is_left_mergeable,
106 //.print_item = direntry_print_item,
107 //.check_item = direntry_check_item,
109 //.create_vi = direntry_create_vi,
110 //.check_left = direntry_check_left,
111 //.check_right = direntry_check_right,
112 //.part_size = direntry_part_size,
113 //.unit_num = direntry_unit_num,
114 //.print_vi = direntry_print_vi
117 /* -------------------------------------------------------------------
118 * Error catching functions to catch errors caused by incorrect item
120 * -------------------------------------------------------------------*/
123 errcatch_bytes_number(struct item_head *ih, int block_size)
126 reiserfs_log(LOG_WARNING, "invalid item type observed, run fsck ASAP");
130 struct item_operations errcatch_ops = {
131 errcatch_bytes_number,
132 //errcatch_decrement_key,
133 //errcatch_is_left_mergeable,
134 //errcatch_print_item,
135 //errcatch_check_item,
137 //errcatch_create_vi,
138 //errcatch_check_left,
139 //errcatch_check_right,
140 //errcatch_part_size,
145 #if !(TYPE_STAT_DATA == 0 && TYPE_INDIRECT == 1 && \
146 TYPE_DIRECT == 2 && TYPE_DIRENTRY == 3)
150 struct item_operations *item_ops[TYPE_ANY + 1] = {
155 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
156 &errcatch_ops /* This is to catch errors with invalid type (15th
157 entry for TYPE_ANY) */