All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: Greg KH <greg@kroah.com>
Cc: zanussi@us.ibm.com, linux-kernel@vger.kernel.org
Subject: [PATCH] sysfs: Add __ATTR_RELAY() helper for relay attributes.
Date: Tue, 21 Feb 2006 17:10:31 +0200	[thread overview]
Message-ID: <20060221151031.GA20816@linux-sh.org> (raw)
In-Reply-To: <20060220222449.GC28042@kroah.com>

On Mon, Feb 20, 2006 at 02:24:49PM -0800, Greg KH wrote:
> One thing to note, a lot of people forgot to set that field for binary
> attribute files, while "normal" attributes get it set "automatically"
> due to the macro that was used to create them.  You might consider also
> creating a macro for this struture so people can not forget to set the
> field.
> 
Good point, how about this?

This adds a simple __ATTR_RELAY() to help people define relay attributes,
this takes care of things like getting the module owner right.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

---

 include/linux/sysfs.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

5a1440482f48b3ab4b8365a8081295869992bad2
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 0faca48..36a078e 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -44,6 +44,16 @@ struct attribute_group {
 	.show	= _name##_show,	\
 }
 
+#define __ATTR_RELAY(_name,_buffer_size,_nr_buffers) {	\
+	.attr	= {					\
+		.owner = THIS_MODULE,			\
+		.name = __stringify(_name),		\
+		.mode = 0400,				\
+	},						\
+	.subbuf_size	= _buffer_size,			\
+	.n_subbufs	= _nr_buffers,			\
+}
+
 #define __ATTR_NULL { .attr = { .name = NULL } }
 
 #define attr_name(_attr) (_attr).attr.name

      reply	other threads:[~2006-02-21 15:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-19 17:17 [PATCH, RFC] sysfs: relay channel buffers as sysfs attributes Paul Mundt
2006-02-19 17:21 ` Christoph Hellwig
2006-02-19 17:56 ` Greg KH
2006-02-19 18:52   ` Paul Mundt
2006-02-20  5:29     ` Tom Zanussi
2006-02-20  9:20       ` Jens Axboe
2006-02-20 11:17       ` Paul Mundt
2006-02-20 13:05       ` Mathieu Desnoyers
2006-02-20 14:17         ` Christoph Hellwig
2006-02-20 17:15         ` Paul Mundt
2006-02-20 17:37           ` Mathieu Desnoyers
2006-02-20 22:27             ` Greg KH
2006-02-21 15:21             ` Paul Mundt
2006-02-21 16:48               ` Mathieu Desnoyers
2006-02-21 17:43                 ` Greg KH
2006-02-22 21:27                   ` Karim Yaghmour
2006-02-22 21:32                     ` Greg KH
2006-02-20 22:24     ` Greg KH
2006-02-21 15:10       ` Paul Mundt [this message]

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=20060221151031.GA20816@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zanussi@us.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.