staging: lustre: lustre: make all struct file_operations constant
authorJames Simmons <jsimmons@infradead.org>
Wed, 14 Jun 2017 15:01:17 +0000 (11:01 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Jun 2017 16:17:02 +0000 (00:17 +0800)
Checkpatch reported several cases of struct file_operations
not being const. This resolves those warnings.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/fld/lproc_fld.c
drivers/staging/lustre/lustre/include/lprocfs_status.h
drivers/staging/lustre/lustre/llite/file.c
drivers/staging/lustre/lustre/llite/llite_internal.h
drivers/staging/lustre/lustre/llite/lproc_llite.c
drivers/staging/lustre/lustre/lov/lov_pool.c
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c

index 61ac420798afbe49c0f04b2da37bc4b9bd494e9f..b83d7ebb2d18b527981bda03832337e9ef6219e3 100644 (file)
@@ -136,7 +136,7 @@ fld_debugfs_cache_flush_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static struct file_operations fld_debugfs_cache_flush_fops = {
+static const struct file_operations fld_debugfs_cache_flush_fops = {
        .owner          = THIS_MODULE,
        .open           = simple_open,
        .write          = fld_debugfs_cache_flush_write,
index 242abb88176637773477b9512f28dd53929aa4e7..1e68c77d0cdf714f87a9f68c64b63dee71ad6cff 100644 (file)
@@ -49,7 +49,7 @@
 
 struct lprocfs_vars {
        const char              *name;
-       struct file_operations  *fops;
+       const struct file_operations    *fops;
        void                    *data;
        /**
         * sysfs file mode.
@@ -449,7 +449,7 @@ int lprocfs_exp_cleanup(struct obd_export *exp);
 struct dentry *ldebugfs_add_simple(struct dentry *root,
                                   char *name,
                                   void *data,
-                                  struct file_operations *fops);
+                                  const struct file_operations *fops);
 
 int ldebugfs_register_stats(struct dentry *parent,
                            const char *name,
@@ -536,7 +536,7 @@ static int name##_single_open(struct inode *inode, struct file *file)       \
 {                                                                      \
        return single_open(file, name##_seq_show, inode->i_private);    \
 }                                                                      \
-static struct file_operations name##_fops = {                          \
+static const struct file_operations name##_fops = {                    \
        .owner   = THIS_MODULE,                                     \
        .open    = name##_single_open,                               \
        .read    = seq_read,                                           \
@@ -581,7 +581,7 @@ static struct file_operations name##_fops = {                               \
        {                                                               \
                return single_open(file, NULL, inode->i_private);       \
        }                                                               \
-       static struct file_operations name##_##type##_fops = {  \
+       static const struct file_operations name##_##type##_fops = {    \
                .open   = name##_##type##_open,                         \
                .write  = name##_##type##_write,                        \
                .release = lprocfs_single_release,                      \
index 711fbb004c9b49c59b993abb3e217e1b52f655bb..ab1c85c1ed3896b1d2da0b84f0674dfe633a3a02 100644 (file)
@@ -3114,7 +3114,7 @@ int ll_inode_permission(struct inode *inode, int mask)
 }
 
 /* -o localflock - only provides locally consistent flock locks */
-struct file_operations ll_file_operations = {
+const struct file_operations ll_file_operations = {
        .read_iter = ll_file_read_iter,
        .write_iter = ll_file_write_iter,
        .unlocked_ioctl = ll_file_ioctl,
@@ -3127,7 +3127,7 @@ struct file_operations ll_file_operations = {
        .flush    = ll_flush
 };
 
-struct file_operations ll_file_operations_flock = {
+const struct file_operations ll_file_operations_flock = {
        .read_iter    = ll_file_read_iter,
        .write_iter   = ll_file_write_iter,
        .unlocked_ioctl = ll_file_ioctl,
@@ -3143,7 +3143,7 @@ struct file_operations ll_file_operations_flock = {
 };
 
 /* These are for -o noflock - to return ENOSYS on flock calls */
-struct file_operations ll_file_operations_noflock = {
+const struct file_operations ll_file_operations_noflock = {
        .read_iter    = ll_file_read_iter,
        .write_iter   = ll_file_write_iter,
        .unlocked_ioctl = ll_file_ioctl,
index de09ddfdfa6ab9b4c6700648d479b1a3bfe470ce..41a0c8d95a00ce14599107b21b3ecd8dd86a80d0 100644 (file)
@@ -470,7 +470,7 @@ struct ll_sb_info {
 
        struct ll_ra_info        ll_ra_info;
        unsigned int          ll_namelen;
-       struct file_operations   *ll_fop;
+       const struct file_operations    *ll_fop;
 
        unsigned int              ll_md_brw_pages; /* readdir pages per RPC */
 
@@ -736,9 +736,9 @@ void ll_cl_remove(struct file *file, const struct lu_env *env);
 extern const struct address_space_operations ll_aops;
 
 /* llite/file.c */
-extern struct file_operations ll_file_operations;
-extern struct file_operations ll_file_operations_flock;
-extern struct file_operations ll_file_operations_noflock;
+extern const struct file_operations ll_file_operations;
+extern const struct file_operations ll_file_operations_flock;
+extern const struct file_operations ll_file_operations_noflock;
 extern const struct inode_operations ll_file_inode_operations;
 int ll_have_md_lock(struct inode *inode, __u64 *bits,
                    enum ldlm_mode l_req_mode);
index c742cba601992bcfc0c0d618ac5dee5b1e80b39b..aeae6670e262411b262294340a445a681b622482 100644 (file)
@@ -39,9 +39,9 @@
 #include "vvp_internal.h"
 
 /* debugfs llite mount point registration */
-static struct file_operations ll_rw_extents_stats_fops;
-static struct file_operations ll_rw_extents_stats_pp_fops;
-static struct file_operations ll_rw_offset_stats_fops;
+static const struct file_operations ll_rw_extents_stats_fops;
+static const struct file_operations ll_rw_extents_stats_pp_fops;
+static const struct file_operations ll_rw_offset_stats_fops;
 
 static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr,
                              char *buf)
index 1952bbdeb29e50fed69d0afbca0d9aef6f195dd4..39daa17e073673a5451bbe6ec524d132f7beef4a 100644 (file)
@@ -286,7 +286,7 @@ static int pool_proc_open(struct inode *inode, struct file *file)
        return rc;
 }
 
-static struct file_operations pool_proc_operations = {
+static const struct file_operations pool_proc_operations = {
        .open      = pool_proc_open,
        .read      = seq_read,
        .llseek  = seq_lseek,
index 6d1caed02733d1bccb190da074e2f69f779dda27..bc19f19d38d9a2e08bf7687fe156998e44e7e35c 100644 (file)
@@ -301,7 +301,7 @@ EXPORT_SYMBOL(lprocfs_seq_release);
 
 struct dentry *ldebugfs_add_simple(struct dentry *root,
                                   char *name, void *data,
-                                  struct file_operations *fops)
+                                  const struct file_operations *fops)
 {
        struct dentry *entry;
        umode_t mode = 0;