diff options
| author | Poul-Henning Kamp <phk@FreeBSD.org> | 2004-12-22 16:25:50 +0000 |
|---|---|---|
| committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2004-12-22 16:25:50 +0000 |
| commit | 10eee285f7682f9330e17198c966a66665e119d6 (patch) | |
| tree | 12ff436fda22d2c0efef46bc2c11a23259c056c1 /sys | |
| parent | 9168f082588b1fcbc8d398fb7c78d7d2b9b8405c (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/fs/devfs/devfs_vnops.c | 13 | ||||
| -rw-r--r-- | sys/sys/vnode.h | 7 |
2 files changed, 17 insertions, 3 deletions
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 2ffaa1389d9fe..b75caa6af0a79 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -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); diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 31156f69d7642..94873e78de24b 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -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 */ |
