--- zzzz-none-000/linux-3.10.107/fs/reiserfs/item_ops.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/fs/reiserfs/item_ops.c 2021-02-04 17:41:59.000000000 +0000 @@ -5,15 +5,17 @@ #include #include "reiserfs.h" -// this contains item handlers for old item types: sd, direct, -// indirect, directory +/* + * this contains item handlers for old item types: sd, direct, + * indirect, directory + */ -/* and where are the comments? how about saying where we can find an - explanation of each item handler method? -Hans */ +/* + * and where are the comments? how about saying where we can find an + * explanation of each item handler method? -Hans + */ -////////////////////////////////////////////////////////////////////////////// -// stat data functions -// +/* stat data functions */ static int sd_bytes_number(struct item_head *ih, int block_size) { return 0; @@ -52,7 +54,7 @@ } else { struct stat_data *sd = (struct stat_data *)item; - printk("\t0%-6o | %6Lu | %2u | %d | %s\n", sd_v2_mode(sd), + printk("\t0%-6o | %6llu | %2u | %d | %s\n", sd_v2_mode(sd), (unsigned long long)sd_v2_size(sd), sd_v2_nlink(sd), sd_v2_rdev(sd), print_time(sd_v2_mtime(sd))); } @@ -60,7 +62,7 @@ static void sd_check_item(struct item_head *ih, char *item) { - // FIXME: type something here! + /* unused */ } static int sd_create_vi(struct virtual_node *vn, @@ -68,7 +70,6 @@ int is_affected, int insert_size) { vi->vi_index = TYPE_STAT_DATA; - //vi->vi_type |= VI_TYPE_STAT_DATA;// not needed? return 0; } @@ -117,15 +118,13 @@ .print_vi = sd_print_vi }; -////////////////////////////////////////////////////////////////////////////// -// direct item functions -// +/* direct item functions */ static int direct_bytes_number(struct item_head *ih, int block_size) { return ih_item_len(ih); } -// FIXME: this should probably switch to indirect as well +/* FIXME: this should probably switch to indirect as well */ static void direct_decrement_key(struct cpu_key *key) { cpu_key_k_offset_dec(key); @@ -144,7 +143,7 @@ { int j = 0; -// return; +/* return; */ printk("\""); while (j < ih_item_len(ih)) printk("%c", item[j++]); @@ -153,7 +152,7 @@ static void direct_check_item(struct item_head *ih, char *item) { - // FIXME: type something here! + /* unused */ } static int direct_create_vi(struct virtual_node *vn, @@ -161,7 +160,6 @@ int is_affected, int insert_size) { vi->vi_index = TYPE_DIRECT; - //vi->vi_type |= VI_TYPE_DIRECT; return 0; } @@ -211,16 +209,13 @@ .print_vi = direct_print_vi }; -////////////////////////////////////////////////////////////////////////////// -// indirect item functions -// - +/* indirect item functions */ static int indirect_bytes_number(struct item_head *ih, int block_size) { - return ih_item_len(ih) / UNFM_P_SIZE * block_size; //- get_ih_free_space (ih); + return ih_item_len(ih) / UNFM_P_SIZE * block_size; } -// decrease offset, if it becomes 0, change type to stat data +/* decrease offset, if it becomes 0, change type to stat data */ static void indirect_decrement_key(struct cpu_key *key) { cpu_key_k_offset_dec(key); @@ -228,7 +223,7 @@ set_cpu_key_k_type(key, TYPE_STAT_DATA); } -// if it is not first item of the body, then it is mergeable +/* if it is not first item of the body, then it is mergeable */ static int indirect_is_left_mergeable(struct reiserfs_key *key, unsigned long bsize) { @@ -236,7 +231,7 @@ return (le_key_k_offset(version, key) != 1); } -// printing of indirect item +/* printing of indirect item */ static void start_new_sequence(__u32 * start, int *len, __u32 new) { *start = new; @@ -295,7 +290,7 @@ static void indirect_check_item(struct item_head *ih, char *item) { - // FIXME: type something here! + /* unused */ } static int indirect_create_vi(struct virtual_node *vn, @@ -303,7 +298,6 @@ int is_affected, int insert_size) { vi->vi_index = TYPE_INDIRECT; - //vi->vi_type |= VI_TYPE_INDIRECT; return 0; } @@ -321,16 +315,19 @@ return indirect_check_left(vi, free, 0, 0); } -// return size in bytes of 'units' units. If first == 0 - calculate from the head (left), otherwise - from tail (right) +/* + * return size in bytes of 'units' units. If first == 0 - calculate + * from the head (left), otherwise - from tail (right) + */ static int indirect_part_size(struct virtual_item *vi, int first, int units) { - // unit of indirect item is byte (yet) + /* unit of indirect item is byte (yet) */ return units; } static int indirect_unit_num(struct virtual_item *vi) { - // unit of indirect item is byte (yet) + /* unit of indirect item is byte (yet) */ return vi->vi_item_len - IH_SIZE; } @@ -356,10 +353,7 @@ .print_vi = indirect_print_vi }; -////////////////////////////////////////////////////////////////////////////// -// direntry functions -// - +/* direntry functions */ static int direntry_bytes_number(struct item_head *ih, int block_size) { reiserfs_warning(NULL, "vs-16090", @@ -396,7 +390,7 @@ deh = (struct reiserfs_de_head *)item; - for (i = 0; i < I_ENTRY_COUNT(ih); i++, deh++) { + for (i = 0; i < ih_entry_count(ih); i++, deh++) { namelen = (i ? (deh_location(deh - 1)) : ih_item_len(ih)) - deh_location(deh); @@ -414,7 +408,7 @@ namebuf[namelen + 2] = 0; } - printk("%d: %-15s%-15d%-15d%-15Ld%-15Ld(%s)\n", + printk("%d: %-15s%-15d%-15d%-15lld%-15lld(%s)\n", i, namebuf, deh_dir_id(deh), deh_objectid(deh), GET_HASH_VALUE(deh_offset(deh)), @@ -428,9 +422,9 @@ int i; struct reiserfs_de_head *deh; - // FIXME: type something here! + /* unused */ deh = (struct reiserfs_de_head *)item; - for (i = 0; i < I_ENTRY_COUNT(ih); i++, deh++) { + for (i = 0; i < ih_entry_count(ih); i++, deh++) { ; } } @@ -439,7 +433,8 @@ /* * function returns old entry number in directory item in real node - * using new entry number in virtual item in virtual node */ + * using new entry number in virtual item in virtual node + */ static inline int old_entry_num(int is_affected, int virtual_entry_num, int pos_in_item, int mode) { @@ -463,9 +458,11 @@ return virtual_entry_num - 1; } -/* Create an array of sizes of directory entries for virtual - item. Return space used by an item. FIXME: no control over - consuming of space used by this item handler */ +/* + * Create an array of sizes of directory entries for virtual + * item. Return space used by an item. FIXME: no control over + * consuming of space used by this item handler + */ static int direntry_create_vi(struct virtual_node *vn, struct virtual_item *vi, int is_affected, int insert_size) @@ -494,8 +491,8 @@ j = old_entry_num(is_affected, i, vn->vn_pos_in_item, vn->vn_mode); dir_u->entry_sizes[i] = - (j ? deh_location(&(deh[j - 1])) : ih_item_len(vi->vi_ih)) - - deh_location(&(deh[j])) + DEH_SIZE; + (j ? deh_location(&deh[j - 1]) : ih_item_len(vi->vi_ih)) - + deh_location(&deh[j]) + DEH_SIZE; } size += (dir_u->entry_count * sizeof(short)); @@ -529,10 +526,10 @@ } -// -// return number of entries which may fit into specified amount of -// free space, or -1 if free space is not enough even for 1 entry -// +/* + * return number of entries which may fit into specified amount of + * free space, or -1 if free space is not enough even for 1 entry + */ static int direntry_check_left(struct virtual_item *vi, int free, int start_skip, int end_skip) { @@ -541,8 +538,8 @@ struct direntry_uarea *dir_u = vi->vi_uarea; for (i = start_skip; i < dir_u->entry_count - end_skip; i++) { + /* i-th entry doesn't fit into the remaining free space */ if (dir_u->entry_sizes[i] > free) - /* i-th entry doesn't fit into the remaining free space */ break; free -= dir_u->entry_sizes[i]; @@ -570,8 +567,8 @@ struct direntry_uarea *dir_u = vi->vi_uarea; for (i = dir_u->entry_count - 1; i >= 0; i--) { + /* i-th entry doesn't fit into the remaining free space */ if (dir_u->entry_sizes[i] > free) - /* i-th entry doesn't fit into the remaining free space */ break; free -= dir_u->entry_sizes[i]; @@ -643,9 +640,7 @@ .print_vi = direntry_print_vi }; -////////////////////////////////////////////////////////////////////////////// -// Error catching functions to catch errors caused by incorrect item types. -// +/* Error catching functions to catch errors caused by incorrect item types. */ static int errcatch_bytes_number(struct item_head *ih, int block_size) { reiserfs_warning(NULL, "green-16001", @@ -685,8 +680,12 @@ { reiserfs_warning(NULL, "green-16006", "Invalid item type observed, run fsck ASAP"); - return 0; // We might return -1 here as well, but it won't help as create_virtual_node() from where - // this operation is called from is of return type void. + /* + * We might return -1 here as well, but it won't help as + * create_virtual_node() from where this operation is called + * from is of return type void. + */ + return 0; } static int errcatch_check_left(struct virtual_item *vi, int free, @@ -739,9 +738,6 @@ errcatch_print_vi }; -////////////////////////////////////////////////////////////////////////////// -// -// #if ! (TYPE_STAT_DATA == 0 && TYPE_INDIRECT == 1 && TYPE_DIRECT == 2 && TYPE_DIRENTRY == 3) #error Item types must use disk-format assigned values. #endif