diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2004-12-14 09:32:18 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2004-12-14 09:32:18 +0000 |
commit | 2a9e0c32161ddbadffebd14a1ae3308290790c1d (patch) | |
tree | 7a0ea11328b3ebe543765155025648d03ed51f96 /sys | |
parent | 2010c542b2aba2ceaf597612fd75fcab11121f38 (diff) | |
download | src-2a9e0c32161ddbadffebd14a1ae3308290790c1d.tar.gz src-2a9e0c32161ddbadffebd14a1ae3308290790c1d.zip |
Be a bit more assertive about vnode bypass.
Notes
Notes:
svn path=/head/; revision=138841
Diffstat (limited to 'sys')
-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 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); } |