Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 754661f1 authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Linus Torvalds
Browse files

[PATCH] mark struct inode_operations const 1



Many struct inode_operations in the kernel can be "const".  Marking them const
moves these to the .rodata section, which avoids false sharing with potential
dirty data.  In addition it'll catch accidental writes at compile time to
these shared resources.

Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9c2e08c5
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -220,7 +220,7 @@ static int spufs_dir_close(struct inode *inode, struct file *file)
	return dcache_dir_close(inode, file);
	return dcache_dir_close(inode, file);
}
}


struct inode_operations spufs_dir_inode_operations = {
const struct inode_operations spufs_dir_inode_operations = {
	.lookup = simple_lookup,
	.lookup = simple_lookup,
};
};


+8 −8
Original line number Original line Diff line number Diff line
@@ -41,10 +41,10 @@
#include "v9fs_vfs.h"
#include "v9fs_vfs.h"
#include "fid.h"
#include "fid.h"


static struct inode_operations v9fs_dir_inode_operations;
static const struct inode_operations v9fs_dir_inode_operations;
static struct inode_operations v9fs_dir_inode_operations_ext;
static const struct inode_operations v9fs_dir_inode_operations_ext;
static struct inode_operations v9fs_file_inode_operations;
static const struct inode_operations v9fs_file_inode_operations;
static struct inode_operations v9fs_symlink_inode_operations;
static const struct inode_operations v9fs_symlink_inode_operations;


/**
/**
 * unixmode2p9mode - convert unix mode bits to plan 9
 * unixmode2p9mode - convert unix mode bits to plan 9
@@ -1303,7 +1303,7 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
	return retval;
	return retval;
}
}


static struct inode_operations v9fs_dir_inode_operations_ext = {
static const struct inode_operations v9fs_dir_inode_operations_ext = {
	.create = v9fs_vfs_create,
	.create = v9fs_vfs_create,
	.lookup = v9fs_vfs_lookup,
	.lookup = v9fs_vfs_lookup,
	.symlink = v9fs_vfs_symlink,
	.symlink = v9fs_vfs_symlink,
@@ -1318,7 +1318,7 @@ static struct inode_operations v9fs_dir_inode_operations_ext = {
	.setattr = v9fs_vfs_setattr,
	.setattr = v9fs_vfs_setattr,
};
};


static struct inode_operations v9fs_dir_inode_operations = {
static const struct inode_operations v9fs_dir_inode_operations = {
	.create = v9fs_vfs_create,
	.create = v9fs_vfs_create,
	.lookup = v9fs_vfs_lookup,
	.lookup = v9fs_vfs_lookup,
	.unlink = v9fs_vfs_unlink,
	.unlink = v9fs_vfs_unlink,
@@ -1330,12 +1330,12 @@ static struct inode_operations v9fs_dir_inode_operations = {
	.setattr = v9fs_vfs_setattr,
	.setattr = v9fs_vfs_setattr,
};
};


static struct inode_operations v9fs_file_inode_operations = {
static const struct inode_operations v9fs_file_inode_operations = {
	.getattr = v9fs_vfs_getattr,
	.getattr = v9fs_vfs_getattr,
	.setattr = v9fs_vfs_setattr,
	.setattr = v9fs_vfs_setattr,
};
};


static struct inode_operations v9fs_symlink_inode_operations = {
static const struct inode_operations v9fs_symlink_inode_operations = {
	.readlink = v9fs_vfs_readlink,
	.readlink = v9fs_vfs_readlink,
	.follow_link = v9fs_vfs_follow_link,
	.follow_link = v9fs_vfs_follow_link,
	.put_link = v9fs_vfs_put_link,
	.put_link = v9fs_vfs_put_link,
+2 −2
Original line number Original line Diff line number Diff line
@@ -84,7 +84,7 @@ void __adfs_error(struct super_block *sb, const char *function,
 */
 */


/* dir_*.c */
/* dir_*.c */
extern struct inode_operations adfs_dir_inode_operations;
extern const struct inode_operations adfs_dir_inode_operations;
extern const struct file_operations adfs_dir_operations;
extern const struct file_operations adfs_dir_operations;
extern struct dentry_operations adfs_dentry_operations;
extern struct dentry_operations adfs_dentry_operations;
extern struct adfs_dir_ops adfs_f_dir_ops;
extern struct adfs_dir_ops adfs_f_dir_ops;
@@ -93,7 +93,7 @@ extern struct adfs_dir_ops adfs_fplus_dir_ops;
extern int adfs_dir_update(struct super_block *sb, struct object_info *obj);
extern int adfs_dir_update(struct super_block *sb, struct object_info *obj);


/* file.c */
/* file.c */
extern struct inode_operations adfs_file_inode_operations;
extern const struct inode_operations adfs_file_inode_operations;
extern const struct file_operations adfs_file_operations;
extern const struct file_operations adfs_file_operations;


static inline __u32 signed_asl(__u32 val, signed int shift)
static inline __u32 signed_asl(__u32 val, signed int shift)
+1 −1
Original line number Original line Diff line number Diff line
@@ -295,7 +295,7 @@ adfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
/*
/*
 * directories can handle most operations...
 * directories can handle most operations...
 */
 */
struct inode_operations adfs_dir_inode_operations = {
const struct inode_operations adfs_dir_inode_operations = {
	.lookup		= adfs_lookup,
	.lookup		= adfs_lookup,
	.setattr	= adfs_notify_change,
	.setattr	= adfs_notify_change,
};
};
+1 −1
Original line number Original line Diff line number Diff line
@@ -36,6 +36,6 @@ const struct file_operations adfs_file_operations = {
	.sendfile	= generic_file_sendfile,
	.sendfile	= generic_file_sendfile,
};
};


struct inode_operations adfs_file_inode_operations = {
const struct inode_operations adfs_file_inode_operations = {
	.setattr	= adfs_notify_change,
	.setattr	= adfs_notify_change,
};
};
Loading