Linux 5.6 compat: struct proc_ops

The proc_ops structure was introduced to replace the use of of the
file_operations structure when registering proc handlers.  This
change creates a new kstat_proc_op_t typedef for compatibility
which can be used to pass around the correct structure.

This change additionally adds the 'const' keyword to all of the
existing proc operations structures.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #9961
This commit is contained in:
Brian Behlendorf
2020-02-06 10:30:41 -08:00
parent e0ce98d57c
commit 0dd7364853
6 changed files with 97 additions and 12 deletions
+27 -6
View File
@@ -532,11 +532,18 @@ proc_slab_open(struct inode *inode, struct file *filp)
return (seq_open(filp, &slab_seq_ops));
}
static struct file_operations proc_slab_operations = {
.open = proc_slab_open,
.read = seq_read,
.llseek = seq_lseek,
static const kstat_proc_op_t proc_slab_operations = {
#ifdef HAVE_PROC_OPS_STRUCT
.proc_open = proc_slab_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = seq_release,
#else
.open = proc_slab_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
#endif
};
static void
@@ -571,18 +578,32 @@ proc_taskq_open(struct inode *inode, struct file *filp)
return (seq_open(filp, &taskq_seq_ops));
}
static struct file_operations proc_taskq_all_operations = {
static const kstat_proc_op_t proc_taskq_all_operations = {
#ifdef HAVE_PROC_OPS_STRUCT
.proc_open = proc_taskq_all_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = seq_release,
#else
.open = proc_taskq_all_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
#endif
};
static struct file_operations proc_taskq_operations = {
static const kstat_proc_op_t proc_taskq_operations = {
#ifdef HAVE_PROC_OPS_STRUCT
.proc_open = proc_taskq_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = seq_release,
#else
.open = proc_taskq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
#endif
};
static struct ctl_table spl_kmem_table[] = {