• Arnd Bergmann's avatar
    [PATCH] libfs: add simple attribute files · acaefc25
    Arnd Bergmann authored
    Based on the discussion about spufs attributes, this is my suggestion
    for a more generic attribute file support that can be used by both
    debugfs and spufs.
    
    Simple attribute files behave similarly to sequential files from
    a kernel programmers perspective in that a standard set of file
    operations is provided and only an open operation needs to
    be written that registers file specific get() and set() functions.
    
    These operations are defined as
    
    void foo_set(void *data, u64 val); and
    u64 foo_get(void *data);
    
    where data is the inode->u.generic_ip pointer of the file and the
    operations just need to make send of that pointer. The infrastructure
    makes sure this works correctly with concurrent access and partial
    read calls.
    
    A macro named DEFINE_SIMPLE_ATTRIBUTE is provided to further simplify
    using the attributes.
    
    This patch already contains the changes for debugfs to use attributes
    for its internal file operations.
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    acaefc25
file.c 8.51 KB