X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fafs%2Fmntpt.c;h=8f74e845082659fd1efc291f7f37f6f1026ef274;hb=refs%2Fheads%2Fvserver;hp=3a36a3ca5e39653f825ba167d8f4e1f52a6f5e0f;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c index 3a36a3ca5..8f74e8450 100644 --- a/fs/afs/mntpt.c +++ b/fs/afs/mntpt.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include "super.h" #include "cell.h" #include "volume.h" @@ -30,25 +30,19 @@ static struct dentry *afs_mntpt_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd); static int afs_mntpt_open(struct inode *inode, struct file *file); +static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd); -#ifdef AFS_AUTOMOUNT_SUPPORT -static int afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd); -#endif - -struct file_operations afs_mntpt_file_operations = { +const struct file_operations afs_mntpt_file_operations = { .open = afs_mntpt_open, }; struct inode_operations afs_mntpt_inode_operations = { .lookup = afs_mntpt_lookup, -#ifdef AFS_AUTOMOUNT_SUPPORT .follow_link = afs_mntpt_follow_link, -#endif .readlink = page_readlink, .getattr = afs_inode_getattr, }; -#ifdef AFS_AUTOMOUNT_SUPPORT static LIST_HEAD(afs_vfsmounts); static void afs_mntpt_expiry_timed_out(struct afs_timer *timer); @@ -60,7 +54,6 @@ struct afs_timer_ops afs_mntpt_expiry_timer_ops = { struct afs_timer afs_mntpt_expiry_timer; unsigned long afs_mntpt_expiry_timeout = 20; -#endif /*****************************************************************************/ /* @@ -70,7 +63,6 @@ unsigned long afs_mntpt_expiry_timeout = 20; int afs_mntpt_check_symlink(struct afs_vnode *vnode) { struct page *page; - filler_t *filler; size_t size; char *buf; int ret; @@ -78,10 +70,7 @@ int afs_mntpt_check_symlink(struct afs_vnode *vnode) _enter("{%u,%u}", vnode->fid.vnode, vnode->fid.unique); /* read the contents of the symlink into the pagecache */ - filler = (filler_t *) AFS_VNODE_TO_I(vnode)->i_mapping->a_ops->readpage; - - page = read_cache_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0, - filler, NULL); + page = read_mapping_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0, NULL); if (IS_ERR(page)) { ret = PTR_ERR(page); goto out; @@ -147,16 +136,15 @@ static int afs_mntpt_open(struct inode *inode, struct file *file) { kenter("%p,%p{%p{%s},%s}", inode, file, - file->f_dentry->d_parent, - file->f_dentry->d_parent ? - file->f_dentry->d_parent->d_name.name : + file->f_path.dentry->d_parent, + file->f_path.dentry->d_parent ? + file->f_path.dentry->d_parent->d_name.name : (const unsigned char *) "", - file->f_dentry->d_name.name); + file->f_path.dentry->d_name.name); return -EREMOTE; } /* end afs_mntpt_open() */ -#ifdef AFS_AUTOMOUNT_SUPPORT /*****************************************************************************/ /* * create a vfsmount to be automounted @@ -189,9 +177,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) goto error; /* read the contents of the AFS special symlink */ - filler_t *filler = mntpt->d_inode->i_mapping->a_ops->readpage; - - page = read_cache_page(mntpt->d_inode->i_mapping, 0, filler, NULL); + page = read_mapping_page(mntpt->d_inode->i_mapping, 0, NULL); if (IS_ERR(page)) { ret = PTR_ERR(page); goto error; @@ -217,7 +203,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) /* try and do the mount */ kdebug("--- attempting mount %s -o %s ---", devname, options); - mnt = do_kern_mount("afs", 0, devname, options); + mnt = vfs_kern_mount(&afs_fs_type, 0, devname, options); kdebug("--- mount result %p ---", mnt); free_page((unsigned long) devname); @@ -240,10 +226,10 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) /* * follow a link from a mountpoint directory, thus causing it to be mounted */ -static int afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd) +static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd) { - struct nameidata newnd; struct vfsmount *newmnt; + struct dentry *old_dentry; int err; kenter("%p{%s},{%s:%p{%s}}", @@ -254,15 +240,19 @@ static int afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd) nd->dentry->d_name.name); newmnt = afs_mntpt_do_automount(dentry); - if (IS_ERR(newmnt)) - return PTR_ERR(newmnt); + if (IS_ERR(newmnt)) { + path_release(nd); + return (void *)newmnt; + } + + old_dentry = nd->dentry; + nd->dentry = dentry; + err = do_add_mount(newmnt, nd, 0, &afs_vfsmounts); + nd->dentry = old_dentry; - struct_cpy(&newnd, nd); - newnd.dentry = dentry; - err = do_add_mount(newmnt, &newnd, 0, &afs_vfsmounts); + path_release(nd); if (!err) { - path_release(nd); mntget(newmnt); nd->mnt = newmnt; dget(newmnt->mnt_root); @@ -270,7 +260,7 @@ static int afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd) } kleave(" = %d", err); - return err; + return ERR_PTR(err); } /* end afs_mntpt_follow_link() */ /*****************************************************************************/ @@ -288,4 +278,3 @@ static void afs_mntpt_expiry_timed_out(struct afs_timer *timer) kleave(""); } /* end afs_mntpt_expiry_timed_out() */ -#endif