diff options
author | Tejun Heo <htejun@gmail.com> | 2007-09-20 03:05:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 17:51:09 -0400 |
commit | 59f69015684b3de7b9472be9a81b1a978f93a496 (patch) | |
tree | 3d3f7880e9f0d9c867695b120944540e815f194a /include/linux/sysfs.h | |
parent | f88123eaf953f13a0c597dde54745d28f81236de (diff) |
sysfs: clean up header files
sysfs is about to go through major overhaul making this a pretty good
opportunity to clean up (out-of-tree changes and pending patches will
need regeneration anyway). Clean up headers.
* Kill space between * and symbolname.
* Move SYSFS_* type constants and flags into fs/sysfs/sysfs.h.
They're internal to sysfs.
* Reformat function prototypes and add argument symbol names.
* Make dummy function definition order match that of function
prototypes.
* Add some comments.
* Reorganize fs/sysfs/sysfs.h according to which file the declared
variable or feature lives in.
This patch does not introduce any behavior change.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/sysfs.h')
-rw-r--r-- | include/linux/sysfs.h | 127 |
1 files changed, 57 insertions, 70 deletions
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index c16e4c511621..b393bb449624 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -23,14 +23,14 @@ struct module; | |||
23 | * until the tree gets cleaned up fully. | 23 | * until the tree gets cleaned up fully. |
24 | */ | 24 | */ |
25 | struct attribute { | 25 | struct attribute { |
26 | const char * name; | 26 | const char *name; |
27 | struct module * owner; | 27 | struct module *owner; |
28 | mode_t mode; | 28 | mode_t mode; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | struct attribute_group { | 31 | struct attribute_group { |
32 | const char * name; | 32 | const char *name; |
33 | struct attribute ** attrs; | 33 | struct attribute **attrs; |
34 | }; | 34 | }; |
35 | 35 | ||
36 | 36 | ||
@@ -74,65 +74,43 @@ struct sysfs_ops { | |||
74 | ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); | 74 | ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); |
75 | }; | 75 | }; |
76 | 76 | ||
77 | #define SYSFS_TYPE_MASK 0x00ff | ||
78 | #define SYSFS_ROOT 0x0001 | ||
79 | #define SYSFS_DIR 0x0002 | ||
80 | #define SYSFS_KOBJ_ATTR 0x0004 | ||
81 | #define SYSFS_KOBJ_BIN_ATTR 0x0008 | ||
82 | #define SYSFS_KOBJ_LINK 0x0020 | ||
83 | #define SYSFS_COPY_NAME (SYSFS_DIR | SYSFS_KOBJ_LINK) | ||
84 | |||
85 | #define SYSFS_FLAG_MASK ~SYSFS_TYPE_MASK | ||
86 | #define SYSFS_FLAG_REMOVED 0x0100 | ||
87 | |||
88 | #ifdef CONFIG_SYSFS | 77 | #ifdef CONFIG_SYSFS |
89 | 78 | ||
90 | extern int sysfs_schedule_callback(struct kobject *kobj, | 79 | int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), |
91 | void (*func)(void *), void *data, struct module *owner); | 80 | void *data, struct module *owner); |
92 | |||
93 | extern int __must_check | ||
94 | sysfs_create_dir(struct kobject *); | ||
95 | |||
96 | extern void | ||
97 | sysfs_remove_dir(struct kobject *); | ||
98 | |||
99 | extern int __must_check | ||
100 | sysfs_rename_dir(struct kobject *kobj, const char *new_name); | ||
101 | |||
102 | extern int __must_check | ||
103 | sysfs_move_dir(struct kobject *, struct kobject *); | ||
104 | |||
105 | extern int __must_check | ||
106 | sysfs_create_file(struct kobject *, const struct attribute *); | ||
107 | |||
108 | extern int __must_check | ||
109 | sysfs_update_file(struct kobject *, const struct attribute *); | ||
110 | 81 | ||
111 | extern int __must_check | 82 | int __must_check sysfs_create_dir(struct kobject *kobj); |
112 | sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode); | 83 | void sysfs_remove_dir(struct kobject *kobj); |
84 | int __must_check sysfs_rename_dir(struct kobject *kobj, const char *new_name); | ||
85 | int __must_check sysfs_move_dir(struct kobject *kobj, | ||
86 | struct kobject *new_parent_kobj); | ||
113 | 87 | ||
114 | extern void | 88 | int __must_check sysfs_create_file(struct kobject *kobj, |
115 | sysfs_remove_file(struct kobject *, const struct attribute *); | 89 | const struct attribute *attr); |
116 | 90 | int __must_check sysfs_update_file(struct kobject *kobj, | |
117 | extern int __must_check | 91 | const struct attribute *attr); |
118 | sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name); | 92 | int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, |
119 | 93 | mode_t mode); | |
120 | extern void | 94 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); |
121 | sysfs_remove_link(struct kobject *, const char * name); | ||
122 | 95 | ||
123 | int __must_check sysfs_create_bin_file(struct kobject *kobj, | 96 | int __must_check sysfs_create_bin_file(struct kobject *kobj, |
124 | struct bin_attribute *attr); | 97 | struct bin_attribute *attr); |
125 | void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); | 98 | void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); |
126 | 99 | ||
127 | int __must_check sysfs_create_group(struct kobject *, | 100 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, |
128 | const struct attribute_group *); | 101 | const char *name); |
129 | void sysfs_remove_group(struct kobject *, const struct attribute_group *); | 102 | void sysfs_remove_link(struct kobject *kobj, const char *name); |
103 | |||
104 | int __must_check sysfs_create_group(struct kobject *kobj, | ||
105 | const struct attribute_group *grp); | ||
106 | void sysfs_remove_group(struct kobject *kobj, | ||
107 | const struct attribute_group *grp); | ||
130 | int sysfs_add_file_to_group(struct kobject *kobj, | 108 | int sysfs_add_file_to_group(struct kobject *kobj, |
131 | const struct attribute *attr, const char *group); | 109 | const struct attribute *attr, const char *group); |
132 | void sysfs_remove_file_from_group(struct kobject *kobj, | 110 | void sysfs_remove_file_from_group(struct kobject *kobj, |
133 | const struct attribute *attr, const char *group); | 111 | const struct attribute *attr, const char *group); |
134 | 112 | ||
135 | void sysfs_notify(struct kobject * k, char *dir, char *attr); | 113 | void sysfs_notify(struct kobject *kobj, char *dir, char *attr); |
136 | 114 | ||
137 | extern int __must_check sysfs_init(void); | 115 | extern int __must_check sysfs_init(void); |
138 | 116 | ||
@@ -144,72 +122,81 @@ static inline int sysfs_schedule_callback(struct kobject *kobj, | |||
144 | return -ENOSYS; | 122 | return -ENOSYS; |
145 | } | 123 | } |
146 | 124 | ||
147 | static inline int sysfs_create_dir(struct kobject * kobj) | 125 | static inline int sysfs_create_dir(struct kobject *kobj) |
148 | { | 126 | { |
149 | return 0; | 127 | return 0; |
150 | } | 128 | } |
151 | 129 | ||
152 | static inline void sysfs_remove_dir(struct kobject * k) | 130 | static inline void sysfs_remove_dir(struct kobject *kobj) |
153 | { | 131 | { |
154 | ; | 132 | ; |
155 | } | 133 | } |
156 | 134 | ||
157 | static inline int sysfs_rename_dir(struct kobject * kobj, const char *new_name) | 135 | static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name) |
158 | { | 136 | { |
159 | return 0; | 137 | return 0; |
160 | } | 138 | } |
161 | 139 | ||
162 | static inline int sysfs_move_dir(struct kobject * k, struct kobject * new_parent) | 140 | static inline int sysfs_move_dir(struct kobject *kobj, |
141 | struct kobject *new_parent_kobj) | ||
163 | { | 142 | { |
164 | return 0; | 143 | return 0; |
165 | } | 144 | } |
166 | 145 | ||
167 | static inline int sysfs_create_file(struct kobject * k, const struct attribute * a) | 146 | static inline int sysfs_create_file(struct kobject *kobj, |
147 | const struct attribute *attr) | ||
168 | { | 148 | { |
169 | return 0; | 149 | return 0; |
170 | } | 150 | } |
171 | 151 | ||
172 | static inline int sysfs_update_file(struct kobject * k, const struct attribute * a) | 152 | static inline int sysfs_update_file(struct kobject *kobj, |
153 | const struct attribute *attr) | ||
173 | { | 154 | { |
174 | return 0; | 155 | return 0; |
175 | } | 156 | } |
176 | static inline int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) | 157 | static inline int sysfs_chmod_file(struct kobject *kobj, |
158 | struct attribute *attr, mode_t mode) | ||
177 | { | 159 | { |
178 | return 0; | 160 | return 0; |
179 | } | 161 | } |
180 | 162 | ||
181 | static inline void sysfs_remove_file(struct kobject * k, const struct attribute * a) | 163 | static inline void sysfs_remove_file(struct kobject *kobj, |
164 | const struct attribute *attr) | ||
182 | { | 165 | { |
183 | ; | 166 | ; |
184 | } | 167 | } |
185 | 168 | ||
186 | static inline int sysfs_create_link(struct kobject * k, struct kobject * t, const char * n) | 169 | static inline int sysfs_create_bin_file(struct kobject *kobj, |
170 | struct bin_attribute *attr) | ||
187 | { | 171 | { |
188 | return 0; | 172 | return 0; |
189 | } | 173 | } |
190 | 174 | ||
191 | static inline void sysfs_remove_link(struct kobject * k, const char * name) | 175 | static inline int sysfs_remove_bin_file(struct kobject *kobj, |
176 | struct bin_attribute *attr) | ||
192 | { | 177 | { |
193 | ; | 178 | return 0; |
194 | } | 179 | } |
195 | 180 | ||
196 | 181 | static inline int sysfs_create_link(struct kobject *kobj, | |
197 | static inline int sysfs_create_bin_file(struct kobject * k, struct bin_attribute * a) | 182 | struct kobject *target, const char *name) |
198 | { | 183 | { |
199 | return 0; | 184 | return 0; |
200 | } | 185 | } |
201 | 186 | ||
202 | static inline int sysfs_remove_bin_file(struct kobject * k, struct bin_attribute * a) | 187 | static inline void sysfs_remove_link(struct kobject *kobj, const char *name) |
203 | { | 188 | { |
204 | return 0; | 189 | ; |
205 | } | 190 | } |
206 | 191 | ||
207 | static inline int sysfs_create_group(struct kobject * k, const struct attribute_group *g) | 192 | static inline int sysfs_create_group(struct kobject *kobj, |
193 | const struct attribute_group *grp) | ||
208 | { | 194 | { |
209 | return 0; | 195 | return 0; |
210 | } | 196 | } |
211 | 197 | ||
212 | static inline void sysfs_remove_group(struct kobject * k, const struct attribute_group * g) | 198 | static inline void sysfs_remove_group(struct kobject *kobj, |
199 | const struct attribute_group *grp) | ||
213 | { | 200 | { |
214 | ; | 201 | ; |
215 | } | 202 | } |
@@ -225,7 +212,7 @@ static inline void sysfs_remove_file_from_group(struct kobject *kobj, | |||
225 | { | 212 | { |
226 | } | 213 | } |
227 | 214 | ||
228 | static inline void sysfs_notify(struct kobject * k, char *dir, char *attr) | 215 | static inline void sysfs_notify(struct kobject *kobj, char *dir, char *attr) |
229 | { | 216 | { |
230 | } | 217 | } |
231 | 218 | ||