@@ -331,7 +331,6 @@ enum nsim_dev_hwstats_do {
331
331
};
332
332
333
333
struct nsim_dev_hwstats_fops {
334
- const struct file_operations fops ;
335
334
enum nsim_dev_hwstats_do action ;
336
335
enum netdev_offload_xstats_type type ;
337
336
};
@@ -342,13 +341,12 @@ nsim_dev_hwstats_do_write(struct file *file,
342
341
size_t count , loff_t * ppos )
343
342
{
344
343
struct nsim_dev_hwstats * hwstats = file -> private_data ;
345
- struct nsim_dev_hwstats_fops * hwsfops ;
344
+ const struct nsim_dev_hwstats_fops * hwsfops ;
346
345
struct list_head * hwsdev_list ;
347
346
int ifindex ;
348
347
int err ;
349
348
350
- hwsfops = container_of (debugfs_real_fops (file ),
351
- struct nsim_dev_hwstats_fops , fops );
349
+ hwsfops = debugfs_get_aux (file );
352
350
353
351
err = kstrtoint_from_user (data , count , 0 , & ifindex );
354
352
if (err )
@@ -381,14 +379,13 @@ nsim_dev_hwstats_do_write(struct file *file,
381
379
return count ;
382
380
}
383
381
382
+ static struct debugfs_short_fops debugfs_ops = {
383
+ .write = nsim_dev_hwstats_do_write ,
384
+ .llseek = generic_file_llseek ,
385
+ };
386
+
384
387
#define NSIM_DEV_HWSTATS_FOPS (ACTION , TYPE ) \
385
388
{ \
386
- .fops = { \
387
- .open = simple_open, \
388
- .write = nsim_dev_hwstats_do_write, \
389
- .llseek = generic_file_llseek, \
390
- .owner = THIS_MODULE, \
391
- }, \
392
389
.action = ACTION, \
393
390
.type = TYPE, \
394
391
}
@@ -433,12 +430,12 @@ int nsim_dev_hwstats_init(struct nsim_dev *nsim_dev)
433
430
goto err_remove_hwstats_recursive ;
434
431
}
435
432
436
- debugfs_create_file ("enable_ifindex" , 0200 , hwstats -> l3_ddir , hwstats ,
437
- & nsim_dev_hwstats_l3_enable_fops . fops );
438
- debugfs_create_file ("disable_ifindex" , 0200 , hwstats -> l3_ddir , hwstats ,
439
- & nsim_dev_hwstats_l3_disable_fops . fops );
440
- debugfs_create_file ("fail_next_enable" , 0200 , hwstats -> l3_ddir , hwstats ,
441
- & nsim_dev_hwstats_l3_fail_fops . fops );
433
+ debugfs_create_file_aux ("enable_ifindex" , 0200 , hwstats -> l3_ddir , hwstats ,
434
+ & nsim_dev_hwstats_l3_enable_fops , & debugfs_ops );
435
+ debugfs_create_file_aux ("disable_ifindex" , 0200 , hwstats -> l3_ddir , hwstats ,
436
+ & nsim_dev_hwstats_l3_disable_fops , & debugfs_ops );
437
+ debugfs_create_file_aux ("fail_next_enable" , 0200 , hwstats -> l3_ddir , hwstats ,
438
+ & nsim_dev_hwstats_l3_fail_fops , & debugfs_ops );
442
439
443
440
INIT_DELAYED_WORK (& hwstats -> traffic_dw ,
444
441
& nsim_dev_hwstats_traffic_work );
0 commit comments