From 2a9e0c32161ddbadffebd14a1ae3308290790c1d Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Tue, 14 Dec 2004 09:32:18 +0000 Subject: Be a bit more assertive about vnode bypass. --- sys/fs/devfs/devfs_vnops.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'sys/fs/devfs') diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 4eba833bdba4..0ddfde188587 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -811,23 +811,24 @@ devfs_open(ap) if (error) return (error); - if (ap->a_fdidx >= 0) { - /* - * This is a pretty disgustingly long chain, but I am not - * sure there is any better way. Passing the fdidx into - * VOP_OPEN() offers us more information than just passing - * the file *. - */ - fp = ap->a_td->td_proc->p_fd->fd_ofiles[ap->a_fdidx]; - if (fp->f_ops == &badfileops) { -#if 0 - printf("devfs_open(%s)\n", devtoname(dev)); +#if 0 /* /dev/console */ + KASSERT(ap->a_fdidx >= 0, + ("Could not vnode bypass device on fd %d", ap->a_fdidx)); +#else + if(ap->a_fdidx < 0) + return (error); #endif - fp->f_ops = &devfs_ops_f; - fp->f_data = dev; - } - } - + /* + * This is a pretty disgustingly long chain, but I am not + * sure there is any better way. Passing the fdidx into + * VOP_OPEN() offers us more information than just passing + * the file *. + */ + fp = ap->a_td->td_proc->p_fd->fd_ofiles[ap->a_fdidx]; + KASSERT(fp->f_ops == &badfileops, + ("Could not vnode bypass device on fdops %p", fp->f_ops)); + fp->f_ops = &devfs_ops_f; + fp->f_data = dev; return (error); } -- cgit v1.2.3