diff options
author | phk <phk@FreeBSD.org> | 2004-12-22 17:05:44 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-12-22 17:05:44 +0000 |
commit | c13e70487f9f1464f4cc1811e45d83247f519c32 (patch) | |
tree | 17dbf44eddfe14fb16682afc4c49bf957dd943c5 /sys/fs/devfs | |
parent | 4e6a1d00d2241fdd7a7437ba78dfbf47bc2fd57e (diff) | |
download | FreeBSD-src-c13e70487f9f1464f4cc1811e45d83247f519c32.zip FreeBSD-src-c13e70487f9f1464f4cc1811e45d83247f519c32.tar.gz |
Be consistent about flag values passed to device drivers read/write
methods:
Read can see O_NONBLOCK and O_DIRECT.
Write can see O_NONBLOCK, O_DIRECT and O_FSYNC.
In addition O_DIRECT is shadowed as IO_DIRECT for now for backwards
compatibility.
Diffstat (limited to 'sys/fs/devfs')
-rw-r--r-- | sys/fs/devfs/devfs_vnops.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index b75caa6..0ec0ce1 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -919,10 +919,8 @@ devfs_read_f(struct file *fp, struct uio *uio, struct ucred *cred, int flags, st if (error) return (error); resid = uio->uio_resid; - ioflag = 0; - if (fp->f_flag & O_NONBLOCK) - ioflag |= IO_NDELAY; - if (fp->f_flag & O_DIRECT) + ioflag = fp->f_flag & (O_NONBLOCK | O_DIRECT); + if (ioflag & O_DIRECT) ioflag |= IO_DIRECT; if ((flags & FOF_OFFSET) == 0) @@ -1351,14 +1349,9 @@ devfs_write_f(struct file *fp, struct uio *uio, struct ucred *cred, int flags, s return (error); KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); vp = fp->f_vnode; - ioflag = 0; - if (fp->f_flag & O_NONBLOCK) - ioflag |= IO_NDELAY; - if (fp->f_flag & O_DIRECT) + ioflag = fp->f_flag & (O_NONBLOCK | O_DIRECT | O_FSYNC); + if (ioflag & O_DIRECT) ioflag |= IO_DIRECT; - if ((fp->f_flag & O_FSYNC) || - (vp->v_mount && (vp->v_mount->mnt_flag & MNT_SYNCHRONOUS))) - ioflag |= IO_SYNC; if ((flags & FOF_OFFSET) == 0) uio->uio_offset = fp->f_offset; |