diff options
author | Satyam Sharma <ssatyam@cse.iitk.ac.in> | 2007-07-04 07:07:06 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2007-07-10 19:52:27 -0400 |
commit | 9b1d9aa4e9c5cafe73b9df21d758b50b5d75264d (patch) | |
tree | fdb043638b15b429fb3b04be8d56667c3d9963be | |
parent | 4c62b53454a83178676e5ecae6665447d363c7b4 (diff) |
[PATCH] 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: David Teigland <teigland@redhat.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
-rw-r--r-- | fs/dlm/config.c | 8 | ||||
-rw-r--r-- | include/linux/configfs.h | 16 |
2 files changed, 16 insertions, 8 deletions
diff --git a/fs/dlm/config.c b/fs/dlm/config.c index 5069b2cb5a1f..e47eb42406fa 100644 --- a/fs/dlm/config.c +++ b/fs/dlm/config.c | |||
@@ -133,14 +133,6 @@ static ssize_t cluster_set(struct cluster *cl, unsigned int *cl_field, | |||
133 | return len; | 133 | return len; |
134 | } | 134 | } |
135 | 135 | ||
136 | #define __CONFIGFS_ATTR(_name,_mode,_read,_write) { \ | ||
137 | .attr = { .ca_name = __stringify(_name), \ | ||
138 | .ca_mode = _mode, \ | ||
139 | .ca_owner = THIS_MODULE }, \ | ||
140 | .show = _read, \ | ||
141 | .store = _write, \ | ||
142 | } | ||
143 | |||
144 | #define CLUSTER_ATTR(name, check_zero) \ | 136 | #define CLUSTER_ATTR(name, check_zero) \ |
145 | static ssize_t name##_write(struct cluster *cl, const char *buf, size_t len) \ | 137 | static ssize_t name##_write(struct cluster *cl, const char *buf, size_t len) \ |
146 | { \ | 138 | { \ |
diff --git a/include/linux/configfs.h b/include/linux/configfs.h index 3d4a96eb0e9b..def7c83d43a2 100644 --- a/include/linux/configfs.h +++ b/include/linux/configfs.h | |||
@@ -130,6 +130,22 @@ struct configfs_attribute { | |||
130 | mode_t ca_mode; | 130 | mode_t ca_mode; |
131 | }; | 131 | }; |
132 | 132 | ||
133 | /* | ||
134 | * Users often need to create attribute structures for their configurable | ||
135 | * attributes, containing a configfs_attribute member and function pointers | ||
136 | * for the show() and store() operations on that attribute. They can use | ||
137 | * this macro (similar to sysfs' __ATTR) to make defining attributes easier. | ||
138 | */ | ||
139 | #define __CONFIGFS_ATTR(_name, _mode, _show, _store) \ | ||
140 | { \ | ||
141 | .attr = { \ | ||
142 | .ca_name = __stringify(_name), \ | ||
143 | .ca_mode = _mode, \ | ||
144 | .ca_owner = THIS_MODULE, \ | ||
145 | }, \ | ||
146 | .show = _show, \ | ||
147 | .store = _store, \ | ||
148 | } | ||
133 | 149 | ||
134 | /* | 150 | /* |
135 | * If allow_link() exists, the item can symlink(2) out to other | 151 | * If allow_link() exists, the item can symlink(2) out to other |