Shuffle numeric values of the IO_* flags to match the O_* flags from

fcntl.h.

This is in preparation for making the flags passed to device drivers be
consistently from fcntl.h for all entrypoints.

Today open, close and ioctl uses fcntl.h flags, while read and write
uses vnode.h flags.
This commit is contained in:
Poul-Henning Kamp 2004-12-22 16:25:50 +00:00
parent 9168f08258
commit 10eee285f7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=139188
2 changed files with 17 additions and 3 deletions

View File

@ -1435,3 +1435,16 @@ static struct vop_vector devfs_specops = {
.vop_symlink = VOP_PANIC,
.vop_write = VOP_PANIC,
};
/*
* Our calling convention to the device drivers used to be that we passed
* vnode.h IO_* flags to read()/write(), but we're moving to fcntl.h O_
* flags instead since that's what open(), close() and ioctl() takes and
* we don't really want vnode.h in device drivers.
* We solved the source compatibility by redefining some vnode flags to
* be the same as the fcntl ones and by sending down the bitwise OR of
* the respective fcntl/vnode flags. These CTASSERTS make sure nobody
* pulls the rug out under this.
*/
CTASSERT(O_NONBLOCK == IO_NDELAY);
CTASSERT(O_FSYNC == IO_SYNC);

View File

@ -267,15 +267,16 @@ struct vattr {
/*
* Flags for ioflag. (high 16 bits used to ask for read-ahead and
* help with write clustering)
* NB: IO_NDELAY and IO_DIRECT are linked to fcntl.h
*/
#define IO_UNIT 0x0001 /* do I/O as atomic unit */
#define IO_APPEND 0x0002 /* append write to end */
#define IO_SYNC 0x0004 /* do I/O synchronously */
#define IO_NDELAY 0x0004 /* FNDELAY flag set in file table */
#define IO_NODELOCKED 0x0008 /* underlying node already locked */
#define IO_NDELAY 0x0010 /* FNDELAY flag set in file table */
#define IO_ASYNC 0x0010 /* bawrite rather then bdwrite */
#define IO_VMIO 0x0020 /* data already in VMIO space */
#define IO_INVAL 0x0040 /* invalidate after I/O */
#define IO_ASYNC 0x0080 /* bawrite rather then bdwrite */
#define IO_SYNC 0x0080 /* do I/O synchronously */
#define IO_DIRECT 0x0100 /* attempt to bypass buffer cache */
#define IO_EXT 0x0400 /* operate on external attributes */
#define IO_NORMAL 0x0800 /* operate on regular data */