mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Satyam Sharma <ssatyam@cse.iitk.ac.in>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Joel Becker <joel.becker@oracle.com>,
	Satyam Sharma <ssatyam@cse.iitk.ac.in>,
	David Teigland <david.teigland@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Mark Fasheh <mark.fasheh@oracle.com>
Subject: [PATCH -mm 1/3] configfs+dlm: Separate out __CONFIGFS_ATTR into configfs.h
Date: Wed, 04 Jul 2007 16:37:06 +0530	[thread overview]
Message-ID: <20070704110706.28503.65615.sendpatchset@cselinux1.cse.iitk.ac.in> (raw)
In-Reply-To: <20070704110701.28503.95359.sendpatchset@cselinux1.cse.iitk.ac.in>

From: Satyam Sharma <ssatyam@cse.iitk.ac.in>

[1/3] configfs+dlm: Separate out __CONFIGFS_ATTR into configfs.h

fs/dlm/config.c contains a useful generic macro called __CONFIGFS_ATTR
that is similar to sysfs' __ATTR macro that makes defining attributes
easy for any user of configfs. Separate it out into configfs.h so that
other users (forthcoming in dynamic netconsole patchset) can use it too.

Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>
Cc: Joel Becker <joel.becker@oracle.com>
Cc: David Teigland <teigland@redhat.com>

---

 fs/dlm/config.c          |    8 --------
 include/linux/configfs.h |   16 ++++++++++++++++
 2 files changed, 16 insertions(+), 8 deletions(-)

---

diff -ruNp a/fs/dlm/config.c b/fs/dlm/config.c
--- a/fs/dlm/config.c	2007-06-28 17:32:57.000000000 +0530
+++ b/fs/dlm/config.c	2007-07-03 16:56:35.000000000 +0530
@@ -133,14 +133,6 @@ static ssize_t cluster_set(struct cluste
 	return len;
 }
 
-#define __CONFIGFS_ATTR(_name,_mode,_read,_write) {                           \
-	.attr   = { .ca_name = __stringify(_name),                            \
-		    .ca_mode = _mode,                                         \
-		    .ca_owner = THIS_MODULE },                                \
-	.show   = _read,                                                      \
-	.store  = _write,                                                     \
-}
-
 #define CLUSTER_ATTR(name, check_zero)                                        \
 static ssize_t name##_write(struct cluster *cl, const char *buf, size_t len)  \
 {                                                                             \
diff -ruNp a/include/linux/configfs.h b/include/linux/configfs.h
--- a/include/linux/configfs.h	2007-06-28 17:33:19.000000000 +0530
+++ b/include/linux/configfs.h	2007-07-03 16:56:35.000000000 +0530
@@ -130,6 +130,22 @@ struct configfs_attribute {
 	mode_t			ca_mode;
 };
 
+/*
+ * Users often need to create attribute structures for their configurable
+ * attributes, containing a configfs_attribute member and function pointers
+ * for the show() and store() operations on that attribute. They can use
+ * this macro (similar to sysfs' __ATTR) to make defining attributes easier.
+ */
+#define __CONFIGFS_ATTR(_name, _mode, _show, _store)			\
+{									\
+	.attr	= {							\
+			.ca_name = __stringify(_name),			\
+			.ca_mode = _mode,				\
+			.ca_owner = THIS_MODULE,			\
+	},								\
+	.show	= _show,						\
+	.store	= _store,						\
+}
 
 /*
  * If allow_link() exists, the item can symlink(2) out to other

  reply	other threads:[~2007-07-04 11:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-04 11:07 [PATCH -mm 0/3] configfs: Miscellaneous cleanups Satyam Sharma
2007-07-04 11:07 ` Satyam Sharma [this message]
2007-07-04 11:07 ` [PATCH -mm 2/3] configfs+dlm+ocfs2: Convert subsystem semaphore to mutex Satyam Sharma
2007-07-07  6:36   ` [PATCH] configfs: " Joel Becker
2007-07-07  8:00     ` Satyam Sharma
2007-07-04 11:07 ` [PATCH -mm 3/3] configfs+dlm: Rename config_group_find_obj and state semantics clearly Satyam Sharma
2007-07-04 11:28 ` [PATCH -mm 0/3] configfs: Miscellaneous cleanups Satyam Sharma
2007-07-05  6:30 ` Joel Becker
2007-07-05  9:30   ` Satyam Sharma
2007-07-05 13:39   ` David Teigland
2007-07-07  5:32   ` Joel Becker

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=20070704110706.28503.65615.sendpatchset@cselinux1.cse.iitk.ac.in \
    --to=ssatyam@cse.iitk.ac.in \
    --cc=akpm@linux-foundation.org \
    --cc=david.teigland@redhat.com \
    --cc=joel.becker@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.fasheh@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®