Commit 99ac48f5 authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Linus Torvalds

[PATCH] mark f_ops const in the inode

Mark the f_ops members of inodes as const, as well as fix the
ripple-through this causes by places that copy this f_ops and then "do
stuff" with it.
Signed-off-by: default avatarArjan van de Ven <arjan@infradead.org>
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ec1b9466
...@@ -103,7 +103,7 @@ spufs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -103,7 +103,7 @@ spufs_setattr(struct dentry *dentry, struct iattr *attr)
static int static int
spufs_new_file(struct super_block *sb, struct dentry *dentry, spufs_new_file(struct super_block *sb, struct dentry *dentry,
struct file_operations *fops, int mode, const struct file_operations *fops, int mode,
struct spu_context *ctx) struct spu_context *ctx)
{ {
static struct inode_operations spufs_file_iops = { static struct inode_operations spufs_file_iops = {
......
...@@ -52,7 +52,7 @@ static int ppc_htab_open(struct inode *inode, struct file *file) ...@@ -52,7 +52,7 @@ static int ppc_htab_open(struct inode *inode, struct file *file)
return single_open(file, ppc_htab_show, NULL); return single_open(file, ppc_htab_show, NULL);
} }
struct file_operations ppc_htab_operations = { const struct file_operations ppc_htab_operations = {
.open = ppc_htab_open, .open = ppc_htab_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
......
...@@ -175,7 +175,7 @@ int drm_stub_open(struct inode *inode, struct file *filp) ...@@ -175,7 +175,7 @@ int drm_stub_open(struct inode *inode, struct file *filp)
drm_device_t *dev = NULL; drm_device_t *dev = NULL;
int minor = iminor(inode); int minor = iminor(inode);
int err = -ENODEV; int err = -ENODEV;
struct file_operations *old_fops; const struct file_operations *old_fops;
DRM_DEBUG("\n"); DRM_DEBUG("\n");
......
...@@ -126,7 +126,7 @@ static int i810_map_buffer(drm_buf_t * buf, struct file *filp) ...@@ -126,7 +126,7 @@ static int i810_map_buffer(drm_buf_t * buf, struct file *filp)
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
drm_i810_buf_priv_t *buf_priv = buf->dev_private; drm_i810_buf_priv_t *buf_priv = buf->dev_private;
drm_i810_private_t *dev_priv = dev->dev_private; drm_i810_private_t *dev_priv = dev->dev_private;
struct file_operations *old_fops; const struct file_operations *old_fops;
int retcode = 0; int retcode = 0;
if (buf_priv->currently_mapped == I810_BUF_MAPPED) if (buf_priv->currently_mapped == I810_BUF_MAPPED)
......
...@@ -128,7 +128,7 @@ static int i830_map_buffer(drm_buf_t * buf, struct file *filp) ...@@ -128,7 +128,7 @@ static int i830_map_buffer(drm_buf_t * buf, struct file *filp)
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
drm_i830_buf_priv_t *buf_priv = buf->dev_private; drm_i830_buf_priv_t *buf_priv = buf->dev_private;
drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_private_t *dev_priv = dev->dev_private;
struct file_operations *old_fops; const struct file_operations *old_fops;
unsigned long virtual; unsigned long virtual;
int retcode = 0; int retcode = 0;
......
...@@ -899,7 +899,7 @@ static const struct { ...@@ -899,7 +899,7 @@ static const struct {
unsigned int minor; unsigned int minor;
char *name; char *name;
umode_t mode; umode_t mode;
struct file_operations *fops; const struct file_operations *fops;
} devlist[] = { /* list of minor devices */ } devlist[] = { /* list of minor devices */
{1, "mem", S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops}, {1, "mem", S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops},
{2, "kmem", S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops}, {2, "kmem", S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops},
......
...@@ -129,7 +129,7 @@ static int misc_open(struct inode * inode, struct file * file) ...@@ -129,7 +129,7 @@ static int misc_open(struct inode * inode, struct file * file)
int minor = iminor(inode); int minor = iminor(inode);
struct miscdevice *c; struct miscdevice *c;
int err = -ENODEV; int err = -ENODEV;
struct file_operations *old_fops, *new_fops = NULL; const struct file_operations *old_fops, *new_fops = NULL;
down(&misc_sem); down(&misc_sem);
......
...@@ -923,7 +923,7 @@ void input_unregister_handler(struct input_handler *handler) ...@@ -923,7 +923,7 @@ void input_unregister_handler(struct input_handler *handler)
static int input_open_file(struct inode *inode, struct file *file) static int input_open_file(struct inode *inode, struct file *file)
{ {
struct input_handler *handler = input_table[iminor(inode) >> 5]; struct input_handler *handler = input_table[iminor(inode) >> 5];
struct file_operations *old_fops, *new_fops = NULL; const struct file_operations *old_fops, *new_fops = NULL;
int err; int err;
/* No load-on-demand here? */ /* No load-on-demand here? */
......
...@@ -233,7 +233,7 @@ static struct file_operations proc_applstats_ops = { ...@@ -233,7 +233,7 @@ static struct file_operations proc_applstats_ops = {
}; };
static void static void
create_seq_entry(char *name, mode_t mode, struct file_operations *f) create_seq_entry(char *name, mode_t mode, const struct file_operations *f)
{ {
struct proc_dir_entry *entry; struct proc_dir_entry *entry;
entry = create_proc_entry(name, mode, NULL); entry = create_proc_entry(name, mode, NULL);
......
...@@ -86,7 +86,7 @@ static int dvb_device_open(struct inode *inode, struct file *file) ...@@ -86,7 +86,7 @@ static int dvb_device_open(struct inode *inode, struct file *file)
if (dvbdev && dvbdev->fops) { if (dvbdev && dvbdev->fops) {
int err = 0; int err = 0;
struct file_operations *old_fops; const struct file_operations *old_fops;
file->private_data = dvbdev; file->private_data = dvbdev;
old_fops = file->f_op; old_fops = file->f_op;
......
...@@ -97,7 +97,7 @@ static int video_open(struct inode *inode, struct file *file) ...@@ -97,7 +97,7 @@ static int video_open(struct inode *inode, struct file *file)
unsigned int minor = iminor(inode); unsigned int minor = iminor(inode);
int err = 0; int err = 0;
struct video_device *vfl; struct video_device *vfl;
struct file_operations *old_fops; const struct file_operations *old_fops;
if(minor>=VIDEO_NUM_DEVICES) if(minor>=VIDEO_NUM_DEVICES)
return -ENODEV; return -ENODEV;
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
typedef struct _i2o_proc_entry_t { typedef struct _i2o_proc_entry_t {
char *name; /* entry name */ char *name; /* entry name */
mode_t mode; /* mode */ mode_t mode; /* mode */
struct file_operations *fops; /* open function */ const struct file_operations *fops; /* open function */
} i2o_proc_entry; } i2o_proc_entry;
/* global I2O /proc/i2o entry */ /* global I2O /proc/i2o entry */
......
...@@ -130,7 +130,7 @@ static struct file_operations ulong_ro_fops = { ...@@ -130,7 +130,7 @@ static struct file_operations ulong_ro_fops = {
static struct dentry * __oprofilefs_create_file(struct super_block * sb, static struct dentry * __oprofilefs_create_file(struct super_block * sb,
struct dentry * root, char const * name, struct file_operations * fops, struct dentry * root, char const * name, const struct file_operations * fops,
int perm) int perm)
{ {
struct dentry * dentry; struct dentry * dentry;
...@@ -203,7 +203,7 @@ int oprofilefs_create_ro_atomic(struct super_block * sb, struct dentry * root, ...@@ -203,7 +203,7 @@ int oprofilefs_create_ro_atomic(struct super_block * sb, struct dentry * root,
int oprofilefs_create_file(struct super_block * sb, struct dentry * root, int oprofilefs_create_file(struct super_block * sb, struct dentry * root,
char const * name, struct file_operations * fops) char const * name, const struct file_operations * fops)
{ {
if (!__oprofilefs_create_file(sb, root, name, fops, 0644)) if (!__oprofilefs_create_file(sb, root, name, fops, 0644))
return -EFAULT; return -EFAULT;
...@@ -212,7 +212,7 @@ int oprofilefs_create_file(struct super_block * sb, struct dentry * root, ...@@ -212,7 +212,7 @@ int oprofilefs_create_file(struct super_block * sb, struct dentry * root,
int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root, int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root,
char const * name, struct file_operations * fops, int perm) char const * name, const struct file_operations * fops, int perm)
{ {
if (!__oprofilefs_create_file(sb, root, name, fops, perm)) if (!__oprofilefs_create_file(sb, root, name, fops, perm))
return -EFAULT; return -EFAULT;
......
...@@ -49,7 +49,7 @@ static int phone_open(struct inode *inode, struct file *file) ...@@ -49,7 +49,7 @@ static int phone_open(struct inode *inode, struct file *file)
unsigned int minor = iminor(inode); unsigned int minor = iminor(inode);
int err = 0; int err = 0;
struct phone_device *p; struct phone_device *p;
struct file_operations *old_fops, *new_fops = NULL; const struct file_operations *old_fops, *new_fops = NULL;
if (minor >= PHONE_NUM_DEVICES) if (minor >= PHONE_NUM_DEVICES)
return -ENODEV; return -ENODEV;
......
...@@ -24,15 +24,15 @@ ...@@ -24,15 +24,15 @@
#include "usb.h" #include "usb.h"
#define MAX_USB_MINORS 256 #define MAX_USB_MINORS 256
static struct file_operations *usb_minors[MAX_USB_MINORS]; static const struct file_operations *usb_minors[MAX_USB_MINORS];
static DEFINE_SPINLOCK(minor_lock); static DEFINE_SPINLOCK(minor_lock);
static int usb_open(struct inode * inode, struct file * file) static int usb_open(struct inode * inode, struct file * file)
{ {
int minor = iminor(inode); int minor = iminor(inode);
struct file_operations *c; const struct file_operations *c;
int err = -ENODEV; int err = -ENODEV;
struct file_operations *old_fops, *new_fops = NULL; const struct file_operations *old_fops, *new_fops = NULL;
spin_lock (&minor_lock); spin_lock (&minor_lock);
c = usb_minors[minor]; c = usb_minors[minor];
......
...@@ -1581,7 +1581,7 @@ static void destroy_ep_files (struct dev_data *dev) ...@@ -1581,7 +1581,7 @@ static void destroy_ep_files (struct dev_data *dev)
static struct inode * static struct inode *
gadgetfs_create_file (struct super_block *sb, char const *name, gadgetfs_create_file (struct super_block *sb, char const *name,
void *data, struct file_operations *fops, void *data, const struct file_operations *fops,
struct dentry **dentry_p); struct dentry **dentry_p);
static int activate_ep_files (struct dev_data *dev) static int activate_ep_files (struct dev_data *dev)
...@@ -1955,7 +1955,7 @@ module_param (default_perm, uint, 0644); ...@@ -1955,7 +1955,7 @@ module_param (default_perm, uint, 0644);
static struct inode * static struct inode *
gadgetfs_make_inode (struct super_block *sb, gadgetfs_make_inode (struct super_block *sb,
void *data, struct file_operations *fops, void *data, const struct file_operations *fops,
int mode) int mode)
{ {
struct inode *inode = new_inode (sb); struct inode *inode = new_inode (sb);
...@@ -1979,7 +1979,7 @@ gadgetfs_make_inode (struct super_block *sb, ...@@ -1979,7 +1979,7 @@ gadgetfs_make_inode (struct super_block *sb,
*/ */
static struct inode * static struct inode *
gadgetfs_create_file (struct super_block *sb, char const *name, gadgetfs_create_file (struct super_block *sb, char const *name,
void *data, struct file_operations *fops, void *data, const struct file_operations *fops,
struct dentry **dentry_p) struct dentry **dentry_p)
{ {
struct dentry *dentry; struct dentry *dentry;
......
...@@ -250,7 +250,7 @@ int alloc_chrdev_region(dev_t *dev, unsigned baseminor, unsigned count, ...@@ -250,7 +250,7 @@ int alloc_chrdev_region(dev_t *dev, unsigned baseminor, unsigned count,
} }
int register_chrdev(unsigned int major, const char *name, int register_chrdev(unsigned int major, const char *name,
struct file_operations *fops) const struct file_operations *fops)
{ {
struct char_device_struct *cd; struct char_device_struct *cd;
struct cdev *cdev; struct cdev *cdev;
...@@ -473,7 +473,7 @@ struct cdev *cdev_alloc(void) ...@@ -473,7 +473,7 @@ struct cdev *cdev_alloc(void)
return p; return p;
} }
void cdev_init(struct cdev *cdev, struct file_operations *fops) void cdev_init(struct cdev *cdev, const struct file_operations *fops)
{ {
memset(cdev, 0, sizeof *cdev); memset(cdev, 0, sizeof *cdev);
INIT_LIST_HEAD(&cdev->list); INIT_LIST_HEAD(&cdev->list);
......
...@@ -191,7 +191,7 @@ static int debugfs_create_by_name(const char *name, mode_t mode, ...@@ -191,7 +191,7 @@ static int debugfs_create_by_name(const char *name, mode_t mode,
*/ */
struct dentry *debugfs_create_file(const char *name, mode_t mode, struct dentry *debugfs_create_file(const char *name, mode_t mode,
struct dentry *parent, void *data, struct dentry *parent, void *data,
struct file_operations *fops) const struct file_operations *fops)
{ {
struct dentry *dentry = NULL; struct dentry *dentry = NULL;
int error; int error;
......
...@@ -104,7 +104,7 @@ static struct inode *alloc_inode(struct super_block *sb) ...@@ -104,7 +104,7 @@ static struct inode *alloc_inode(struct super_block *sb)
{ {
static struct address_space_operations empty_aops; static struct address_space_operations empty_aops;
static struct inode_operations empty_iops; static struct inode_operations empty_iops;
static struct file_operations empty_fops; static const struct file_operations empty_fops;
struct inode *inode; struct inode *inode;
if (sb->s_op->alloc_inode) if (sb->s_op->alloc_inode)
......
...@@ -706,7 +706,7 @@ nfsd_close(struct file *filp) ...@@ -706,7 +706,7 @@ nfsd_close(struct file *filp)
* after it. * after it.
*/ */
static inline int nfsd_dosync(struct file *filp, struct dentry *dp, static inline int nfsd_dosync(struct file *filp, struct dentry *dp,
struct file_operations *fop) const struct file_operations *fop)
{ {
struct inode *inode = dp->d_inode; struct inode *inode = dp->d_inode;
int (*fsync) (struct file *, struct dentry *, int); int (*fsync) (struct file *, struct dentry *, int);
......
...@@ -560,7 +560,7 @@ static void proc_kill_inodes(struct proc_dir_entry *de) ...@@ -560,7 +560,7 @@ static void proc_kill_inodes(struct proc_dir_entry *de)
struct file * filp = list_entry(p, struct file, f_u.fu_list); struct file * filp = list_entry(p, struct file, f_u.fu_list);
struct dentry * dentry = filp->f_dentry; struct dentry * dentry = filp->f_dentry;
struct inode * inode; struct inode * inode;
struct file_operations *fops; const struct file_operations *fops;
if (dentry->d_op != &proc_dentry_operations) if (dentry->d_op != &proc_dentry_operations)
continue; continue;
......
...@@ -30,7 +30,7 @@ do { \ ...@@ -30,7 +30,7 @@ do { \
#endif #endif
extern void create_seq_entry(char *name, mode_t mode, struct file_operations *f); extern void create_seq_entry(char *name, mode_t mode, const struct file_operations *f);
extern int proc_exe_link(struct inode *, struct dentry **, struct vfsmount **); extern int proc_exe_link(struct inode *, struct dentry **, struct vfsmount **);
extern int proc_tid_stat(struct task_struct *, char *); extern int proc_tid_stat(struct task_struct *, char *);
extern int proc_tgid_stat(struct task_struct *, char *); extern int proc_tgid_stat(struct task_struct *, char *);
......
...@@ -731,7 +731,7 @@ static struct file_operations proc_sysrq_trigger_operations = { ...@@ -731,7 +731,7 @@ static struct file_operations proc_sysrq_trigger_operations = {
struct proc_dir_entry *proc_root_kcore; struct proc_dir_entry *proc_root_kcore;
void create_seq_entry(char *name, mode_t mode, struct file_operations *f) void create_seq_entry(char *name, mode_t mode, const struct file_operations *f)
{ {
struct proc_dir_entry *entry; struct proc_dir_entry *entry;
entry = create_proc_entry(name, mode, NULL); entry = create_proc_entry(name, mode, NULL);
......
...@@ -220,7 +220,7 @@ int do_select(int n, fd_set_bits *fds, s64 *timeout) ...@@ -220,7 +220,7 @@ int do_select(int n, fd_set_bits *fds, s64 *timeout)
for (i = 0; i < n; ++rinp, ++routp, ++rexp) { for (i = 0; i < n; ++rinp, ++routp, ++rexp) {
unsigned long in, out, ex, all_bits, bit = 1, mask, j; unsigned long in, out, ex, all_bits, bit = 1, mask, j;
unsigned long res_in = 0, res_out = 0, res_ex = 0; unsigned long res_in = 0, res_out = 0, res_ex = 0;
struct file_operations *f_op = NULL; const struct file_operations *f_op = NULL;
struct file *file = NULL; struct file *file = NULL;
in = *inp++; out = *outp++; ex = *exp++; in = *inp++; out = *outp++; ex = *exp++;
......
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
struct cdev { struct cdev {
struct kobject kobj; struct kobject kobj;
struct module *owner; struct module *owner;
struct file_operations *ops; const struct file_operations *ops;
struct list_head list; struct list_head list;
dev_t dev; dev_t dev;
unsigned int count; unsigned int count;
}; };
void cdev_init(struct cdev *, struct file_operations *); void cdev_init(struct cdev *, const struct file_operations *);
struct cdev *cdev_alloc(void); struct cdev *cdev_alloc(void);
......
...@@ -29,7 +29,7 @@ struct debugfs_blob_wrapper { ...@@ -29,7 +29,7 @@ struct debugfs_blob_wrapper {
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
struct dentry *debugfs_create_file(const char *name, mode_t mode, struct dentry *debugfs_create_file(const char *name, mode_t mode,
struct dentry *parent, void *data, struct dentry *parent, void *data,
struct file_operations *fops); const struct file_operations *fops);
struct dentry *debugfs_create_dir(const char *name, struct dentry *parent); struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);
......
...@@ -496,7 +496,7 @@ struct inode { ...@@ -496,7 +496,7 @@ struct inode {
struct mutex i_mutex; struct mutex i_mutex;
struct rw_semaphore i_alloc_sem; struct rw_semaphore i_alloc_sem;
struct inode_operations *i_op; struct inode_operations *i_op;
struct file_operations *i_fop; /* former ->i_op->default_file_ops */ const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
struct super_block *i_sb; struct super_block *i_sb;
struct file_lock *i_flock; struct file_lock *i_flock;
struct address_space *i_mapping; struct address_space *i_mapping;
...@@ -636,7 +636,7 @@ struct file { ...@@ -636,7 +636,7 @@ struct file {
} f_u; } f_u;
struct dentry *f_dentry; struct dentry *f_dentry;
struct vfsmount *f_vfsmnt; struct vfsmount *f_vfsmnt;
struct file_operations *f_op; const struct file_operations *f_op;
atomic_t f_count; atomic_t f_count;
unsigned int f_flags; unsigned int f_flags;
mode_t f_mode; mode_t f_mode;
...@@ -1414,7 +1414,7 @@ extern void bd_release_from_disk(struct block_device *, struct gendisk *); ...@@ -1414,7 +1414,7 @@ extern void bd_release_from_disk(struct block_device *, struct gendisk *);
extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *); extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
extern int register_chrdev_region(dev_t, unsigned, const char *); extern int register_chrdev_region(dev_t, unsigned, const char *);
extern int register_chrdev(unsigned int, const char *, extern int register_chrdev(unsigned int, const char *,
struct file_operations *); const struct file_operations *);
extern int unregister_chrdev(unsigned int, const char *); extern int unregister_chrdev(unsigned int, const char *);
extern void unregister_chrdev_region(dev_t, unsigned); extern void unregister_chrdev_region(dev_t, unsigned);
extern int chrdev_open(struct inode *, struct file *); extern int chrdev_open(struct inode *, struct file *);
......
...@@ -957,7 +957,7 @@ struct input_handler { ...@@ -957,7 +957,7 @@ struct input_handler {
struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id); struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id);
void (*disconnect)(struct input_handle *handle); void (*disconnect)(struct input_handle *handle);
struct file_operations *fops; const struct file_operations *fops;
int minor; int minor;
char *name; char *name;
......
...@@ -36,7 +36,7 @@ struct class_device; ...@@ -36,7 +36,7 @@ struct class_device;
struct miscdevice { struct miscdevice {
int minor; int minor;
const char *name; const char *name;
struct file_operations *fops; const struct file_operations *fops;
struct list_head list; struct list_head list;
struct device *dev; struct device *dev;
struct class_device *class; struct class_device *class;
......
...@@ -84,10 +84,10 @@ void oprofile_add_trace(unsigned long eip); ...@@ -84,10 +84,10 @@ void oprofile_add_trace(unsigned long eip);
* the specified file operations. * the specified file operations.
*/ */
int oprofilefs_create_file(struct super_block * sb, struct dentry * root, int oprofilefs_create_file(struct super_block * sb, struct dentry * root,
char const * name, struct file_operations * fops); char const * name, const struct file_operations * fops);
int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root, int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root,
char const * name, struct file_operations * fops, int perm); char const * name, const struct file_operations * fops, int perm);
/** Create a file for read/write access to an unsigned long. */ /** Create a file for read/write access to an unsigned long. */
int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root, int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root,
......
...@@ -58,7 +58,7 @@ struct proc_dir_entry { ...@@ -58,7 +58,7 @@ struct proc_dir_entry {
gid_t gid; gid_t gid;
loff_t size; loff_t size;
struct inode_operations * proc_iops; struct inode_operations * proc_iops;
struct file_operations * proc_fops; const struct file_operations * proc_fops;
get_info_t *get_info; get_info_t *get_info;
struct module *owner; struct module *owner;
struct proc_dir_entry *next, *parent, *subdir; struct proc_dir_entry *next, *parent, *subdir;
...@@ -189,7 +189,7 @@ static inline struct proc_dir_entry *proc_net_create(const char *name, ...@@ -189,7 +189,7 @@ static inline struct proc_dir_entry *proc_net_create(const char *name,
} }
static inline struct proc_dir_entry *proc_net_fops_create(const char *name, static inline struct proc_dir_entry *proc_net_fops_create(const char *name,
mode_t mode, struct file_operations *fops) mode_t mode, const struct file_operations *fops)
{ {
struct proc_dir_entry *res = create_proc_entry(name, mode, proc_net); struct proc_dir_entry *res = create_proc_entry(name, mode, proc_net);
if (res) if (res)
......
...@@ -30,12 +30,12 @@ ...@@ -30,12 +30,12 @@
*/ */
struct device; struct device;
extern int register_sound_special(struct file_operations *fops, int unit); extern int register_sound_special(const struct file_operations *fops, int unit);
extern int register_sound_special_device(struct file_operations *fops, int unit, struct device *dev); extern int register_sound_special_device(const struct file_operations *fops, int unit, struct device *dev);
extern int register_sound_mixer(struct file_operations *fops, int dev); extern int register_sound_mixer(const struct file_operations *fops, int dev);
extern int register_sound_midi(struct file_operations *fops, int dev); extern int register_sound_midi(const struct file_operations *fops, int dev);
extern int register_sound_dsp(struct file_operations *fops, int dev); extern int register_sound_dsp(const struct file_operations *fops, int dev);
extern int register_sound_synth(struct file_operations *fops, int dev); extern int register_sound_synth(const struct file_operations *fops, int dev);
extern void unregister_sound_special(int unit); extern void unregister_sound_special(int unit);
extern void unregister_sound_mixer(int unit); extern void unregister_sound_mixer(int unit);
......
...@@ -50,7 +50,7 @@ struct proc_dir_entry * rpc_proc_register(struct rpc_stat *); ...@@ -50,7 +50,7 @@ struct proc_dir_entry * rpc_proc_register(struct rpc_stat *);
void rpc_proc_unregister(const char *); void rpc_proc_unregister(const char *);
void rpc_proc_zero(struct rpc_program *); void rpc_proc_zero(struct rpc_program *);
struct proc_dir_entry * svc_proc_register(struct svc_stat *, struct proc_dir_entry * svc_proc_register(struct svc_stat *,
struct file_operations *); const struct file_operations *);
void svc_proc_unregister(const char *); void svc_proc_unregister(const char *);
void svc_seq_show(struct seq_file *, void svc_seq_show(struct seq_file *,
...@@ -65,7 +65,7 @@ static inline void rpc_proc_unregister(const char *p) {} ...@@ -65,7 +65,7 @@ static inline void rpc_proc_unregister(const char *p) {}
static inline void rpc_proc_zero(struct rpc_program *p) {} static inline void rpc_proc_zero(struct rpc_program *p) {}
static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s, static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s,
struct file_operations *f) { return NULL; } const struct file_operations *f) { return NULL; }
static inline void svc_proc_unregister(const char *p) {} static inline void svc_proc_unregister(const char *p) {}
static inline void svc_seq_show(struct seq_file *seq, static inline void svc_seq_show(struct seq_file *seq,
......
...@@ -615,7 +615,7 @@ extern struct bus_type usb_bus_type; ...@@ -615,7 +615,7 @@ extern struct bus_type usb_bus_type;
*/ */
struct usb_class_driver { struct usb_class_driver {
char *name; char *name;
struct file_operations *fops; const struct file_operations *fops;
int minor_base; int minor_base;
}; };
......
...@@ -75,7 +75,7 @@ struct video_device ...@@ -75,7 +75,7 @@ struct video_device
int minor; int minor;
/* device ops + callbacks */ /* device ops + callbacks */
struct file_operations *fops; const struct file_operations *fops;
void (*release)(struct video_device *vfd); void (*release)(struct video_device *vfd);
......
...@@ -186,7 +186,7 @@ struct snd_minor { ...@@ -186,7 +186,7 @@ struct snd_minor {
int type; /* SNDRV_DEVICE_TYPE_XXX */ int type; /* SNDRV_DEVICE_TYPE_XXX */
int card; /* card number */ int card; /* card number */
int device; /* device number */ int device; /* device number */
struct file_operations *f_ops; /* file operations */ const struct file_operations *f_ops; /* file operations */
void *private_data; /* private data for f_ops->open */ void *private_data; /* private data for f_ops->open */
char name[0]; /* device name (keep at the end of char name[0]; /* device name (keep at the end of
structure) */ structure) */
...@@ -200,14 +200,14 @@ extern int snd_ecards_limit; ...@@ -200,14 +200,14 @@ extern int snd_ecards_limit;
void snd_request_card(int card); void snd_request_card(int card);
int snd_register_device(int type, struct snd_card *card, int dev, int snd_register_device(int type, struct snd_card *card, int dev,
struct file_operations *f_ops, void *private_data, const struct file_operations *f_ops, void *private_data,
const char *name); const char *name);
int snd_unregister_device(int type, struct snd_card *card, int dev); int snd_unregister_device(int type, struct snd_card *card, int dev);
void *snd_lookup_minor_data(unsigned int minor, int type); void *snd_lookup_minor_data(unsigned int minor, int type);
#ifdef CONFIG_SND_OSSEMUL #ifdef CONFIG_SND_OSSEMUL
int snd_register_oss_device(int type, struct snd_card *card, int dev, int snd_register_oss_device(int type, struct snd_card *card, int dev,
struct file_operations *f_ops, void *private_data, const struct file_operations *f_ops, void *private_data,
const char *name); const char *name);
int snd_unregister_oss_device(int type, struct snd_card *card, int dev); int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
void *snd_lookup_oss_minor_data(unsigned int minor, int type); void *snd_lookup_oss_minor_data(unsigned int minor, int type);
......
...@@ -395,7 +395,7 @@ enum { ...@@ -395,7 +395,7 @@ enum {
*/ */
struct rpc_filelist { struct rpc_filelist {
char *name; char *name;
struct file_operations *i_fop; const struct file_operations *i_fop;
int mode; int mode;
}; };
......
...@@ -225,7 +225,7 @@ EXPORT_SYMBOL(rpc_print_iostats); ...@@ -225,7 +225,7 @@ EXPORT_SYMBOL(rpc_print_iostats);
* Register/unregister RPC proc files * Register/unregister RPC proc files
*/ */
static inline struct proc_dir_entry * static inline struct proc_dir_entry *
do_register(const char *name, void *data, struct file_operations *fops) do_register(const char *name, void *data, const struct file_operations *fops)
{ {
struct proc_dir_entry *ent; struct proc_dir_entry *ent;
...@@ -253,7 +253,7 @@ rpc_proc_unregister(const char *name) ...@@ -253,7 +253,7 @@ rpc_proc_unregister(const char *name)
} }
struct proc_dir_entry * struct proc_dir_entry *
svc_proc_register(struct svc_stat *statp, struct file_operations *fops) svc_proc_register(struct svc_stat *statp, const struct file_operations *fops)
{ {
return do_register(statp->program->pg_name, statp, fops); return do_register(statp->program->pg_name, statp, fops);
} }
......
...@@ -223,7 +223,8 @@ int snd_card_disconnect(struct snd_card *card) ...@@ -223,7 +223,8 @@ int snd_card_disconnect(struct snd_card *card)
struct snd_monitor_file *mfile; struct snd_monitor_file *mfile;
struct file *file; struct file *file;
struct snd_shutdown_f_ops *s_f_ops; struct snd_shutdown_f_ops *s_f_ops;
struct file_operations *f_ops, *old_f_ops; struct file_operations *f_ops;
const struct file_operations *old_f_ops;
int err; int err;
spin_lock(&card->files_lock); spin_lock(&card->files_lock);
......
...@@ -137,7 +137,7 @@ static int snd_open(struct inode *inode, struct file *file) ...@@ -137,7 +137,7 @@ static int snd_open(struct inode *inode, struct file *file)
{ {
unsigned int minor = iminor(inode); unsigned int minor = iminor(inode);
struct snd_minor *mptr = NULL; struct snd_minor *mptr = NULL;
struct file_operations *old_fops; const struct file_operations *old_fops;
int err = 0; int err = 0;
if (minor >= ARRAY_SIZE(snd_minors)) if (minor >= ARRAY_SIZE(snd_minors))
...@@ -240,7 +240,7 @@ static int snd_kernel_minor(int type, struct snd_card *card, int dev) ...@@ -240,7 +240,7 @@ static int snd_kernel_minor(int type, struct snd_card *card, int dev)
* Retrurns zero if successful, or a negative error code on failure. * Retrurns zero if successful, or a negative error code on failure.
*/ */
int snd_register_device(int type, struct snd_card *card, int dev, int snd_register_device(int type, struct snd_card *card, int dev,
struct file_operations *f_ops, void *private_data, const struct file_operations *f_ops, void *private_data,
const char *name) const char *name)
{ {
int minor; int minor;
......
...@@ -95,7 +95,7 @@ static int snd_oss_kernel_minor(int type, struct snd_card *card, int dev) ...@@ -95,7 +95,7 @@ static int snd_oss_kernel_minor(int type, struct snd_card *card, int dev)
} }
int snd_register_oss_device(int type, struct snd_card *card, int dev, int snd_register_oss_device(int type, struct snd_card *card, int dev,
struct file_operations *f_ops, void *private_data, const struct file_operations *f_ops, void *private_data,
const char *name) const char *name)
{ {
int minor = snd_oss_kernel_minor(type, card, dev); int minor = snd_oss_kernel_minor(type, card, dev);
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
struct sound_unit struct sound_unit
{ {
int unit_minor; int unit_minor;
struct file_operations *unit_fops; const struct file_operations *unit_fops;
struct sound_unit *next; struct sound_unit *next;
char name[32]; char name[32];
}; };
...@@ -73,7 +73,7 @@ EXPORT_SYMBOL(sound_class); ...@@ -73,7 +73,7 @@ EXPORT_SYMBOL(sound_class);
* join into it. Called with the lock asserted * join into it. Called with the lock asserted
*/ */
static int __sound_insert_unit(struct sound_unit * s, struct sound_unit **list, struct file_operations *fops, int index, int low, int top) static int __sound_insert_unit(struct sound_unit * s, struct sound_unit **list, const struct file_operations *fops, int index, int low, int top)
{ {
int n=low; int n=low;
...@@ -153,7 +153,7 @@ static DEFINE_SPINLOCK(sound_loader_lock); ...@@ -153,7 +153,7 @@ static DEFINE_SPINLOCK(sound_loader_lock);
* list. Acquires locks as needed * list. Acquires locks as needed
*/ */
static int sound_insert_unit(struct sound_unit **list, struct file_operations *fops, int index, int low, int top, const char *name, umode_t mode, struct device *dev) static int sound_insert_unit(struct sound_unit **list, const struct file_operations *fops, int index, int low, int top, const char *name, umode_t mode, struct device *dev)
{ {
struct sound_unit *s = kmalloc(sizeof(*s), GFP_KERNEL); struct sound_unit *s = kmalloc(sizeof(*s), GFP_KERNEL);
int r; int r;
...@@ -237,7 +237,7 @@ static struct sound_unit *chains[SOUND_STEP]; ...@@ -237,7 +237,7 @@ static struct sound_unit *chains[SOUND_STEP];
* a negative error code is returned. * a negative error code is returned.
*/ */
int register_sound_special_device(struct file_operations *fops, int unit, int register_sound_special_device(const struct file_operations *fops, int unit,
struct device *dev) struct device *dev)
{ {
const int chain = unit % SOUND_STEP; const int chain = unit % SOUND_STEP;
...@@ -301,7 +301,7 @@ int register_sound_special_device(struct file_operations *fops, int unit, ...@@ -301,7 +301,7 @@ int register_sound_special_device(struct file_operations *fops, int unit,
EXPORT_SYMBOL(register_sound_special_device); EXPORT_SYMBOL(register_sound_special_device);
int register_sound_special(struct file_operations *fops, int unit) int register_sound_special(const struct file_operations *fops, int unit)
{ {
return register_sound_special_device(fops, unit, NULL); return register_sound_special_device(fops, unit, NULL);
} }
...@@ -318,7 +318,7 @@ EXPORT_SYMBOL(register_sound_special); ...@@ -318,7 +318,7 @@ EXPORT_SYMBOL(register_sound_special);
* number is returned, on failure a negative error code is returned. * number is returned, on failure a negative error code is returned.
*/ */
int register_sound_mixer(struct file_operations *fops, int dev) int register_sound_mixer(const struct file_operations *fops, int dev)
{ {
return sound_insert_unit(&chains[0], fops, dev, 0, 128, return sound_insert_unit(&chains[0], fops, dev, 0, 128,
"mixer", S_IRUSR | S_IWUSR, NULL); "mixer", S_IRUSR | S_IWUSR, NULL);
...@@ -336,7 +336,7 @@ EXPORT_SYMBOL(register_sound_mixer); ...@@ -336,7 +336,7 @@ EXPORT_SYMBOL(register_sound_mixer);
* number is returned, on failure a negative error code is returned. * number is returned, on failure a negative error code is returned.
*/ */
int register_sound_midi(struct file_operations *fops, int dev) int register_sound_midi(const struct file_operations *fops, int dev)
{ {
return sound_insert_unit(&chains[2], fops, dev, 2, 130, return sound_insert_unit(&chains[2], fops, dev, 2, 130,
"midi", S_IRUSR | S_IWUSR, NULL); "midi", S_IRUSR | S_IWUSR, NULL);
...@@ -362,7 +362,7 @@ EXPORT_SYMBOL(register_sound_midi); ...@@ -362,7 +362,7 @@ EXPORT_SYMBOL(register_sound_midi);
* and will always allocate them as a matching pair - eg dsp3/audio3 * and will always allocate them as a matching pair - eg dsp3/audio3
*/ */
int register_sound_dsp(struct file_operations *fops, int dev) int register_sound_dsp(const struct file_operations *fops, int dev)
{ {
return sound_insert_unit(&chains[3], fops, dev, 3, 131, return sound_insert_unit(&chains[3], fops, dev, 3, 131,
"dsp", S_IWUSR | S_IRUSR, NULL); "dsp", S_IWUSR | S_IRUSR, NULL);
...@@ -381,7 +381,7 @@ EXPORT_SYMBOL(register_sound_dsp); ...@@ -381,7 +381,7 @@ EXPORT_SYMBOL(register_sound_dsp);
*/ */
int register_sound_synth(struct file_operations *fops, int dev) int register_sound_synth(const struct file_operations *fops, int dev)
{ {
return sound_insert_unit(&chains[9], fops, dev, 9, 137, return sound_insert_unit(&chains[9], fops, dev, 9, 137,
"synth", S_IRUSR | S_IWUSR, NULL); "synth", S_IRUSR | S_IWUSR, NULL);
...@@ -501,7 +501,7 @@ int soundcore_open(struct inode *inode, struct file *file) ...@@ -501,7 +501,7 @@ int soundcore_open(struct inode *inode, struct file *file)
int chain; int chain;
int unit = iminor(inode); int unit = iminor(inode);
struct sound_unit *s; struct sound_unit *s;
struct file_operations *new_fops = NULL; const struct file_operations *new_fops = NULL;
chain=unit&0x0F; chain=unit&0x0F;
if(chain==4 || chain==5) /* dsp/audio/dsp16 */ if(chain==4 || chain==5) /* dsp/audio/dsp16 */
...@@ -540,7 +540,7 @@ int soundcore_open(struct inode *inode, struct file *file) ...@@ -540,7 +540,7 @@ int soundcore_open(struct inode *inode, struct file *file)
* switching ->f_op in the first place. * switching ->f_op in the first place.
*/ */
int err = 0; int err = 0;
struct file_operations *old_fops = file->f_op; const struct file_operations *old_fops = file->f_op;
file->f_op = new_fops; file->f_op = new_fops;
spin_unlock(&sound_loader_lock); spin_unlock(&sound_loader_lock);
if(file->f_op->open) if(file->f_op->open)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment