~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/nilfs2/sysfs.h

Version: ~ [ linux-5.18 ] ~ [ linux-5.17.9 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.41 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.117 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.195 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.244 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.280 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.315 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0+ */
  2 /*
  3  * sysfs.h - sysfs support declarations.
  4  *
  5  * Copyright (C) 2005-2014 Nippon Telegraph and Telephone Corporation.
  6  * Copyright (C) 2014 HGST, Inc., a Western Digital Company.
  7  *
  8  * Written by Vyacheslav Dubeyko <Vyacheslav.Dubeyko@hgst.com>
  9  */
 10 
 11 #ifndef _NILFS_SYSFS_H
 12 #define _NILFS_SYSFS_H
 13 
 14 #include <linux/sysfs.h>
 15 
 16 #define NILFS_ROOT_GROUP_NAME   "nilfs2"
 17 
 18 /*
 19  * struct nilfs_sysfs_dev_subgroups - device subgroup kernel objects
 20  * @sg_superblock_kobj: /sys/fs/<nilfs>/<device>/superblock
 21  * @sg_superblock_kobj_unregister: completion state
 22  * @sg_segctor_kobj: /sys/fs/<nilfs>/<device>/segctor
 23  * @sg_segctor_kobj_unregister: completion state
 24  * @sg_mounted_snapshots_kobj: /sys/fs/<nilfs>/<device>/mounted_snapshots
 25  * @sg_mounted_snapshots_kobj_unregister: completion state
 26  * @sg_checkpoints_kobj: /sys/fs/<nilfs>/<device>/checkpoints
 27  * @sg_checkpoints_kobj_unregister: completion state
 28  * @sg_segments_kobj: /sys/fs/<nilfs>/<device>/segments
 29  * @sg_segments_kobj_unregister: completion state
 30  */
 31 struct nilfs_sysfs_dev_subgroups {
 32         /* /sys/fs/<nilfs>/<device>/superblock */
 33         struct kobject sg_superblock_kobj;
 34         struct completion sg_superblock_kobj_unregister;
 35 
 36         /* /sys/fs/<nilfs>/<device>/segctor */
 37         struct kobject sg_segctor_kobj;
 38         struct completion sg_segctor_kobj_unregister;
 39 
 40         /* /sys/fs/<nilfs>/<device>/mounted_snapshots */
 41         struct kobject sg_mounted_snapshots_kobj;
 42         struct completion sg_mounted_snapshots_kobj_unregister;
 43 
 44         /* /sys/fs/<nilfs>/<device>/checkpoints */
 45         struct kobject sg_checkpoints_kobj;
 46         struct completion sg_checkpoints_kobj_unregister;
 47 
 48         /* /sys/fs/<nilfs>/<device>/segments */
 49         struct kobject sg_segments_kobj;
 50         struct completion sg_segments_kobj_unregister;
 51 };
 52 
 53 #define NILFS_COMMON_ATTR_STRUCT(name) \
 54 struct nilfs_##name##_attr { \
 55         struct attribute attr; \
 56         ssize_t (*show)(struct kobject *, struct attribute *, \
 57                         char *); \
 58         ssize_t (*store)(struct kobject *, struct attribute *, \
 59                          const char *, size_t); \
 60 }
 61 
 62 NILFS_COMMON_ATTR_STRUCT(feature);
 63 
 64 #define NILFS_DEV_ATTR_STRUCT(name) \
 65 struct nilfs_##name##_attr { \
 66         struct attribute attr; \
 67         ssize_t (*show)(struct nilfs_##name##_attr *, struct the_nilfs *, \
 68                         char *); \
 69         ssize_t (*store)(struct nilfs_##name##_attr *, struct the_nilfs *, \
 70                          const char *, size_t); \
 71 }
 72 
 73 NILFS_DEV_ATTR_STRUCT(dev);
 74 NILFS_DEV_ATTR_STRUCT(segments);
 75 NILFS_DEV_ATTR_STRUCT(mounted_snapshots);
 76 NILFS_DEV_ATTR_STRUCT(checkpoints);
 77 NILFS_DEV_ATTR_STRUCT(superblock);
 78 NILFS_DEV_ATTR_STRUCT(segctor);
 79 
 80 #define NILFS_CP_ATTR_STRUCT(name) \
 81 struct nilfs_##name##_attr { \
 82         struct attribute attr; \
 83         ssize_t (*show)(struct nilfs_##name##_attr *, struct nilfs_root *, \
 84                         char *); \
 85         ssize_t (*store)(struct nilfs_##name##_attr *, struct nilfs_root *, \
 86                          const char *, size_t); \
 87 }
 88 
 89 NILFS_CP_ATTR_STRUCT(snapshot);
 90 
 91 #define NILFS_ATTR(type, name, mode, show, store) \
 92         static struct nilfs_##type##_attr nilfs_##type##_attr_##name = \
 93                 __ATTR(name, mode, show, store)
 94 
 95 #define NILFS_INFO_ATTR(type, name) \
 96         NILFS_ATTR(type, name, 0444, NULL, NULL)
 97 #define NILFS_RO_ATTR(type, name) \
 98         NILFS_ATTR(type, name, 0444, nilfs_##type##_##name##_show, NULL)
 99 #define NILFS_RW_ATTR(type, name) \
100         NILFS_ATTR(type, name, 0644, \
101                     nilfs_##type##_##name##_show, \
102                     nilfs_##type##_##name##_store)
103 
104 #define NILFS_FEATURE_INFO_ATTR(name) \
105         NILFS_INFO_ATTR(feature, name)
106 #define NILFS_FEATURE_RO_ATTR(name) \
107         NILFS_RO_ATTR(feature, name)
108 #define NILFS_FEATURE_RW_ATTR(name) \
109         NILFS_RW_ATTR(feature, name)
110 
111 #define NILFS_DEV_INFO_ATTR(name) \
112         NILFS_INFO_ATTR(dev, name)
113 #define NILFS_DEV_RO_ATTR(name) \
114         NILFS_RO_ATTR(dev, name)
115 #define NILFS_DEV_RW_ATTR(name) \
116         NILFS_RW_ATTR(dev, name)
117 
118 #define NILFS_SEGMENTS_RO_ATTR(name) \
119         NILFS_RO_ATTR(segments, name)
120 #define NILFS_SEGMENTS_RW_ATTR(name) \
121         NILFS_RW_ATTR(segs_info, name)
122 
123 #define NILFS_MOUNTED_SNAPSHOTS_RO_ATTR(name) \
124         NILFS_RO_ATTR(mounted_snapshots, name)
125 
126 #define NILFS_CHECKPOINTS_RO_ATTR(name) \
127         NILFS_RO_ATTR(checkpoints, name)
128 #define NILFS_CHECKPOINTS_RW_ATTR(name) \
129         NILFS_RW_ATTR(checkpoints, name)
130 
131 #define NILFS_SNAPSHOT_INFO_ATTR(name) \
132         NILFS_INFO_ATTR(snapshot, name)
133 #define NILFS_SNAPSHOT_RO_ATTR(name) \
134         NILFS_RO_ATTR(snapshot, name)
135 #define NILFS_SNAPSHOT_RW_ATTR(name) \
136         NILFS_RW_ATTR(snapshot, name)
137 
138 #define NILFS_SUPERBLOCK_RO_ATTR(name) \
139         NILFS_RO_ATTR(superblock, name)
140 #define NILFS_SUPERBLOCK_RW_ATTR(name) \
141         NILFS_RW_ATTR(superblock, name)
142 
143 #define NILFS_SEGCTOR_INFO_ATTR(name) \
144         NILFS_INFO_ATTR(segctor, name)
145 #define NILFS_SEGCTOR_RO_ATTR(name) \
146         NILFS_RO_ATTR(segctor, name)
147 #define NILFS_SEGCTOR_RW_ATTR(name) \
148         NILFS_RW_ATTR(segctor, name)
149 
150 #define NILFS_FEATURE_ATTR_LIST(name) \
151         (&nilfs_feature_attr_##name.attr)
152 #define NILFS_DEV_ATTR_LIST(name) \
153         (&nilfs_dev_attr_##name.attr)
154 #define NILFS_SEGMENTS_ATTR_LIST(name) \
155         (&nilfs_segments_attr_##name.attr)
156 #define NILFS_MOUNTED_SNAPSHOTS_ATTR_LIST(name) \
157         (&nilfs_mounted_snapshots_attr_##name.attr)
158 #define NILFS_CHECKPOINTS_ATTR_LIST(name) \
159         (&nilfs_checkpoints_attr_##name.attr)
160 #define NILFS_SNAPSHOT_ATTR_LIST(name) \
161         (&nilfs_snapshot_attr_##name.attr)
162 #define NILFS_SUPERBLOCK_ATTR_LIST(name) \
163         (&nilfs_superblock_attr_##name.attr)
164 #define NILFS_SEGCTOR_ATTR_LIST(name) \
165         (&nilfs_segctor_attr_##name.attr)
166 
167 #endif /* _NILFS_SYSFS_H */
168 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp