Skip to content

Commit

Permalink
[PATCH] Mark struct super_operations const
Browse files Browse the repository at this point in the history
This patch is inspired by Arjan's "Patch series to mark struct
file_operations and struct inode_operations const".

Compile tested with gcc & sparse.

Signed-off-by: Josef 'Jeff' Sipek <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Josef 'Jeff' Sipek authored and Linus Torvalds committed Feb 12, 2007
1 parent c5ef1c4 commit ee9b6d6
Show file tree
Hide file tree
Showing 58 changed files with 75 additions and 75 deletions.
4 changes: 2 additions & 2 deletions fs/9p/vfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include "fid.h"

static void v9fs_clear_inode(struct inode *);
static struct super_operations v9fs_super_ops;
static const struct super_operations v9fs_super_ops;

/**
* v9fs_clear_inode - release an inode
Expand Down Expand Up @@ -263,7 +263,7 @@ v9fs_umount_begin(struct vfsmount *vfsmnt, int flags)
v9fs_session_cancel(v9ses);
}

static struct super_operations v9fs_super_ops = {
static const struct super_operations v9fs_super_ops = {
.statfs = simple_statfs,
.clear_inode = v9fs_clear_inode,
.show_options = v9fs_show_options,
Expand Down
2 changes: 1 addition & 1 deletion fs/adfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ static void destroy_inodecache(void)
kmem_cache_destroy(adfs_inode_cachep);
}

static struct super_operations adfs_sops = {
static const struct super_operations adfs_sops = {
.alloc_inode = adfs_alloc_inode,
.destroy_inode = adfs_destroy_inode,
.write_inode = adfs_write_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/affs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static void destroy_inodecache(void)
kmem_cache_destroy(affs_inode_cachep);
}

static struct super_operations affs_sops = {
static const struct super_operations affs_sops = {
.alloc_inode = affs_alloc_inode,
.destroy_inode = affs_destroy_inode,
.read_inode = affs_read_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/afs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct file_system_type afs_fs_type = {
.fs_flags = FS_BINARY_MOUNTDATA,
};

static struct super_operations afs_super_ops = {
static const struct super_operations afs_super_ops = {
.statfs = simple_statfs,
.alloc_inode = afs_alloc_inode,
.drop_inode = generic_delete_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/autofs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void autofs_kill_sb(struct super_block *sb)

static void autofs_read_inode(struct inode *inode);

static struct super_operations autofs_sops = {
static const struct super_operations autofs_sops = {
.read_inode = autofs_read_inode,
.statfs = simple_statfs,
};
Expand Down
2 changes: 1 addition & 1 deletion fs/autofs4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt)
return 0;
}

static struct super_operations autofs4_sops = {
static const struct super_operations autofs4_sops = {
.statfs = simple_statfs,
.show_options = autofs4_show_options,
};
Expand Down
2 changes: 1 addition & 1 deletion fs/bfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ static void destroy_inodecache(void)
kmem_cache_destroy(bfs_inode_cachep);
}

static struct super_operations bfs_sops = {
static const struct super_operations bfs_sops = {
.alloc_inode = bfs_alloc_inode,
.destroy_inode = bfs_destroy_inode,
.read_inode = bfs_read_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/binfmt_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ static const struct file_operations bm_status_operations = {

/* Superblock handling */

static struct super_operations s_ops = {
static const struct super_operations s_ops = {
.statfs = simple_statfs,
.clear_inode = bm_clear_inode,
};
Expand Down
2 changes: 1 addition & 1 deletion fs/block_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ static void bdev_clear_inode(struct inode *inode)
spin_unlock(&bdev_lock);
}

static struct super_operations bdev_sops = {
static const struct super_operations bdev_sops = {
.statfs = simple_statfs,
.alloc_inode = bdev_alloc_inode,
.destroy_inode = bdev_destroy_inode,
Expand Down
4 changes: 2 additions & 2 deletions fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extern struct task_struct * oplockThread; /* remove sparse warning */
struct task_struct * oplockThread = NULL;
extern struct task_struct * dnotifyThread; /* remove sparse warning */
struct task_struct * dnotifyThread = NULL;
static struct super_operations cifs_super_ops;
static const struct super_operations cifs_super_ops;
unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE;
module_param(CIFSMaxBufSize, int, 0);
MODULE_PARM_DESC(CIFSMaxBufSize,"Network buffer size (not including header). Default: 16384 Range: 8192 to 130048");
Expand Down Expand Up @@ -453,7 +453,7 @@ static int cifs_remount(struct super_block *sb, int *flags, char *data)
return 0;
}

static struct super_operations cifs_super_ops = {
static const struct super_operations cifs_super_ops = {
.read_inode = cifs_read_inode,
.put_super = cifs_put_super,
.statfs = cifs_statfs,
Expand Down
2 changes: 1 addition & 1 deletion fs/cifs/cifsfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ extern const struct address_space_operations cifs_addr_ops;
extern const struct address_space_operations cifs_addr_ops_smallbuf;

/* Functions related to super block operations */
/* extern struct super_operations cifs_super_ops;*/
/* extern const struct super_operations cifs_super_ops;*/
extern void cifs_read_inode(struct inode *);
extern void cifs_delete_inode(struct inode *);
/* extern void cifs_write_inode(struct inode *); *//* BB not needed yet */
Expand Down
2 changes: 1 addition & 1 deletion fs/coda/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static int coda_remount(struct super_block *sb, int *flags, char *data)
}

/* exported operations */
static struct super_operations coda_super_operations =
static const struct super_operations coda_super_operations =
{
.alloc_inode = coda_alloc_inode,
.destroy_inode = coda_destroy_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/configfs/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct super_block * configfs_sb = NULL;
struct kmem_cache *configfs_dir_cachep;
static int configfs_mnt_count = 0;

static struct super_operations configfs_ops = {
static const struct super_operations configfs_ops = {
.statfs = simple_statfs,
.drop_inode = generic_delete_inode,
};
Expand Down
4 changes: 2 additions & 2 deletions fs/cramfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include <asm/uaccess.h>

static struct super_operations cramfs_ops;
static const struct super_operations cramfs_ops;
static const struct inode_operations cramfs_dir_inode_operations;
static const struct file_operations cramfs_directory_operations;
static const struct address_space_operations cramfs_aops;
Expand Down Expand Up @@ -522,7 +522,7 @@ static const struct inode_operations cramfs_dir_inode_operations = {
.lookup = cramfs_lookup,
};

static struct super_operations cramfs_ops = {
static const struct super_operations cramfs_ops = {
.put_super = cramfs_put_super,
.remount_fs = cramfs_remount,
.statfs = cramfs_statfs,
Expand Down
2 changes: 1 addition & 1 deletion fs/devpts/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static int devpts_remount(struct super_block *sb, int *flags, char *data)
return 0;
}

static struct super_operations devpts_sops = {
static const struct super_operations devpts_sops = {
.statfs = simple_statfs,
.remount_fs = devpts_remount,
};
Expand Down
2 changes: 1 addition & 1 deletion fs/ecryptfs/ecryptfs_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ extern const struct file_operations ecryptfs_dir_fops;
extern const struct inode_operations ecryptfs_main_iops;
extern const struct inode_operations ecryptfs_dir_iops;
extern const struct inode_operations ecryptfs_symlink_iops;
extern struct super_operations ecryptfs_sops;
extern const struct super_operations ecryptfs_sops;
extern struct dentry_operations ecryptfs_dops;
extern struct address_space_operations ecryptfs_aops;
extern int ecryptfs_verbosity;
Expand Down
2 changes: 1 addition & 1 deletion fs/ecryptfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static int ecryptfs_show_options(struct seq_file *m, struct vfsmount *mnt)
return rc;
}

struct super_operations ecryptfs_sops = {
const struct super_operations ecryptfs_sops = {
.alloc_inode = ecryptfs_alloc_inode,
.destroy_inode = ecryptfs_destroy_inode,
.drop_inode = generic_delete_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/efs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static int efs_remount(struct super_block *sb, int *flags, char *data)
return 0;
}

static struct super_operations efs_superblock_operations = {
static const struct super_operations efs_superblock_operations = {
.alloc_inode = efs_alloc_inode,
.destroy_inode = efs_destroy_inode,
.read_inode = efs_read_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/ext2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, siz
static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off);
#endif

static struct super_operations ext2_sops = {
static const struct super_operations ext2_sops = {
.alloc_inode = ext2_alloc_inode,
.destroy_inode = ext2_destroy_inode,
.read_inode = ext2_read_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/ext3/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ static struct quotactl_ops ext3_qctl_operations = {
};
#endif

static struct super_operations ext3_sops = {
static const struct super_operations ext3_sops = {
.alloc_inode = ext3_alloc_inode,
.destroy_inode = ext3_destroy_inode,
.read_inode = ext3_read_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ static struct quotactl_ops ext4_qctl_operations = {
};
#endif

static struct super_operations ext4_sops = {
static const struct super_operations ext4_sops = {
.alloc_inode = ext4_alloc_inode,
.destroy_inode = ext4_destroy_inode,
.read_inode = ext4_read_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/fat/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ int fat_sync_inode(struct inode *inode)
EXPORT_SYMBOL_GPL(fat_sync_inode);

static int fat_show_options(struct seq_file *m, struct vfsmount *mnt);
static struct super_operations fat_sops = {
static const struct super_operations fat_sops = {
.alloc_inode = fat_alloc_inode,
.destroy_inode = fat_destroy_inode,
.write_inode = fat_write_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/freevxfs/vxfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static void vxfs_put_super(struct super_block *);
static int vxfs_statfs(struct dentry *, struct kstatfs *);
static int vxfs_remount(struct super_block *, int *, char *);

static struct super_operations vxfs_super_ops = {
static const struct super_operations vxfs_super_ops = {
.read_inode = vxfs_read_inode,
.clear_inode = vxfs_clear_inode,
.put_super = vxfs_put_super,
Expand Down
2 changes: 1 addition & 1 deletion fs/fuse/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ static struct inode *get_root_inode(struct super_block *sb, unsigned mode)
return fuse_iget(sb, 1, 0, &attr);
}

static struct super_operations fuse_super_operations = {
static const struct super_operations fuse_super_operations = {
.alloc_inode = fuse_alloc_inode,
.destroy_inode = fuse_destroy_inode,
.read_inode = fuse_read_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/ops_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ static void gfs2_destroy_inode(struct inode *inode)
kmem_cache_free(gfs2_inode_cachep, inode);
}

struct super_operations gfs2_super_ops = {
const struct super_operations gfs2_super_ops = {
.alloc_inode = gfs2_alloc_inode,
.destroy_inode = gfs2_destroy_inode,
.write_inode = gfs2_write_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/ops_super.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@

#include <linux/fs.h>

extern struct super_operations gfs2_super_ops;
extern const struct super_operations gfs2_super_ops;

#endif /* __OPS_SUPER_DOT_H__ */
2 changes: 1 addition & 1 deletion fs/hfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static void hfs_destroy_inode(struct inode *inode)
kmem_cache_free(hfs_inode_cachep, HFS_I(inode));
}

static struct super_operations hfs_super_operations = {
static const struct super_operations hfs_super_operations = {
.alloc_inode = hfs_alloc_inode,
.destroy_inode = hfs_destroy_inode,
.write_inode = hfs_write_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/hfsplus/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ static int hfsplus_remount(struct super_block *sb, int *flags, char *data)
return 0;
}

static struct super_operations hfsplus_sops = {
static const struct super_operations hfsplus_sops = {
.alloc_inode = hfsplus_alloc_inode,
.destroy_inode = hfsplus_destroy_inode,
.read_inode = hfsplus_read_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/hostfs/hostfs_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static void hostfs_read_inode(struct inode *inode)
read_inode(inode);
}

static struct super_operations hostfs_sbops = {
static const struct super_operations hostfs_sbops = {
.alloc_inode = hostfs_alloc_inode,
.drop_inode = generic_delete_inode,
.delete_inode = hostfs_delete_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/hpfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)

/* Super operations */

static struct super_operations hpfs_sops =
static const struct super_operations hpfs_sops =
{
.alloc_inode = hpfs_alloc_inode,
.destroy_inode = hpfs_destroy_inode,
Expand Down
4 changes: 2 additions & 2 deletions fs/hppfs/hppfs_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static inline struct hppfs_inode_info *HPPFS_I(struct inode *inode)

#define HPPFS_SUPER_MAGIC 0xb00000ee

static struct super_operations hppfs_sbops;
static const struct super_operations hppfs_sbops;

static int is_pid(struct dentry *dentry)
{
Expand Down Expand Up @@ -649,7 +649,7 @@ static void hppfs_destroy_inode(struct inode *inode)
kfree(HPPFS_I(inode));
}

static struct super_operations hppfs_sbops = {
static const struct super_operations hppfs_sbops = {
.alloc_inode = hppfs_alloc_inode,
.destroy_inode = hppfs_destroy_inode,
.read_inode = hppfs_read_inode,
Expand Down
4 changes: 2 additions & 2 deletions fs/hugetlbfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/* some random number */
#define HUGETLBFS_MAGIC 0x958458f6

static struct super_operations hugetlbfs_ops;
static const struct super_operations hugetlbfs_ops;
static const struct address_space_operations hugetlbfs_aops;
const struct file_operations hugetlbfs_file_operations;
static const struct inode_operations hugetlbfs_dir_inode_operations;
Expand Down Expand Up @@ -580,7 +580,7 @@ static const struct inode_operations hugetlbfs_inode_operations = {
.setattr = hugetlbfs_setattr,
};

static struct super_operations hugetlbfs_ops = {
static const struct super_operations hugetlbfs_ops = {
.alloc_inode = hugetlbfs_alloc_inode,
.destroy_inode = hugetlbfs_destroy_inode,
.statfs = hugetlbfs_statfs,
Expand Down
6 changes: 3 additions & 3 deletions fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ EXPORT_SYMBOL(remove_inode_hash);
*/
void generic_delete_inode(struct inode *inode)
{
struct super_operations *op = inode->i_sb->s_op;
const struct super_operations *op = inode->i_sb->s_op;

list_del_init(&inode->i_list);
list_del_init(&inode->i_sb_list);
Expand Down Expand Up @@ -1093,7 +1093,7 @@ EXPORT_SYMBOL_GPL(generic_drop_inode);
*/
static inline void iput_final(struct inode *inode)
{
struct super_operations *op = inode->i_sb->s_op;
const struct super_operations *op = inode->i_sb->s_op;
void (*drop)(struct inode *) = generic_drop_inode;

if (op && op->drop_inode)
Expand All @@ -1113,7 +1113,7 @@ static inline void iput_final(struct inode *inode)
void iput(struct inode *inode)
{
if (inode) {
struct super_operations *op = inode->i_sb->s_op;
const struct super_operations *op = inode->i_sb->s_op;

BUG_ON(inode->i_state == I_CLEAR);

Expand Down
2 changes: 1 addition & 1 deletion fs/isofs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static int isofs_remount(struct super_block *sb, int *flags, char *data)
return 0;
}

static struct super_operations isofs_sops = {
static const struct super_operations isofs_sops = {
.alloc_inode = isofs_alloc_inode,
.destroy_inode = isofs_destroy_inode,
.read_inode = isofs_read_inode,
Expand Down
4 changes: 2 additions & 2 deletions fs/jffs/inode-v23.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

static int jffs_remove(struct inode *dir, struct dentry *dentry, int type);

static struct super_operations jffs_ops;
static const struct super_operations jffs_ops;
static const struct file_operations jffs_file_operations;
static const struct inode_operations jffs_file_inode_operations;
static const struct file_operations jffs_dir_operations;
Expand Down Expand Up @@ -1774,7 +1774,7 @@ static int jffs_remount(struct super_block *sb, int *flags, char *data)
return 0;
}

static struct super_operations jffs_ops =
static const struct super_operations jffs_ops =
{
.read_inode = jffs_read_inode,
.delete_inode = jffs_delete_inode,
Expand Down
2 changes: 1 addition & 1 deletion fs/jffs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static int jffs2_sync_fs(struct super_block *sb, int wait)
return 0;
}

static struct super_operations jffs2_super_operations =
static const struct super_operations jffs2_super_operations =
{
.alloc_inode = jffs2_alloc_inode,
.destroy_inode =jffs2_destroy_inode,
Expand Down
Loading

0 comments on commit ee9b6d6

Please sign in to comment.