diff -rup linux-2.4.7-ac1/fs/reiserfs/buffer2.c linux-2.4.7-ac1.patched/fs/reiserfs/buffer2.c
--- linux-2.4.7-ac1/fs/reiserfs/buffer2.c	Fri Jul 27 22:26:37 2001
+++ linux-2.4.7-ac1.patched/fs/reiserfs/buffer2.c	Fri Jul 27 22:27:14 2001
@@ -33,7 +33,7 @@
    hold we did free all buffers in tree balance structure
    (get_empty_nodes and get_nodes_for_preserving) or in path structure
    only (get_new_buffer) just before calling this */
-void wait_buffer_until_released (struct buffer_head * bh)
+void wait_buffer_until_released (const struct buffer_head * bh)
 {
   int repeat_counter = 0;
 
diff -rup linux-2.4.7-ac1/fs/reiserfs/dir.c linux-2.4.7-ac1.patched/fs/reiserfs/dir.c
--- linux-2.4.7-ac1/fs/reiserfs/dir.c	Fri Jul 27 22:26:37 2001
+++ linux-2.4.7-ac1.patched/fs/reiserfs/dir.c	Fri Jul 27 22:27:14 2001
@@ -68,7 +68,7 @@ static int reiserfs_readdir (struct file
     INITIALIZE_PATH (path_to_entry);
     struct buffer_head * bh;
     int item_num, entry_num;
-    struct key * rkey;
+    const struct key * rkey;
     struct item_head * ih, tmp_ih;
     int search_res;
     char * local_buf;
diff -rup linux-2.4.7-ac1/fs/reiserfs/do_balan.c linux-2.4.7-ac1.patched/fs/reiserfs/do_balan.c
--- linux-2.4.7-ac1/fs/reiserfs/do_balan.c	Fri Jul 27 22:26:37 2001
+++ linux-2.4.7-ac1.patched/fs/reiserfs/do_balan.c	Fri Jul 27 22:27:14 2001
@@ -106,7 +106,7 @@ static int balance_leaf_when_delete (str
 
 	 RFALSE( le16_to_cpu (ih->ih_item_len) + IH_SIZE != -tb->insert_size [0],
 		 "vs-12013: mode Delete, insert size %d, ih to be deleted %h", 
-		 ih);
+		 -tb->insert_size [0], ih);
 
 #if 0 /* rigth delim key not supported */
 	if ( ! item_pos && (! tb->L[0] || COMP_KEYS(B_PRIGHT_DELIM_KEY(tb->L[0]), B_N_PKEY(tbS0, 0))) ) {
diff -rup linux-2.4.7-ac1/fs/reiserfs/ibalance.c linux-2.4.7-ac1.patched/fs/reiserfs/ibalance.c
--- linux-2.4.7-ac1/fs/reiserfs/ibalance.c	Fri Jul 27 22:26:37 2001
+++ linux-2.4.7-ac1.patched/fs/reiserfs/ibalance.c	Fri Jul 27 22:27:14 2001
@@ -113,7 +113,7 @@ static void	internal_define_dest_src_inf
 	break;
 
     default:
-	reiserfs_panic (tb->tb_sb, "internal_define_dest_src_infos", "shift type is unknown (%d)", shift_mode);
+	reiserfs_panic (tb->tb_sb, "internal_define_dest_src_infos: shift type is unknown (%d)", shift_mode);
     }
 }
 
@@ -677,7 +677,7 @@ static void balance_internal_when_delete
 
 	return;
     }
-    reiserfs_panic (tb->tb_sb, "balance_internal_when_delete", "unexpected tb->lnum[%d]==%d or tb->rnum[%d]==%d",
+    reiserfs_panic (tb->tb_sb, "balance_internal_when_delete: unexpected tb->lnum[%d]==%d or tb->rnum[%d]==%d",
 		    h, tb->lnum[h], h, tb->rnum[h]);
 }
 
@@ -905,7 +905,7 @@ int balance_internal (struct tree_balanc
 
 
 	if ( tb->blknum[h] != 1 )
-	    reiserfs_panic(0, "balance_internal", "One new node required for creating the new root");
+	    reiserfs_panic(0, "balance_internal: One new node required for creating the new root");
 	/* S[h] = empty buffer from the list FEB. */
 	tbSh = get_FEB (tb);
 	B_BLK_HEAD(tbSh)->blk_level = cpu_to_le16 (h + 1);
diff -rup linux-2.4.7-ac1/fs/reiserfs/inode.c linux-2.4.7-ac1.patched/fs/reiserfs/inode.c
--- linux-2.4.7-ac1/fs/reiserfs/inode.c	Fri Jul 27 22:26:37 2001
+++ linux-2.4.7-ac1.patched/fs/reiserfs/inode.c	Fri Jul 27 22:27:14 2001
@@ -78,8 +78,10 @@ void make_cpu_key (struct cpu_key * key,
 //
 // when key is 0, do not set version and short key
 //
-inline void make_le_item_head (struct item_head * ih, struct cpu_key * key, int version,
-			       loff_t offset, int type, int length, int entry_count/*or ih_free_space*/)
+inline void make_le_item_head (struct item_head * ih, const struct cpu_key * key,
+			       int version,
+			       loff_t offset, int type, int length, 
+			       int entry_count/*or ih_free_space*/)
 {
     if (key) {
 	ih->ih_key.k_dir_id = cpu_to_le32 (key->on_disk_key.k_dir_id);
@@ -1121,7 +1123,7 @@ void reiserfs_read_inode2 (struct inode 
 }
 
 
-struct inode * reiserfs_iget (struct super_block * s, struct cpu_key * key)
+struct inode * reiserfs_iget (struct super_block * s, const struct cpu_key * key)
 {
     struct inode * inode;
     struct reiserfs_iget4_args args ;
@@ -1891,7 +1893,8 @@ static int reiserfs_writepage (struct pa
 //
 // from ext2_prepare_write, but modified
 //
-int reiserfs_prepare_write(struct file *f, struct page *page, unsigned from, unsigned to) {
+int reiserfs_prepare_write(struct file *f, struct page *page, 
+			   unsigned from, unsigned to) {
     struct inode *inode = page->mapping->host ;
     reiserfs_wait_on_write_block(inode->i_sb) ;
     fix_tail_page_for_writing(page) ;
diff -rup linux-2.4.7-ac1/fs/reiserfs/journal.c linux-2.4.7-ac1.patched/fs/reiserfs/journal.c
--- linux-2.4.7-ac1/fs/reiserfs/journal.c	Fri Jul 27 22:26:37 2001
+++ linux-2.4.7-ac1.patched/fs/reiserfs/journal.c	Fri Jul 27 22:27:14 2001
@@ -375,9 +375,9 @@ static int clear_prepared_bits(struct bu
 }
 
 /* buffer is in current transaction */
-inline int buffer_journaled(struct buffer_head *bh) {
+inline int buffer_journaled(const struct buffer_head *bh) {
   if (bh)
-    return test_bit(BH_JDirty, &bh->b_state) ;
+    return test_bit(BH_JDirty, ( struct buffer_head * ) &bh->b_state) ;
   else
     return 0 ;
 }
@@ -385,9 +385,9 @@ inline int buffer_journaled(struct buffe
 /* disk block was taken off free list before being in a finished transation, or written to disk
 ** journal_new blocks can be reused immediately, for any purpose
 */ 
-inline int buffer_journal_new(struct buffer_head *bh) {
+inline int buffer_journal_new(const struct buffer_head *bh) {
   if (bh) 
-    return test_bit(BH_JNew, &bh->b_state) ;
+    return test_bit(BH_JNew, ( struct buffer_head * )&bh->b_state) ;
   else
     return 0 ;
 }
@@ -731,8 +731,8 @@ reiserfs_panic(s, "journal-539: flush_co
       retry_count++ ;
       goto retry;
     }
-    reiserfs_panic(s, "journal-563: flush_commit_list: BAD, j_commit_left is %lu, should be 1\n", 
-                       atomic_read(&(jl->j_commit_left)));
+    reiserfs_panic(s, "journal-563: flush_commit_list: BAD, j_commit_left is %u, should be 1\n", 
+		   atomic_read(&(jl->j_commit_left)));
   }
 
   mark_buffer_dirty(jl->j_commit_bh) ;
@@ -861,7 +861,7 @@ static int flush_older_journal_lists(str
 
 static void reiserfs_end_buffer_io_sync(struct buffer_head *bh, int uptodate) {
     if (buffer_journaled(bh)) {
-        reiserfs_warning("clm-2084: pinned buffer %u:%s sent to disk\n",
+        reiserfs_warning("clm-2084: pinned buffer %lu:%s sent to disk\n",
 	                 bh->b_blocknr, kdevname(bh->b_dev)) ;
     }
     mark_buffer_uptodate(bh, uptodate) ;
@@ -2102,7 +2102,7 @@ int journal_mark_dirty(struct reiserfs_t
   }
 
   if (th->t_trans_id != SB_JOURNAL(p_s_sb)->j_trans_id) {
-    reiserfs_panic(th->t_super, "journal-1577: handle trans id %d != current trans id %d\n", 
+    reiserfs_panic(th->t_super, "journal-1577: handle trans id %ld != current trans id %ld\n", 
                    th->t_trans_id, SB_JOURNAL(p_s_sb)->j_trans_id);
   }
   p_s_sb->s_dirt = 1 ;
@@ -2440,7 +2440,7 @@ static int check_journal_end(struct reis
   int wait_on_commit = flags & WAIT ;
 
   if (th->t_trans_id != SB_JOURNAL(p_s_sb)->j_trans_id) {
-    reiserfs_panic(th->t_super, "journal-1577: handle trans id %d != current trans id %d\n", 
+    reiserfs_panic(th->t_super, "journal-1577: handle trans id %ld != current trans id %ld\n", 
                    th->t_trans_id, SB_JOURNAL(p_s_sb)->j_trans_id);
   }
 
@@ -2511,7 +2511,7 @@ static int check_journal_end(struct reis
   }
 
   if (SB_JOURNAL(p_s_sb)->j_start > JOURNAL_BLOCK_COUNT) {
-    reiserfs_panic(p_s_sb, "journal-003: journal_end: j_start (%d) is too high\n", SB_JOURNAL(p_s_sb)->j_start) ;
+    reiserfs_panic(p_s_sb, "journal-003: journal_end: j_start (%ld) is too high\n", SB_JOURNAL(p_s_sb)->j_start) ;
   }
   return 1 ;
 }
diff -rup linux-2.4.7-ac1/fs/reiserfs/lbalance.c linux-2.4.7-ac1.patched/fs/reiserfs/lbalance.c
--- linux-2.4.7-ac1/fs/reiserfs/lbalance.c	Fri Jul 27 22:26:37 2001
+++ linux-2.4.7-ac1.patched/fs/reiserfs/lbalance.c	Fri Jul 27 22:27:14 2001
@@ -215,7 +215,8 @@ static int leaf_copy_boundary_item (stru
     /* merge to right only part of item */
     RFALSE( le16_to_cpu (ih->ih_item_len) <= bytes_or_entries,
 	    "vs-10060: no so much bytes %lu (needed %lu)",
-	    ih->ih_item_len, bytes_or_entries);
+	    ( long unsigned ) ih->ih_item_len, 
+	    ( long unsigned ) bytes_or_entries);
     
     /* change first item key of the DEST */
     if ( is_direct_le_ih (dih) ) {
@@ -318,7 +319,7 @@ static void leaf_copy_items_entirely (st
     if (dest_bi->bi_parent) {
 	RFALSE( B_N_CHILD (dest_bi->bi_parent, dest_bi->bi_position)->dc_block_number != dest->b_blocknr,
 		"vs-10160: block number in bh does not match to field in disk_child structure %lu and %lu",
-		dest->b_blocknr, B_N_CHILD (dest_bi->bi_parent, dest_bi->bi_position)->dc_block_number);
+		( long unsigned ) dest->b_blocknr, ( long unsigned ) B_N_CHILD (dest_bi->bi_parent, dest_bi->bi_position)->dc_block_number);
 	B_N_CHILD (dest_bi->bi_parent, dest_bi->bi_position)->dc_size +=
 	    j - last_inserted_loc + IH_SIZE * cpy_num;
     
@@ -354,7 +355,7 @@ static void leaf_item_bottle (struct buf
 		RFALSE( cpy_bytes == le16_to_cpu (ih->ih_item_len) && 
 			get_ih_free_space (ih),
 			"vs-10180: when whole indirect item is bottle to left neighbor, it must have free_space==0 (not %lu)",
-			get_ih_free_space (ih));
+			( long unsigned ) get_ih_free_space (ih));
 		set_ih_free_space (&n_ih, 0);
 	    }
 
@@ -979,7 +980,9 @@ void leaf_cut_from_buffer (struct buffer
 	RFALSE( pos_in_item && 
 		pos_in_item + cut_size != le16_to_cpu (ih->ih_item_len),
 		"invalid offset (%lu) or trunc_size (%lu) or ih_item_len (%lu)",
-                pos_in_item, cut_size, le16_to_cpu (ih->ih_item_len));
+                ( long unsigned ) pos_in_item, 
+		( long unsigned ) cut_size, 
+		( long unsigned ) le16_to_cpu (ih->ih_item_len));
 
         /* shift item body to left if cut is from the head of item */
         if (pos_in_item == 0) {
diff -rup linux-2.4.7-ac1/fs/reiserfs/namei.c linux-2.4.7-ac1.patched/fs/reiserfs/namei.c
--- linux-2.4.7-ac1/fs/reiserfs/namei.c	Fri Jul 27 22:26:37 2001
+++ linux-2.4.7-ac1.patched/fs/reiserfs/namei.c	Fri Jul 27 22:27:14 2001
@@ -125,7 +125,7 @@ entry position in the item 
 */
 
 /* The function is NOT SCHEDULE-SAFE! */
-int search_by_entry_key (struct super_block * sb, struct cpu_key * key,
+int search_by_entry_key (struct super_block * sb, const struct cpu_key * key,
 			 struct path * path, struct reiserfs_dir_entry * de)
 {
     int retval;
diff -rup linux-2.4.7-ac1/fs/reiserfs/objectid.c linux-2.4.7-ac1.patched/fs/reiserfs/objectid.c
--- linux-2.4.7-ac1/fs/reiserfs/objectid.c	Fri Jul 27 22:26:37 2001
+++ linux-2.4.7-ac1.patched/fs/reiserfs/objectid.c	Fri Jul 27 22:27:14 2001
@@ -21,7 +21,7 @@ static void check_objectid_map (struct s
 {
     if (le32_to_cpu (map[0]) != 1)
 	reiserfs_panic (s, "vs-15010: check_objectid_map: map corrupted: %lx",
-			le32_to_cpu (map[0]));
+			( long unsigned int ) le32_to_cpu (map[0]));
 
     // FIXME: add something else here
 }
@@ -161,7 +161,7 @@ void reiserfs_release_objectid (struct r
     }
 
     reiserfs_warning ("vs-15010: reiserfs_release_objectid: tried to free free object id (%lu)", 
-		      objectid_to_release);
+		      ( long unsigned ) objectid_to_release);
 }
 
 
diff -rup linux-2.4.7-ac1/fs/reiserfs/stree.c linux-2.4.7-ac1.patched/fs/reiserfs/stree.c
--- linux-2.4.7-ac1/fs/reiserfs/stree.c	Fri Jul 27 22:26:37 2001
+++ linux-2.4.7-ac1.patched/fs/reiserfs/stree.c	Fri Jul 27 22:27:14 2001
@@ -62,7 +62,7 @@
 #include <linux/smp_lock.h>
 
 /* Does the buffer contain a disk block which is in the tree. */
-inline int B_IS_IN_TREE (struct buffer_head * p_s_bh)
+inline int B_IS_IN_TREE (const struct buffer_head * p_s_bh)
 {
 
   RFALSE( B_LEVEL (p_s_bh) > MAX_HEIGHT,
@@ -74,7 +74,7 @@ inline int B_IS_IN_TREE (struct buffer_h
 
 
 
-inline void copy_short_key (void * to, void * from)
+inline void copy_short_key (void * to, const void * from)
 {
     memcpy (to, from, SHORT_KEY_SIZE);
 }
@@ -82,7 +82,8 @@ inline void copy_short_key (void * to, v
 //
 // to gets item head in le form
 //
-inline void copy_item_head(void * p_v_to, void * p_v_from)
+inline void copy_item_head(struct item_head * p_v_to, 
+			   const struct item_head * p_v_from)
 {
   memcpy (p_v_to, p_v_from, IH_SIZE);
 }
@@ -94,7 +95,8 @@ inline void copy_item_head(void * p_v_to
    Returns: -1 if key1 < key2 
    0 if key1 == key2
    1 if key1 > key2 */
-inline int  comp_short_keys (struct key * le_key, struct cpu_key * cpu_key)
+inline int  comp_short_keys (const struct key * le_key, 
+			     const struct cpu_key * cpu_key)
 {
   __u32 * p_s_le_u32, * p_s_cpu_u32;
   int n_key_length = REISERFS_SHORT_KEY_LEN;
@@ -117,7 +119,7 @@ inline int  comp_short_keys (struct key 
    Compare keys using all 4 key fields.
    Returns: -1 if key1 < key2 0
    if key1 = key2 1 if key1 > key2 */
-inline int  comp_keys (struct key * le_key, struct cpu_key * cpu_key)
+inline int  comp_keys (const struct key * le_key, const struct cpu_key * cpu_key)
 {
   int retval;
 
@@ -146,7 +148,8 @@ inline int  comp_keys (struct key * le_k
 //
 // FIXME: not used yet
 //
-inline int comp_cpu_keys (struct cpu_key * key1, struct cpu_key * key2)
+inline int comp_cpu_keys (const struct cpu_key * key1, 
+			  const struct cpu_key * key2)
 {
     if (key1->on_disk_key.k_dir_id < key2->on_disk_key.k_dir_id)
 	return -1;
@@ -173,7 +176,7 @@ inline int comp_cpu_keys (struct cpu_key
     return 0;
 }
 
-inline int comp_short_le_keys (struct key * key1, struct key * key2)
+inline int comp_short_le_keys (const struct key * key1, const struct key * key2)
 {
   __u32 * p_s_1_u32, * p_s_2_u32;
   int n_key_length = REISERFS_SHORT_KEY_LEN;
@@ -189,8 +192,8 @@ inline int comp_short_le_keys (struct ke
   return 0;
 }
 
-inline int comp_short_cpu_keys (struct cpu_key * key1, 
-				struct cpu_key * key2)
+inline int comp_short_cpu_keys (const struct cpu_key * key1, 
+				const struct cpu_key * key2)
 {
   __u32 * p_s_1_u32, * p_s_2_u32;
   int n_key_length = REISERFS_SHORT_KEY_LEN;
@@ -209,13 +212,13 @@ inline int comp_short_cpu_keys (struct c
 
 
 
-inline void cpu_key2cpu_key (struct cpu_key * to, struct cpu_key * from)
+inline void cpu_key2cpu_key (struct cpu_key * to, const struct cpu_key * from)
 {
     memcpy (to, from, sizeof (struct cpu_key));
 }
 
 
-inline void le_key2cpu_key (struct cpu_key * to, struct key * from)
+inline void le_key2cpu_key (struct cpu_key * to, const struct key * from)
 {
     to->on_disk_key.k_dir_id = le32_to_cpu (from->k_dir_id);
     to->on_disk_key.k_objectid = le32_to_cpu (from->k_objectid);
@@ -235,7 +238,7 @@ inline void le_key2cpu_key (struct cpu_k
 
 // this does not say which one is bigger, it only returns 1 if keys
 // are not equal, 0 otherwise
-inline int comp_le_keys (struct key * k1, struct key * k2)
+inline int comp_le_keys (const struct key * k1, const struct key * k2)
 {
     return memcmp (k1, k2, sizeof (struct key));
 }
@@ -255,8 +258,8 @@ inline int comp_le_keys (struct key * k1
  cut the number of possible items it could be by one more than half rounded down,
  or we find it. */
 inline	int bin_search (
-              void    * p_v_key,    /* Key to search for.                   */
-	      void    * p_v_base,   /* First item in the array.             */
+              const void * p_v_key, /* Key to search for.                   */
+	      const void * p_v_base,/* First item in the array.             */
 	      int       p_n_num,    /* Number of items in the array.        */
 	      int       p_n_width,  /* Item size in the array.
 				       searched. Lest the reader be
@@ -290,19 +293,19 @@ extern struct tree_balance * cur_tb;
 
 
 /* Minimal possible key. It is never in the tree. */
-struct key  MIN_KEY = {0, 0, {{0, 0},}};
+const struct key  MIN_KEY = {0, 0, {{0, 0},}};
 
 /* Maximal possible key. It is never in the tree. */
-struct key  MAX_KEY = {0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},}};
+const struct key  MAX_KEY = {0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},}};
 
 
 /* Get delimiting key of the buffer by looking for it in the buffers in the path, starting from the bottom
    of the path, and going upwards.  We must check the path's validity at each step.  If the key is not in
    the path, there is no delimiting key in the tree (buffer is first or last buffer in tree), and in this
    case we return a special key, either MIN_KEY or MAX_KEY. */
-inline	struct  key * get_lkey  (
-	                struct path         * p_s_chk_path,
-                        struct super_block  * p_s_sb
+inline	const struct  key * get_lkey  (
+	                const struct path         * p_s_chk_path,
+                        const struct super_block  * p_s_sb
                       ) {
   int                   n_position, n_path_offset = p_s_chk_path->path_length;
   struct buffer_head  * p_s_parent;
@@ -339,9 +342,9 @@ inline	struct  key * get_lkey  (
 
 
 /* Get delimiting key of the buffer at the path and its right neighbor. */
-inline	struct  key * get_rkey  (
-	                struct path         * p_s_chk_path,
-                        struct super_block  * p_s_sb
+inline	const struct  key * get_rkey  (
+	                const struct path         * p_s_chk_path,
+                        const struct super_block  * p_s_sb
                       ) {
   int                   n_position,
     			n_path_offset = p_s_chk_path->path_length;
@@ -384,7 +387,7 @@ inline	struct  key * get_rkey  (
    this case get_lkey and get_rkey return a special key which is MIN_KEY or MAX_KEY. */
 static  inline  int key_in_buffer (
                       struct path         * p_s_chk_path, /* Path which should be checked.  */
-                      struct cpu_key      * p_s_key,      /* Key which should be checked.   */
+                      const struct cpu_key      * p_s_key,      /* Key which should be checked.   */
                       struct super_block  * p_s_sb        /* Super block pointer.           */
 		      ) {
 
@@ -635,7 +638,7 @@ static void search_by_key_reada (struct 
    correctness of the bottom of the path */
 /* The function is NOT SCHEDULE-SAFE! */
 int search_by_key (struct super_block * p_s_sb,
-		   struct cpu_key * p_s_key, /* Key to search. */
+		   const struct cpu_key * p_s_key, /* Key to search. */
 		   struct path * p_s_search_path, /* This structure was
 						     allocated and initialized
 						     by the calling
@@ -729,7 +732,8 @@ int search_by_key (struct super_block * 
 	// certain level
 	if (!is_tree_node (p_s_bh, expected_level)) {
 	    reiserfs_warning ("vs-5150: search_by_key: "
-			      "invalid format found in block %d. Fsck?\n", p_s_bh->b_blocknr);
+			      "invalid format found in block %ld. Fsck?\n", 
+			      p_s_bh->b_blocknr);
 	    pathrelse (p_s_search_path);
 	    return IO_ERROR;
 	}
@@ -738,7 +742,7 @@ int search_by_key (struct super_block * 
 	n_node_level = B_LEVEL (p_s_bh);
 
 	RFALSE( n_node_level < n_stop_level,
-		"vs-5152: tree level is less than stop level (%d)",
+		"vs-5152: tree level (%d) is less than stop level (%d)",
 		n_node_level, n_stop_level);
 
 	n_retval = bin_search (p_s_key, B_N_PITEM_HEAD(p_s_bh, 0), B_NR_ITEMS(p_s_bh),
@@ -787,7 +791,7 @@ int search_by_key (struct super_block * 
 
 /* The function is NOT SCHEDULE-SAFE! */
 int search_for_position_by_key (struct super_block  * p_s_sb,         /* Pointer to the super block.          */
-				struct cpu_key      * p_cpu_key,      /* Key to search (cpu variable)         */
+				const struct cpu_key  * p_cpu_key,      /* Key to search (cpu variable)         */
 				struct path         * p_s_search_path /* Filled up by this function.          */
     ) {
     struct item_head    * p_le_ih; /* pointer to on-disk structure */
@@ -855,7 +859,7 @@ int search_for_position_by_key (struct s
 
 
 /* Compare given item and item pointed to by the path. */
-int comp_items (struct item_head * stored_ih, struct path * p_s_path)
+int comp_items (const struct item_head * stored_ih, const struct path * p_s_path)
 {
     struct buffer_head  * p_s_bh;
     struct item_head    * ih;
@@ -871,23 +875,6 @@ int comp_items (struct item_head * store
     /* we need only to know, whether it is the same item */
     ih = get_ih (p_s_path);
     return memcmp (stored_ih, ih, IH_SIZE);
-
-#if 0
-    /* Get item at the path. */
-    p_s_path_item = PATH_PITEM_HEAD(p_s_path);
-    /* Compare keys. */
-    if ( COMP_KEYS(&(p_s_path_item->ih_key), &(p_cpu_ih->ih_key)) )
-	return 1;
-
-    /* Compare other items fields. */
-    if ( le16_to_cpu (p_s_path_item->u.ih_entry_count) != p_cpu_ih->u.ih_entry_count ||
-	 le16_to_cpu (p_s_path_item->ih_item_len) != p_cpu_ih->ih_item_len ||
-	 le16_to_cpu ( p_s_path_item->ih_item_location) != p_cpu_ih->ih_item_location )
-	return 1;
-
-    /* Items are equal. */
-    return 0;
-#endif
 }
 
 
@@ -983,7 +970,7 @@ static char  prepare_for_delete_or_cut(
 				       struct reiserfs_transaction_handle *th, 
 				       struct inode * inode,
 				       struct path         * p_s_path,
-				       struct cpu_key      * p_s_item_key,
+				       const struct cpu_key      * p_s_item_key,
 				       int                 * p_n_removed,      /* Number of unformatted nodes which were removed
 										  from end of the file. */
 				       int                 * p_n_cut_size,
@@ -1277,7 +1264,7 @@ void padd_item (char * item, int total_l
 /* Delete object item. */
 int reiserfs_delete_item (struct reiserfs_transaction_handle *th, 
 			  struct path * p_s_path, /* Path to the deleted item. */
-			  struct cpu_key * p_s_item_key, /* Key to search for the deleted item.  */
+			  const struct cpu_key * p_s_item_key, /* Key to search for the deleted item.  */
 			  struct inode * p_s_inode,/* inode is here just to update i_blocks */
 			  struct buffer_head  * p_s_un_bh)    /* NULL or unformatted node pointer.    */
 {
@@ -1475,7 +1462,7 @@ static int maybe_indirect_to_direct (str
 			      struct inode * p_s_inode,
 			      struct page *page, 
 			      struct path         * p_s_path,
-			      struct cpu_key      * p_s_item_key,
+			      const struct cpu_key      * p_s_item_key,
 			      loff_t         n_new_file_size,
 			      char                * p_c_mode
 			      ) {
@@ -1635,7 +1622,7 @@ int reiserfs_cut_from_item (struct reise
 	    indirect_to_direct_roll_back (th, p_s_inode, p_s_path);
 	}
 	if (n_ret_value == NO_DISK_SPACE)
-	    reiserfs_warning ("");
+	    reiserfs_warning ("NO_DISK_SPACE");
 	unfix_nodes (&s_cut_balance);
 	return -EIO;
     }
@@ -1674,7 +1661,7 @@ int reiserfs_cut_from_item (struct reise
 
 	if (c_mode == M_DELETE && le16_to_cpu (le_ih->ih_item_len) != UNFM_P_SIZE)
 	    reiserfs_panic (p_s_sb, "vs-5653: reiserfs_cut_from_item: "
-			    "completing indirect2direct conversion indirect item %h"
+			    "completing indirect2direct conversion indirect item %h "
 			    "being deleted must be of 4 byte long", le_ih);
 
 	if (c_mode == M_CUT && s_cut_balance.insert_size[0] != -UNFM_P_SIZE) {
@@ -1844,7 +1831,8 @@ void reiserfs_do_truncate (struct reiser
 
 #ifdef CONFIG_REISERFS_CHECK
 // this makes sure, that we __append__, not overwrite or add holes
-static void check_research_for_paste (struct path * path, struct cpu_key * p_s_key)
+static void check_research_for_paste (struct path * path, 
+				      const struct cpu_key * p_s_key)
 {
     struct item_head * found_ih = get_ih (path);
     
@@ -1871,7 +1859,7 @@ static void check_research_for_paste (st
 /* Paste bytes to the existing item. Returns bytes number pasted into the item. */
 int reiserfs_paste_into_item (struct reiserfs_transaction_handle *th, 
 			      struct path         * p_s_search_path,	/* Path to the pasted item.          */
-			      struct cpu_key      * p_s_key,        	/* Key to search for the needed item.*/
+			      const struct cpu_key      * p_s_key,        	/* Key to search for the needed item.*/
 			      const char          * p_c_body,       	/* Pointer to the bytes to paste.    */
 			      int                   n_pasted_size)  	/* Size of pasted bytes.             */
 {
@@ -1915,7 +1903,7 @@ error_out:
 /* Insert new item into the buffer at the path. */
 int reiserfs_insert_item(struct reiserfs_transaction_handle *th, 
 			 struct path         * 	p_s_path,         /* Path to the inserteded item.         */
-			 struct cpu_key      * key,
+			 const struct cpu_key      * key,
 			 struct item_head    * 	p_s_ih,           /* Pointer to the item header to insert.*/
 			 const char          * 	p_c_body)         /* Pointer to the bytes to insert.      */
 {
diff -rup linux-2.4.7-ac1/fs/reiserfs/super.c linux-2.4.7-ac1.patched/fs/reiserfs/super.c
--- linux-2.4.7-ac1/fs/reiserfs/super.c	Fri Jul 27 22:16:50 2001
+++ linux-2.4.7-ac1.patched/fs/reiserfs/super.c	Fri Jul 27 22:27:14 2001
@@ -26,13 +26,8 @@
 #define REISERFS_SUPER_MAGIC_STRING_OFFSET_NJ 20
 
 
-#if 0
-// this one is not used currently
-inline void reiserfs_mark_buffer_dirty (struct buffer_head * bh, int flag)
-{
-  mark_buffer_dirty (bh, flag);
-}
-#endif
+char reiserfs_super_magic_string[] = REISERFS_SUPER_MAGIC_STRING;
+char reiser2fs_super_magic_string[] = REISER2FS_SUPER_MAGIC_STRING;
 
 //
 // a portion of this function, particularly the VFS interface portion,
diff -rup linux-2.4.7-ac1/fs/reiserfs/tail_conversion.c linux-2.4.7-ac1.patched/fs/reiserfs/tail_conversion.c
--- linux-2.4.7-ac1/fs/reiserfs/tail_conversion.c	Fri Jul 27 22:26:37 2001
+++ linux-2.4.7-ac1.patched/fs/reiserfs/tail_conversion.c	Fri Jul 27 22:27:14 2001
@@ -189,7 +189,7 @@ int indirect2direct (struct reiserfs_tra
 		     struct inode * p_s_inode,
 		     struct page *page, 
 		     struct path * p_s_path, /* path to the indirect item. */
-		     struct cpu_key * p_s_item_key, /* Key to look for unformatted node pointer to be cut. */
+		     const struct cpu_key * p_s_item_key, /* Key to look for unformatted node pointer to be cut. */
 		     loff_t n_new_file_size, /* New file size. */
 		     char * p_c_mode)
 {
diff -rup linux-2.4.7-ac1/include/linux/reiserfs_fs.h linux-2.4.7-ac1.patched/include/linux/reiserfs_fs.h
--- linux-2.4.7-ac1/include/linux/reiserfs_fs.h	Fri Jul 27 22:26:37 2001
+++ linux-2.4.7-ac1.patched/include/linux/reiserfs_fs.h	Fri Jul 27 22:27:14 2001
@@ -114,6 +114,7 @@ if( !( cond ) ) 								\
 #define RFALSE( cond, format, args... ) do {;} while( 0 )
 #endif
 
+#define CONSTF __attribute__( ( const ) )
 /*
  * Disk Data Structures
  */
@@ -134,12 +135,15 @@ if( !( cond ) ) 								\
 #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
 #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
 
-extern inline int is_reiserfs_magic_string (struct reiserfs_super_block * rs)
+extern char reiserfs_super_magic_string[];
+extern char reiser2fs_super_magic_string[];
+
+extern inline int is_reiserfs_magic_string (const struct reiserfs_super_block * rs)
 {
-    return (!strncmp (rs->s_magic, REISERFS_SUPER_MAGIC_STRING, 
-		      strlen ( REISERFS_SUPER_MAGIC_STRING)) ||
-	    !strncmp (rs->s_magic, REISER2FS_SUPER_MAGIC_STRING, 
-		      strlen ( REISER2FS_SUPER_MAGIC_STRING)));
+    return (!strncmp (rs->s_magic, reiserfs_super_magic_string, 
+		      strlen ( reiserfs_super_magic_string)) ||
+	    !strncmp (rs->s_magic, reiser2fs_super_magic_string, 
+		      strlen ( reiser2fs_super_magic_string)));
 }
 
 				/* ReiserFS leaves the first 64k unused,
@@ -198,41 +202,11 @@ struct unfm_nodeinfo {
 */
 #define MIN_PACK_ON_CLOSE		512
 
-/* the defines below say, that if file size is >=
-   DIRECT_TAIL_SUPPRESSION_SIZE * blocksize, then if tail is longer
-   than MAX_BYTES_SUPPRESS_DIRECT_TAIL, it will be stored in
-   unformatted node */
-#define DIRECT_TAIL_SUPPRESSION_SIZE      1024
-#define MAX_BYTES_SUPPRESS_DIRECT_TAIL    1024
-
-#if 0
-
-//
-#define mark_file_with_tail(inode,offset) \
-{\
-inode->u.reiserfs_i.i_has_tail = 1;\
-}
-
-#define mark_file_without_tail(inode) \
-{\
-inode->u.reiserfs_i.i_has_tail = 0;\
-}
-
-#endif
-
 // this says about version of all items (but stat data) the object
 // consists of
 #define inode_items_version(inode) ((inode)->u.reiserfs_i.i_version)
 
 
-/* We store tail in unformatted node if it is too big to fit into a
-   formatted node or if DIRECT_TAIL_SUPPRESSION_SIZE,
-   MAX_BYTES_SUPPRESS_DIRECT_TAIL and file size say that. */
-/* #define STORE_TAIL_IN_UNFM(n_file_size,n_tail_size,n_block_size) \ */
-/* ( ((n_tail_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) || \ */
-/*   ( ( (n_file_size) >= (n_block_size) * DIRECT_TAIL_SUPPRESSION_SIZE ) && \ */
-/*    ( (n_tail_size) >= MAX_BYTES_SUPPRESS_DIRECT_TAIL ) ) ) */
-
   /* This is an aggressive tail suppression policy, I am hoping it
      improves our benchmarks. The principle behind it is that
      percentage space saving is what matters, not absolute space
@@ -423,7 +397,7 @@ struct item_head
 
 
 // FIXME: now would that work for other than i386 archs
-#define unreachable_item(ih) (ih->ih_version & (1 << 15))
+#define unreachable_item(ih) (ih_version (ih) & (1 << 15))
 
 #define get_ih_free_space(ih) (ih_version (ih) == ITEM_VERSION_2 ? 0 : ih_free_space (ih))
 #define set_ih_free_space(ih,val) put_ih_free_space((ih), ((ih_version(ih) == ITEM_VERSION_2) ? 0 : (val)))
@@ -450,6 +424,7 @@ struct item_head
 //
 // here are conversion routines
 //
+extern inline int uniqueness2type (__u32 uniqueness) CONSTF;
 extern inline int uniqueness2type (__u32 uniqueness)
 {
     switch (uniqueness) {
@@ -467,6 +442,7 @@ extern inline int uniqueness2type (__u32
     return TYPE_ANY;
 }
 
+extern inline __u32 type2uniqueness (int type) CONSTF;
 extern inline __u32 type2uniqueness (int type)
 {
     switch (type) {
@@ -488,23 +464,23 @@ extern inline __u32 type2uniqueness (int
 // there is no way to get version of object from key, so, provide
 // version to these defines
 //
-extern inline loff_t le_key_k_offset (int version, struct key * key)
+extern inline loff_t le_key_k_offset (int version, const struct key * key)
 {
     return (version == ITEM_VERSION_1) ? key->u.k_offset_v1.k_offset :
 	le64_to_cpu (key->u.k_offset_v2.k_offset);
 }
-extern inline loff_t le_ih_k_offset (struct item_head * ih)
+extern inline loff_t le_ih_k_offset (const struct item_head * ih)
 {
     return le_key_k_offset (ih_version (ih), &(ih->ih_key));
 }
 
 
-extern inline loff_t le_key_k_type (int version, struct key * key)
+extern inline loff_t le_key_k_type (int version, const struct key * key)
 {
     return (version == ITEM_VERSION_1) ? uniqueness2type (key->u.k_offset_v1.k_uniqueness) :
 	le16_to_cpu (key->u.k_offset_v2.k_type);
 }
-extern inline loff_t le_ih_k_type (struct item_head * ih)
+extern inline loff_t le_ih_k_type (const struct item_head * ih)
 {
     return le_key_k_type (ih_version (ih), &(ih->ih_key));
 }
@@ -551,13 +527,13 @@ extern inline void set_le_ih_k_type (str
 //
 // key is pointer to cpu key, result is cpu
 //
-extern inline loff_t cpu_key_k_offset (struct cpu_key * key)
+extern inline loff_t cpu_key_k_offset (const struct cpu_key * key)
 {
     return (key->version == ITEM_VERSION_1) ? key->on_disk_key.u.k_offset_v1.k_offset :
 	key->on_disk_key.u.k_offset_v2.k_offset;
 }
 
-extern inline loff_t cpu_key_k_type (struct cpu_key * key)
+extern inline loff_t cpu_key_k_type (const struct cpu_key * key)
 {
     return (key->version == ITEM_VERSION_1) ? uniqueness2type (key->on_disk_key.u.k_offset_v1.k_uniqueness) :
 	key->on_disk_key.u.k_offset_v2.k_type;
@@ -921,8 +897,8 @@ extern inline void make_empty_dir_item (
 #define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \
 ((i) ? (((deh)-1)->deh_location - (deh)->deh_location) : ((ih)->ih_item_len) - (deh)->deh_location)
 */
-extern inline int entry_length (struct buffer_head * bh, struct item_head * ih,
-				int pos_in_item)
+extern inline int entry_length (const struct buffer_head * bh, 
+				const struct item_head * ih, int pos_in_item)
 {
     struct reiserfs_de_head * deh;
 
@@ -1153,7 +1129,7 @@ struct path var = {ILLEGAL_PATH_ELEMENT_
 
 // reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset
 #define U32_MAX (~(__u32)0)
-extern inline loff_t max_reiserfs_offset (struct inode * inode)
+extern inline loff_t max_reiserfs_offset (const struct inode * inode)
 {
     if (inode_items_version (inode) == ITEM_VERSION_1)
 	return (loff_t)U32_MAX;
@@ -1322,41 +1298,6 @@ struct tree_balance
 			          see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */
 } ;
 
-
-#if 0
-				/* when balancing we potentially affect a 3 node wide column of nodes
-                                   in the tree (the top of the column may be tapered). C is the nodes
-                                   at the center of this column, and L and R are the nodes to the
-                                   left and right.  */
-  struct seal * L_path_seals[MAX_HEIGHT];
-  struct seal * C_path_seals[MAX_HEIGHT];
-  struct seal * R_path_seals[MAX_HEIGHT];
-  char L_path_lock_types[MAX_HEIGHT];   /* 'r', 'w', or 'n' for read, write, or none */
-  char C_path_lock_types[MAX_HEIGHT];
-  char R_path_lock_types[MAX_HEIGHT];
-
-
-  struct seal_list_elem * C_seal[MAX_HEIGHT];        /* array of seals on nodes in the path */
-  struct seal_list_elem * L_seal[MAX_HEIGHT];        /* array of seals on left neighbors of nodes in the path */
-  struct seal_list_elem * R_seal[MAX_HEIGHT];        /* array of seals on right neighbors of nodes in the path*/
-  struct seal_list_elem * FL_seal[MAX_HEIGHT];       /* array of seals on fathers of the left  neighbors      */
-  struct seal_list_elem * FR_seal[MAX_HEIGHT];       /* array of seals on fathers of the right neighbors      */
-  struct seal_list_elem * CFL_seal[MAX_HEIGHT];      /* array of seals on common parents of center node and its left neighbor  */
-  struct seal_list_elem * CFR_seal[MAX_HEIGHT];      /* array of seals on common parents of center node and its right neighbor */
- 
-  struct char C_desired_lock_type[MAX_HEIGHT]; /* 'r', 'w', or 'n' for read, write, or none */
-  struct char L_desired_lock_type[MAX_HEIGHT];        
-  struct char R_desired_lock_type[MAX_HEIGHT];        
-  struct char FL_desired_lock_type[MAX_HEIGHT];       
-  struct char FR_desired_lock_type[MAX_HEIGHT];       
-  struct char CFL_desired_lock_type[MAX_HEIGHT];      
-  struct char CFR_desired_lock_type[MAX_HEIGHT];      
-#endif
-
-
-
-
-
 /* These are modes of balancing */
 
 /* When inserting an item. */
@@ -1497,28 +1438,6 @@ extern struct item_operations * item_ops
 #define B_I_POS_UNFM_POINTER(bh,ih,pos) (*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)))
 #define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0)
 
-/* Reiserfs buffer cache statistics. */
-#ifdef REISERFS_CACHE_STAT
- struct reiserfs_cache_stat
-	{
-  	int nr_reiserfs_ll_r_block; 		/* Number of block reads. */
-  	int nr_reiserfs_ll_w_block; 		/* Number of block writes. */
-	int nr_reiserfs_schedule; 		/* Number of locked buffers waits. */
-	unsigned long nr_reiserfs_bread;	/* Number of calls to reiserfs_bread function */
-	unsigned long nr_returns; /* Number of breads of buffers that were hoped to contain a key but did not after bread completed
-				     (usually due to object shifting while bread was executing.)
-				     In the code this manifests as the number
-				     of times that the repeat variable is nonzero in search_by_key.*/
-	unsigned long nr_fixed;		/* number of calls of fix_nodes function */
-	unsigned long nr_failed;	/* number of calls of fix_nodes in which schedule occurred while the function worked */
-	unsigned long nr_find1;		/* How many times we access a child buffer using its direct pointer from an internal node.*/
-	unsigned long nr_find2;	        /* Number of times there is neither a direct pointer to
-					   nor any entry in the child list pointing to the buffer. */
-	unsigned long nr_find3;	        /* When parent is locked (meaning that there are no direct pointers)
-					   or parent is leaf and buffer to be found is an unformatted node. */
-	}  cache_stat;
-#endif
-
 struct reiserfs_iget4_args {
     __u32 objectid ;
 } ;
@@ -1623,7 +1542,7 @@ void flush_async_commits(struct super_bl
 int remove_from_transaction(struct super_block *p_s_sb, unsigned long blocknr, int already_cleaned) ;
 int remove_from_journal_list(struct super_block *s, struct reiserfs_journal_list *jl, struct buffer_head *bh, int remove_freed) ;
 
-int buffer_journaled(struct buffer_head *bh) ;
+int buffer_journaled(const struct buffer_head *bh) ;
 int mark_buffer_journal_new(struct buffer_head *bh) ;
 int reiserfs_sync_all_buffers(kdev_t dev, int wait) ;
 int reiserfs_sync_buffers(kdev_t dev, int wait) ;
@@ -1635,17 +1554,17 @@ int reiserfs_remove_page_from_flush_list
 int reiserfs_allocate_list_bitmaps(struct super_block *s, struct reiserfs_list_bitmap *, int) ;
 
 				/* why is this kerplunked right here? */
-static inline int reiserfs_buffer_prepared(struct buffer_head *bh) {
-  if (bh && test_bit(BH_JPrepared, &bh->b_state))
+static inline int reiserfs_buffer_prepared(const struct buffer_head *bh) {
+  if (bh && test_bit(BH_JPrepared, ( struct buffer_head * ) &bh->b_state))
     return 1 ;
   else
     return 0 ;
 }
 
 /* buffer was journaled, waiting to get to disk */
-static inline int buffer_journal_dirty(struct buffer_head *bh) {
+static inline int buffer_journal_dirty(const struct buffer_head *bh) {
   if (bh)
-    return test_bit(BH_JDirty_wait, &bh->b_state) ;
+    return test_bit(BH_JDirty_wait, ( struct buffer_head * ) &bh->b_state) ;
   else
     return 0 ;
 }
@@ -1667,29 +1586,32 @@ void reiserfs_release_objectid (struct r
 int reiserfs_convert_objectid_map_v1(struct super_block *) ;
 
 /* stree.c */
-int B_IS_IN_TREE(struct buffer_head *);
-extern inline void copy_key (void * to, void * from);
-extern inline void copy_short_key (void * to, void * from);
-extern inline void copy_item_head(void * p_v_to, void * p_v_from);
+int B_IS_IN_TREE(const struct buffer_head *);
+extern inline void copy_short_key (void * to, const void * from);
+extern inline void copy_item_head(struct item_head * p_v_to, 
+				  const struct item_head * p_v_from);
 
 // first key is in cpu form, second - le
-extern inline int comp_keys (struct key * le_key, struct cpu_key * cpu_key);
-extern inline int  comp_short_keys (struct key * le_key, struct cpu_key * cpu_key);
-extern inline void le_key2cpu_key (struct cpu_key * to, struct key * from);
+extern inline int comp_keys (const struct key * le_key, 
+			     const struct cpu_key * cpu_key);
+extern inline int  comp_short_keys (const struct key * le_key, 
+				    const struct cpu_key * cpu_key);
+extern inline void le_key2cpu_key (struct cpu_key * to, const struct key * from);
 
 // both are cpu keys
-extern inline int comp_cpu_keys (struct cpu_key *, struct cpu_key *);
-extern inline int comp_short_cpu_keys (struct cpu_key *, struct cpu_key *);
-extern inline void cpu_key2cpu_key (struct cpu_key *, struct cpu_key *);
+extern inline int comp_cpu_keys (const struct cpu_key *, const struct cpu_key *);
+extern inline int comp_short_cpu_keys (const struct cpu_key *, 
+				       const struct cpu_key *);
+extern inline void cpu_key2cpu_key (struct cpu_key *, const struct cpu_key *);
 
 // both are in le form
-extern inline int comp_le_keys (struct key *, struct key *);
-extern inline int comp_short_le_keys (struct key *, struct key *);
+extern inline int comp_le_keys (const struct key *, const struct key *);
+extern inline int comp_short_le_keys (const struct key *, const struct key *);
 
 //
 // get key version from on disk key - kludge
 //
-extern inline int le_key_version (struct key * key)
+extern inline int le_key_version (const struct key * key)
 {
     int type;
     
@@ -1702,18 +1624,23 @@ extern inline int le_key_version (struct
 }
 
 
-extern inline void copy_key (void * to, void * from)
+extern inline void copy_key (struct key *to, const struct key *from)
 {
   memcpy (to, from, KEY_SIZE);
 }
 
 
-int comp_items (struct item_head  * p_s_ih, struct path * p_s_path);
-struct key * get_rkey (struct path * p_s_chk_path, struct super_block  * p_s_sb);
-inline int bin_search (void * p_v_key, void * p_v_base, int p_n_num, int p_n_width, int * p_n_pos);
-int search_by_key (struct super_block *, struct cpu_key *, struct path *, int);
+int comp_items (const struct item_head  * p_s_ih, const struct path * p_s_path);
+const struct key * get_rkey (const struct path * p_s_chk_path, 
+			     const struct super_block  * p_s_sb);
+inline int bin_search (const void * p_v_key, const void * p_v_base, 
+		       int p_n_num, int p_n_width, int * p_n_pos);
+int search_by_key (struct super_block *, const struct cpu_key *, 
+		   struct path *, int);
 #define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL)
-int search_for_position_by_key (struct super_block * p_s_sb, struct cpu_key * p_s_cpu_key, struct path * p_s_search_path);
+int search_for_position_by_key (struct super_block * p_s_sb, 
+				const struct cpu_key * p_s_cpu_key, 
+				struct path * p_s_search_path);
 extern inline void decrement_bcount (struct buffer_head * p_s_bh);
 void decrement_counters_in_path (struct path * p_s_search_path);
 void pathrelse (struct path * p_s_search_path);
@@ -1722,12 +1649,12 @@ void pathrelse_and_restore (struct super
 
 int reiserfs_insert_item (struct reiserfs_transaction_handle *th, 
 			  struct path * path, 
-			  struct cpu_key * key,
+			  const struct cpu_key * key,
 			  struct item_head * ih, const char * body);
 
 int reiserfs_paste_into_item (struct reiserfs_transaction_handle *th,
 			      struct path * path,
-			      struct cpu_key * key,
+			      const struct cpu_key * key,
 			      const char * body, int paste_size);
 
 int reiserfs_cut_from_item (struct reiserfs_transaction_handle *th,
@@ -1739,7 +1666,7 @@ int reiserfs_cut_from_item (struct reise
 
 int reiserfs_delete_item (struct reiserfs_transaction_handle *th,
 			  struct path * path, 
-			  struct cpu_key * key,
+			  const struct cpu_key * key,
 			  struct inode * inode, 
 			  struct buffer_head  * p_s_un_bh);
 
@@ -1779,13 +1706,15 @@ int reiserfs_prepare_write(struct file *
 void reiserfs_truncate_file(struct inode *, int update_timestamps) ;
 void make_cpu_key (struct cpu_key * cpu_key, const struct inode * inode, loff_t offset,
 		   int type, int key_length);
-void make_le_item_head (struct item_head * ih, struct cpu_key * key, int version,
-			       loff_t offset, int type, int length, int entry_count);
+void make_le_item_head (struct item_head * ih, const struct cpu_key * key, 
+			int version,
+			loff_t offset, int type, int length, int entry_count);
 /*void store_key (struct key * key);
 void forget_key (struct key * key);*/
 int reiserfs_get_block (struct inode * inode, long block,
 			struct buffer_head * bh_result, int create);
-struct inode * reiserfs_iget (struct super_block * s, struct cpu_key * key);
+struct inode * reiserfs_iget (struct super_block * s, 
+			      const struct cpu_key * key);
 void reiserfs_read_inode (struct inode * inode) ;
 void reiserfs_read_inode2(struct inode * inode, void *p) ;
 void reiserfs_delete_inode (struct inode * inode);
@@ -1799,7 +1728,8 @@ int reiserfs_dentry_to_fh(struct dentry 
 /* we don't mark inodes dirty, we just log them */
 void reiserfs_dirty_inode (struct inode * inode) ;
 
-struct inode * reiserfs_new_inode (struct reiserfs_transaction_handle *th, const struct inode * dir, int mode, 
+struct inode * reiserfs_new_inode (struct reiserfs_transaction_handle *th, 
+				   const struct inode * dir, int mode, 
 				   const char * symname, int item_len,
 				   struct dentry *dentry, struct inode *inode, int * err);
 int reiserfs_sync_inode (struct reiserfs_transaction_handle *th, struct inode * inode);
@@ -1808,7 +1738,8 @@ int reiserfs_inode_setattr(struct dentry
 
 /* namei.c */
 inline void set_de_name_and_namelen (struct reiserfs_dir_entry * de);
-int search_by_entry_key (struct super_block * sb, struct cpu_key * key, struct path * path, 
+int search_by_entry_key (struct super_block * sb, const struct cpu_key * key, 
+			 struct path * path, 
 			 struct reiserfs_dir_entry * de);
 struct dentry * reiserfs_lookup (struct inode * dir, struct dentry *dentry);
 int reiserfs_create (struct inode * dir, struct dentry *dentry,	int mode);
@@ -1823,7 +1754,6 @@ int reiserfs_rename (struct inode * old_
 /* super.c */
 inline void reiserfs_mark_buffer_dirty (struct buffer_head * bh, int flag);
 inline void reiserfs_mark_buffer_clean (struct buffer_head * bh);
-void reiserfs_panic (struct super_block * s, const char * fmt, ...);
 void reiserfs_write_super (struct super_block * s);
 void reiserfs_put_super (struct super_block * s);
 int reiserfs_remount (struct super_block * s, int * flags, char * data);
@@ -1840,7 +1770,7 @@ extern struct file_operations reiserfs_d
 
 /* tail_conversion.c */
 int direct2indirect (struct reiserfs_transaction_handle *, struct inode *, struct path *, struct buffer_head *, loff_t);
-int indirect2direct (struct reiserfs_transaction_handle *, struct inode *, struct page *, struct path *, struct cpu_key *, loff_t, char *);
+int indirect2direct (struct reiserfs_transaction_handle *, struct inode *, struct page *, struct path *, const struct cpu_key *, loff_t, char *);
 void reiserfs_unmap_buffer(struct buffer_head *) ;
 
 
@@ -1854,22 +1784,26 @@ int get_new_buffer (struct reiserfs_tran
 
 /* buffer2.c */
 struct buffer_head * reiserfs_getblk (kdev_t n_dev, int n_block, int n_size);
-void wait_buffer_until_released (struct buffer_head * bh);
+void wait_buffer_until_released (const struct buffer_head * bh);
 struct buffer_head * reiserfs_bread (kdev_t n_dev, int n_block, int n_size);
 
 
 /* fix_nodes.c */
 void * reiserfs_kmalloc (size_t size, int flags, struct super_block * s);
 void reiserfs_kfree (const void * vp, size_t size, struct super_block * s);
-int fix_nodes (int n_op_mode, struct tree_balance * p_s_tb, struct item_head * p_s_ins_ih, const void *);
+int fix_nodes (int n_op_mode, struct tree_balance * p_s_tb, 
+	       struct item_head * p_s_ins_ih, const void *);
 void unfix_nodes (struct tree_balance *);
 void free_buffers_in_tb (struct tree_balance * p_s_tb);
 
 
 /* prints.c */
-void reiserfs_panic (struct super_block * s, const char * fmt, ...);
+void reiserfs_panic (struct super_block * s, const char * fmt, ...)
+__attribute__ ( ( noreturn ) );/* __attribute__( ( format ( printf, 2, 3 ) ) ) */
 void reiserfs_warning (const char * fmt, ...);
+/* __attribute__( ( format ( printf, 1, 2 ) ) ); */
 void reiserfs_debug (struct super_block *s, int level, const char * fmt, ...);
+/* __attribute__( ( format ( printf, 3, 4 ) ) ); */
 void print_virtual_node (struct virtual_node * vn);
 void print_indirect_item (struct buffer_head * bh, int item_num);
 void store_print_tb (struct tree_balance * tb);
@@ -1949,7 +1883,7 @@ __u32 yura_hash (const char *msg, int le
 __u32 r5_hash (const char *msg, int len);
 
 /* version.c */
-char *reiserfs_get_version_string(void) ;
+const char *reiserfs_get_version_string(void) CONSTF;
 
 /* the ext2 bit routines adjust for big or little endian as
 ** appropriate for the arch, so in our laziness we use them rather
@@ -1969,7 +1903,7 @@ char *reiserfs_get_version_string(void) 
 #ifdef __i386__
 
 extern __inline__ int 
-find_first_nonzero_bit(void * addr, unsigned size) {
+find_first_nonzero_bit(const void * addr, unsigned size) {
   int res;
   int __d0;
   void *__d1;
@@ -1997,7 +1931,8 @@ find_first_nonzero_bit(void * addr, unsi
 
 #else /* __i386__ */
 
-extern __inline__ int find_next_nonzero_bit(void * addr, unsigned size, unsigned offset)
+extern __inline__ int find_next_nonzero_bit(const void * addr, 
+					    unsigned size, unsigned offset)
 {
 	unsigned int * p = ((unsigned int *) addr) + (offset >> 5);
 	unsigned int result = offset & ~31UL;
@@ -2045,10 +1980,10 @@ found_middle:
    absolutely safe */
 #define SPARE_SPACE 500
 
-extern inline unsigned long reiserfs_get_journal_block(struct super_block *s) {
+extern inline unsigned long reiserfs_get_journal_block(const struct super_block *s) {
     return le32_to_cpu(SB_DISK_SUPER_BLOCK(s)->s_journal_block) ;
 }
-extern inline unsigned long reiserfs_get_journal_orig_size(struct super_block *s) {
+extern inline unsigned long reiserfs_get_journal_orig_size(const struct super_block *s) {
     return le32_to_cpu(SB_DISK_SUPER_BLOCK(s)->s_orig_journal_size) ;
 }
 
