diff options
author | Len Brown <len.brown@intel.com> | 2006-01-27 17:18:29 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-01-27 17:18:29 -0500 |
commit | 292dd876ee765c478b27c93cc51e93a558ed58bf (patch) | |
tree | 5b740e93253295baee2a9c414a6c66d03d44a9ef /fs/fuse/fuse_i.h | |
parent | d4ec6c7cc9a15a7a529719bc3b84f46812f9842e (diff) | |
parent | 9fdb62af92c741addbea15545f214a6e89460865 (diff) |
Pull release into acpica branch
Diffstat (limited to 'fs/fuse/fuse_i.h')
-rw-r--r-- | fs/fuse/fuse_i.h | 98 |
1 files changed, 63 insertions, 35 deletions
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 74c8d098a14a..46cf933aa3bf 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -94,6 +94,11 @@ struct fuse_out { | |||
94 | /** Header returned from userspace */ | 94 | /** Header returned from userspace */ |
95 | struct fuse_out_header h; | 95 | struct fuse_out_header h; |
96 | 96 | ||
97 | /* | ||
98 | * The following bitfields are not changed during the request | ||
99 | * processing | ||
100 | */ | ||
101 | |||
97 | /** Last argument is variable length (can be shorter than | 102 | /** Last argument is variable length (can be shorter than |
98 | arg->size) */ | 103 | arg->size) */ |
99 | unsigned argvar:1; | 104 | unsigned argvar:1; |
@@ -111,12 +116,23 @@ struct fuse_out { | |||
111 | struct fuse_arg args[3]; | 116 | struct fuse_arg args[3]; |
112 | }; | 117 | }; |
113 | 118 | ||
119 | /** The request state */ | ||
120 | enum fuse_req_state { | ||
121 | FUSE_REQ_INIT = 0, | ||
122 | FUSE_REQ_PENDING, | ||
123 | FUSE_REQ_READING, | ||
124 | FUSE_REQ_SENT, | ||
125 | FUSE_REQ_FINISHED | ||
126 | }; | ||
127 | |||
128 | struct fuse_conn; | ||
129 | |||
114 | /** | 130 | /** |
115 | * A request to the client | 131 | * A request to the client |
116 | */ | 132 | */ |
117 | struct fuse_req { | 133 | struct fuse_req { |
118 | /** This can be on either unused_list, pending or processing | 134 | /** This can be on either unused_list, pending processing or |
119 | lists in fuse_conn */ | 135 | io lists in fuse_conn */ |
120 | struct list_head list; | 136 | struct list_head list; |
121 | 137 | ||
122 | /** Entry on the background list */ | 138 | /** Entry on the background list */ |
@@ -125,6 +141,12 @@ struct fuse_req { | |||
125 | /** refcount */ | 141 | /** refcount */ |
126 | atomic_t count; | 142 | atomic_t count; |
127 | 143 | ||
144 | /* | ||
145 | * The following bitfields are either set once before the | ||
146 | * request is queued or setting/clearing them is protected by | ||
147 | * fuse_lock | ||
148 | */ | ||
149 | |||
128 | /** True if the request has reply */ | 150 | /** True if the request has reply */ |
129 | unsigned isreply:1; | 151 | unsigned isreply:1; |
130 | 152 | ||
@@ -140,11 +162,8 @@ struct fuse_req { | |||
140 | /** Data is being copied to/from the request */ | 162 | /** Data is being copied to/from the request */ |
141 | unsigned locked:1; | 163 | unsigned locked:1; |
142 | 164 | ||
143 | /** Request has been sent to userspace */ | 165 | /** State of the request */ |
144 | unsigned sent:1; | 166 | enum fuse_req_state state; |
145 | |||
146 | /** The request is finished */ | ||
147 | unsigned finished:1; | ||
148 | 167 | ||
149 | /** The request input */ | 168 | /** The request input */ |
150 | struct fuse_in in; | 169 | struct fuse_in in; |
@@ -161,6 +180,7 @@ struct fuse_req { | |||
161 | struct fuse_release_in release_in; | 180 | struct fuse_release_in release_in; |
162 | struct fuse_init_in init_in; | 181 | struct fuse_init_in init_in; |
163 | struct fuse_init_out init_out; | 182 | struct fuse_init_out init_out; |
183 | struct fuse_read_in read_in; | ||
164 | } misc; | 184 | } misc; |
165 | 185 | ||
166 | /** page vector */ | 186 | /** page vector */ |
@@ -180,6 +200,9 @@ struct fuse_req { | |||
180 | 200 | ||
181 | /** File used in the request (or NULL) */ | 201 | /** File used in the request (or NULL) */ |
182 | struct file *file; | 202 | struct file *file; |
203 | |||
204 | /** Request completion callback */ | ||
205 | void (*end)(struct fuse_conn *, struct fuse_req *); | ||
183 | }; | 206 | }; |
184 | 207 | ||
185 | /** | 208 | /** |
@@ -190,9 +213,6 @@ struct fuse_req { | |||
190 | * unmounted. | 213 | * unmounted. |
191 | */ | 214 | */ |
192 | struct fuse_conn { | 215 | struct fuse_conn { |
193 | /** Reference count */ | ||
194 | int count; | ||
195 | |||
196 | /** The user id for this mount */ | 216 | /** The user id for this mount */ |
197 | uid_t user_id; | 217 | uid_t user_id; |
198 | 218 | ||
@@ -217,6 +237,9 @@ struct fuse_conn { | |||
217 | /** The list of requests being processed */ | 237 | /** The list of requests being processed */ |
218 | struct list_head processing; | 238 | struct list_head processing; |
219 | 239 | ||
240 | /** The list of requests under I/O */ | ||
241 | struct list_head io; | ||
242 | |||
220 | /** Requests put in the background (RELEASE or any other | 243 | /** Requests put in the background (RELEASE or any other |
221 | interrupted request) */ | 244 | interrupted request) */ |
222 | struct list_head background; | 245 | struct list_head background; |
@@ -238,14 +261,22 @@ struct fuse_conn { | |||
238 | u64 reqctr; | 261 | u64 reqctr; |
239 | 262 | ||
240 | /** Mount is active */ | 263 | /** Mount is active */ |
241 | unsigned mounted : 1; | 264 | unsigned mounted; |
242 | 265 | ||
243 | /** Connection established */ | 266 | /** Connection established, cleared on umount, connection |
244 | unsigned connected : 1; | 267 | abort and device release */ |
268 | unsigned connected; | ||
245 | 269 | ||
246 | /** Connection failed (version mismatch) */ | 270 | /** Connection failed (version mismatch). Cannot race with |
271 | setting other bitfields since it is only set once in INIT | ||
272 | reply, before any other request, and never cleared */ | ||
247 | unsigned conn_error : 1; | 273 | unsigned conn_error : 1; |
248 | 274 | ||
275 | /* | ||
276 | * The following bitfields are only for optimization purposes | ||
277 | * and hence races in setting them will not cause malfunction | ||
278 | */ | ||
279 | |||
249 | /** Is fsync not implemented by fs? */ | 280 | /** Is fsync not implemented by fs? */ |
250 | unsigned no_fsync : 1; | 281 | unsigned no_fsync : 1; |
251 | 282 | ||
@@ -273,21 +304,22 @@ struct fuse_conn { | |||
273 | /** Is create not implemented by fs? */ | 304 | /** Is create not implemented by fs? */ |
274 | unsigned no_create : 1; | 305 | unsigned no_create : 1; |
275 | 306 | ||
307 | /** The number of requests waiting for completion */ | ||
308 | atomic_t num_waiting; | ||
309 | |||
276 | /** Negotiated minor version */ | 310 | /** Negotiated minor version */ |
277 | unsigned minor; | 311 | unsigned minor; |
278 | 312 | ||
279 | /** Backing dev info */ | 313 | /** Backing dev info */ |
280 | struct backing_dev_info bdi; | 314 | struct backing_dev_info bdi; |
281 | }; | ||
282 | 315 | ||
283 | static inline struct fuse_conn **get_fuse_conn_super_p(struct super_block *sb) | 316 | /** kobject */ |
284 | { | 317 | struct kobject kobj; |
285 | return (struct fuse_conn **) &sb->s_fs_info; | 318 | }; |
286 | } | ||
287 | 319 | ||
288 | static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) | 320 | static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) |
289 | { | 321 | { |
290 | return *get_fuse_conn_super_p(sb); | 322 | return sb->s_fs_info; |
291 | } | 323 | } |
292 | 324 | ||
293 | static inline struct fuse_conn *get_fuse_conn(struct inode *inode) | 325 | static inline struct fuse_conn *get_fuse_conn(struct inode *inode) |
@@ -295,6 +327,11 @@ static inline struct fuse_conn *get_fuse_conn(struct inode *inode) | |||
295 | return get_fuse_conn_super(inode->i_sb); | 327 | return get_fuse_conn_super(inode->i_sb); |
296 | } | 328 | } |
297 | 329 | ||
330 | static inline struct fuse_conn *get_fuse_conn_kobj(struct kobject *obj) | ||
331 | { | ||
332 | return container_of(obj, struct fuse_conn, kobj); | ||
333 | } | ||
334 | |||
298 | static inline struct fuse_inode *get_fuse_inode(struct inode *inode) | 335 | static inline struct fuse_inode *get_fuse_inode(struct inode *inode) |
299 | { | 336 | { |
300 | return container_of(inode, struct fuse_inode, inode); | 337 | return container_of(inode, struct fuse_inode, inode); |
@@ -336,11 +373,10 @@ void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req, | |||
336 | unsigned long nodeid, u64 nlookup); | 373 | unsigned long nodeid, u64 nlookup); |
337 | 374 | ||
338 | /** | 375 | /** |
339 | * Send READ or READDIR request | 376 | * Initialize READ or READDIR request |
340 | */ | 377 | */ |
341 | size_t fuse_send_read_common(struct fuse_req *req, struct file *file, | 378 | void fuse_read_fill(struct fuse_req *req, struct file *file, |
342 | struct inode *inode, loff_t pos, size_t count, | 379 | struct inode *inode, loff_t pos, size_t count, int opcode); |
343 | int isdir); | ||
344 | 380 | ||
345 | /** | 381 | /** |
346 | * Send OPEN or OPENDIR request | 382 | * Send OPEN or OPENDIR request |
@@ -395,12 +431,6 @@ void fuse_init_symlink(struct inode *inode); | |||
395 | void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr); | 431 | void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr); |
396 | 432 | ||
397 | /** | 433 | /** |
398 | * Check if the connection can be released, and if yes, then free the | ||
399 | * connection structure | ||
400 | */ | ||
401 | void fuse_release_conn(struct fuse_conn *fc); | ||
402 | |||
403 | /** | ||
404 | * Initialize the client device | 434 | * Initialize the client device |
405 | */ | 435 | */ |
406 | int fuse_dev_init(void); | 436 | int fuse_dev_init(void); |
@@ -456,6 +486,9 @@ void request_send_background(struct fuse_conn *fc, struct fuse_req *req); | |||
456 | */ | 486 | */ |
457 | void fuse_release_background(struct fuse_req *req); | 487 | void fuse_release_background(struct fuse_req *req); |
458 | 488 | ||
489 | /* Abort all requests */ | ||
490 | void fuse_abort_conn(struct fuse_conn *fc); | ||
491 | |||
459 | /** | 492 | /** |
460 | * Get the attributes of a file | 493 | * Get the attributes of a file |
461 | */ | 494 | */ |
@@ -465,8 +498,3 @@ int fuse_do_getattr(struct inode *inode); | |||
465 | * Invalidate inode attributes | 498 | * Invalidate inode attributes |
466 | */ | 499 | */ |
467 | void fuse_invalidate_attr(struct inode *inode); | 500 | void fuse_invalidate_attr(struct inode *inode); |
468 | |||
469 | /** | ||
470 | * Send the INIT message | ||
471 | */ | ||
472 | void fuse_send_init(struct fuse_conn *fc); | ||