Re: [PATCH 3/6] xfs: add xfs_mount sysfs kobject

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 06, 2014 at 09:13:31AM -0400, Brian Foster wrote:
> Embed a base kobject into xfs_mount. This creates a kobject associated
> with each XFS mount and a subdirectory in sysfs with the name of the
> filesystem. The subdirectory lifecycle matches that of the mount. Also
> add the new xfs_sysfs.[c,h] source files with some XFS sysfs
> infrastructure to facilitate attribute creation.
> 
> Note that there are currently no attributes exported as part of the
> xfs_mount kobject. It exists solely to serve as a per-mount container
> for child objects.
> 
> Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
....
> +#include <linux/sysfs.h>
> +#include "xfs.h"
> +#include "xfs_types.h"
> +#include "xfs_sb.h"
> +#include "xfs_trans_resv.h"
> +#include "xfs_ag.h"
> +#include "xfs_mount.h"
> +
> +struct xfs_sysfs_attr {
> +	struct attribute attr;
> +	ssize_t (*show)(char *buf, void *data);
> +	ssize_t (*store)(const char *buf, size_t count, void *data);
> +};
> +
> +#define XFS_SYSFS_ATTR_RW(name) \
> +	static struct xfs_sysfs_attr xfs_sysfs_attr_##name = __ATTR_RW(name)
> +#define XFS_SYSFS_ATTR_RO(name) \
> +	static struct xfs_sysfs_attr xfs_sysfs_attr_##name = __ATTR_RO(name)
> +
> +#define ATTR_LIST(name) &xfs_sysfs_attr_##name.attr

Not a fan of the sysfs attribute stuff, but it's a generic pattern
so at least the pain is shared by everyone...

Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>


-- 
Dave Chinner
david@xxxxxxxxxxxxx

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux