aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/fhandler_raw.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2004-07-15 14:56:05 +0000
committerCorinna Vinschen <corinna@vinschen.de>2004-07-15 14:56:05 +0000
commit4243412aa5a9443a696cba6198a0daac3100ef3c (patch)
treed288baf81ad0ce74af97e257684d6538c78ae3d8 /winsup/cygwin/fhandler_raw.cc
parentfcedcf9488de0113b50d22fca94d6a72ed59d576 (diff)
downloadnewlib-4243412aa5a9443a696cba6198a0daac3100ef3c.zip
newlib-4243412aa5a9443a696cba6198a0daac3100ef3c.tar.gz
newlib-4243412aa5a9443a696cba6198a0daac3100ef3c.tar.bz2
* fhandler.h (class fhandler_dev_raw): Remove is_writing flag.
Remove declaration of writebuf. (class fhandler_dev_floppy): Remove declaration of close. * fhandler_floppy.cc (fhandler_dev_floppy::close): Delete. (fhandler_dev_floppy::lseek): Remove calls to writebuf. Set eom_detected to false after successful seek. * fhandler_raw.cc (fhandler_dev_raw::writebuf): Delete. (fhandler_dev_raw::raw_read): Remove calls to writebuf. (fhandler_dev_raw::raw_write): Always invalidate buffer.
Diffstat (limited to 'winsup/cygwin/fhandler_raw.cc')
-rw-r--r--winsup/cygwin/fhandler_raw.cc41
1 files changed, 3 insertions, 38 deletions
diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc
index 2de7f3d..4ce444c 100644
--- a/winsup/cygwin/fhandler_raw.cc
+++ b/winsup/cygwin/fhandler_raw.cc
@@ -40,8 +40,7 @@ fhandler_dev_raw::is_eof (int)
}
-/* Wrapper functions to allow fhandler_dev_tape to detect and care for
- media changes and bus resets. */
+/* Wrapper functions to simplify error handling. */
BOOL
fhandler_dev_raw::write_file (const void *buf, DWORD to_write,
@@ -70,28 +69,6 @@ fhandler_dev_raw::read_file (void *buf, DWORD to_read, DWORD *read, int *err)
return ret;
}
-int
-fhandler_dev_raw::writebuf (void)
-{
- DWORD written;
- int ret = 0;
-
- if (is_writing () && devbuf && devbufend)
- {
- DWORD to_write;
- int ret = 0;
-
- memset (devbuf + devbufend, 0, devbufsiz - devbufend);
- to_write = ((devbufend - 1) / 512 + 1) * 512;
- if (!write_file (devbuf, to_write, &written, &ret)
- && is_eom (ret))
- eom_detected (true);
- devbufstart = devbufend = 0;
- }
- is_writing (false);
- return ret;
-}
-
fhandler_dev_raw::fhandler_dev_raw ()
: fhandler_base (), status ()
{
@@ -172,17 +149,6 @@ fhandler_dev_raw::raw_read (void *ptr, size_t& ulen)
char *tgt;
char *p = (char *) ptr;
- /* In mode O_RDWR the buffer has to be written to device first */
- ret = writebuf ();
- if (ret)
- {
- if (is_eom (ret))
- set_errno (ENOSPC);
- else
- __seterrno ();
- goto err;
- }
-
/* Checking a previous end of file */
if (eof_detected () && !lastblk_to_read ())
{
@@ -320,9 +286,8 @@ fhandler_dev_raw::raw_write (const void *ptr, size_t len)
return -1;
}
- if (!is_writing ())
- devbufstart = devbufend = 0;
- is_writing (true);
+ /* Invalidate buffer. */
+ devbufstart = devbufend = 0;
if (len > 0)
{