diff -p -up squashfs3.3/dkms/inode.c.2625 squashfs3.3/dkms/inode.c --- squashfs3.3/dkms/inode.c.2625 2008-07-07 16:16:05.000000000 +0200 +++ squashfs3.3/dkms/inode.c 2008-07-07 16:18:38.000000000 +0200 @@ -1,7 +1,7 @@ /* * Squashfs - a compressed read only filesystem for Linux * - * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007 + * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008 * Phillip Lougher * * This program is free software; you can redistribute it and/or @@ -62,7 +62,10 @@ static DEFINE_PER_CPU(struct sqlzma *, s static int squashfs_cached_blks; -static void vfs_read_inode(struct inode *i); +static struct dentry *squashfs_fh_to_dentry(struct super_block *s, + struct fid *fid, int fh_len, int fh_type); +static struct dentry *squashfs_fh_to_parent(struct super_block *s, + struct fid *fid, int fh_len, int fh_type); static struct dentry *squashfs_get_parent(struct dentry *child); static int squashfs_read_inode(struct inode *i, squashfs_inode_t inode); static int squashfs_statfs(struct dentry *, struct kstatfs *); @@ -103,15 +106,9 @@ static struct super_operations squashfs_ .remount_fs = squashfs_remount }; -static struct super_operations squashfs_export_super_ops = { - .alloc_inode = squashfs_alloc_inode, - .destroy_inode = squashfs_destroy_inode, - .statfs = squashfs_statfs, - .put_super = squashfs_put_super, - .read_inode = vfs_read_inode -}; - static struct export_operations squashfs_export_ops = { + .fh_to_dentry = squashfs_fh_to_dentry, + .fh_to_parent = squashfs_fh_to_parent, .get_parent = squashfs_get_parent }; @@ -667,42 +664,72 @@ static squashfs_inode_t squashfs_inode_l out: return SQUASHFS_INVALID_BLK; } - -static void vfs_read_inode(struct inode *i) + + +static struct dentry *squashfs_export_iget(struct super_block *s, + unsigned int inode_number) { - struct squashfs_sb_info *msblk = i->i_sb->s_fs_info; - squashfs_inode_t inode = squashfs_inode_lookup(i->i_sb, i->i_ino); + squashfs_inode_t inode; + struct inode *i; + struct dentry *dentry; - TRACE("Entered vfs_read_inode\n"); + TRACE("Entered squashfs_export_iget\n"); - if(inode != SQUASHFS_INVALID_BLK) - (msblk->read_inode)(i, inode); + inode = squashfs_inode_lookup(s, inode_number); + if(inode == SQUASHFS_INVALID_BLK) { + dentry = ERR_PTR(-ENOENT); + goto failure; + } + + i = squashfs_iget(s, inode, inode_number); + if(i == NULL) { + dentry = ERR_PTR(-EACCES); + goto failure; + } + + dentry = d_alloc_anon(i); + if (dentry == NULL) { + iput(i); + dentry = ERR_PTR(-ENOMEM); + } + +failure: + return dentry; +} + + +static struct dentry *squashfs_fh_to_dentry(struct super_block *s, + struct fid *fid, int fh_len, int fh_type) +{ + if((fh_type != FILEID_INO32_GEN && fh_type != FILEID_INO32_GEN_PARENT) || + fh_len < 2) + return NULL; + + return squashfs_export_iget(s, fid->i32.ino); +} + + +static struct dentry *squashfs_fh_to_parent(struct super_block *s, + struct fid *fid, int fh_len, int fh_type) +{ + if(fh_type != FILEID_INO32_GEN_PARENT || fh_len < 4) + return NULL; + + return squashfs_export_iget(s, fid->i32.parent_ino); } static struct dentry *squashfs_get_parent(struct dentry *child) { struct inode *i = child->d_inode; - struct inode *parent = iget(i->i_sb, SQUASHFS_I(i)->u.s2.parent_inode); - struct dentry *rv; TRACE("Entered squashfs_get_parent\n"); - if(parent == NULL) { - rv = ERR_PTR(-EACCES); - goto out; - } - - rv = d_alloc_anon(parent); - if(rv == NULL) - rv = ERR_PTR(-ENOMEM); - -out: - return rv; + return squashfs_export_iget(i->i_sb, SQUASHFS_I(i)->u.s2.parent_inode); } - + SQSH_EXTERN struct inode *squashfs_iget(struct super_block *s, squashfs_inode_t inode, unsigned int inode_number) { @@ -1318,7 +1345,6 @@ static int squashfs_fill_super(struct su if (read_inode_lookup_table(s) == 0) goto failed_mount; - s->s_op = &squashfs_export_super_ops; s->s_export_op = &squashfs_export_ops; allocate_root: