take private bits of reiserfs_xattr.h to fs/reiserfs/xattr.h
[linux-2.6.git] / fs / reiserfs / item_ops.c
index 7a88adb..72cb1cc 100644 (file)
@@ -23,7 +23,7 @@ static void sd_decrement_key(struct cpu_key *key)
 {
        key->on_disk_key.k_objectid--;
        set_cpu_key_k_type(key, TYPE_ANY);
-       set_cpu_key_k_offset(key, (loff_t) (-1));
+       set_cpu_key_k_offset(key, (loff_t)(~0ULL >> 1));
 }
 
 static int sd_is_left_mergeable(struct reiserfs_key *key, unsigned long bsize)
@@ -75,8 +75,7 @@ static int sd_create_vi(struct virtual_node *vn,
 static int sd_check_left(struct virtual_item *vi, int free,
                         int start_skip, int end_skip)
 {
-       if (start_skip || end_skip)
-               BUG();
+       BUG_ON(start_skip || end_skip);
        return -1;
 }
 
@@ -87,8 +86,7 @@ static int sd_check_right(struct virtual_item *vi, int free)
 
 static int sd_part_size(struct virtual_item *vi, int first, int count)
 {
-       if (count)
-               BUG();
+       BUG_ON(count);
        return 0;
 }
 
@@ -99,7 +97,8 @@ static int sd_unit_num(struct virtual_item *vi)
 
 static void sd_print_vi(struct virtual_item *vi)
 {
-       reiserfs_warning(NULL, "STATDATA, index %d, type 0x%x, %h",
+       reiserfs_warning(NULL, "reiserfs-16100",
+                        "STATDATA, index %d, type 0x%x, %h",
                         vi->vi_index, vi->vi_type, vi->vi_ih);
 }
 
@@ -192,7 +191,8 @@ static int direct_unit_num(struct virtual_item *vi)
 
 static void direct_print_vi(struct virtual_item *vi)
 {
-       reiserfs_warning(NULL, "DIRECT, index %d, type 0x%x, %h",
+       reiserfs_warning(NULL, "reiserfs-16101",
+                        "DIRECT, index %d, type 0x%x, %h",
                         vi->vi_index, vi->vi_type, vi->vi_ih);
 }
 
@@ -280,7 +280,7 @@ static void indirect_print_item(struct item_head *ih, char *item)
        unp = (__le32 *) item;
 
        if (ih_item_len(ih) % UNFM_P_SIZE)
-               reiserfs_warning(NULL, "indirect_print_item: invalid item len");
+               reiserfs_warning(NULL, "reiserfs-16102", "invalid item len");
 
        printk("%d pointers\n[ ", (int)I_UNFM_NUM(ih));
        for (j = 0; j < I_UNFM_NUM(ih); j++) {
@@ -336,7 +336,8 @@ static int indirect_unit_num(struct virtual_item *vi)
 
 static void indirect_print_vi(struct virtual_item *vi)
 {
-       reiserfs_warning(NULL, "INDIRECT, index %d, type 0x%x, %h",
+       reiserfs_warning(NULL, "reiserfs-16103",
+                        "INDIRECT, index %d, type 0x%x, %h",
                         vi->vi_index, vi->vi_type, vi->vi_ih);
 }
 
@@ -361,7 +362,7 @@ static struct item_operations indirect_ops = {
 
 static int direntry_bytes_number(struct item_head *ih, int block_size)
 {
-       reiserfs_warning(NULL, "vs-16090: direntry_bytes_number: "
+       reiserfs_warning(NULL, "vs-16090",
                         "bytes number is asked for direntry");
        return 0;
 }
@@ -476,8 +477,7 @@ static int direntry_create_vi(struct virtual_node *vn,
 
        vi->vi_index = TYPE_DIRENTRY;
 
-       if (!(vi->vi_ih) || !vi->vi_item)
-               BUG();
+       BUG_ON(!(vi->vi_ih) || !vi->vi_item);
 
        dir_u->flags = 0;
        if (le_ih_k_offset(vi->vi_ih) == DOT_OFFSET)
@@ -517,8 +517,9 @@ static int direntry_create_vi(struct virtual_node *vn,
                    ((is_affected
                      && (vn->vn_mode == M_PASTE
                          || vn->vn_mode == M_CUT)) ? insert_size : 0)) {
-                       reiserfs_panic(NULL,
-                                      "vs-8025: set_entry_sizes: (mode==%c, insert_size==%d), invalid length of directory item",
+                       reiserfs_panic(NULL, "vs-8025", "(mode==%c, "
+                                      "insert_size==%d), invalid length of "
+                                      "directory item",
                                       vn->vn_mode, insert_size);
                }
        }
@@ -549,7 +550,8 @@ static int direntry_check_left(struct virtual_item *vi, int free,
        }
 
        if (entries == dir_u->entry_count) {
-               reiserfs_panic(NULL, "free space %d, entry_count %d\n", free,
+               reiserfs_panic(NULL, "item_ops-1",
+                              "free space %d, entry_count %d", free,
                               dir_u->entry_count);
        }
 
@@ -575,8 +577,7 @@ static int direntry_check_right(struct virtual_item *vi, int free)
                free -= dir_u->entry_sizes[i];
                entries++;
        }
-       if (entries == dir_u->entry_count)
-               BUG();
+       BUG_ON(entries == dir_u->entry_count);
 
        /* "." and ".." can not be separated from each other */
        if ((dir_u->flags & DIRENTRY_VI_FIRST_DIRENTRY_ITEM)
@@ -618,7 +619,8 @@ static void direntry_print_vi(struct virtual_item *vi)
        int i;
        struct direntry_uarea *dir_u = vi->vi_uarea;
 
-       reiserfs_warning(NULL, "DIRENTRY, index %d, type 0x%x, %h, flags 0x%x",
+       reiserfs_warning(NULL, "reiserfs-16104",
+                        "DIRENTRY, index %d, type 0x%x, %h, 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++)
@@ -646,43 +648,43 @@ static struct item_operations direntry_ops = {
 //
 static int errcatch_bytes_number(struct item_head *ih, int block_size)
 {
-       reiserfs_warning(NULL,
-                        "green-16001: Invalid item type observed, run fsck ASAP");
+       reiserfs_warning(NULL, "green-16001",
+                        "Invalid item type observed, run fsck ASAP");
        return 0;
 }
 
 static void errcatch_decrement_key(struct cpu_key *key)
 {
-       reiserfs_warning(NULL,
-                        "green-16002: Invalid item type observed, run fsck ASAP");
+       reiserfs_warning(NULL, "green-16002",
+                        "Invalid item type observed, run fsck ASAP");
 }
 
 static int errcatch_is_left_mergeable(struct reiserfs_key *key,
                                      unsigned long bsize)
 {
-       reiserfs_warning(NULL,
-                        "green-16003: Invalid item type observed, run fsck ASAP");
+       reiserfs_warning(NULL, "green-16003",
+                        "Invalid item type observed, run fsck ASAP");
        return 0;
 }
 
 static void errcatch_print_item(struct item_head *ih, char *item)
 {
-       reiserfs_warning(NULL,
-                        "green-16004: Invalid item type observed, run fsck ASAP");
+       reiserfs_warning(NULL, "green-16004",
+                        "Invalid item type observed, run fsck ASAP");
 }
 
 static void errcatch_check_item(struct item_head *ih, char *item)
 {
-       reiserfs_warning(NULL,
-                        "green-16005: Invalid item type observed, run fsck ASAP");
+       reiserfs_warning(NULL, "green-16005",
+                        "Invalid item type observed, run fsck ASAP");
 }
 
 static int errcatch_create_vi(struct virtual_node *vn,
                              struct virtual_item *vi,
                              int is_affected, int insert_size)
 {
-       reiserfs_warning(NULL,
-                        "green-16006: Invalid item type observed, run fsck ASAP");
+       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.
 }
@@ -690,36 +692,36 @@ static int errcatch_create_vi(struct virtual_node *vn,
 static int errcatch_check_left(struct virtual_item *vi, int free,
                               int start_skip, int end_skip)
 {
-       reiserfs_warning(NULL,
-                        "green-16007: Invalid item type observed, run fsck ASAP");
+       reiserfs_warning(NULL, "green-16007",
+                        "Invalid item type observed, run fsck ASAP");
        return -1;
 }
 
 static int errcatch_check_right(struct virtual_item *vi, int free)
 {
-       reiserfs_warning(NULL,
-                        "green-16008: Invalid item type observed, run fsck ASAP");
+       reiserfs_warning(NULL, "green-16008",
+                        "Invalid item type observed, run fsck ASAP");
        return -1;
 }
 
 static int errcatch_part_size(struct virtual_item *vi, int first, int count)
 {
-       reiserfs_warning(NULL,
-                        "green-16009: Invalid item type observed, run fsck ASAP");
+       reiserfs_warning(NULL, "green-16009",
+                        "Invalid item type observed, run fsck ASAP");
        return 0;
 }
 
 static int errcatch_unit_num(struct virtual_item *vi)
 {
-       reiserfs_warning(NULL,
-                        "green-16010: Invalid item type observed, run fsck ASAP");
+       reiserfs_warning(NULL, "green-16010",
+                        "Invalid item type observed, run fsck ASAP");
        return 0;
 }
 
 static void errcatch_print_vi(struct virtual_item *vi)
 {
-       reiserfs_warning(NULL,
-                        "green-16011: Invalid item type observed, run fsck ASAP");
+       reiserfs_warning(NULL, "green-16011",
+                        "Invalid item type observed, run fsck ASAP");
 }
 
 static struct item_operations errcatch_ops = {