diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-05 23:43:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-05 23:43:11 -0500 |
commit | 29552b1462799afbe02af035b243e97579d63350 (patch) | |
tree | 42ad1639678a1bc8064f690494f62497bc48d318 /include | |
parent | 6c59f9d9fb95934bf3d7d64249b338ce79953b5b (diff) | |
parent | 51e7a5987058c6b4d0c1337587f2ec0c34ffa708 (diff) |
Merge http://oss.oracle.com/git/ocfs2
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/configfs.h | 205 | ||||
-rw-r--r-- | include/linux/fs.h | 31 | ||||
-rw-r--r-- | include/linux/writeback.h | 6 |
3 files changed, 236 insertions, 6 deletions
diff --git a/include/linux/configfs.h b/include/linux/configfs.h new file mode 100644 index 000000000000..acffb8c9073a --- /dev/null +++ b/include/linux/configfs.h | |||
@@ -0,0 +1,205 @@ | |||
1 | /* -*- mode: c; c-basic-offset: 8; -*- | ||
2 | * vim: noexpandtab sw=8 ts=8 sts=0: | ||
3 | * | ||
4 | * configfs.h - definitions for the device driver filesystem | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public | ||
8 | * License as published by the Free Software Foundation; either | ||
9 | * version 2 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public | ||
17 | * License along with this program; if not, write to the | ||
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
19 | * Boston, MA 021110-1307, USA. | ||
20 | * | ||
21 | * Based on sysfs: | ||
22 | * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel | ||
23 | * | ||
24 | * Based on kobject.h: | ||
25 | * Copyright (c) 2002-2003 Patrick Mochel | ||
26 | * Copyright (c) 2002-2003 Open Source Development Labs | ||
27 | * | ||
28 | * configfs Copyright (C) 2005 Oracle. All rights reserved. | ||
29 | * | ||
30 | * Please read Documentation/filesystems/configfs.txt before using the | ||
31 | * configfs interface, ESPECIALLY the parts about reference counts and | ||
32 | * item destructors. | ||
33 | */ | ||
34 | |||
35 | #ifndef _CONFIGFS_H_ | ||
36 | #define _CONFIGFS_H_ | ||
37 | |||
38 | #ifdef __KERNEL__ | ||
39 | |||
40 | #include <linux/types.h> | ||
41 | #include <linux/list.h> | ||
42 | #include <linux/kref.h> | ||
43 | |||
44 | #include <asm/atomic.h> | ||
45 | #include <asm/semaphore.h> | ||
46 | |||
47 | #define CONFIGFS_ITEM_NAME_LEN 20 | ||
48 | |||
49 | struct module; | ||
50 | |||
51 | struct configfs_item_operations; | ||
52 | struct configfs_group_operations; | ||
53 | struct configfs_attribute; | ||
54 | struct configfs_subsystem; | ||
55 | |||
56 | struct config_item { | ||
57 | char *ci_name; | ||
58 | char ci_namebuf[CONFIGFS_ITEM_NAME_LEN]; | ||
59 | struct kref ci_kref; | ||
60 | struct list_head ci_entry; | ||
61 | struct config_item *ci_parent; | ||
62 | struct config_group *ci_group; | ||
63 | struct config_item_type *ci_type; | ||
64 | struct dentry *ci_dentry; | ||
65 | }; | ||
66 | |||
67 | extern int config_item_set_name(struct config_item *, const char *, ...); | ||
68 | |||
69 | static inline char *config_item_name(struct config_item * item) | ||
70 | { | ||
71 | return item->ci_name; | ||
72 | } | ||
73 | |||
74 | extern void config_item_init(struct config_item *); | ||
75 | extern void config_item_init_type_name(struct config_item *item, | ||
76 | const char *name, | ||
77 | struct config_item_type *type); | ||
78 | extern void config_item_cleanup(struct config_item *); | ||
79 | |||
80 | extern struct config_item * config_item_get(struct config_item *); | ||
81 | extern void config_item_put(struct config_item *); | ||
82 | |||
83 | struct config_item_type { | ||
84 | struct module *ct_owner; | ||
85 | struct configfs_item_operations *ct_item_ops; | ||
86 | struct configfs_group_operations *ct_group_ops; | ||
87 | struct configfs_attribute **ct_attrs; | ||
88 | }; | ||
89 | |||
90 | |||
91 | /** | ||
92 | * group - a group of config_items of a specific type, belonging | ||
93 | * to a specific subsystem. | ||
94 | */ | ||
95 | |||
96 | struct config_group { | ||
97 | struct config_item cg_item; | ||
98 | struct list_head cg_children; | ||
99 | struct configfs_subsystem *cg_subsys; | ||
100 | struct config_group **default_groups; | ||
101 | }; | ||
102 | |||
103 | |||
104 | extern void config_group_init(struct config_group *group); | ||
105 | extern void config_group_init_type_name(struct config_group *group, | ||
106 | const char *name, | ||
107 | struct config_item_type *type); | ||
108 | |||
109 | |||
110 | static inline struct config_group *to_config_group(struct config_item *item) | ||
111 | { | ||
112 | return item ? container_of(item,struct config_group,cg_item) : NULL; | ||
113 | } | ||
114 | |||
115 | static inline struct config_group *config_group_get(struct config_group *group) | ||
116 | { | ||
117 | return group ? to_config_group(config_item_get(&group->cg_item)) : NULL; | ||
118 | } | ||
119 | |||
120 | static inline void config_group_put(struct config_group *group) | ||
121 | { | ||
122 | config_item_put(&group->cg_item); | ||
123 | } | ||
124 | |||
125 | extern struct config_item *config_group_find_obj(struct config_group *, const char *); | ||
126 | |||
127 | |||
128 | struct configfs_attribute { | ||
129 | char *ca_name; | ||
130 | struct module *ca_owner; | ||
131 | mode_t ca_mode; | ||
132 | }; | ||
133 | |||
134 | |||
135 | /* | ||
136 | * If allow_link() exists, the item can symlink(2) out to other | ||
137 | * items. If the item is a group, it may support mkdir(2). | ||
138 | * Groups supply one of make_group() and make_item(). If the | ||
139 | * group supports make_group(), one can create group children. If it | ||
140 | * supports make_item(), one can create config_item children. If it has | ||
141 | * default_groups on group->default_groups, it has automatically created | ||
142 | * group children. default_groups may coexist alongsize make_group() or | ||
143 | * make_item(), but if the group wishes to have only default_groups | ||
144 | * children (disallowing mkdir(2)), it need not provide either function. | ||
145 | * If the group has commit(), it supports pending and commited (active) | ||
146 | * items. | ||
147 | */ | ||
148 | struct configfs_item_operations { | ||
149 | void (*release)(struct config_item *); | ||
150 | ssize_t (*show_attribute)(struct config_item *, struct configfs_attribute *,char *); | ||
151 | ssize_t (*store_attribute)(struct config_item *,struct configfs_attribute *,const char *, size_t); | ||
152 | int (*allow_link)(struct config_item *src, struct config_item *target); | ||
153 | int (*drop_link)(struct config_item *src, struct config_item *target); | ||
154 | }; | ||
155 | |||
156 | struct configfs_group_operations { | ||
157 | struct config_item *(*make_item)(struct config_group *group, const char *name); | ||
158 | struct config_group *(*make_group)(struct config_group *group, const char *name); | ||
159 | int (*commit_item)(struct config_item *item); | ||
160 | void (*drop_item)(struct config_group *group, struct config_item *item); | ||
161 | }; | ||
162 | |||
163 | |||
164 | |||
165 | /** | ||
166 | * Use these macros to make defining attributes easier. See include/linux/device.h | ||
167 | * for examples.. | ||
168 | */ | ||
169 | |||
170 | #if 0 | ||
171 | #define __ATTR(_name,_mode,_show,_store) { \ | ||
172 | .attr = {.ca_name = __stringify(_name), .ca_mode = _mode, .ca_owner = THIS_MODULE }, \ | ||
173 | .show = _show, \ | ||
174 | .store = _store, \ | ||
175 | } | ||
176 | |||
177 | #define __ATTR_RO(_name) { \ | ||
178 | .attr = { .ca_name = __stringify(_name), .ca_mode = 0444, .ca_owner = THIS_MODULE }, \ | ||
179 | .show = _name##_show, \ | ||
180 | } | ||
181 | |||
182 | #define __ATTR_NULL { .attr = { .name = NULL } } | ||
183 | |||
184 | #define attr_name(_attr) (_attr).attr.name | ||
185 | #endif | ||
186 | |||
187 | |||
188 | struct configfs_subsystem { | ||
189 | struct config_group su_group; | ||
190 | struct semaphore su_sem; | ||
191 | }; | ||
192 | |||
193 | static inline struct configfs_subsystem *to_configfs_subsystem(struct config_group *group) | ||
194 | { | ||
195 | return group ? | ||
196 | container_of(group, struct configfs_subsystem, su_group) : | ||
197 | NULL; | ||
198 | } | ||
199 | |||
200 | int configfs_register_subsystem(struct configfs_subsystem *subsys); | ||
201 | void configfs_unregister_subsystem(struct configfs_subsystem *subsys); | ||
202 | |||
203 | #endif /* __KERNEL__ */ | ||
204 | |||
205 | #endif /* _CONFIGFS_H_ */ | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index cc35b6ac778d..ed9a41a71e8b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -302,6 +302,37 @@ struct iattr { | |||
302 | */ | 302 | */ |
303 | #include <linux/quota.h> | 303 | #include <linux/quota.h> |
304 | 304 | ||
305 | /** | ||
306 | * enum positive_aop_returns - aop return codes with specific semantics | ||
307 | * | ||
308 | * @AOP_WRITEPAGE_ACTIVATE: Informs the caller that page writeback has | ||
309 | * completed, that the page is still locked, and | ||
310 | * should be considered active. The VM uses this hint | ||
311 | * to return the page to the active list -- it won't | ||
312 | * be a candidate for writeback again in the near | ||
313 | * future. Other callers must be careful to unlock | ||
314 | * the page if they get this return. Returned by | ||
315 | * writepage(); | ||
316 | * | ||
317 | * @AOP_TRUNCATED_PAGE: The AOP method that was handed a locked page has | ||
318 | * unlocked it and the page might have been truncated. | ||
319 | * The caller should back up to acquiring a new page and | ||
320 | * trying again. The aop will be taking reasonable | ||
321 | * precautions not to livelock. If the caller held a page | ||
322 | * reference, it should drop it before retrying. Returned | ||
323 | * by readpage(), prepare_write(), and commit_write(). | ||
324 | * | ||
325 | * address_space_operation functions return these large constants to indicate | ||
326 | * special semantics to the caller. These are much larger than the bytes in a | ||
327 | * page to allow for functions that return the number of bytes operated on in a | ||
328 | * given page. | ||
329 | */ | ||
330 | |||
331 | enum positive_aop_returns { | ||
332 | AOP_WRITEPAGE_ACTIVATE = 0x80000, | ||
333 | AOP_TRUNCATED_PAGE = 0x80001, | ||
334 | }; | ||
335 | |||
305 | /* | 336 | /* |
306 | * oh the beauties of C type declarations. | 337 | * oh the beauties of C type declarations. |
307 | */ | 338 | */ |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 343d883d69c5..64a36ba43b2f 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -60,12 +60,6 @@ struct writeback_control { | |||
60 | }; | 60 | }; |
61 | 61 | ||
62 | /* | 62 | /* |
63 | * ->writepage() return values (make these much larger than a pagesize, in | ||
64 | * case some fs is returning number-of-bytes-written from writepage) | ||
65 | */ | ||
66 | #define WRITEPAGE_ACTIVATE 0x80000 /* IO was not started: activate page */ | ||
67 | |||
68 | /* | ||
69 | * fs/fs-writeback.c | 63 | * fs/fs-writeback.c |
70 | */ | 64 | */ |
71 | void writeback_inodes(struct writeback_control *wbc); | 65 | void writeback_inodes(struct writeback_control *wbc); |