• Nicolai Stange's avatar
    debugfs: unproxify integer attribute files · 4909f168
    Nicolai Stange authored
    Currently, the struct file_operations associated with the integer attribute
    style files created through the debugfs_create_*() helpers are not file
    lifetime aware as they are defined by means of DEFINE_SIMPLE_ATTRIBUTE().
    Thus, a lifetime managing proxy is created around the original fops each
    time such a file is opened which is an unnecessary waste of resources.
    Migrate all usages of DEFINE_SIMPLE_ATTRIBUTE() within debugfs itself
    to DEFINE_DEBUGFS_ATTRIBUTE() in order to implement file lifetime managing
    within the struct file_operations thus defined.
    Introduce the debugfs_create_mode_unsafe() helper, analogous to
    debugfs_create_mode(), but distinct in that it creates the files in
    non-proxying operation mode through debugfs_create_file_unsafe().
    Feed all struct file_operations migrated to DEFINE_DEBUGFS_ATTRIBUTE()
    into debugfs_create_mode_unsafe() instead of former debugfs_create_mode().
    Signed-off-by: default avatarNicolai Stange <nicstange@gmail.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
file.c 38.3 KB