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@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html