Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b1d9aa4 authored by Satyam Sharma's avatar Satyam Sharma Committed by Mark Fasheh
Browse files

[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: default avatarSatyam Sharma <ssatyam@cse.iitk.ac.in>
Cc: David Teigland <teigland@redhat.com>
Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
parent 4c62b534
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -133,14 +133,6 @@ static ssize_t cluster_set(struct cluster *cl, unsigned int *cl_field,
	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)  \
{                                                                             \
+16 −0
Original line number Diff line number Diff line
@@ -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