* fhandler.cc (fhandler_base::open_9x): Handle O_SYNC and O_DIRECT

flags.
	(fhandler_base::open): Ditto.
	* fhandler_floppy.cc (fhandler_dev_floppy::open): Don't allocate devbuf
	in O_DIRECT case.
	* fhandler_raw.cc (fhandler_dev_raw::ioctl): Don't allow buffer
	changes in O_DIRECT case.  Allow returning a buffer size 0, which
	indicates O_DIRECT.
	* fhandler_tape.cc (fhandler_dev_tape::open): Use O_SYNC flag to
	hand down the !buffer_writes case.  Don't allocate devbuf in O_DIRECT
	case.
	(fhandler_dev_tape::raw_read): Don't mess with devbuf if it's NULL.
	* include/fcntl.h: Define _FDIRECT, O_DIRECT, O_DSYNC and O_RSYNC.
	* include/cygwin/version.h: Bump API minor version.
This commit is contained in:
Corinna Vinschen
2005-12-14 15:54:33 +00:00
parent 10cba930d4
commit e3d14af155
7 changed files with 127 additions and 78 deletions

View File

@ -159,12 +159,14 @@ fhandler_dev_raw::ioctl (unsigned int cmd, void *buf)
}
else if ((devbuf && ((op->rd_parm <= 1 && (devbufend - devbufstart))
|| op->rd_parm < devbufend - devbufstart))
|| (op->rd_parm > 1 && (op->rd_parm % 512)))
|| (op->rd_parm > 1 && (op->rd_parm % 512))
|| (get_flags () & O_DIRECT))
/* The conditions for a *valid* parameter are these:
- If there's still data in the current buffer, it must
fit in the new buffer.
- The new size is either 0 or 1, both indicating unbufferd
I/O, or the new buffersize must be a multiple of 512. */
I/O, or the new buffersize must be a multiple of 512.
- In the O_DIRECT case, the whole request is invalid. */
ret = ERROR_INVALID_PARAMETER;
else if (!devbuf || op->rd_parm != devbufsiz)
{
@ -198,7 +200,7 @@ fhandler_dev_raw::ioctl (unsigned int cmd, void *buf)
if (!get)
ret = ERROR_INVALID_PARAMETER;
else
get->bufsiz = devbufsiz ?: 1L;
get->bufsiz = devbufsiz;
}
else
return fhandler_base::ioctl (cmd, buf);