diff options
author | Tom Zanussi <zanussi@us.ibm.com> | 2006-01-08 04:02:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-08 23:13:51 -0500 |
commit | 761da5c88aca34586e5b7295bd8b9be2438906f2 (patch) | |
tree | f5d1c91d1e16b0e8649ccaf3bdd7d163658e7455 | |
parent | df49af8f3392e96ddbc9cf6dd81fbdc0496e1b44 (diff) |
[PATCH] relayfs: cleanup, change relayfs_file_* to relay_file_*
This patch renames relayfs_file_operations to relay_file_operations, and the
file operations themselves from relayfs_XXX to relay_file_XXX, to make it more
clear that they refer to relay files.
Signed-off-by: Tom Zanussi <zanussi@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/relayfs/inode.c | 89 | ||||
-rw-r--r-- | fs/relayfs/relay.c | 2 | ||||
-rw-r--r-- | include/linux/relayfs_fs.h | 5 |
3 files changed, 50 insertions, 46 deletions
diff --git a/fs/relayfs/inode.c b/fs/relayfs/inode.c index b4c3e0466e98..7b7f2cb5f0e1 100644 --- a/fs/relayfs/inode.c +++ b/fs/relayfs/inode.c | |||
@@ -247,13 +247,13 @@ int relayfs_remove_dir(struct dentry *dentry) | |||
247 | } | 247 | } |
248 | 248 | ||
249 | /** | 249 | /** |
250 | * relayfs_open - open file op for relayfs files | 250 | * relay_file_open - open file op for relay files |
251 | * @inode: the inode | 251 | * @inode: the inode |
252 | * @filp: the file | 252 | * @filp: the file |
253 | * | 253 | * |
254 | * Increments the channel buffer refcount. | 254 | * Increments the channel buffer refcount. |
255 | */ | 255 | */ |
256 | static int relayfs_open(struct inode *inode, struct file *filp) | 256 | static int relay_file_open(struct inode *inode, struct file *filp) |
257 | { | 257 | { |
258 | struct rchan_buf *buf = inode->u.generic_ip; | 258 | struct rchan_buf *buf = inode->u.generic_ip; |
259 | kref_get(&buf->kref); | 259 | kref_get(&buf->kref); |
@@ -263,26 +263,26 @@ static int relayfs_open(struct inode *inode, struct file *filp) | |||
263 | } | 263 | } |
264 | 264 | ||
265 | /** | 265 | /** |
266 | * relayfs_mmap - mmap file op for relayfs files | 266 | * relay_file_mmap - mmap file op for relay files |
267 | * @filp: the file | 267 | * @filp: the file |
268 | * @vma: the vma describing what to map | 268 | * @vma: the vma describing what to map |
269 | * | 269 | * |
270 | * Calls upon relay_mmap_buf to map the file into user space. | 270 | * Calls upon relay_mmap_buf to map the file into user space. |
271 | */ | 271 | */ |
272 | static int relayfs_mmap(struct file *filp, struct vm_area_struct *vma) | 272 | static int relay_file_mmap(struct file *filp, struct vm_area_struct *vma) |
273 | { | 273 | { |
274 | struct rchan_buf *buf = filp->private_data; | 274 | struct rchan_buf *buf = filp->private_data; |
275 | return relay_mmap_buf(buf, vma); | 275 | return relay_mmap_buf(buf, vma); |
276 | } | 276 | } |
277 | 277 | ||
278 | /** | 278 | /** |
279 | * relayfs_poll - poll file op for relayfs files | 279 | * relay_file_poll - poll file op for relay files |
280 | * @filp: the file | 280 | * @filp: the file |
281 | * @wait: poll table | 281 | * @wait: poll table |
282 | * | 282 | * |
283 | * Poll implemention. | 283 | * Poll implemention. |
284 | */ | 284 | */ |
285 | static unsigned int relayfs_poll(struct file *filp, poll_table *wait) | 285 | static unsigned int relay_file_poll(struct file *filp, poll_table *wait) |
286 | { | 286 | { |
287 | unsigned int mask = 0; | 287 | unsigned int mask = 0; |
288 | struct rchan_buf *buf = filp->private_data; | 288 | struct rchan_buf *buf = filp->private_data; |
@@ -300,14 +300,14 @@ static unsigned int relayfs_poll(struct file *filp, poll_table *wait) | |||
300 | } | 300 | } |
301 | 301 | ||
302 | /** | 302 | /** |
303 | * relayfs_release - release file op for relayfs files | 303 | * relay_file_release - release file op for relay files |
304 | * @inode: the inode | 304 | * @inode: the inode |
305 | * @filp: the file | 305 | * @filp: the file |
306 | * | 306 | * |
307 | * Decrements the channel refcount, as the filesystem is | 307 | * Decrements the channel refcount, as the filesystem is |
308 | * no longer using it. | 308 | * no longer using it. |
309 | */ | 309 | */ |
310 | static int relayfs_release(struct inode *inode, struct file *filp) | 310 | static int relay_file_release(struct inode *inode, struct file *filp) |
311 | { | 311 | { |
312 | struct rchan_buf *buf = filp->private_data; | 312 | struct rchan_buf *buf = filp->private_data; |
313 | kref_put(&buf->kref, relay_remove_buf); | 313 | kref_put(&buf->kref, relay_remove_buf); |
@@ -316,11 +316,11 @@ static int relayfs_release(struct inode *inode, struct file *filp) | |||
316 | } | 316 | } |
317 | 317 | ||
318 | /** | 318 | /** |
319 | * relayfs_read_consume - update the consumed count for the buffer | 319 | * relay_file_read_consume - update the consumed count for the buffer |
320 | */ | 320 | */ |
321 | static void relayfs_read_consume(struct rchan_buf *buf, | 321 | static void relay_file_read_consume(struct rchan_buf *buf, |
322 | size_t read_pos, | 322 | size_t read_pos, |
323 | size_t bytes_consumed) | 323 | size_t bytes_consumed) |
324 | { | 324 | { |
325 | size_t subbuf_size = buf->chan->subbuf_size; | 325 | size_t subbuf_size = buf->chan->subbuf_size; |
326 | size_t n_subbufs = buf->chan->n_subbufs; | 326 | size_t n_subbufs = buf->chan->n_subbufs; |
@@ -343,9 +343,9 @@ static void relayfs_read_consume(struct rchan_buf *buf, | |||
343 | } | 343 | } |
344 | 344 | ||
345 | /** | 345 | /** |
346 | * relayfs_read_avail - boolean, are there unconsumed bytes available? | 346 | * relay_file_read_avail - boolean, are there unconsumed bytes available? |
347 | */ | 347 | */ |
348 | static int relayfs_read_avail(struct rchan_buf *buf, size_t read_pos) | 348 | static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos) |
349 | { | 349 | { |
350 | size_t bytes_produced, bytes_consumed, write_offset; | 350 | size_t bytes_produced, bytes_consumed, write_offset; |
351 | size_t subbuf_size = buf->chan->subbuf_size; | 351 | size_t subbuf_size = buf->chan->subbuf_size; |
@@ -376,16 +376,16 @@ static int relayfs_read_avail(struct rchan_buf *buf, size_t read_pos) | |||
376 | if (bytes_produced == bytes_consumed) | 376 | if (bytes_produced == bytes_consumed) |
377 | return 0; | 377 | return 0; |
378 | 378 | ||
379 | relayfs_read_consume(buf, read_pos, 0); | 379 | relay_file_read_consume(buf, read_pos, 0); |
380 | 380 | ||
381 | return 1; | 381 | return 1; |
382 | } | 382 | } |
383 | 383 | ||
384 | /** | 384 | /** |
385 | * relayfs_read_subbuf_avail - return bytes available in sub-buffer | 385 | * relay_file_read_subbuf_avail - return bytes available in sub-buffer |
386 | */ | 386 | */ |
387 | static size_t relayfs_read_subbuf_avail(size_t read_pos, | 387 | static size_t relay_file_read_subbuf_avail(size_t read_pos, |
388 | struct rchan_buf *buf) | 388 | struct rchan_buf *buf) |
389 | { | 389 | { |
390 | size_t padding, avail = 0; | 390 | size_t padding, avail = 0; |
391 | size_t read_subbuf, read_offset, write_subbuf, write_offset; | 391 | size_t read_subbuf, read_offset, write_subbuf, write_offset; |
@@ -407,14 +407,14 @@ static size_t relayfs_read_subbuf_avail(size_t read_pos, | |||
407 | } | 407 | } |
408 | 408 | ||
409 | /** | 409 | /** |
410 | * relayfs_read_start_pos - find the first available byte to read | 410 | * relay_file_read_start_pos - find the first available byte to read |
411 | * | 411 | * |
412 | * If the read_pos is in the middle of padding, return the | 412 | * If the read_pos is in the middle of padding, return the |
413 | * position of the first actually available byte, otherwise | 413 | * position of the first actually available byte, otherwise |
414 | * return the original value. | 414 | * return the original value. |
415 | */ | 415 | */ |
416 | static size_t relayfs_read_start_pos(size_t read_pos, | 416 | static size_t relay_file_read_start_pos(size_t read_pos, |
417 | struct rchan_buf *buf) | 417 | struct rchan_buf *buf) |
418 | { | 418 | { |
419 | size_t read_subbuf, padding, padding_start, padding_end; | 419 | size_t read_subbuf, padding, padding_start, padding_end; |
420 | size_t subbuf_size = buf->chan->subbuf_size; | 420 | size_t subbuf_size = buf->chan->subbuf_size; |
@@ -433,11 +433,11 @@ static size_t relayfs_read_start_pos(size_t read_pos, | |||
433 | } | 433 | } |
434 | 434 | ||
435 | /** | 435 | /** |
436 | * relayfs_read_end_pos - return the new read position | 436 | * relay_file_read_end_pos - return the new read position |
437 | */ | 437 | */ |
438 | static size_t relayfs_read_end_pos(struct rchan_buf *buf, | 438 | static size_t relay_file_read_end_pos(struct rchan_buf *buf, |
439 | size_t read_pos, | 439 | size_t read_pos, |
440 | size_t count) | 440 | size_t count) |
441 | { | 441 | { |
442 | size_t read_subbuf, padding, end_pos; | 442 | size_t read_subbuf, padding, end_pos; |
443 | size_t subbuf_size = buf->chan->subbuf_size; | 443 | size_t subbuf_size = buf->chan->subbuf_size; |
@@ -456,7 +456,7 @@ static size_t relayfs_read_end_pos(struct rchan_buf *buf, | |||
456 | } | 456 | } |
457 | 457 | ||
458 | /** | 458 | /** |
459 | * relayfs_read - read file op for relayfs files | 459 | * relay_file_read - read file op for relay files |
460 | * @filp: the file | 460 | * @filp: the file |
461 | * @buffer: the userspace buffer | 461 | * @buffer: the userspace buffer |
462 | * @count: number of bytes to read | 462 | * @count: number of bytes to read |
@@ -465,10 +465,10 @@ static size_t relayfs_read_end_pos(struct rchan_buf *buf, | |||
465 | * Reads count bytes or the number of bytes available in the | 465 | * Reads count bytes or the number of bytes available in the |
466 | * current sub-buffer being read, whichever is smaller. | 466 | * current sub-buffer being read, whichever is smaller. |
467 | */ | 467 | */ |
468 | static ssize_t relayfs_read(struct file *filp, | 468 | static ssize_t relay_file_read(struct file *filp, |
469 | char __user *buffer, | 469 | char __user *buffer, |
470 | size_t count, | 470 | size_t count, |
471 | loff_t *ppos) | 471 | loff_t *ppos) |
472 | { | 472 | { |
473 | struct rchan_buf *buf = filp->private_data; | 473 | struct rchan_buf *buf = filp->private_data; |
474 | struct inode *inode = filp->f_dentry->d_inode; | 474 | struct inode *inode = filp->f_dentry->d_inode; |
@@ -477,11 +477,11 @@ static ssize_t relayfs_read(struct file *filp, | |||
477 | void *from; | 477 | void *from; |
478 | 478 | ||
479 | down(&inode->i_sem); | 479 | down(&inode->i_sem); |
480 | if(!relayfs_read_avail(buf, *ppos)) | 480 | if(!relay_file_read_avail(buf, *ppos)) |
481 | goto out; | 481 | goto out; |
482 | 482 | ||
483 | read_start = relayfs_read_start_pos(*ppos, buf); | 483 | read_start = relay_file_read_start_pos(*ppos, buf); |
484 | avail = relayfs_read_subbuf_avail(read_start, buf); | 484 | avail = relay_file_read_subbuf_avail(read_start, buf); |
485 | if (!avail) | 485 | if (!avail) |
486 | goto out; | 486 | goto out; |
487 | 487 | ||
@@ -491,20 +491,20 @@ static ssize_t relayfs_read(struct file *filp, | |||
491 | ret = -EFAULT; | 491 | ret = -EFAULT; |
492 | goto out; | 492 | goto out; |
493 | } | 493 | } |
494 | relayfs_read_consume(buf, read_start, count); | 494 | relay_file_read_consume(buf, read_start, count); |
495 | *ppos = relayfs_read_end_pos(buf, read_start, count); | 495 | *ppos = relay_file_read_end_pos(buf, read_start, count); |
496 | out: | 496 | out: |
497 | up(&inode->i_sem); | 497 | up(&inode->i_sem); |
498 | return ret; | 498 | return ret; |
499 | } | 499 | } |
500 | 500 | ||
501 | struct file_operations relayfs_file_operations = { | 501 | struct file_operations relay_file_operations = { |
502 | .open = relayfs_open, | 502 | .open = relay_file_open, |
503 | .poll = relayfs_poll, | 503 | .poll = relay_file_poll, |
504 | .mmap = relayfs_mmap, | 504 | .mmap = relay_file_mmap, |
505 | .read = relayfs_read, | 505 | .read = relay_file_read, |
506 | .llseek = no_llseek, | 506 | .llseek = no_llseek, |
507 | .release = relayfs_release, | 507 | .release = relay_file_release, |
508 | }; | 508 | }; |
509 | 509 | ||
510 | static struct super_operations relayfs_ops = { | 510 | static struct super_operations relayfs_ops = { |
@@ -558,13 +558,18 @@ static int __init init_relayfs_fs(void) | |||
558 | 558 | ||
559 | static void __exit exit_relayfs_fs(void) | 559 | static void __exit exit_relayfs_fs(void) |
560 | { | 560 | { |
561 | |||
562 | |||
563 | |||
564 | |||
565 | |||
561 | unregister_filesystem(&relayfs_fs_type); | 566 | unregister_filesystem(&relayfs_fs_type); |
562 | } | 567 | } |
563 | 568 | ||
564 | module_init(init_relayfs_fs) | 569 | module_init(init_relayfs_fs) |
565 | module_exit(exit_relayfs_fs) | 570 | module_exit(exit_relayfs_fs) |
566 | 571 | ||
567 | EXPORT_SYMBOL_GPL(relayfs_file_operations); | 572 | EXPORT_SYMBOL_GPL(relay_file_operations); |
568 | EXPORT_SYMBOL_GPL(relayfs_create_dir); | 573 | EXPORT_SYMBOL_GPL(relayfs_create_dir); |
569 | EXPORT_SYMBOL_GPL(relayfs_remove_dir); | 574 | EXPORT_SYMBOL_GPL(relayfs_remove_dir); |
570 | EXPORT_SYMBOL_GPL(relayfs_create_file); | 575 | EXPORT_SYMBOL_GPL(relayfs_create_file); |
diff --git a/fs/relayfs/relay.c b/fs/relayfs/relay.c index 2935a6ab8ffa..abf3ceaace49 100644 --- a/fs/relayfs/relay.c +++ b/fs/relayfs/relay.c | |||
@@ -90,7 +90,7 @@ static struct dentry *create_buf_file_default_callback(const char *filename, | |||
90 | int *is_global) | 90 | int *is_global) |
91 | { | 91 | { |
92 | return relayfs_create_file(filename, parent, mode, | 92 | return relayfs_create_file(filename, parent, mode, |
93 | &relayfs_file_operations, buf); | 93 | &relay_file_operations, buf); |
94 | } | 94 | } |
95 | 95 | ||
96 | /* | 96 | /* |
diff --git a/include/linux/relayfs_fs.h b/include/linux/relayfs_fs.h index 30f45511b40d..7342e66247fb 100644 --- a/include/linux/relayfs_fs.h +++ b/include/linux/relayfs_fs.h | |||
@@ -279,10 +279,9 @@ static inline void subbuf_start_reserve(struct rchan_buf *buf, | |||
279 | } | 279 | } |
280 | 280 | ||
281 | /* | 281 | /* |
282 | * exported relayfs file operations, fs/relayfs/inode.c | 282 | * exported relay file operations, fs/relayfs/inode.c |
283 | */ | 283 | */ |
284 | 284 | extern struct file_operations relay_file_operations; | |
285 | extern struct file_operations relayfs_file_operations; | ||
286 | 285 | ||
287 | #endif /* _LINUX_RELAYFS_FS_H */ | 286 | #endif /* _LINUX_RELAYFS_FS_H */ |
288 | 287 | ||