lkml.org 
[lkml]   [2009]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 14/31] Constify struct item_operations for 2.6.32 v1
From: Emese Revfy <re.emese@gmail.com>

Constify struct item_operations.

Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
fs/reiserfs/item_ops.c | 12 ++++++------
include/linux/reiserfs_fs.h | 24 ++++++++++++------------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/fs/reiserfs/item_ops.c b/fs/reiserfs/item_ops.c
index 72cb1cc..d0e3181 100644
--- a/fs/reiserfs/item_ops.c
+++ b/fs/reiserfs/item_ops.c
@@ -102,7 +102,7 @@ static void sd_print_vi(struct virtual_item *vi)
vi->vi_index, vi->vi_type, vi->vi_ih);
}

-static struct item_operations stat_data_ops = {
+static const struct item_operations stat_data_ops = {
.bytes_number = sd_bytes_number,
.decrement_key = sd_decrement_key,
.is_left_mergeable = sd_is_left_mergeable,
@@ -196,7 +196,7 @@ static void direct_print_vi(struct virtual_item *vi)
vi->vi_index, vi->vi_type, vi->vi_ih);
}

-static struct item_operations direct_ops = {
+static const struct item_operations direct_ops = {
.bytes_number = direct_bytes_number,
.decrement_key = direct_decrement_key,
.is_left_mergeable = direct_is_left_mergeable,
@@ -341,7 +341,7 @@ static void indirect_print_vi(struct virtual_item *vi)
vi->vi_index, vi->vi_type, vi->vi_ih);
}

-static struct item_operations indirect_ops = {
+static const struct item_operations indirect_ops = {
.bytes_number = indirect_bytes_number,
.decrement_key = indirect_decrement_key,
.is_left_mergeable = indirect_is_left_mergeable,
@@ -628,7 +628,7 @@ static void direntry_print_vi(struct virtual_item *vi)
printk("\n");
}

-static struct item_operations direntry_ops = {
+static const struct item_operations direntry_ops = {
.bytes_number = direntry_bytes_number,
.decrement_key = direntry_decrement_key,
.is_left_mergeable = direntry_is_left_mergeable,
@@ -724,7 +724,7 @@ static void errcatch_print_vi(struct virtual_item *vi)
"Invalid item type observed, run fsck ASAP");
}

-static struct item_operations errcatch_ops = {
+static const struct item_operations errcatch_ops = {
errcatch_bytes_number,
errcatch_decrement_key,
errcatch_is_left_mergeable,
@@ -746,7 +746,7 @@ static struct item_operations errcatch_ops = {
#error Item types must use disk-format assigned values.
#endif

-struct item_operations *item_ops[TYPE_ANY + 1] = {
+const struct item_operations * const item_ops[TYPE_ANY + 1] = {
&stat_data_ops,
&indirect_ops,
&direct_ops,
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index dd31e7b..5a54e06 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1534,24 +1534,24 @@ static inline struct super_block *sb_from_bi(struct buffer_info *bi)
*/

struct item_operations {
- int (*bytes_number) (struct item_head * ih, int block_size);
- void (*decrement_key) (struct cpu_key *);
- int (*is_left_mergeable) (struct reiserfs_key * ih,
+ int (* const bytes_number) (struct item_head * ih, int block_size);
+ void (* const decrement_key) (struct cpu_key *);
+ int (* const is_left_mergeable) (struct reiserfs_key * ih,
unsigned long bsize);
- void (*print_item) (struct item_head *, char *item);
- void (*check_item) (struct item_head *, char *item);
+ void (* const print_item) (struct item_head *, char *item);
+ void (* const check_item) (struct item_head *, char *item);

- int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi,
+ int (* const create_vi) (struct virtual_node * vn, struct virtual_item * vi,
int is_affected, int insert_size);
- int (*check_left) (struct virtual_item * vi, int free,
+ int (* const check_left) (struct virtual_item * vi, int free,
int start_skip, int end_skip);
- int (*check_right) (struct virtual_item * vi, int free);
- int (*part_size) (struct virtual_item * vi, int from, int to);
- int (*unit_num) (struct virtual_item * vi);
- void (*print_vi) (struct virtual_item * vi);
+ int (* const check_right) (struct virtual_item * vi, int free);
+ int (* const part_size) (struct virtual_item * vi, int from, int to);
+ int (* const unit_num) (struct virtual_item * vi);
+ void (* const print_vi) (struct virtual_item * vi);
};

-extern struct item_operations *item_ops[TYPE_ANY + 1];
+extern const struct item_operations * const item_ops[TYPE_ANY + 1];

#define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize)
#define op_is_left_mergeable(key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize)


\
 
 \ /
  Last update: 2009-12-04 23:31    [from the cache]
©2003-2011 Jasper Spaans