public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Patrick Mochel <mochel@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: driverfs API Updates
Date: Thu, 8 Aug 2002 13:44:07 +1000	[thread overview]
Message-ID: <20020808134407.18fe4041.rusty@rustcorp.com.au> (raw)
In-Reply-To: <Pine.LNX.4.44.0208051216090.1241-100000@cherise.pdx.osdl.net>

On Mon, 5 Aug 2002 12:17:13 -0700 (PDT)
Patrick Mochel <mochel@osdl.org> 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.

Rusty.
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

  parent reply	other threads:[~2002-08-08  3:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-05 19:17 driverfs API Updates Patrick Mochel
2002-08-05 19:47 ` Kai Germaschewski
2002-08-05 20:17   ` Patrick Mochel
2002-08-05 23:38 ` Patrick Mansfield
2002-08-06 16:48   ` Patrick Mochel
2002-08-06 17:44 ` driverfs and ieee1394 Kristian Hogsberg
2002-08-19 19:28   ` Patrick Mochel
2002-08-08  3:44 ` Rusty Russell [this message]
2002-08-08 18:21   ` driverfs API Updates Patrick Mochel
2002-08-09  1:20     ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020808134407.18fe4041.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox