[lkml]   [2002]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: driverfs API Updates
On Mon, 5 Aug 2002 12:17:13 -0700 (PDT)
Patrick Mochel <> wrote:
> I've also created a macro[1] for defining device attributes, that goes
> like this:
> DEVICE_ATTR(name,"strname",mode,show,store);
> This will create a structure by the name of 'dev_attr_##name', where
> ##name is the first parameter, which can then be passed to
> device_create_file(). [2]

Hi Patrick,
I'll grab 2.5.31 when it comes out and play with it.

Personally, I would get rid of the "strname" (make it implied by the variable
name), and use type instead of show & store, eg:

DEVICE_ATTR(frobbable, O_RDWR, int);

This means you can (1) check that frobbable is actually an int at compile
time (__check_int), (2) you can use __show_int and __store_int as standard
routines, and (3) you can use your own types by:

#define __check_frobbable_t(x) ((void)((&x) == (frobbable_t *)0)
/* Define show_frobbable and store_frobbable here */

DEVICE_ATTR(frobbable, O_RDWR, frobbable_t);

This ties into alot of other projects such as event logging, etc.

PS. yeah yeah, I'll send code RSN.
there are those who do and those who hang on and you don't see too
many doers quoting their contemporaries. -- Larry McVoy
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:27    [W:0.094 / U:9.528 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site