mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
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:
@@ -507,12 +507,20 @@ proc_kstat_write(struct file *filp, const char __user *buf, size_t len,
|
||||
return (len);
|
||||
}
|
||||
|
||||
static struct file_operations proc_kstat_operations = {
|
||||
static const kstat_proc_op_t proc_kstat_operations = {
|
||||
#ifdef HAVE_PROC_OPS_STRUCT
|
||||
.proc_open = proc_kstat_open,
|
||||
.proc_write = proc_kstat_write,
|
||||
.proc_read = seq_read,
|
||||
.proc_lseek = seq_lseek,
|
||||
.proc_release = seq_release,
|
||||
#else
|
||||
.open = proc_kstat_open,
|
||||
.write = proc_kstat_write,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release,
|
||||
#endif
|
||||
};
|
||||
|
||||
void
|
||||
@@ -656,7 +664,7 @@ kstat_detect_collision(kstat_proc_entry_t *kpep)
|
||||
*/
|
||||
void
|
||||
kstat_proc_entry_install(kstat_proc_entry_t *kpep, mode_t mode,
|
||||
const struct file_operations *file_ops, void *data)
|
||||
const kstat_proc_op_t *proc_ops, void *data)
|
||||
{
|
||||
kstat_module_t *module;
|
||||
kstat_proc_entry_t *tmp = NULL;
|
||||
@@ -690,7 +698,7 @@ kstat_proc_entry_install(kstat_proc_entry_t *kpep, mode_t mode,
|
||||
|
||||
kpep->kpe_owner = module;
|
||||
kpep->kpe_proc = proc_create_data(kpep->kpe_name, mode,
|
||||
module->ksm_proc, file_ops, data);
|
||||
module->ksm_proc, proc_ops, data);
|
||||
if (kpep->kpe_proc == NULL) {
|
||||
list_del_init(&kpep->kpe_list);
|
||||
if (list_empty(&module->ksm_kstat_list))
|
||||
|
||||
@@ -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[] = {
|
||||
|
||||
@@ -185,13 +185,20 @@ procfs_list_write(struct file *filp, const char __user *buf, size_t len,
|
||||
return (len);
|
||||
}
|
||||
|
||||
static struct file_operations procfs_list_operations = {
|
||||
.owner = THIS_MODULE,
|
||||
static const kstat_proc_op_t procfs_list_operations = {
|
||||
#ifdef HAVE_PROC_OPS_STRUCT
|
||||
.proc_open = procfs_list_open,
|
||||
.proc_write = procfs_list_write,
|
||||
.proc_read = seq_read,
|
||||
.proc_lseek = seq_lseek,
|
||||
.proc_release = seq_release_private,
|
||||
#else
|
||||
.open = procfs_list_open,
|
||||
.write = procfs_list_write,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release_private,
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user