diff options
author | Fabian Frederick <fabf@skynet.be> | 2015-02-17 16:45:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-17 17:34:50 -0500 |
commit | b625032b10222c4406979c7604189f2bef29c5d0 (patch) | |
tree | 9d464c877d84e7b9e0a58765095c1b994cbc403c | |
parent | 111d639dd659bc1496a63cb8854abab8a15f3728 (diff) |
fs/coda/dir.c: forward declaration clean-up
- Move operation structures to avoid forward declarations.
- Fix some checkpatch warnings:
WARNING: Missing a blank line after declarations
+ struct inode *host_inode = file_inode(host_file);
+ mutex_lock(&host_inode->i_mutex);
ERROR: that open brace { should be on the previous line
+const struct dentry_operations coda_dentry_operations =
+{
ERROR: that open brace { should be on the previous line
+const struct inode_operations coda_dir_inode_operations =
+{
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Cc: Jan Harkes <jaharkes@cs.cmu.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/coda/dir.c | 138 |
1 files changed, 56 insertions, 82 deletions
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 86c893884eb9..281ee011bb6a 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
@@ -28,29 +28,6 @@ | |||
28 | 28 | ||
29 | #include "coda_int.h" | 29 | #include "coda_int.h" |
30 | 30 | ||
31 | /* dir inode-ops */ | ||
32 | static int coda_create(struct inode *dir, struct dentry *new, umode_t mode, bool excl); | ||
33 | static struct dentry *coda_lookup(struct inode *dir, struct dentry *target, unsigned int flags); | ||
34 | static int coda_link(struct dentry *old_dentry, struct inode *dir_inode, | ||
35 | struct dentry *entry); | ||
36 | static int coda_unlink(struct inode *dir_inode, struct dentry *entry); | ||
37 | static int coda_symlink(struct inode *dir_inode, struct dentry *entry, | ||
38 | const char *symname); | ||
39 | static int coda_mkdir(struct inode *dir_inode, struct dentry *entry, umode_t mode); | ||
40 | static int coda_rmdir(struct inode *dir_inode, struct dentry *entry); | ||
41 | static int coda_rename(struct inode *old_inode, struct dentry *old_dentry, | ||
42 | struct inode *new_inode, struct dentry *new_dentry); | ||
43 | |||
44 | /* dir file-ops */ | ||
45 | static int coda_readdir(struct file *file, struct dir_context *ctx); | ||
46 | |||
47 | /* dentry ops */ | ||
48 | static int coda_dentry_revalidate(struct dentry *de, unsigned int flags); | ||
49 | static int coda_dentry_delete(const struct dentry *); | ||
50 | |||
51 | /* support routines */ | ||
52 | static int coda_venus_readdir(struct file *, struct dir_context *); | ||
53 | |||
54 | /* same as fs/bad_inode.c */ | 31 | /* same as fs/bad_inode.c */ |
55 | static int coda_return_EIO(void) | 32 | static int coda_return_EIO(void) |
56 | { | 33 | { |
@@ -58,38 +35,6 @@ static int coda_return_EIO(void) | |||
58 | } | 35 | } |
59 | #define CODA_EIO_ERROR ((void *) (coda_return_EIO)) | 36 | #define CODA_EIO_ERROR ((void *) (coda_return_EIO)) |
60 | 37 | ||
61 | const struct dentry_operations coda_dentry_operations = | ||
62 | { | ||
63 | .d_revalidate = coda_dentry_revalidate, | ||
64 | .d_delete = coda_dentry_delete, | ||
65 | }; | ||
66 | |||
67 | const struct inode_operations coda_dir_inode_operations = | ||
68 | { | ||
69 | .create = coda_create, | ||
70 | .lookup = coda_lookup, | ||
71 | .link = coda_link, | ||
72 | .unlink = coda_unlink, | ||
73 | .symlink = coda_symlink, | ||
74 | .mkdir = coda_mkdir, | ||
75 | .rmdir = coda_rmdir, | ||
76 | .mknod = CODA_EIO_ERROR, | ||
77 | .rename = coda_rename, | ||
78 | .permission = coda_permission, | ||
79 | .getattr = coda_getattr, | ||
80 | .setattr = coda_setattr, | ||
81 | }; | ||
82 | |||
83 | const struct file_operations coda_dir_operations = { | ||
84 | .llseek = generic_file_llseek, | ||
85 | .read = generic_read_dir, | ||
86 | .iterate = coda_readdir, | ||
87 | .open = coda_open, | ||
88 | .release = coda_release, | ||
89 | .fsync = coda_fsync, | ||
90 | }; | ||
91 | |||
92 | |||
93 | /* inode operations for directories */ | 38 | /* inode operations for directories */ |
94 | /* access routines: lookup, readlink, permission */ | 39 | /* access routines: lookup, readlink, permission */ |
95 | static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, unsigned int flags) | 40 | static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, unsigned int flags) |
@@ -374,33 +319,6 @@ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
374 | return error; | 319 | return error; |
375 | } | 320 | } |
376 | 321 | ||
377 | |||
378 | /* file operations for directories */ | ||
379 | static int coda_readdir(struct file *coda_file, struct dir_context *ctx) | ||
380 | { | ||
381 | struct coda_file_info *cfi; | ||
382 | struct file *host_file; | ||
383 | int ret; | ||
384 | |||
385 | cfi = CODA_FTOC(coda_file); | ||
386 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
387 | host_file = cfi->cfi_container; | ||
388 | |||
389 | if (host_file->f_op->iterate) { | ||
390 | struct inode *host_inode = file_inode(host_file); | ||
391 | mutex_lock(&host_inode->i_mutex); | ||
392 | ret = -ENOENT; | ||
393 | if (!IS_DEADDIR(host_inode)) { | ||
394 | ret = host_file->f_op->iterate(host_file, ctx); | ||
395 | file_accessed(host_file); | ||
396 | } | ||
397 | mutex_unlock(&host_inode->i_mutex); | ||
398 | return ret; | ||
399 | } | ||
400 | /* Venus: we must read Venus dirents from a file */ | ||
401 | return coda_venus_readdir(coda_file, ctx); | ||
402 | } | ||
403 | |||
404 | static inline unsigned int CDT2DT(unsigned char cdt) | 322 | static inline unsigned int CDT2DT(unsigned char cdt) |
405 | { | 323 | { |
406 | unsigned int dt; | 324 | unsigned int dt; |
@@ -495,6 +413,33 @@ out: | |||
495 | return 0; | 413 | return 0; |
496 | } | 414 | } |
497 | 415 | ||
416 | /* file operations for directories */ | ||
417 | static int coda_readdir(struct file *coda_file, struct dir_context *ctx) | ||
418 | { | ||
419 | struct coda_file_info *cfi; | ||
420 | struct file *host_file; | ||
421 | int ret; | ||
422 | |||
423 | cfi = CODA_FTOC(coda_file); | ||
424 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
425 | host_file = cfi->cfi_container; | ||
426 | |||
427 | if (host_file->f_op->iterate) { | ||
428 | struct inode *host_inode = file_inode(host_file); | ||
429 | |||
430 | mutex_lock(&host_inode->i_mutex); | ||
431 | ret = -ENOENT; | ||
432 | if (!IS_DEADDIR(host_inode)) { | ||
433 | ret = host_file->f_op->iterate(host_file, ctx); | ||
434 | file_accessed(host_file); | ||
435 | } | ||
436 | mutex_unlock(&host_inode->i_mutex); | ||
437 | return ret; | ||
438 | } | ||
439 | /* Venus: we must read Venus dirents from a file */ | ||
440 | return coda_venus_readdir(coda_file, ctx); | ||
441 | } | ||
442 | |||
498 | /* called when a cache lookup succeeds */ | 443 | /* called when a cache lookup succeeds */ |
499 | static int coda_dentry_revalidate(struct dentry *de, unsigned int flags) | 444 | static int coda_dentry_revalidate(struct dentry *de, unsigned int flags) |
500 | { | 445 | { |
@@ -603,3 +548,32 @@ int coda_revalidate_inode(struct inode *inode) | |||
603 | } | 548 | } |
604 | return 0; | 549 | return 0; |
605 | } | 550 | } |
551 | |||
552 | const struct dentry_operations coda_dentry_operations = { | ||
553 | .d_revalidate = coda_dentry_revalidate, | ||
554 | .d_delete = coda_dentry_delete, | ||
555 | }; | ||
556 | |||
557 | const struct inode_operations coda_dir_inode_operations = { | ||
558 | .create = coda_create, | ||
559 | .lookup = coda_lookup, | ||
560 | .link = coda_link, | ||
561 | .unlink = coda_unlink, | ||
562 | .symlink = coda_symlink, | ||
563 | .mkdir = coda_mkdir, | ||
564 | .rmdir = coda_rmdir, | ||
565 | .mknod = CODA_EIO_ERROR, | ||
566 | .rename = coda_rename, | ||
567 | .permission = coda_permission, | ||
568 | .getattr = coda_getattr, | ||
569 | .setattr = coda_setattr, | ||
570 | }; | ||
571 | |||
572 | const struct file_operations coda_dir_operations = { | ||
573 | .llseek = generic_file_llseek, | ||
574 | .read = generic_read_dir, | ||
575 | .iterate = coda_readdir, | ||
576 | .open = coda_open, | ||
577 | .release = coda_release, | ||
578 | .fsync = coda_fsync, | ||
579 | }; | ||