Skip to content

Commit

Permalink
logfs: constify logfs_block_ops structures
Browse files Browse the repository at this point in the history
The logfs_block_ops structures are never modified, so declare them as
const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Julia Lawall authored and Al Viro committed Jan 9, 2016
1 parent 0dbf5f2 commit bc51b2a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions fs/logfs/logfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ struct logfs_block {
struct inode *inode;
struct logfs_transaction *ta;
unsigned long alias_map[LOGFS_BLOCK_FACTOR / BITS_PER_LONG];
struct logfs_block_ops *ops;
const struct logfs_block_ops *ops;
int full;
int partial;
int reserved_bytes;
Expand Down Expand Up @@ -579,7 +579,7 @@ int logfs_exist_block(struct inode *inode, u64 bix);
int get_page_reserve(struct inode *inode, struct page *page);
void logfs_get_wblocks(struct super_block *sb, struct page *page, int lock);
void logfs_put_wblocks(struct super_block *sb, struct page *page, int lock);
extern struct logfs_block_ops indirect_block_ops;
extern const struct logfs_block_ops indirect_block_ops;

/* segment.c */
int logfs_erase_segment(struct super_block *sb, u32 ofs, int ensure_erase);
Expand Down
4 changes: 2 additions & 2 deletions fs/logfs/readwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,13 +569,13 @@ static void indirect_free_block(struct super_block *sb,
}


static struct logfs_block_ops inode_block_ops = {
static const struct logfs_block_ops inode_block_ops = {
.write_block = inode_write_block,
.free_block = inode_free_block,
.write_alias = inode_write_alias,
};

struct logfs_block_ops indirect_block_ops = {
const struct logfs_block_ops indirect_block_ops = {
.write_block = indirect_write_block,
.free_block = indirect_free_block,
.write_alias = indirect_write_alias,
Expand Down
2 changes: 1 addition & 1 deletion fs/logfs/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static int btree_write_alias(struct super_block *sb, struct logfs_block *block,
return 0;
}

static struct logfs_block_ops btree_block_ops = {
static const struct logfs_block_ops btree_block_ops = {
.write_block = btree_write_block,
.free_block = __free_block,
.write_alias = btree_write_alias,
Expand Down

0 comments on commit bc51b2a

Please sign in to comment.