| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README | 
|  | 3 | */ | 
|  | 4 |  | 
|  | 5 | #include <linux/time.h> | 
|  | 6 | #include <linux/reiserfs_fs.h> | 
|  | 7 |  | 
|  | 8 | // this contains item handlers for old item types: sd, direct, | 
|  | 9 | // indirect, directory | 
|  | 10 |  | 
|  | 11 | /* and where are the comments? how about saying where we can find an | 
|  | 12 | explanation of each item handler method? -Hans */ | 
|  | 13 |  | 
|  | 14 | ////////////////////////////////////////////////////////////////////////////// | 
|  | 15 | // stat data functions | 
|  | 16 | // | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 17 | static int sd_bytes_number(struct item_head *ih, int block_size) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 19 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | } | 
|  | 21 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 22 | static void sd_decrement_key(struct cpu_key *key) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 24 | key->on_disk_key.k_objectid--; | 
|  | 25 | set_cpu_key_k_type(key, TYPE_ANY); | 
| Vladimir Saveliev | 6d205f1 | 2007-04-11 23:28:44 -0700 | [diff] [blame] | 26 | set_cpu_key_k_offset(key, (loff_t)(~0ULL >> 1)); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | } | 
|  | 28 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 29 | static int sd_is_left_mergeable(struct reiserfs_key *key, unsigned long bsize) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 31 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | } | 
|  | 33 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 34 | static char *print_time(time_t t) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 36 | static char timebuf[256]; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 38 | sprintf(timebuf, "%ld", t); | 
|  | 39 | return timebuf; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | } | 
|  | 41 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 42 | static void sd_print_item(struct item_head *ih, char *item) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 44 | printk("\tmode | size | nlinks | first direct | mtime\n"); | 
|  | 45 | if (stat_data_v1(ih)) { | 
|  | 46 | struct stat_data_v1 *sd = (struct stat_data_v1 *)item; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 48 | printk("\t0%-6o | %6u | %2u | %d | %s\n", sd_v1_mode(sd), | 
|  | 49 | sd_v1_size(sd), sd_v1_nlink(sd), | 
|  | 50 | sd_v1_first_direct_byte(sd), | 
|  | 51 | print_time(sd_v1_mtime(sd))); | 
|  | 52 | } else { | 
|  | 53 | struct stat_data *sd = (struct stat_data *)item; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 55 | printk("\t0%-6o | %6Lu | %2u | %d | %s\n", sd_v2_mode(sd), | 
|  | 56 | (unsigned long long)sd_v2_size(sd), sd_v2_nlink(sd), | 
|  | 57 | sd_v2_rdev(sd), print_time(sd_v2_mtime(sd))); | 
|  | 58 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | } | 
|  | 60 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 61 | static void sd_check_item(struct item_head *ih, char *item) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 63 | // FIXME: type something here! | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | } | 
|  | 65 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 66 | static int sd_create_vi(struct virtual_node *vn, | 
|  | 67 | struct virtual_item *vi, | 
|  | 68 | int is_affected, int insert_size) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 70 | vi->vi_index = TYPE_STAT_DATA; | 
|  | 71 | //vi->vi_type |= VI_TYPE_STAT_DATA;// not needed? | 
|  | 72 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | } | 
|  | 74 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 75 | static int sd_check_left(struct virtual_item *vi, int free, | 
|  | 76 | int start_skip, int end_skip) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | { | 
| Eric Sesterhenn | 14a6144 | 2006-10-03 23:36:38 +0200 | [diff] [blame] | 78 | BUG_ON(start_skip || end_skip); | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 79 | return -1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | } | 
|  | 81 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 82 | static int sd_check_right(struct virtual_item *vi, int free) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 84 | return -1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | } | 
|  | 86 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 87 | static int sd_part_size(struct virtual_item *vi, int first, int count) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | { | 
| Eric Sesterhenn | 14a6144 | 2006-10-03 23:36:38 +0200 | [diff] [blame] | 89 | BUG_ON(count); | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 90 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | } | 
|  | 92 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 93 | static int sd_unit_num(struct virtual_item *vi) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 95 | return vi->vi_item_len - IH_SIZE; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | } | 
|  | 97 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 98 | static void sd_print_vi(struct virtual_item *vi) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 100 | reiserfs_warning(NULL, "reiserfs-16100", | 
|  | 101 | "STATDATA, index %d, type 0x%x, %h", | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 102 | vi->vi_index, vi->vi_type, vi->vi_ih); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | } | 
|  | 104 |  | 
|  | 105 | static struct item_operations stat_data_ops = { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 106 | .bytes_number = sd_bytes_number, | 
|  | 107 | .decrement_key = sd_decrement_key, | 
|  | 108 | .is_left_mergeable = sd_is_left_mergeable, | 
|  | 109 | .print_item = sd_print_item, | 
|  | 110 | .check_item = sd_check_item, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 112 | .create_vi = sd_create_vi, | 
|  | 113 | .check_left = sd_check_left, | 
|  | 114 | .check_right = sd_check_right, | 
|  | 115 | .part_size = sd_part_size, | 
|  | 116 | .unit_num = sd_unit_num, | 
|  | 117 | .print_vi = sd_print_vi | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | }; | 
|  | 119 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | ////////////////////////////////////////////////////////////////////////////// | 
|  | 121 | // direct item functions | 
|  | 122 | // | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 123 | static int direct_bytes_number(struct item_head *ih, int block_size) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 125 | return ih_item_len(ih); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | } | 
|  | 127 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | // FIXME: this should probably switch to indirect as well | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 129 | static void direct_decrement_key(struct cpu_key *key) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 131 | cpu_key_k_offset_dec(key); | 
|  | 132 | if (cpu_key_k_offset(key) == 0) | 
|  | 133 | set_cpu_key_k_type(key, TYPE_STAT_DATA); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | } | 
|  | 135 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 136 | static int direct_is_left_mergeable(struct reiserfs_key *key, | 
|  | 137 | unsigned long bsize) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 139 | int version = le_key_version(key); | 
|  | 140 | return ((le_key_k_offset(version, key) & (bsize - 1)) != 1); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | } | 
|  | 142 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 143 | static void direct_print_item(struct item_head *ih, char *item) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 145 | int j = 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 |  | 
|  | 147 | //    return; | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 148 | printk("\""); | 
|  | 149 | while (j < ih_item_len(ih)) | 
|  | 150 | printk("%c", item[j++]); | 
|  | 151 | printk("\"\n"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | } | 
|  | 153 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 154 | static void direct_check_item(struct item_head *ih, char *item) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 156 | // FIXME: type something here! | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | } | 
|  | 158 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 159 | static int direct_create_vi(struct virtual_node *vn, | 
|  | 160 | struct virtual_item *vi, | 
|  | 161 | int is_affected, int insert_size) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 163 | vi->vi_index = TYPE_DIRECT; | 
|  | 164 | //vi->vi_type |= VI_TYPE_DIRECT; | 
|  | 165 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | } | 
|  | 167 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 168 | static int direct_check_left(struct virtual_item *vi, int free, | 
|  | 169 | int start_skip, int end_skip) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 171 | int bytes; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 173 | bytes = free - free % 8; | 
|  | 174 | return bytes ? : -1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | } | 
|  | 176 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 177 | static int direct_check_right(struct virtual_item *vi, int free) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 179 | return direct_check_left(vi, free, 0, 0); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | } | 
|  | 181 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 182 | static int direct_part_size(struct virtual_item *vi, int first, int count) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 184 | return count; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | } | 
|  | 186 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 187 | static int direct_unit_num(struct virtual_item *vi) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 189 | return vi->vi_item_len - IH_SIZE; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | } | 
|  | 191 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 192 | static void direct_print_vi(struct virtual_item *vi) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 193 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 194 | reiserfs_warning(NULL, "reiserfs-16101", | 
|  | 195 | "DIRECT, index %d, type 0x%x, %h", | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 196 | vi->vi_index, vi->vi_type, vi->vi_ih); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | } | 
|  | 198 |  | 
|  | 199 | static struct item_operations direct_ops = { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 200 | .bytes_number = direct_bytes_number, | 
|  | 201 | .decrement_key = direct_decrement_key, | 
|  | 202 | .is_left_mergeable = direct_is_left_mergeable, | 
|  | 203 | .print_item = direct_print_item, | 
|  | 204 | .check_item = direct_check_item, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 206 | .create_vi = direct_create_vi, | 
|  | 207 | .check_left = direct_check_left, | 
|  | 208 | .check_right = direct_check_right, | 
|  | 209 | .part_size = direct_part_size, | 
|  | 210 | .unit_num = direct_unit_num, | 
|  | 211 | .print_vi = direct_print_vi | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | }; | 
|  | 213 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | ////////////////////////////////////////////////////////////////////////////// | 
|  | 215 | // indirect item functions | 
|  | 216 | // | 
|  | 217 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 218 | static int indirect_bytes_number(struct item_head *ih, int block_size) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 220 | return ih_item_len(ih) / UNFM_P_SIZE * block_size;	//- get_ih_free_space (ih); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | } | 
|  | 222 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | // decrease offset, if it becomes 0, change type to stat data | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 224 | static void indirect_decrement_key(struct cpu_key *key) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 226 | cpu_key_k_offset_dec(key); | 
|  | 227 | if (cpu_key_k_offset(key) == 0) | 
|  | 228 | set_cpu_key_k_type(key, TYPE_STAT_DATA); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | } | 
|  | 230 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | // if it is not first item of the body, then it is mergeable | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 232 | static int indirect_is_left_mergeable(struct reiserfs_key *key, | 
|  | 233 | unsigned long bsize) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 235 | int version = le_key_version(key); | 
|  | 236 | return (le_key_k_offset(version, key) != 1); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | } | 
|  | 238 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | // printing of indirect item | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 240 | static void start_new_sequence(__u32 * start, int *len, __u32 new) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 242 | *start = new; | 
|  | 243 | *len = 1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | } | 
|  | 245 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 246 | static int sequence_finished(__u32 start, int *len, __u32 new) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 248 | if (start == INT_MAX) | 
|  | 249 | return 1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 251 | if (start == 0 && new == 0) { | 
|  | 252 | (*len)++; | 
|  | 253 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | } | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 255 | if (start != 0 && (start + *len) == new) { | 
|  | 256 | (*len)++; | 
|  | 257 | return 0; | 
|  | 258 | } | 
|  | 259 | return 1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | } | 
|  | 261 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 262 | static void print_sequence(__u32 start, int len) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 264 | if (start == INT_MAX) | 
|  | 265 | return; | 
|  | 266 |  | 
|  | 267 | if (len == 1) | 
|  | 268 | printk(" %d", start); | 
|  | 269 | else | 
|  | 270 | printk(" %d(%d)", start, len); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | } | 
|  | 272 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 273 | static void indirect_print_item(struct item_head *ih, char *item) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 275 | int j; | 
|  | 276 | __le32 *unp; | 
|  | 277 | __u32 prev = INT_MAX; | 
| Benoit Boissinot | d5ee4ea | 2006-03-25 03:07:54 -0800 | [diff] [blame] | 278 | int num = 0; | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 279 |  | 
|  | 280 | unp = (__le32 *) item; | 
|  | 281 |  | 
|  | 282 | if (ih_item_len(ih) % UNFM_P_SIZE) | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 283 | reiserfs_warning(NULL, "reiserfs-16102", "invalid item len"); | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 284 |  | 
|  | 285 | printk("%d pointers\n[ ", (int)I_UNFM_NUM(ih)); | 
|  | 286 | for (j = 0; j < I_UNFM_NUM(ih); j++) { | 
|  | 287 | if (sequence_finished(prev, &num, get_block_num(unp, j))) { | 
|  | 288 | print_sequence(prev, num); | 
|  | 289 | start_new_sequence(&prev, &num, get_block_num(unp, j)); | 
|  | 290 | } | 
|  | 291 | } | 
|  | 292 | print_sequence(prev, num); | 
|  | 293 | printk("]\n"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | } | 
|  | 295 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 296 | static void indirect_check_item(struct item_head *ih, char *item) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 298 | // FIXME: type something here! | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | } | 
|  | 300 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 301 | static int indirect_create_vi(struct virtual_node *vn, | 
|  | 302 | struct virtual_item *vi, | 
|  | 303 | int is_affected, int insert_size) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 305 | vi->vi_index = TYPE_INDIRECT; | 
|  | 306 | //vi->vi_type |= VI_TYPE_INDIRECT; | 
|  | 307 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | } | 
|  | 309 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 310 | static int indirect_check_left(struct virtual_item *vi, int free, | 
|  | 311 | int start_skip, int end_skip) | 
|  | 312 | { | 
|  | 313 | int bytes; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 315 | bytes = free - free % UNFM_P_SIZE; | 
|  | 316 | return bytes ? : -1; | 
|  | 317 | } | 
|  | 318 |  | 
|  | 319 | static int indirect_check_right(struct virtual_item *vi, int free) | 
|  | 320 | { | 
|  | 321 | return indirect_check_left(vi, free, 0, 0); | 
|  | 322 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 |  | 
|  | 324 | // return size in bytes of 'units' units. If first == 0 - calculate from the head (left), otherwise - from tail (right) | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 325 | static int indirect_part_size(struct virtual_item *vi, int first, int units) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 327 | // unit of indirect item is byte (yet) | 
|  | 328 | return units; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | } | 
|  | 330 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 331 | static int indirect_unit_num(struct virtual_item *vi) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 333 | // unit of indirect item is byte (yet) | 
|  | 334 | return vi->vi_item_len - IH_SIZE; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | } | 
|  | 336 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 337 | static void indirect_print_vi(struct virtual_item *vi) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 339 | reiserfs_warning(NULL, "reiserfs-16103", | 
|  | 340 | "INDIRECT, index %d, type 0x%x, %h", | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 341 | vi->vi_index, vi->vi_type, vi->vi_ih); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | } | 
|  | 343 |  | 
|  | 344 | static struct item_operations indirect_ops = { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 345 | .bytes_number = indirect_bytes_number, | 
|  | 346 | .decrement_key = indirect_decrement_key, | 
|  | 347 | .is_left_mergeable = indirect_is_left_mergeable, | 
|  | 348 | .print_item = indirect_print_item, | 
|  | 349 | .check_item = indirect_check_item, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 351 | .create_vi = indirect_create_vi, | 
|  | 352 | .check_left = indirect_check_left, | 
|  | 353 | .check_right = indirect_check_right, | 
|  | 354 | .part_size = indirect_part_size, | 
|  | 355 | .unit_num = indirect_unit_num, | 
|  | 356 | .print_vi = indirect_print_vi | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | }; | 
|  | 358 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | ////////////////////////////////////////////////////////////////////////////// | 
|  | 360 | // direntry functions | 
|  | 361 | // | 
|  | 362 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 363 | static int direntry_bytes_number(struct item_head *ih, int block_size) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 365 | reiserfs_warning(NULL, "vs-16090", | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 366 | "bytes number is asked for direntry"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | } | 
|  | 369 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 370 | static void direntry_decrement_key(struct cpu_key *key) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 372 | cpu_key_k_offset_dec(key); | 
|  | 373 | if (cpu_key_k_offset(key) == 0) | 
|  | 374 | set_cpu_key_k_type(key, TYPE_STAT_DATA); | 
|  | 375 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 377 | static int direntry_is_left_mergeable(struct reiserfs_key *key, | 
|  | 378 | unsigned long bsize) | 
|  | 379 | { | 
|  | 380 | if (le32_to_cpu(key->u.k_offset_v1.k_offset) == DOT_OFFSET) | 
|  | 381 | return 0; | 
|  | 382 | return 1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 384 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 386 | static void direntry_print_item(struct item_head *ih, char *item) | 
|  | 387 | { | 
|  | 388 | int i; | 
|  | 389 | int namelen; | 
|  | 390 | struct reiserfs_de_head *deh; | 
|  | 391 | char *name; | 
|  | 392 | static char namebuf[80]; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 393 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 394 | printk("\n # %-15s%-30s%-15s%-15s%-15s\n", "Name", | 
|  | 395 | "Key of pointed object", "Hash", "Gen number", "Status"); | 
|  | 396 |  | 
|  | 397 | deh = (struct reiserfs_de_head *)item; | 
|  | 398 |  | 
|  | 399 | for (i = 0; i < I_ENTRY_COUNT(ih); i++, deh++) { | 
|  | 400 | namelen = | 
|  | 401 | (i ? (deh_location(deh - 1)) : ih_item_len(ih)) - | 
|  | 402 | deh_location(deh); | 
|  | 403 | name = item + deh_location(deh); | 
|  | 404 | if (name[namelen - 1] == 0) | 
|  | 405 | namelen = strlen(name); | 
|  | 406 | namebuf[0] = '"'; | 
|  | 407 | if (namelen > sizeof(namebuf) - 3) { | 
|  | 408 | strncpy(namebuf + 1, name, sizeof(namebuf) - 3); | 
|  | 409 | namebuf[sizeof(namebuf) - 2] = '"'; | 
|  | 410 | namebuf[sizeof(namebuf) - 1] = 0; | 
|  | 411 | } else { | 
|  | 412 | memcpy(namebuf + 1, name, namelen); | 
|  | 413 | namebuf[namelen + 1] = '"'; | 
|  | 414 | namebuf[namelen + 2] = 0; | 
|  | 415 | } | 
|  | 416 |  | 
|  | 417 | printk("%d:  %-15s%-15d%-15d%-15Ld%-15Ld(%s)\n", | 
|  | 418 | i, namebuf, | 
|  | 419 | deh_dir_id(deh), deh_objectid(deh), | 
|  | 420 | GET_HASH_VALUE(deh_offset(deh)), | 
|  | 421 | GET_GENERATION_NUMBER((deh_offset(deh))), | 
|  | 422 | (de_hidden(deh)) ? "HIDDEN" : "VISIBLE"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 423 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 424 | } | 
|  | 425 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 426 | static void direntry_check_item(struct item_head *ih, char *item) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 427 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 428 | int i; | 
|  | 429 | struct reiserfs_de_head *deh; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 430 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 431 | // FIXME: type something here! | 
|  | 432 | deh = (struct reiserfs_de_head *)item; | 
|  | 433 | for (i = 0; i < I_ENTRY_COUNT(ih); i++, deh++) { | 
|  | 434 | ; | 
|  | 435 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | } | 
|  | 437 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | #define DIRENTRY_VI_FIRST_DIRENTRY_ITEM 1 | 
|  | 439 |  | 
|  | 440 | /* | 
|  | 441 | * function returns old entry number in directory item in real node | 
|  | 442 | * using new entry number in virtual item in virtual node */ | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 443 | static inline int old_entry_num(int is_affected, int virtual_entry_num, | 
|  | 444 | int pos_in_item, int mode) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 446 | if (mode == M_INSERT || mode == M_DELETE) | 
|  | 447 | return virtual_entry_num; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 448 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 449 | if (!is_affected) | 
|  | 450 | /* cut or paste is applied to another item */ | 
|  | 451 | return virtual_entry_num; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 452 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 453 | if (virtual_entry_num < pos_in_item) | 
|  | 454 | return virtual_entry_num; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 456 | if (mode == M_CUT) | 
|  | 457 | return virtual_entry_num + 1; | 
|  | 458 |  | 
|  | 459 | RFALSE(mode != M_PASTE || virtual_entry_num == 0, | 
|  | 460 | "vs-8015: old_entry_num: mode must be M_PASTE (mode = \'%c\'", | 
|  | 461 | mode); | 
|  | 462 |  | 
|  | 463 | return virtual_entry_num - 1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | } | 
|  | 465 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | /* Create an array of sizes of directory entries for virtual | 
|  | 467 | item. Return space used by an item. FIXME: no control over | 
|  | 468 | consuming of space used by this item handler */ | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 469 | static int direntry_create_vi(struct virtual_node *vn, | 
|  | 470 | struct virtual_item *vi, | 
|  | 471 | int is_affected, int insert_size) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 473 | struct direntry_uarea *dir_u = vi->vi_uarea; | 
|  | 474 | int i, j; | 
|  | 475 | int size = sizeof(struct direntry_uarea); | 
|  | 476 | struct reiserfs_de_head *deh; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 478 | vi->vi_index = TYPE_DIRENTRY; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 |  | 
| Eric Sesterhenn | 14a6144 | 2006-10-03 23:36:38 +0200 | [diff] [blame] | 480 | BUG_ON(!(vi->vi_ih) || !vi->vi_item); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 482 | dir_u->flags = 0; | 
|  | 483 | if (le_ih_k_offset(vi->vi_ih) == DOT_OFFSET) | 
|  | 484 | dir_u->flags |= DIRENTRY_VI_FIRST_DIRENTRY_ITEM; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 485 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 486 | deh = (struct reiserfs_de_head *)(vi->vi_item); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 487 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 488 | /* virtual directory item have this amount of entry after */ | 
|  | 489 | dir_u->entry_count = ih_entry_count(vi->vi_ih) + | 
|  | 490 | ((is_affected) ? ((vn->vn_mode == M_CUT) ? -1 : | 
|  | 491 | (vn->vn_mode == M_PASTE ? 1 : 0)) : 0); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 493 | for (i = 0; i < dir_u->entry_count; i++) { | 
|  | 494 | j = old_entry_num(is_affected, i, vn->vn_pos_in_item, | 
|  | 495 | vn->vn_mode); | 
|  | 496 | dir_u->entry_sizes[i] = | 
|  | 497 | (j ? deh_location(&(deh[j - 1])) : ih_item_len(vi->vi_ih)) - | 
|  | 498 | deh_location(&(deh[j])) + DEH_SIZE; | 
|  | 499 | } | 
|  | 500 |  | 
|  | 501 | size += (dir_u->entry_count * sizeof(short)); | 
|  | 502 |  | 
|  | 503 | /* set size of pasted entry */ | 
|  | 504 | if (is_affected && vn->vn_mode == M_PASTE) | 
|  | 505 | dir_u->entry_sizes[vn->vn_pos_in_item] = insert_size; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 |  | 
|  | 507 | #ifdef CONFIG_REISERFS_CHECK | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 508 | /* compare total size of entries with item length */ | 
|  | 509 | { | 
|  | 510 | int k, l; | 
|  | 511 |  | 
|  | 512 | l = 0; | 
|  | 513 | for (k = 0; k < dir_u->entry_count; k++) | 
|  | 514 | l += dir_u->entry_sizes[k]; | 
|  | 515 |  | 
|  | 516 | if (l + IH_SIZE != vi->vi_item_len + | 
|  | 517 | ((is_affected | 
|  | 518 | && (vn->vn_mode == M_PASTE | 
|  | 519 | || vn->vn_mode == M_CUT)) ? insert_size : 0)) { | 
| Jeff Mahoney | c3a9c21 | 2009-03-30 14:02:25 -0400 | [diff] [blame] | 520 | reiserfs_panic(NULL, "vs-8025", "(mode==%c, " | 
|  | 521 | "insert_size==%d), invalid length of " | 
|  | 522 | "directory item", | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 523 | vn->vn_mode, insert_size); | 
|  | 524 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | #endif | 
|  | 527 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 528 | return size; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 529 |  | 
|  | 530 | } | 
|  | 531 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 532 | // | 
|  | 533 | // return number of entries which may fit into specified amount of | 
|  | 534 | // free space, or -1 if free space is not enough even for 1 entry | 
|  | 535 | // | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 536 | static int direntry_check_left(struct virtual_item *vi, int free, | 
|  | 537 | int start_skip, int end_skip) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 539 | int i; | 
|  | 540 | int entries = 0; | 
|  | 541 | struct direntry_uarea *dir_u = vi->vi_uarea; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 542 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 543 | for (i = start_skip; i < dir_u->entry_count - end_skip; i++) { | 
|  | 544 | if (dir_u->entry_sizes[i] > free) | 
|  | 545 | /* i-th entry doesn't fit into the remaining free space */ | 
|  | 546 | break; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 547 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 548 | free -= dir_u->entry_sizes[i]; | 
|  | 549 | entries++; | 
|  | 550 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 552 | if (entries == dir_u->entry_count) { | 
| Jeff Mahoney | c3a9c21 | 2009-03-30 14:02:25 -0400 | [diff] [blame] | 553 | reiserfs_panic(NULL, "item_ops-1", | 
|  | 554 | "free space %d, entry_count %d", free, | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 555 | dir_u->entry_count); | 
|  | 556 | } | 
|  | 557 |  | 
|  | 558 | /* "." and ".." can not be separated from each other */ | 
|  | 559 | if (start_skip == 0 && (dir_u->flags & DIRENTRY_VI_FIRST_DIRENTRY_ITEM) | 
|  | 560 | && entries < 2) | 
|  | 561 | entries = 0; | 
|  | 562 |  | 
|  | 563 | return entries ? : -1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 564 | } | 
|  | 565 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 566 | static int direntry_check_right(struct virtual_item *vi, int free) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 567 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 568 | int i; | 
|  | 569 | int entries = 0; | 
|  | 570 | struct direntry_uarea *dir_u = vi->vi_uarea; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 571 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 572 | for (i = dir_u->entry_count - 1; i >= 0; i--) { | 
|  | 573 | if (dir_u->entry_sizes[i] > free) | 
|  | 574 | /* i-th entry doesn't fit into the remaining free space */ | 
|  | 575 | break; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 576 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 577 | free -= dir_u->entry_sizes[i]; | 
|  | 578 | entries++; | 
|  | 579 | } | 
| Eric Sesterhenn | 14a6144 | 2006-10-03 23:36:38 +0200 | [diff] [blame] | 580 | BUG_ON(entries == dir_u->entry_count); | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 581 |  | 
|  | 582 | /* "." and ".." can not be separated from each other */ | 
|  | 583 | if ((dir_u->flags & DIRENTRY_VI_FIRST_DIRENTRY_ITEM) | 
|  | 584 | && entries > dir_u->entry_count - 2) | 
|  | 585 | entries = dir_u->entry_count - 2; | 
|  | 586 |  | 
|  | 587 | return entries ? : -1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 588 | } | 
|  | 589 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 590 | /* sum of entry sizes between from-th and to-th entries including both edges */ | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 591 | static int direntry_part_size(struct virtual_item *vi, int first, int count) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 592 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 593 | int i, retval; | 
|  | 594 | int from, to; | 
|  | 595 | struct direntry_uarea *dir_u = vi->vi_uarea; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 596 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 597 | retval = 0; | 
|  | 598 | if (first == 0) | 
|  | 599 | from = 0; | 
|  | 600 | else | 
|  | 601 | from = dir_u->entry_count - count; | 
|  | 602 | to = from + count - 1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 603 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 604 | for (i = from; i <= to; i++) | 
|  | 605 | retval += dir_u->entry_sizes[i]; | 
|  | 606 |  | 
|  | 607 | return retval; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 608 | } | 
|  | 609 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 610 | static int direntry_unit_num(struct virtual_item *vi) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 611 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 612 | struct direntry_uarea *dir_u = vi->vi_uarea; | 
|  | 613 |  | 
|  | 614 | return dir_u->entry_count; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 615 | } | 
|  | 616 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 617 | static void direntry_print_vi(struct virtual_item *vi) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 618 | { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 619 | int i; | 
|  | 620 | struct direntry_uarea *dir_u = vi->vi_uarea; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 621 |  | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 622 | reiserfs_warning(NULL, "reiserfs-16104", | 
|  | 623 | "DIRENTRY, index %d, type 0x%x, %h, flags 0x%x", | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 624 | vi->vi_index, vi->vi_type, vi->vi_ih, dir_u->flags); | 
|  | 625 | printk("%d entries: ", dir_u->entry_count); | 
|  | 626 | for (i = 0; i < dir_u->entry_count; i++) | 
|  | 627 | printk("%d ", dir_u->entry_sizes[i]); | 
|  | 628 | printk("\n"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 629 | } | 
|  | 630 |  | 
|  | 631 | static struct item_operations direntry_ops = { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 632 | .bytes_number = direntry_bytes_number, | 
|  | 633 | .decrement_key = direntry_decrement_key, | 
|  | 634 | .is_left_mergeable = direntry_is_left_mergeable, | 
|  | 635 | .print_item = direntry_print_item, | 
|  | 636 | .check_item = direntry_check_item, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 637 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 638 | .create_vi = direntry_create_vi, | 
|  | 639 | .check_left = direntry_check_left, | 
|  | 640 | .check_right = direntry_check_right, | 
|  | 641 | .part_size = direntry_part_size, | 
|  | 642 | .unit_num = direntry_unit_num, | 
|  | 643 | .print_vi = direntry_print_vi | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 644 | }; | 
|  | 645 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 646 | ////////////////////////////////////////////////////////////////////////////// | 
|  | 647 | // Error catching functions to catch errors caused by incorrect item types. | 
|  | 648 | // | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 649 | static int errcatch_bytes_number(struct item_head *ih, int block_size) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 650 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 651 | reiserfs_warning(NULL, "green-16001", | 
|  | 652 | "Invalid item type observed, run fsck ASAP"); | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 653 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 654 | } | 
|  | 655 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 656 | static void errcatch_decrement_key(struct cpu_key *key) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 657 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 658 | reiserfs_warning(NULL, "green-16002", | 
|  | 659 | "Invalid item type observed, run fsck ASAP"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 660 | } | 
|  | 661 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 662 | static int errcatch_is_left_mergeable(struct reiserfs_key *key, | 
|  | 663 | unsigned long bsize) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 664 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 665 | reiserfs_warning(NULL, "green-16003", | 
|  | 666 | "Invalid item type observed, run fsck ASAP"); | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 667 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 668 | } | 
|  | 669 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 670 | static void errcatch_print_item(struct item_head *ih, char *item) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 671 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 672 | reiserfs_warning(NULL, "green-16004", | 
|  | 673 | "Invalid item type observed, run fsck ASAP"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 674 | } | 
|  | 675 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 676 | static void errcatch_check_item(struct item_head *ih, char *item) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 677 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 678 | reiserfs_warning(NULL, "green-16005", | 
|  | 679 | "Invalid item type observed, run fsck ASAP"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 680 | } | 
|  | 681 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 682 | static int errcatch_create_vi(struct virtual_node *vn, | 
|  | 683 | struct virtual_item *vi, | 
|  | 684 | int is_affected, int insert_size) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 685 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 686 | reiserfs_warning(NULL, "green-16006", | 
|  | 687 | "Invalid item type observed, run fsck ASAP"); | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 688 | return 0;		// We might return -1 here as well, but it won't help as create_virtual_node() from where | 
|  | 689 | // this operation is called from is of return type void. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 690 | } | 
|  | 691 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 692 | static int errcatch_check_left(struct virtual_item *vi, int free, | 
|  | 693 | int start_skip, int end_skip) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 694 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 695 | reiserfs_warning(NULL, "green-16007", | 
|  | 696 | "Invalid item type observed, run fsck ASAP"); | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 697 | return -1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 698 | } | 
|  | 699 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 700 | static int errcatch_check_right(struct virtual_item *vi, int free) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 701 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 702 | reiserfs_warning(NULL, "green-16008", | 
|  | 703 | "Invalid item type observed, run fsck ASAP"); | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 704 | return -1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 705 | } | 
|  | 706 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 707 | static int errcatch_part_size(struct virtual_item *vi, int first, int count) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 708 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 709 | reiserfs_warning(NULL, "green-16009", | 
|  | 710 | "Invalid item type observed, run fsck ASAP"); | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 711 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 712 | } | 
|  | 713 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 714 | static int errcatch_unit_num(struct virtual_item *vi) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 715 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 716 | reiserfs_warning(NULL, "green-16010", | 
|  | 717 | "Invalid item type observed, run fsck ASAP"); | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 718 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 719 | } | 
|  | 720 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 721 | static void errcatch_print_vi(struct virtual_item *vi) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 722 | { | 
| Jeff Mahoney | 45b03d5 | 2009-03-30 14:02:21 -0400 | [diff] [blame] | 723 | reiserfs_warning(NULL, "green-16011", | 
|  | 724 | "Invalid item type observed, run fsck ASAP"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 725 | } | 
|  | 726 |  | 
|  | 727 | static struct item_operations errcatch_ops = { | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 728 | errcatch_bytes_number, | 
|  | 729 | errcatch_decrement_key, | 
|  | 730 | errcatch_is_left_mergeable, | 
|  | 731 | errcatch_print_item, | 
|  | 732 | errcatch_check_item, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 733 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 734 | errcatch_create_vi, | 
|  | 735 | errcatch_check_left, | 
|  | 736 | errcatch_check_right, | 
|  | 737 | errcatch_part_size, | 
|  | 738 | errcatch_unit_num, | 
|  | 739 | errcatch_print_vi | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 740 | }; | 
|  | 741 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 742 | ////////////////////////////////////////////////////////////////////////////// | 
|  | 743 | // | 
|  | 744 | // | 
|  | 745 | #if ! (TYPE_STAT_DATA == 0 && TYPE_INDIRECT == 1 && TYPE_DIRECT == 2 && TYPE_DIRENTRY == 3) | 
| Jeff Mahoney | 7fa94c8 | 2005-07-12 19:19:30 -0400 | [diff] [blame] | 746 | #error Item types must use disk-format assigned values. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 747 | #endif | 
|  | 748 |  | 
| Linus Torvalds | bd4c625 | 2005-07-12 20:21:28 -0700 | [diff] [blame] | 749 | struct item_operations *item_ops[TYPE_ANY + 1] = { | 
|  | 750 | &stat_data_ops, | 
|  | 751 | &indirect_ops, | 
|  | 752 | &direct_ops, | 
|  | 753 | &direntry_ops, | 
|  | 754 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 
|  | 755 | &errcatch_ops		/* This is to catch errors with invalid type (15th entry for TYPE_ANY) */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 756 | }; |