aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-10-21 19:42:13 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-22 11:13:20 -0400
commit480b116c98344ca246f50aade6eb7aca98151a2f (patch)
tree72ba3ba17f8c5a72fbd168d1a963b06e269ad898 /mm
parent905251a02eeccc59f8e1d743679b8edadc5f738b (diff)
shmem: new export ops
I'm not sure what people were thinking when adding support to export tmpfs, but here's the conversion anyway: Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Neil Brown <neilb@suse.de> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/shmem.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 289dbb0a6fd6..9dd219e6e059 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2020,33 +2020,25 @@ static int shmem_match(struct inode *ino, void *vfh)
2020 return ino->i_ino == inum && fh[0] == ino->i_generation; 2020 return ino->i_ino == inum && fh[0] == ino->i_generation;
2021} 2021}
2022 2022
2023static struct dentry *shmem_get_dentry(struct super_block *sb, void *vfh) 2023static struct dentry *shmem_fh_to_dentry(struct super_block *sb,
2024 struct fid *fid, int fh_len, int fh_type)
2024{ 2025{
2025 struct dentry *de = NULL;
2026 struct inode *inode; 2026 struct inode *inode;
2027 __u32 *fh = vfh; 2027 struct dentry *dentry = NULL;
2028 __u64 inum = fh[2]; 2028 u64 inum = fid->raw[2];
2029 inum = (inum << 32) | fh[1]; 2029 inum = (inum << 32) | fid->raw[1];
2030
2031 if (fh_len < 3)
2032 return NULL;
2030 2033
2031 inode = ilookup5(sb, (unsigned long)(inum+fh[0]), shmem_match, vfh); 2034 inode = ilookup5(sb, (unsigned long)(inum + fid->raw[0]),
2035 shmem_match, fid->raw);
2032 if (inode) { 2036 if (inode) {
2033 de = d_find_alias(inode); 2037 dentry = d_find_alias(inode);
2034 iput(inode); 2038 iput(inode);
2035 } 2039 }
2036 2040
2037 return de? de: ERR_PTR(-ESTALE); 2041 return dentry;
2038}
2039
2040static struct dentry *shmem_decode_fh(struct super_block *sb, __u32 *fh,
2041 int len, int type,
2042 int (*acceptable)(void *context, struct dentry *de),
2043 void *context)
2044{
2045 if (len < 3)
2046 return ERR_PTR(-ESTALE);
2047
2048 return sb->s_export_op->find_exported_dentry(sb, fh, NULL, acceptable,
2049 context);
2050} 2042}
2051 2043
2052static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len, 2044static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
@@ -2081,9 +2073,8 @@ static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
2081 2073
2082static struct export_operations shmem_export_ops = { 2074static struct export_operations shmem_export_ops = {
2083 .get_parent = shmem_get_parent, 2075 .get_parent = shmem_get_parent,
2084 .get_dentry = shmem_get_dentry,
2085 .encode_fh = shmem_encode_fh, 2076 .encode_fh = shmem_encode_fh,
2086 .decode_fh = shmem_decode_fh, 2077 .fh_to_dentry = shmem_fh_to_dentry,
2087}; 2078};
2088 2079
2089static int shmem_parse_options(char *options, int *mode, uid_t *uid, 2080static int shmem_parse_options(char *options, int *mode, uid_t *uid,