aboutsummaryrefslogtreecommitdiffstats
path: root/fs/coda
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 13:27:28 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 13:27:28 -0500
commitb2034d474b7e1e8578bd5c2977024b51693269d9 (patch)
treee43969bf7c2ba89884c2580f56978826f1014520 /fs/coda
parent27d189c02ba25851973c8582e419c0bded9f7e5b (diff)
parent924241575a85249b9d410e38f5b2fcad9035e45c (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (41 commits) fs: add documentation on fallocate hole punching Gfs2: fail if we try to use hole punch Btrfs: fail if we try to use hole punch Ext4: fail if we try to use hole punch Ocfs2: handle hole punching via fallocate properly XFS: handle hole punching via fallocate properly fs: add hole punching to fallocate vfs: pass struct file to do_truncate on O_TRUNC opens (try #2) fix signedness mess in rw_verify_area() on 64bit architectures fs: fix kernel-doc for dcache::prepend_path fs: fix kernel-doc for dcache::d_validate sanitize ecryptfs ->mount() switch afs move internal-only parts of ncpfs headers to fs/ncpfs switch ncpfs switch 9p pass default dentry_operations to mount_pseudo() switch hostfs switch affs switch configfs ...
Diffstat (limited to 'fs/coda')
-rw-r--r--fs/coda/cache.c5
-rw-r--r--fs/coda/cnode.c3
-rw-r--r--fs/coda/coda_cache.h22
-rw-r--r--fs/coda/coda_fs_i.h58
-rw-r--r--fs/coda/coda_linux.c3
-rw-r--r--fs/coda/coda_linux.h101
-rw-r--r--fs/coda/dir.c9
-rw-r--r--fs/coda/file.c3
-rw-r--r--fs/coda/inode.c6
-rw-r--r--fs/coda/pioctl.c4
-rw-r--r--fs/coda/psdev.c4
-rw-r--r--fs/coda/symlink.c4
-rw-r--r--fs/coda/upcall.c5
13 files changed, 200 insertions, 27 deletions
diff --git a/fs/coda/cache.c b/fs/coda/cache.c
index 5525e1c660fd..690157876184 100644
--- a/fs/coda/cache.c
+++ b/fs/coda/cache.c
@@ -20,10 +20,9 @@
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21 21
22#include <linux/coda.h> 22#include <linux/coda.h>
23#include <linux/coda_linux.h>
24#include <linux/coda_psdev.h> 23#include <linux/coda_psdev.h>
25#include <linux/coda_fs_i.h> 24#include "coda_linux.h"
26#include <linux/coda_cache.h> 25#include "coda_cache.h"
27 26
28static atomic_t permission_epoch = ATOMIC_INIT(0); 27static atomic_t permission_epoch = ATOMIC_INIT(0);
29 28
diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c
index 602240569c89..6475877b0763 100644
--- a/fs/coda/cnode.c
+++ b/fs/coda/cnode.c
@@ -7,9 +7,8 @@
7#include <linux/time.h> 7#include <linux/time.h>
8 8
9#include <linux/coda.h> 9#include <linux/coda.h>
10#include <linux/coda_linux.h>
11#include <linux/coda_fs_i.h>
12#include <linux/coda_psdev.h> 10#include <linux/coda_psdev.h>
11#include "coda_linux.h"
13 12
14static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2) 13static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2)
15{ 14{
diff --git a/fs/coda/coda_cache.h b/fs/coda/coda_cache.h
new file mode 100644
index 000000000000..c910b5eb1ceb
--- /dev/null
+++ b/fs/coda/coda_cache.h
@@ -0,0 +1,22 @@
1/* Coda filesystem -- Linux Minicache
2 *
3 * Copyright (C) 1989 - 1997 Carnegie Mellon University
4 *
5 * Carnegie Mellon University encourages users of this software to
6 * contribute improvements to the Coda project. Contact Peter Braam
7 * <coda@cs.cmu.edu>
8 */
9
10#ifndef _CFSNC_HEADER_
11#define _CFSNC_HEADER_
12
13/* credential cache */
14void coda_cache_enter(struct inode *inode, int mask);
15void coda_cache_clear_inode(struct inode *);
16void coda_cache_clear_all(struct super_block *sb);
17int coda_cache_check(struct inode *inode, int mask);
18
19/* for downcalls and attributes and lookups */
20void coda_flag_inode_children(struct inode *inode, int flag);
21
22#endif /* _CFSNC_HEADER_ */
diff --git a/fs/coda/coda_fs_i.h b/fs/coda/coda_fs_i.h
new file mode 100644
index 000000000000..e35071b1de0e
--- /dev/null
+++ b/fs/coda/coda_fs_i.h
@@ -0,0 +1,58 @@
1/*
2 * coda_fs_i.h
3 *
4 * Copyright (C) 1998 Carnegie Mellon University
5 *
6 */
7
8#ifndef _LINUX_CODA_FS_I
9#define _LINUX_CODA_FS_I
10
11#include <linux/types.h>
12#include <linux/list.h>
13#include <linux/spinlock.h>
14#include <linux/coda.h>
15
16/*
17 * coda fs inode data
18 * c_lock protects accesses to c_flags, c_mapcount, c_cached_epoch, c_uid and
19 * c_cached_perm.
20 * vfs_inode is set only when the inode is created and never changes.
21 * c_fid is set when the inode is created and should be considered immutable.
22 */
23struct coda_inode_info {
24 struct CodaFid c_fid; /* Coda identifier */
25 u_short c_flags; /* flags (see below) */
26 unsigned int c_mapcount; /* nr of times this inode is mapped */
27 unsigned int c_cached_epoch; /* epoch for cached permissions */
28 vuid_t c_uid; /* fsuid for cached permissions */
29 unsigned int c_cached_perm; /* cached access permissions */
30 spinlock_t c_lock;
31 struct inode vfs_inode;
32};
33
34/*
35 * coda fs file private data
36 */
37#define CODA_MAGIC 0xC0DAC0DA
38struct coda_file_info {
39 int cfi_magic; /* magic number */
40 struct file *cfi_container; /* container file for this cnode */
41 unsigned int cfi_mapcount; /* nr of times this file is mapped */
42};
43
44#define CODA_FTOC(file) ((struct coda_file_info *)((file)->private_data))
45
46/* flags */
47#define C_VATTR 0x1 /* Validity of vattr in inode */
48#define C_FLUSH 0x2 /* used after a flush */
49#define C_DYING 0x4 /* from venus (which died) */
50#define C_PURGE 0x8
51
52int coda_cnode_make(struct inode **, struct CodaFid *, struct super_block *);
53struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr);
54int coda_cnode_makectl(struct inode **inode, struct super_block *sb);
55struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb);
56void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *);
57
58#endif
diff --git a/fs/coda/coda_linux.c b/fs/coda/coda_linux.c
index bf4a3fd3c8e3..2bdbcc11b373 100644
--- a/fs/coda/coda_linux.c
+++ b/fs/coda/coda_linux.c
@@ -17,9 +17,8 @@
17#include <linux/string.h> 17#include <linux/string.h>
18 18
19#include <linux/coda.h> 19#include <linux/coda.h>
20#include <linux/coda_linux.h>
21#include <linux/coda_psdev.h> 20#include <linux/coda_psdev.h>
22#include <linux/coda_fs_i.h> 21#include "coda_linux.h"
23 22
24/* initialize the debugging variables */ 23/* initialize the debugging variables */
25int coda_fake_statfs; 24int coda_fake_statfs;
diff --git a/fs/coda/coda_linux.h b/fs/coda/coda_linux.h
new file mode 100644
index 000000000000..9b0c5323890b
--- /dev/null
+++ b/fs/coda/coda_linux.h
@@ -0,0 +1,101 @@
1/*
2 * Coda File System, Linux Kernel module
3 *
4 * Original version, adapted from cfs_mach.c, (C) Carnegie Mellon University
5 * Linux modifications (C) 1996, Peter J. Braam
6 * Rewritten for Linux 2.1 (C) 1997 Carnegie Mellon University
7 *
8 * Carnegie Mellon University encourages users of this software to
9 * contribute improvements to the Coda project.
10 */
11
12#ifndef _LINUX_CODA_FS
13#define _LINUX_CODA_FS
14
15#include <linux/kernel.h>
16#include <linux/param.h>
17#include <linux/mm.h>
18#include <linux/vmalloc.h>
19#include <linux/slab.h>
20#include <linux/wait.h>
21#include <linux/types.h>
22#include <linux/fs.h>
23#include "coda_fs_i.h"
24
25/* operations */
26extern const struct inode_operations coda_dir_inode_operations;
27extern const struct inode_operations coda_file_inode_operations;
28extern const struct inode_operations coda_ioctl_inode_operations;
29
30extern const struct dentry_operations coda_dentry_operations;
31
32extern const struct address_space_operations coda_file_aops;
33extern const struct address_space_operations coda_symlink_aops;
34
35extern const struct file_operations coda_dir_operations;
36extern const struct file_operations coda_file_operations;
37extern const struct file_operations coda_ioctl_operations;
38
39/* operations shared over more than one file */
40int coda_open(struct inode *i, struct file *f);
41int coda_release(struct inode *i, struct file *f);
42int coda_permission(struct inode *inode, int mask, unsigned int flags);
43int coda_revalidate_inode(struct dentry *);
44int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
45int coda_setattr(struct dentry *, struct iattr *);
46
47/* this file: heloers */
48char *coda_f2s(struct CodaFid *f);
49int coda_isroot(struct inode *i);
50int coda_iscontrol(const char *name, size_t length);
51
52void coda_vattr_to_iattr(struct inode *, struct coda_vattr *);
53void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *);
54unsigned short coda_flags_to_cflags(unsigned short);
55
56/* sysctl.h */
57void coda_sysctl_init(void);
58void coda_sysctl_clean(void);
59
60#define CODA_ALLOC(ptr, cast, size) do { \
61 if (size < PAGE_SIZE) \
62 ptr = kmalloc((unsigned long) size, GFP_KERNEL); \
63 else \
64 ptr = (cast)vmalloc((unsigned long) size); \
65 if (!ptr) \
66 printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \
67 else memset( ptr, 0, size ); \
68} while (0)
69
70
71#define CODA_FREE(ptr,size) \
72 do { if (size < PAGE_SIZE) kfree((ptr)); else vfree((ptr)); } while (0)
73
74/* inode to cnode access functions */
75
76static inline struct coda_inode_info *ITOC(struct inode *inode)
77{
78 return list_entry(inode, struct coda_inode_info, vfs_inode);
79}
80
81static __inline__ struct CodaFid *coda_i2f(struct inode *inode)
82{
83 return &(ITOC(inode)->c_fid);
84}
85
86static __inline__ char *coda_i2s(struct inode *inode)
87{
88 return coda_f2s(&(ITOC(inode)->c_fid));
89}
90
91/* this will not zap the inode away */
92static __inline__ void coda_flag_inode(struct inode *inode, int flag)
93{
94 struct coda_inode_info *cii = ITOC(inode);
95
96 spin_lock(&cii->c_lock);
97 cii->c_flags |= flag;
98 spin_unlock(&cii->c_lock);
99}
100
101#endif
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 29badd91360f..2b8dae4d121e 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -23,10 +23,9 @@
23#include <asm/uaccess.h> 23#include <asm/uaccess.h>
24 24
25#include <linux/coda.h> 25#include <linux/coda.h>
26#include <linux/coda_linux.h>
27#include <linux/coda_psdev.h> 26#include <linux/coda_psdev.h>
28#include <linux/coda_fs_i.h> 27#include "coda_linux.h"
29#include <linux/coda_cache.h> 28#include "coda_cache.h"
30 29
31#include "coda_int.h" 30#include "coda_int.h"
32 31
@@ -61,7 +60,7 @@ static int coda_return_EIO(void)
61} 60}
62#define CODA_EIO_ERROR ((void *) (coda_return_EIO)) 61#define CODA_EIO_ERROR ((void *) (coda_return_EIO))
63 62
64static const struct dentry_operations coda_dentry_operations = 63const struct dentry_operations coda_dentry_operations =
65{ 64{
66 .d_revalidate = coda_dentry_revalidate, 65 .d_revalidate = coda_dentry_revalidate,
67 .d_delete = coda_dentry_delete, 66 .d_delete = coda_dentry_delete,
@@ -126,8 +125,6 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struc
126 return ERR_PTR(error); 125 return ERR_PTR(error);
127 126
128exit: 127exit:
129 d_set_d_op(entry, &coda_dentry_operations);
130
131 if (inode && (type & CODA_NOCACHE)) 128 if (inode && (type & CODA_NOCACHE))
132 coda_flag_inode(inode, C_VATTR | C_PURGE); 129 coda_flag_inode(inode, C_VATTR | C_PURGE);
133 130
diff --git a/fs/coda/file.c b/fs/coda/file.c
index c8b50ba4366a..0433057be330 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -21,10 +21,9 @@
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22 22
23#include <linux/coda.h> 23#include <linux/coda.h>
24#include <linux/coda_linux.h>
25#include <linux/coda_fs_i.h>
26#include <linux/coda_psdev.h> 24#include <linux/coda_psdev.h>
27 25
26#include "coda_linux.h"
28#include "coda_int.h" 27#include "coda_int.h"
29 28
30static ssize_t 29static ssize_t
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index f065a5d31a19..871b27715465 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -28,10 +28,9 @@
28#include <linux/vmalloc.h> 28#include <linux/vmalloc.h>
29 29
30#include <linux/coda.h> 30#include <linux/coda.h>
31#include <linux/coda_linux.h>
32#include <linux/coda_psdev.h> 31#include <linux/coda_psdev.h>
33#include <linux/coda_fs_i.h> 32#include "coda_linux.h"
34#include <linux/coda_cache.h> 33#include "coda_cache.h"
35 34
36#include "coda_int.h" 35#include "coda_int.h"
37 36
@@ -193,6 +192,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
193 sb->s_blocksize_bits = 12; 192 sb->s_blocksize_bits = 12;
194 sb->s_magic = CODA_SUPER_MAGIC; 193 sb->s_magic = CODA_SUPER_MAGIC;
195 sb->s_op = &coda_super_operations; 194 sb->s_op = &coda_super_operations;
195 sb->s_d_op = &coda_dentry_operations;
196 sb->s_bdi = &vc->bdi; 196 sb->s_bdi = &vc->bdi;
197 197
198 /* get root fid from Venus: this needs the root inode */ 198 /* get root fid from Venus: this needs the root inode */
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c
index 741f0bd03918..6cbb3afb36dc 100644
--- a/fs/coda/pioctl.c
+++ b/fs/coda/pioctl.c
@@ -19,10 +19,10 @@
19#include <asm/uaccess.h> 19#include <asm/uaccess.h>
20 20
21#include <linux/coda.h> 21#include <linux/coda.h>
22#include <linux/coda_linux.h>
23#include <linux/coda_fs_i.h>
24#include <linux/coda_psdev.h> 22#include <linux/coda_psdev.h>
25 23
24#include "coda_linux.h"
25
26/* pioctl ops */ 26/* pioctl ops */
27static int coda_ioctl_permission(struct inode *inode, int mask, unsigned int flags); 27static int coda_ioctl_permission(struct inode *inode, int mask, unsigned int flags);
28static long coda_pioctl(struct file *filp, unsigned int cmd, 28static long coda_pioctl(struct file *filp, unsigned int cmd,
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c
index 62647a8595e4..8f616e0e252c 100644
--- a/fs/coda/psdev.c
+++ b/fs/coda/psdev.c
@@ -43,10 +43,10 @@
43#include <asm/uaccess.h> 43#include <asm/uaccess.h>
44 44
45#include <linux/coda.h> 45#include <linux/coda.h>
46#include <linux/coda_linux.h>
47#include <linux/coda_fs_i.h>
48#include <linux/coda_psdev.h> 46#include <linux/coda_psdev.h>
49 47
48#include "coda_linux.h"
49
50#include "coda_int.h" 50#include "coda_int.h"
51 51
52/* statistics */ 52/* statistics */
diff --git a/fs/coda/symlink.c b/fs/coda/symlink.c
index af78f007a2b0..ab94ef63caef 100644
--- a/fs/coda/symlink.c
+++ b/fs/coda/symlink.c
@@ -16,9 +16,9 @@
16#include <linux/pagemap.h> 16#include <linux/pagemap.h>
17 17
18#include <linux/coda.h> 18#include <linux/coda.h>
19#include <linux/coda_linux.h>
20#include <linux/coda_psdev.h> 19#include <linux/coda_psdev.h>
21#include <linux/coda_fs_i.h> 20
21#include "coda_linux.h"
22 22
23static int coda_symlink_filler(struct file *file, struct page *page) 23static int coda_symlink_filler(struct file *file, struct page *page)
24{ 24{
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
index c3563cab9758..9727e0c52579 100644
--- a/fs/coda/upcall.c
+++ b/fs/coda/upcall.c
@@ -33,10 +33,9 @@
33#include <linux/vfs.h> 33#include <linux/vfs.h>
34 34
35#include <linux/coda.h> 35#include <linux/coda.h>
36#include <linux/coda_linux.h>
37#include <linux/coda_psdev.h> 36#include <linux/coda_psdev.h>
38#include <linux/coda_fs_i.h> 37#include "coda_linux.h"
39#include <linux/coda_cache.h> 38#include "coda_cache.h"
40 39
41#include "coda_int.h" 40#include "coda_int.h"
42 41