mirror of
https://github.com/torvalds/linux.git
synced 2026-01-12 00:42:35 +08:00
netdevsim: don't embed file_operations into your structs
Just use debugfs_get_aux() instead of debugfs_real_fops(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Link: https://lore.kernel.org/r/20250112080705.141166-10-viro@zeniv.linux.org.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
231e9f0512
commit
1eb87004d2
@@ -331,7 +331,6 @@ enum nsim_dev_hwstats_do {
|
||||
};
|
||||
|
||||
struct nsim_dev_hwstats_fops {
|
||||
const struct file_operations fops;
|
||||
enum nsim_dev_hwstats_do action;
|
||||
enum netdev_offload_xstats_type type;
|
||||
};
|
||||
@@ -342,13 +341,12 @@ nsim_dev_hwstats_do_write(struct file *file,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct nsim_dev_hwstats *hwstats = file->private_data;
|
||||
struct nsim_dev_hwstats_fops *hwsfops;
|
||||
const struct nsim_dev_hwstats_fops *hwsfops;
|
||||
struct list_head *hwsdev_list;
|
||||
int ifindex;
|
||||
int err;
|
||||
|
||||
hwsfops = container_of(debugfs_real_fops(file),
|
||||
struct nsim_dev_hwstats_fops, fops);
|
||||
hwsfops = debugfs_get_aux(file);
|
||||
|
||||
err = kstrtoint_from_user(data, count, 0, &ifindex);
|
||||
if (err)
|
||||
@@ -381,14 +379,13 @@ nsim_dev_hwstats_do_write(struct file *file,
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct debugfs_short_fops debugfs_ops = {
|
||||
.write = nsim_dev_hwstats_do_write,
|
||||
.llseek = generic_file_llseek,
|
||||
};
|
||||
|
||||
#define NSIM_DEV_HWSTATS_FOPS(ACTION, TYPE) \
|
||||
{ \
|
||||
.fops = { \
|
||||
.open = simple_open, \
|
||||
.write = nsim_dev_hwstats_do_write, \
|
||||
.llseek = generic_file_llseek, \
|
||||
.owner = THIS_MODULE, \
|
||||
}, \
|
||||
.action = ACTION, \
|
||||
.type = TYPE, \
|
||||
}
|
||||
@@ -433,12 +430,12 @@ int nsim_dev_hwstats_init(struct nsim_dev *nsim_dev)
|
||||
goto err_remove_hwstats_recursive;
|
||||
}
|
||||
|
||||
debugfs_create_file("enable_ifindex", 0200, hwstats->l3_ddir, hwstats,
|
||||
&nsim_dev_hwstats_l3_enable_fops.fops);
|
||||
debugfs_create_file("disable_ifindex", 0200, hwstats->l3_ddir, hwstats,
|
||||
&nsim_dev_hwstats_l3_disable_fops.fops);
|
||||
debugfs_create_file("fail_next_enable", 0200, hwstats->l3_ddir, hwstats,
|
||||
&nsim_dev_hwstats_l3_fail_fops.fops);
|
||||
debugfs_create_file_aux("enable_ifindex", 0200, hwstats->l3_ddir, hwstats,
|
||||
&nsim_dev_hwstats_l3_enable_fops, &debugfs_ops);
|
||||
debugfs_create_file_aux("disable_ifindex", 0200, hwstats->l3_ddir, hwstats,
|
||||
&nsim_dev_hwstats_l3_disable_fops, &debugfs_ops);
|
||||
debugfs_create_file_aux("fail_next_enable", 0200, hwstats->l3_ddir, hwstats,
|
||||
&nsim_dev_hwstats_l3_fail_fops, &debugfs_ops);
|
||||
|
||||
INIT_DELAYED_WORK(&hwstats->traffic_dw,
|
||||
&nsim_dev_hwstats_traffic_work);
|
||||
|
||||
Reference in New Issue
Block a user