linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Joel Becker <joel.becker@oracle.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	"Linux-iSCSI.org Target Dev"
	<linux-iscsi-target-dev@googlegroups.com>
Subject: [PATCH] [ConfigFS]: Added CONFIGFS_EATTR_OPS_RO() to remove unused store() function
Date: Thu, 23 Oct 2008 18:11:43 -0700	[thread overview]
Message-ID: <1224810703.16558.19.camel@haakon2.linux-iscsi.org> (raw)

Hi again,

Added another change to the CONFIGFS_EATTR() macros I am using in
drivers/lio-core/configfs_macros.h:

When using __CONFIGFS_ATTR_RO(), I noticed that CONFIGFS_ATTR_OPS() was
getting the compiler warning about unused store() functions.  So I ended
up breaking out the 3 functions into three different macros..

Thanks!

--nab

>From 4cfb0287a2fc48bc414e3467edb8cdfc88c2fc72 Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <nab@linux-iscsi.org>
Date: Thu, 23 Oct 2008 06:56:29 -0700
Subject: [PATCH] [ConfigFS]: Added CONFIGFS_EATTR_OPS_RO() to remove unused store() function

Added CONFIGFS_EATTR_OPS_RO() macro only defines show().  This patch also
breaks out the show()/store() and to_##_name() functions into their own
macros.

Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
---
 drivers/lio-core/configfs_macros.h |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/lio-core/configfs_macros.h b/drivers/lio-core/configfs_macros.h
index 4dd3f1e..2185822 100644
--- a/drivers/lio-core/configfs_macros.h
+++ b/drivers/lio-core/configfs_macros.h
@@ -98,12 +98,14 @@ struct _name##_attribute {						\
  *		                      ^^_item^^^^^  ^^_item_member^^^
  * This macro expects the attributes to be named "struct <name>_attribute".
  */
-#define CONFIGFS_EATTR_OPS(_name, _item, _item_member)			\
+#define CONFIGFS_EATTR_OPS_TO_FUNC(_name, _item, _item_member)		\
 static struct _item *to_##_name(struct config_item *ci)			\
 {									\
 	return((ci) ? container_of(to_config_group(ci), struct _item,	\
 		_item_member) : NULL);					\
-}									\
+}
+
+#define CONFIGFS_EATTR_OPS_SHOW(_name, _item)				\
 static ssize_t _name##_attr_show(struct config_item *item,		\
 				 struct configfs_attribute *attr,	\
 				 char *page)				\
@@ -116,7 +118,9 @@ static ssize_t _name##_attr_show(struct config_item *item,		\
 	if (_name##_attr->show)						\
 		ret = _name##_attr->show(_item, page);			\
 	return ret;							\
-}									\
+}
+
+#define CONFIGFS_EATTR_OPS_STORE(_name, _item)				\
 static ssize_t _name##_attr_store(struct config_item *item,		\
 				  struct configfs_attribute *attr,	\
 				  const char *page, size_t count)	\
@@ -131,4 +135,13 @@ static ssize_t _name##_attr_store(struct config_item *item,		\
 	return ret;							\
 }
 
+#define CONFIGFS_EATTR_OPS(_name, _item, _item_member)			\
+CONFIGFS_EATTR_OPS_TO_FUNC(_name, _item, _item_member);			\
+CONFIGFS_EATTR_OPS_SHOW(_name, _item);					\
+CONFIGFS_EATTR_OPS_STORE(_name, _item);	
+
+#define CONFIGFS_EATTR_OPS_RO(_name, _item, _item_member)		\
+CONFIGFS_EATTR_OPS_TO_FUNC(_name, _item, _item_member);			\
+CONFIGFS_EATTR_OPS_SHOW(_name, _item);
+
 #endif /* _CONFIGFS_MACROS_H_ */
-- 
1.5.4.1




                 reply	other threads:[~2008-10-24  1:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1224810703.16558.19.camel@haakon2.linux-iscsi.org \
    --to=nab@linux-iscsi.org \
    --cc=joel.becker@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-iscsi-target-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).