diff options
author | phk <phk@FreeBSD.org> | 2004-12-14 09:32:18 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-12-14 09:32:18 +0000 |
commit | ccf97ed87f086f46cc6e18d665218832133a8321 (patch) | |
tree | 7a0ea11328b3ebe543765155025648d03ed51f96 | |
parent | 2c72e53bd395cf5a847a2838490b9d0051bd41d1 (diff) | |
download | FreeBSD-src-ccf97ed87f086f46cc6e18d665218832133a8321.zip FreeBSD-src-ccf97ed87f086f46cc6e18d665218832133a8321.tar.gz |
Be a bit more assertive about vnode bypass.
-rw-r--r-- | sys/fs/devfs/devfs_vnops.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 4eba833..0ddfde1 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); } |