blob: ae9aa7a1a06a8ffca33a9e71abda860485ded34e [file] [log] [blame]
Brian Fostera31b1d32014-07-15 08:07:01 +10001/*
2 * Copyright (c) 2014 Red Hat, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include "xfs.h"
20#include "xfs_sysfs.h"
21
22struct xfs_sysfs_attr {
23 struct attribute attr;
24 ssize_t (*show)(char *buf, void *data);
25 ssize_t (*store)(const char *buf, size_t count, void *data);
26};
27
28static inline struct xfs_sysfs_attr *
29to_attr(struct attribute *attr)
30{
31 return container_of(attr, struct xfs_sysfs_attr, attr);
32}
33
34#define XFS_SYSFS_ATTR_RW(name) \
35 static struct xfs_sysfs_attr xfs_sysfs_attr_##name = __ATTR_RW(name)
36#define XFS_SYSFS_ATTR_RO(name) \
37 static struct xfs_sysfs_attr xfs_sysfs_attr_##name = __ATTR_RO(name)
38
39#define ATTR_LIST(name) &xfs_sysfs_attr_##name.attr
40
41/*
42 * xfs_mount kobject. This currently has no attributes and thus no need for show
43 * and store helpers. The mp kobject serves as the per-mount parent object that
44 * is identified by the fsname under sysfs.
45 */
46
47struct kobj_type xfs_mp_ktype = {
48 .release = xfs_sysfs_release,
49};