linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [ConfigFS]: Added CONFIGFS_EATTR_OPS_RO() to remove unused store() function
@ 2008-10-24  1:11 Nicholas A. Bellinger
  0 siblings, 0 replies; only message in thread
From: Nicholas A. Bellinger @ 2008-10-24  1:11 UTC (permalink / raw)
  To: Joel Becker; +Cc: LKML, Linux-fsdevel, Linux-iSCSI.org Target Dev

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




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-10-24  1:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-24  1:11 [PATCH] [ConfigFS]: Added CONFIGFS_EATTR_OPS_RO() to remove unused store() function Nicholas A. Bellinger

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