]> bbs.cooldavid.org Git - net-next-2.6.git/commit - fs/libfs.c
[PATCH] libfs: add simple attribute files
authorArnd Bergmann <arnd@arndb.de>
Wed, 18 May 2005 12:40:59 +0000 (14:40 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Jun 2005 22:15:30 +0000 (15:15 -0700)
commitacaefc25d21f850e47ecc5098d1e0bc442c526be
treefbc7aa605c71667507b54d3b3320f9a999458dd4
parent4109aca06cb7b042ea791d0f9d3c9615bc3bf5cd
[PATCH] libfs: add simple attribute files

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: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/debugfs/file.c
fs/libfs.c
include/linux/fs.h