/* This should eventually move to userland. open a file on nfsd fs  */
static struct file* do_open(char *name, int flags)
/* This should eventually move to userland. open a file on nfsd fs  */
static struct file* do_open(char *name, int flags)
{
	struct nameidata nd;
	struct vfsmount *mnt;
	int error;
	mnt = do_kern_mount("nfsd", 0, "nfsd", NULL);
	if (IS_ERR(mnt))
		return (struct file *)mnt;
	error = vfs_path_lookup(mnt->mnt_root, mnt, name, 0, &nd);
	mntput(mnt);
	if (error)
		return ERR_PTR(error);
	if (flags == O_RDWR)
		error = may_open(&nd.path, MAY_READ|MAY_WRITE,
					   FMODE_READ|FMODE_WRITE);
	else
		error = may_open(&nd.path, MAY_WRITE, FMODE_WRITE);
	if (!error)
		return dentry_open(nd.path.dentry, nd.path.mnt, flags,
				   current_cred());
	path_put(&nd.path);
	return ERR_PTR(error);
}