eata_pio: missing break statement
[linux/fpc-iii.git] / fs / nilfs2 / sysfs.h
blob677e3a1a83708d26e8fadc5a9f7eb6992ef74d59
1 /*
2 * sysfs.h - sysfs support declarations.
4 * Copyright (C) 2005-2014 Nippon Telegraph and Telephone Corporation.
5 * Copyright (C) 2014 HGST, Inc., a Western Digital Company.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * Written by Vyacheslav Dubeyko <Vyacheslav.Dubeyko@hgst.com>
20 #ifndef _NILFS_SYSFS_H
21 #define _NILFS_SYSFS_H
23 #include <linux/sysfs.h>
25 #define NILFS_ROOT_GROUP_NAME "nilfs2"
28 * struct nilfs_sysfs_dev_subgroups - device subgroup kernel objects
29 * @sg_superblock_kobj: /sys/fs/<nilfs>/<device>/superblock
30 * @sg_superblock_kobj_unregister: completion state
31 * @sg_segctor_kobj: /sys/fs/<nilfs>/<device>/segctor
32 * @sg_segctor_kobj_unregister: completion state
33 * @sg_mounted_snapshots_kobj: /sys/fs/<nilfs>/<device>/mounted_snapshots
34 * @sg_mounted_snapshots_kobj_unregister: completion state
35 * @sg_checkpoints_kobj: /sys/fs/<nilfs>/<device>/checkpoints
36 * @sg_checkpoints_kobj_unregister: completion state
37 * @sg_segments_kobj: /sys/fs/<nilfs>/<device>/segments
38 * @sg_segments_kobj_unregister: completion state
40 struct nilfs_sysfs_dev_subgroups {
41 /* /sys/fs/<nilfs>/<device>/superblock */
42 struct kobject sg_superblock_kobj;
43 struct completion sg_superblock_kobj_unregister;
45 /* /sys/fs/<nilfs>/<device>/segctor */
46 struct kobject sg_segctor_kobj;
47 struct completion sg_segctor_kobj_unregister;
49 /* /sys/fs/<nilfs>/<device>/mounted_snapshots */
50 struct kobject sg_mounted_snapshots_kobj;
51 struct completion sg_mounted_snapshots_kobj_unregister;
53 /* /sys/fs/<nilfs>/<device>/checkpoints */
54 struct kobject sg_checkpoints_kobj;
55 struct completion sg_checkpoints_kobj_unregister;
57 /* /sys/fs/<nilfs>/<device>/segments */
58 struct kobject sg_segments_kobj;
59 struct completion sg_segments_kobj_unregister;
62 #define NILFS_COMMON_ATTR_STRUCT(name) \
63 struct nilfs_##name##_attr { \
64 struct attribute attr; \
65 ssize_t (*show)(struct kobject *, struct attribute *, \
66 char *); \
67 ssize_t (*store)(struct kobject *, struct attribute *, \
68 const char *, size_t); \
71 NILFS_COMMON_ATTR_STRUCT(feature);
73 #define NILFS_DEV_ATTR_STRUCT(name) \
74 struct nilfs_##name##_attr { \
75 struct attribute attr; \
76 ssize_t (*show)(struct nilfs_##name##_attr *, struct the_nilfs *, \
77 char *); \
78 ssize_t (*store)(struct nilfs_##name##_attr *, struct the_nilfs *, \
79 const char *, size_t); \
82 NILFS_DEV_ATTR_STRUCT(dev);
83 NILFS_DEV_ATTR_STRUCT(segments);
84 NILFS_DEV_ATTR_STRUCT(mounted_snapshots);
85 NILFS_DEV_ATTR_STRUCT(checkpoints);
86 NILFS_DEV_ATTR_STRUCT(superblock);
87 NILFS_DEV_ATTR_STRUCT(segctor);
89 #define NILFS_CP_ATTR_STRUCT(name) \
90 struct nilfs_##name##_attr { \
91 struct attribute attr; \
92 ssize_t (*show)(struct nilfs_##name##_attr *, struct nilfs_root *, \
93 char *); \
94 ssize_t (*store)(struct nilfs_##name##_attr *, struct nilfs_root *, \
95 const char *, size_t); \
98 NILFS_CP_ATTR_STRUCT(snapshot);
100 #define NILFS_ATTR(type, name, mode, show, store) \
101 static struct nilfs_##type##_attr nilfs_##type##_attr_##name = \
102 __ATTR(name, mode, show, store)
104 #define NILFS_INFO_ATTR(type, name) \
105 NILFS_ATTR(type, name, 0444, NULL, NULL)
106 #define NILFS_RO_ATTR(type, name) \
107 NILFS_ATTR(type, name, 0444, nilfs_##type##_##name##_show, NULL)
108 #define NILFS_RW_ATTR(type, name) \
109 NILFS_ATTR(type, name, 0644, \
110 nilfs_##type##_##name##_show, \
111 nilfs_##type##_##name##_store)
113 #define NILFS_FEATURE_INFO_ATTR(name) \
114 NILFS_INFO_ATTR(feature, name)
115 #define NILFS_FEATURE_RO_ATTR(name) \
116 NILFS_RO_ATTR(feature, name)
117 #define NILFS_FEATURE_RW_ATTR(name) \
118 NILFS_RW_ATTR(feature, name)
120 #define NILFS_DEV_INFO_ATTR(name) \
121 NILFS_INFO_ATTR(dev, name)
122 #define NILFS_DEV_RO_ATTR(name) \
123 NILFS_RO_ATTR(dev, name)
124 #define NILFS_DEV_RW_ATTR(name) \
125 NILFS_RW_ATTR(dev, name)
127 #define NILFS_SEGMENTS_RO_ATTR(name) \
128 NILFS_RO_ATTR(segments, name)
129 #define NILFS_SEGMENTS_RW_ATTR(name) \
130 NILFS_RW_ATTR(segs_info, name)
132 #define NILFS_MOUNTED_SNAPSHOTS_RO_ATTR(name) \
133 NILFS_RO_ATTR(mounted_snapshots, name)
135 #define NILFS_CHECKPOINTS_RO_ATTR(name) \
136 NILFS_RO_ATTR(checkpoints, name)
137 #define NILFS_CHECKPOINTS_RW_ATTR(name) \
138 NILFS_RW_ATTR(checkpoints, name)
140 #define NILFS_SNAPSHOT_INFO_ATTR(name) \
141 NILFS_INFO_ATTR(snapshot, name)
142 #define NILFS_SNAPSHOT_RO_ATTR(name) \
143 NILFS_RO_ATTR(snapshot, name)
144 #define NILFS_SNAPSHOT_RW_ATTR(name) \
145 NILFS_RW_ATTR(snapshot, name)
147 #define NILFS_SUPERBLOCK_RO_ATTR(name) \
148 NILFS_RO_ATTR(superblock, name)
149 #define NILFS_SUPERBLOCK_RW_ATTR(name) \
150 NILFS_RW_ATTR(superblock, name)
152 #define NILFS_SEGCTOR_INFO_ATTR(name) \
153 NILFS_INFO_ATTR(segctor, name)
154 #define NILFS_SEGCTOR_RO_ATTR(name) \
155 NILFS_RO_ATTR(segctor, name)
156 #define NILFS_SEGCTOR_RW_ATTR(name) \
157 NILFS_RW_ATTR(segctor, name)
159 #define NILFS_FEATURE_ATTR_LIST(name) \
160 (&nilfs_feature_attr_##name.attr)
161 #define NILFS_DEV_ATTR_LIST(name) \
162 (&nilfs_dev_attr_##name.attr)
163 #define NILFS_SEGMENTS_ATTR_LIST(name) \
164 (&nilfs_segments_attr_##name.attr)
165 #define NILFS_MOUNTED_SNAPSHOTS_ATTR_LIST(name) \
166 (&nilfs_mounted_snapshots_attr_##name.attr)
167 #define NILFS_CHECKPOINTS_ATTR_LIST(name) \
168 (&nilfs_checkpoints_attr_##name.attr)
169 #define NILFS_SNAPSHOT_ATTR_LIST(name) \
170 (&nilfs_snapshot_attr_##name.attr)
171 #define NILFS_SUPERBLOCK_ATTR_LIST(name) \
172 (&nilfs_superblock_attr_##name.attr)
173 #define NILFS_SEGCTOR_ATTR_LIST(name) \
174 (&nilfs_segctor_attr_##name.attr)
176 #endif /* _NILFS_SYSFS_H */