diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2009-12-15 19:46:51 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:20:06 -0500 |
commit | f3e2a520f5fb1a1df033efd9c2e5eadb384aad9b (patch) | |
tree | da8272b8fc8aa7bb1d0d039bf0e13b4b9609a4b7 /fs | |
parent | 080497079c0bad05133fb8d1dee300bd9e6354ec (diff) |
ufs: NFS support
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Evgeniy Dushistov <dushistov@mail.ru>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ufs/super.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 5faed7954d0a..143c20bfb04b 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -66,6 +66,7 @@ | |||
66 | */ | 66 | */ |
67 | 67 | ||
68 | 68 | ||
69 | #include <linux/exportfs.h> | ||
69 | #include <linux/module.h> | 70 | #include <linux/module.h> |
70 | #include <linux/bitops.h> | 71 | #include <linux/bitops.h> |
71 | 72 | ||
@@ -96,6 +97,56 @@ | |||
96 | #include "swab.h" | 97 | #include "swab.h" |
97 | #include "util.h" | 98 | #include "util.h" |
98 | 99 | ||
100 | static struct inode *ufs_nfs_get_inode(struct super_block *sb, u64 ino, u32 generation) | ||
101 | { | ||
102 | struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; | ||
103 | struct inode *inode; | ||
104 | |||
105 | if (ino < UFS_ROOTINO || ino > uspi->s_ncg * uspi->s_ipg) | ||
106 | return ERR_PTR(-ESTALE); | ||
107 | |||
108 | inode = ufs_iget(sb, ino); | ||
109 | if (IS_ERR(inode)) | ||
110 | return ERR_CAST(inode); | ||
111 | if (generation && inode->i_generation != generation) { | ||
112 | iput(inode); | ||
113 | return ERR_PTR(-ESTALE); | ||
114 | } | ||
115 | return inode; | ||
116 | } | ||
117 | |||
118 | static struct dentry *ufs_fh_to_dentry(struct super_block *sb, struct fid *fid, | ||
119 | int fh_len, int fh_type) | ||
120 | { | ||
121 | return generic_fh_to_dentry(sb, fid, fh_len, fh_type, ufs_nfs_get_inode); | ||
122 | } | ||
123 | |||
124 | static struct dentry *ufs_fh_to_parent(struct super_block *sb, struct fid *fid, | ||
125 | int fh_len, int fh_type) | ||
126 | { | ||
127 | return generic_fh_to_parent(sb, fid, fh_len, fh_type, ufs_nfs_get_inode); | ||
128 | } | ||
129 | |||
130 | static struct dentry *ufs_get_parent(struct dentry *child) | ||
131 | { | ||
132 | struct qstr dot_dot = { | ||
133 | .name = "..", | ||
134 | .len = 2, | ||
135 | }; | ||
136 | ino_t ino; | ||
137 | |||
138 | ino = ufs_inode_by_name(child->d_inode, &dot_dot); | ||
139 | if (!ino) | ||
140 | return ERR_PTR(-ENOENT); | ||
141 | return d_obtain_alias(ufs_iget(child->d_inode->i_sb, ino)); | ||
142 | } | ||
143 | |||
144 | static const struct export_operations ufs_export_ops = { | ||
145 | .fh_to_dentry = ufs_fh_to_dentry, | ||
146 | .fh_to_parent = ufs_fh_to_parent, | ||
147 | .get_parent = ufs_get_parent, | ||
148 | }; | ||
149 | |||
99 | #ifdef CONFIG_UFS_DEBUG | 150 | #ifdef CONFIG_UFS_DEBUG |
100 | /* | 151 | /* |
101 | * Print contents of ufs_super_block, useful for debugging | 152 | * Print contents of ufs_super_block, useful for debugging |
@@ -990,6 +1041,7 @@ magic_found: | |||
990 | * Read ufs_super_block into internal data structures | 1041 | * Read ufs_super_block into internal data structures |
991 | */ | 1042 | */ |
992 | sb->s_op = &ufs_super_ops; | 1043 | sb->s_op = &ufs_super_ops; |
1044 | sb->s_export_op = &ufs_export_ops; | ||
993 | sb->dq_op = NULL; /***/ | 1045 | sb->dq_op = NULL; /***/ |
994 | sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic); | 1046 | sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic); |
995 | 1047 | ||