debugfs: unproxify files created through debugfs_create_bool()
authorNicolai Stange <nicstange@gmail.com>
Tue, 22 Mar 2016 13:11:18 +0000 (14:11 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Apr 2016 21:14:21 +0000 (14:14 -0700)
commit4d45f7974ccf0aa783034fef2661573b3a28609e
tree302b046fc51e7215d5eca256385dfc2d7e98852f
parent4909f168104b24f592fb8d502e2a6520346a3927
debugfs: unproxify files created through debugfs_create_bool()

Currently, the struct file_operations fops_bool associated with files
created through the debugfs_create_bool() helpers are not file
lifetime aware.

Thus, a lifetime managing proxy is created around fops_bool each time such
a file is opened which is an unnecessary waste of resources.

Implement file lifetime management for the fops_bool file_operations.
Namely, make debugfs_read_file_bool() and debugfs_write_file_bool() safe
against file removals by means of debugfs_use_file_start() and
debugfs_use_file_finish().

Make debugfs_create_bool() create its files in non-proxying operation mode
through debugfs_create_mode_unsafe().

Finally, purge debugfs_create_mode() as debugfs_create_bool() had been its
last user.

Signed-off-by: Nicolai Stange <nicstange@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/debugfs/file.c