reiserfs: convert string formatting to evprintk
PATCH 3/3 reiserfs: convert string formatting to evprintk
The reiserfs string formatting code bounces back and forth between its own internal formatting rules and those provided by vsnprintf. It's worked alright, but depends on undefined behavior - behavior that changed in a recent gcc release IIRC.
This patch eliminates the reiserfs-internal string formatting and provides sprintf_type rules to allow reiserfs to use evprintk.
Signed-off-by Jeff Mahoney <[email protected]>
--- fs/reiserfs/dir.c | 4 fs/reiserfs/do_balan.c | 25 +- fs/reiserfs/fix_node.c | 58 +++-- fs/reiserfs/ibalance.c | 4 fs/reiserfs/inode.c | 23 +- fs/reiserfs/item_ops.c | 11 - fs/reiserfs/lbalance.c | 43 ++-- fs/reiserfs/namei.c | 9 fs/reiserfs/prints.c | 413 +++++++++++++++++++----------------------- fs/reiserfs/stree.c | 119 ++++++------ fs/reiserfs/super.c | 27 +- fs/reiserfs/tail_conversion.c | 19 - fs/reiserfs/xattr.c | 10 - 13 files changed, 385 insertions(+), 380 deletions(-)
fs/reiserfs/dir.c +2 -2
@@ -92,8 +92,8 @@ static int reiserfs_readdir(struct file/* we must have found item, that is item of this directory, */ RFALSE (COMP_SHORT_KEYS (&(ih->ih_key), &pos_key), -"vs-9000: found item %h does not match to dir we readdir %K" , - ih, &pos_key); +"vs-9000: found item %peh does not match to dir " +"we readdir %peK" , ih, &pos_key);RFALSE (item_num >B_NR_ITEMS (bh) -1 ,"vs-9005 item_num == %d, item amount == %d" , item_num,B_NR_ITEMS (bh));
fs/reiserfs/do_balan.c +13 -12
@@ -79,7 +79,7 @@ static int balance_leaf_when_delete(strustruct item_head *ih;RFALSE (tb->FR[0 ] &&B_LEVEL (tb->FR[0 ]) !=DISK_LEAF_NODE_LEVEL +1 , -"vs- 12000: level: wrong FR %z" , tb->FR[0 ]); +"vs- 12000: level: wrong FR %pez" , tb->FR[0 ]);RFALSE (tb->blknum[0 ] >1 ,"PAP-12005: tb->blknum == %d, can not be > 1" , tb->blknum[0 ]); RFALSE(!tb->blknum[0] && !PATH_H_PPARENT(tb->tb_path, 0),
@@ -93,8 +93,8 @@ static int balance_leaf_when_delete(strucase M_DELETE :/* delete item in S[0] */ RFALSE (ih_item_len (ih) +IH_SIZE != -tb->insert_size[0 ], -"vs-12013: mode Delete, insert size %d, ih to be deleted %h" , - -tb->insert_size[0 ], ih); +"vs-12013: mode Delete, insert size %d, ih to " +"be deleted %peh" , -tb->insert_size[0 ], ih); bi.tb = tb; bi.bi_bh = tbS0;
@@ -1549,8 +1549,8 @@ static int balance_leaf(struct tree_balaRFALSE (!buffer_journaled (S_new[i]) ||buffer_journal_dirty (S_new[i]) - ||buffer_dirty (S_new[i]),"PAP-12247: S_new[%d] : (%b)" , - i, S_new[i]); + ||buffer_dirty (S_new[i]), +"PAP-12247: S_new[%d] : (%peb)" , i, S_new[i]); }/* if the affected item was not wholly shifted then we perform all necessary operations on that part or whole of the
@@ -1804,8 +1804,8 @@ void replace_key(struct tree_balance *tb"vs-12305: source or destination buffer is 0 (src=%p, dest=%p)" , src, dest);RFALSE (!B_IS_KEYS_LEVEL (dest), -"vs-12310: invalid level (%z) for destination buffer. dest must be leaf" , - dest); +"vs-12310: invalid level (%pez) for destination buffer. " +"dest must be leaf" , dest);RFALSE (n_dest <0 || n_src <0 ,"vs-12315: src(%d) or dest(%d) key number < 0" , n_src, n_dest); RFALSE(n_dest >= B_NR_ITEMS(dest) || n_src >= B_NR_ITEMS(src),
@@ -1867,14 +1867,15 @@ static void check_internal_node(struct sRFALSE (!buffer_dirty (bh) && !(buffer_journaled (bh) ||buffer_journal_dirty (bh)), -"PAP-12337: buffer (%b) must be dirty" , bh); +"PAP-12337: buffer (%peb) must be dirty" , bh); dc =B_N_CHILD (bh,0 );for (i =0 ; i <=B_NR_ITEMS (bh); i++, dc++) {if (!is_reusable (s,dc_block_number (dc),1 )) {print_cur_tb (mes);reiserfs_panic (s, -"PAP-12338: check_internal_node: invalid child pointer %y in %b" , +"PAP-12338: check_internal_node: " +"invalid child pointer %pey in %peb" , dc, bh); } }
@@ -1885,7 +1886,7 @@ static int locked_or_not_in_tree(structif ((!buffer_journal_prepared (bh) &&buffer_locked (bh)) || !B_IS_IN_TREE (bh)) {reiserfs_warning (NULL , -"vs-12339: locked_or_not_in_tree: %s (%b)" , +"vs-12339: locked_or_not_in_tree: %s (%peb)" , which, bh);return 1 ; }
@@ -1956,8 +1957,8 @@ static void check_after_balance_leaf(str 1))));print_cur_tb ("12223" ); reiserfs_warning(tb->tb_sb, - "B_FREE_SPACE (PATH_H_PBUFFER(tb->tb_path,0)) = %d; " - "MAX_CHILD_SIZE (%d) - dc_size( %y, %d ) [%d] = %d", + "B_FREE_SPACE (PATH_H_PBUFFER(tb->tb_path,0)) = %d; " + "MAX_CHILD_SIZE (%d) - dc_size( %pey, %d ) [%d] = %d", left, MAX_CHILD_SIZE(PATH_H_PBUFFER(tb->tb_path, 0)), PATH_H_PBUFFER(tb->tb_path, 1),
fs/reiserfs/fix_node.c +35 -23
146 lines not on this page · raw message
fs/reiserfs/ibalance.c +2 -2
@@ -226,7 +226,7 @@ static void internal_delete_pointers_iteRFALSE (first_i + del_num >B_NR_ITEMS (cur),"first_i = %d del_num = %d " -"no so many keys (%d) in the node (%b)(%z)" , +"no so many keys (%d) in the node (%peb)(%pez)" , first_i, del_num, first_i + del_num, cur, cur);/* deleting */
@@ -1063,7 +1063,7 @@ int balance_internal(struct tree_balance new_insert_ptr = S_new;RFALSE (!buffer_journaled (S_new) ||buffer_journal_dirty (S_new) - ||buffer_dirty (S_new),"cm-00001: bad S_new (%b)" , + ||buffer_dirty (S_new),"cm-00001: bad S_new (%peb)" , S_new);// S_new is released in unfix_nodes
fs/reiserfs/inode.c +12 -11
@@ -1008,7 +1008,7 @@ int reiserfs_get_block(struct inode *inoif (retval ==POSITION_FOUND ) {reiserfs_warning (inode->i_sb,"vs-825: reiserfs_get_block: " -"%K should not be found" , &key); +"%peK should not be found" , &key); retval = -EEXIST ;if (allocated_block_nr) reiserfs_free_block(th, inode,
@@ -1300,8 +1300,8 @@ static void update_stat_data(struct treeif (!is_statdata_le_ih (ih))reiserfs_panic (inode->i_sb, -"vs-13065: update_stat_data: key %k, found item %h" , -INODE_PKEY (inode), ih); +"vs-13065: update_stat_data: key %pek, found item %peh" , +INODE_PKEY (inode), ih);if (stat_data_v1 (ih)) {// path points to old stat data
@@ -1334,8 +1334,8 @@ void reiserfs_update_sd_size(struct reisif (retval ==IO_ERROR ) {reiserfs_warning (inode->i_sb,"vs-13050: reiserfs_update_sd: " -"i/o failure occurred trying to update %K stat data" , - &key); +"i/o failure occurred trying to " +"update %peK stat data" , &key);return ; }if (retval ==ITEM_NOT_FOUND ) {
@@ -1347,7 +1347,8 @@ void reiserfs_update_sd_size(struct reis }reiserfs_warning (inode->i_sb,"vs-13060: reiserfs_update_sd: " -"stat data of object %k (nlink == %d) not found (pos %d)" , +"stat data of object %pek " +"(nlink == %d) not found (pos %d)" ,INODE_PKEY (inode), inode->i_nlink, pos);reiserfs_check_path (&path);
@@ -1426,8 +1427,8 @@ void reiserfs_read_locked_inode(struct iif (retval ==IO_ERROR ) {reiserfs_warning (inode->i_sb,"vs-13070: reiserfs_read_locked_inode: " -"i/o failure occurred trying to find stat data of %K" , - &key); +"i/o failure occurred trying to find " +"stat data of %peK" , &key);reiserfs_make_bad_inode (inode);return ; }
@@ -1459,7 +1460,7 @@ void reiserfs_read_locked_inode(struct i !REISERFS_SB(inode->i_sb)->s_is_unlinked_ok) {reiserfs_warning (inode->i_sb,"vs-13075: reiserfs_read_locked_inode: " -"dead inode read from disk %K. " +"dead inode read from disk %peK. " "This is likely to be race with knfsd. Ignore" , &key);reiserfs_make_bad_inode (inode);
@@ -1687,7 +1688,7 @@ static int reiserfs_new_directory(structif (retval ==ITEM_FOUND ) {pathrelse (path);reiserfs_warning (sb,"vs-13070: reiserfs_new_directory: " -"object with this key exists (%k)" , +"object with this key exists (%pek)" , &(ih->ih_key));return -EEXIST ; }
@@ -1727,7 +1728,7 @@ static int reiserfs_new_symlink(struct rif (retval ==ITEM_FOUND ) {pathrelse (path);reiserfs_warning (sb,"vs-13080: reiserfs_new_symlink: " -"object with this key exists (%k)" , +"object with this key exists (%pek)" , &(ih->ih_key));return -EEXIST ; }
fs/reiserfs/item_ops.c +6 -5
@@ -97,7 +97,7 @@ static int sd_unit_num(struct virtual_itstatic void sd_print_vi (struct virtual_item *vi) { -reiserfs_warning (NULL ,"STATDATA, index %d, type 0x%x, %h" , +reiserfs_warning (NULL ,"STATDATA, index %d, type 0x%x, %peh" , vi->vi_index, vi->vi_type, vi->vi_ih); }
@@ -190,7 +190,7 @@ static int direct_unit_num(struct virtuastatic void direct_print_vi (struct virtual_item *vi) { -reiserfs_warning (NULL ,"DIRECT, index %d, type 0x%x, %h" , +reiserfs_warning (NULL ,"DIRECT, index %d, type 0x%x, %peh" , vi->vi_index, vi->vi_type, vi->vi_ih); }
@@ -334,7 +334,7 @@ static int indirect_unit_num(struct virtstatic void indirect_print_vi (struct virtual_item *vi) { -reiserfs_warning (NULL ,"INDIRECT, index %d, type 0x%x, %h" , +reiserfs_warning (NULL ,"INDIRECT, index %d, type 0x%x, %peh" , vi->vi_index, vi->vi_type, vi->vi_ih); }
@@ -614,8 +614,9 @@ static void direntry_print_vi(struct virint i;struct direntry_uarea *dir_u = vi->vi_uarea; -reiserfs_warning (NULL ,"DIRENTRY, index %d, type 0x%x, %h, flags 0x%x" , - vi->vi_index, vi->vi_type, vi->vi_ih, dir_u->flags); +reiserfs_warning (NULL ,"DIRENTRY, index %d, type 0x%x, %peh, " +"flags 0x%x" , vi->vi_index, vi->vi_type, + vi->vi_ih, dir_u->flags);printk ("%d entries: " , dir_u->entry_count);for (i =0 ; i < dir_u->entry_count; i++)printk ("%d " , dir_u->entry_sizes[i]);
fs/reiserfs/lbalance.c +25 -18
105 lines not on this page · raw message
fs/reiserfs/namei.c +5 -4
@@ -147,8 +147,9 @@ int search_by_entry_key(struct super_blo COMP_SHORT_KEYS(&(de->de_ih->ih_key), key)) {print_block (de->de_bh,0 ,-1 ,-1 );reiserfs_panic (sb, -"vs-7005: search_by_entry_key: found item %h is not directory item or " -"does not belong to the same directory as key %K" , +"vs-7005: search_by_entry_key: found item " +"%peh is not directory item or does not " +"belong to the same directory as key %peK" , de->de_ih, key); }#endif /* CONFIG_REISERFS_CHECK */
@@ -517,8 +518,8 @@ static int reiserfs_add_entry(struct rei NAME_NOT_FOUND) {reiserfs_warning (dir->i_sb,"vs-7032: reiserfs_add_entry: " -"entry with this key (%K) already exists" , - &entry_key); +"entry with this key (%peK) already " +"exists" , &entry_key);if (buffer != small_buf)kfree (buffer);
fs/reiserfs/prints.c +196 -217
568 lines not on this page · raw message
fs/reiserfs/stree.c +62 -57
283 lines not on this page · raw message
fs/reiserfs/super.c +13 -14
@@ -235,18 +235,16 @@ static int finish_unfinished(struct supeif (!inode) {/* the unlink almost completed, it just did not manage to remove "save" link and release objectid */ -reiserfs_warning (s, -"vs-2180: finish_unfinished: iget failed for %K" , - &obj_key); +reiserfs_warning (s,"vs-2180: finish_unfinished: " +"iget failed for %peK" , &obj_key); retval =remove_save_link_only (s, &save_link_key,1 );continue ; }if (!truncate && inode->i_nlink) {/* file is not unlinked */ -reiserfs_warning (s, -"vs-2185: finish_unfinished: file %K is not unlinked" , - &obj_key); +reiserfs_warning (s,"vs-2185: finish_unfinished: " +"file %peK is not unlinked" , &obj_key); retval =remove_save_link_only (s, &save_link_key,0 );continue ; }
@@ -257,8 +255,8 @@ static int finish_unfinished(struct supeThe only imaginable way is to execute unfinished truncate request then boot into old kernel, remove the file and create dir with the same key. */ -reiserfs_warning (s, -"green-2101: impossible truncate on a directory %k. Please report" , +reiserfs_warning (s,"green-2101: impossible truncate " +"on a directory %pek. Please report" ,INODE_PKEY (inode)); retval =remove_save_link_only (s, &save_link_key,0 ); truncate =0 ;
@@ -271,7 +269,7 @@ static int finish_unfinished(struct supe i_link_saved_truncate_mask;/* not completed truncate found. New size was committed together with "save" link */ -reiserfs_info (s,"Truncating %k to %Ld .." , +reiserfs_info (s,"Truncating %pek to %lld .." ,INODE_PKEY (inode), inode->i_size);reiserfs_truncate_file (inode, 0
@@ -281,7 +279,7 @@ static int finish_unfinished(struct supe }else {REISERFS_I (inode)->i_flags |= i_link_saved_unlink_mask;/* not completed unlink (rmdir) found */ -reiserfs_info (s,"Removing %k.." ,INODE_PKEY (inode)); +reiserfs_info (s,"Removing %pek.." ,INODE_PKEY (inode));if (memcmp (&last_inode_key,INODE_PKEY (inode),sizeof (last_inode_key))){ last_inode_key = *INODE_PKEY (inode);
@@ -360,8 +358,9 @@ void add_save_link(struct reiserfs_trans }else {/* truncate */ if (S_ISDIR (inode->i_mode)) -reiserfs_warning (inode->i_sb, -"green-2102: Adding a truncate savelink for a directory %k! Please report" , +reiserfs_warning (inode->i_sb,"green-2102: Adding a " +"truncate savelink for a directory " +"%pek! Please report" ,INODE_PKEY (inode));set_cpu_key_k_offset (&key,1 );set_cpu_key_k_type (&key,TYPE_INDIRECT );
@@ -377,8 +376,8 @@ void add_save_link(struct reiserfs_transif (retval !=ITEM_NOT_FOUND ) {if (retval != -ENOSPC )reiserfs_warning (inode->i_sb,"vs-2100: add_save_link:" -"search_by_key (%K) returned %d" , &key, - retval); +"search_by_key (%peK) returned %d" , + &key, retval);pathrelse (&path);return ; }
fs/reiserfs/tail_conversion.c +9 -10
@@ -48,8 +48,8 @@ int direct2indirect(struct reiserfs_tran// FIXME: we could avoid this if (search_for_position_by_key (sb, &end_key, path) ==POSITION_FOUND ) { -reiserfs_warning (sb,"PAP-14030: direct2indirect: " -"pasted or inserted byte exists in the tree %K. " +reiserfs_warning (sb,"PAP-14030: direct2indirect: pasted or " +"inserted byte exists in the tree %peK. " "Use fsck to repair." , &end_key);pathrelse (path);return -EIO ;
@@ -92,12 +92,12 @@ int direct2indirect(struct reiserfs_tranlast item of the file */ if (search_for_position_by_key (sb, &end_key, path) ==POSITION_FOUND ) -reiserfs_panic (sb, -"PAP-14050: direct2indirect: " -"direct item (%K) not found" , &end_key); +reiserfs_panic (sb,"PAP-14050: direct2indirect: " +"direct item (%peK) not found" , + &end_key); p_le_ih =PATH_PITEM_HEAD (path);RFALSE (!is_direct_le_ih (p_le_ih), -"vs-14055: direct item expected(%K), found %h" , +"vs-14055: direct item expected(%peK), found %peh" , &end_key, p_le_ih); tail_size = (le_ih_k_offset (p_le_ih) & (n_blk_size -1 )) +ih_item_len (p_le_ih) -1 ;
@@ -214,10 +214,9 @@ int indirect2direct(struct reiserfs_tran/* re-search indirect item */ if (search_for_position_by_key (p_s_sb, p_s_item_key, p_s_path) ==POSITION_NOT_FOUND ) -reiserfs_panic (p_s_sb, -"PAP-5520: indirect2direct: " -"item to be converted %K does not exist" , - p_s_item_key); +reiserfs_panic (p_s_sb,"PAP-5520: indirect2direct: " +"item to be converted %peK does not " +"exist" , p_s_item_key);copy_item_head (&s_ih,PATH_PITEM_HEAD (p_s_path));#ifdef CONFIG_REISERFS_CHECK pos = le_ih_k_offset(&s_ih) - 1 +
fs/reiserfs/xattr.c +5 -5
@@ -259,15 +259,15 @@ static int __xattr_readdir(struct inode ih = de.de_ih;if (!is_direntry_le_ih (ih)) { -reiserfs_warning (inode->i_sb,"not direntry %h" , ih); +reiserfs_warning (inode->i_sb,"not direntry %peh" , ih);break ; }copy_item_head (&tmp_ih, ih);/* we must have found item, that is item of this directory, */ RFALSE (COMP_SHORT_KEYS (&(ih->ih_key), &pos_key), -"vs-9000: found item %h does not match to dir we readdir %K" , - ih, &pos_key); +"vs-9000: found item %peh does not match to " +"dir we readdir %peK" , ih, &pos_key);if (deh_offset (deh) <=DOT_DOT_OFFSET ) {break ;
@@ -600,7 +600,7 @@ reiserfs_xattr_get(const struct inode *ireiserfs_put_page (page);reiserfs_warning (inode->i_sb,"Invalid magic for xattr (%s) " -"associated with %k" , name, +"associated with %pek" , name,INODE_PKEY (inode)); err = -EIO ; goto out_dput;
@@ -620,7 +620,7 @@ reiserfs_xattr_get(const struct inode *i hash) {reiserfs_warning (inode->i_sb,"Invalid hash for xattr (%s) associated " -"with %k" , name,INODE_PKEY (inode)); +"with %pek" , name,INODE_PKEY (inode)); err = -EIO ; }
Signature · 2 lines
Jeff Mahoney SUSE Labs