diff options
author | Miles Bader <miles@gnu.org> | 1995-04-16 20:24:37 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-04-16 20:24:37 +0000 |
commit | f6741a1a39df72c34a8d6b39ae965f2e27cb26d8 (patch) | |
tree | 24693cfe8b42e111b904dc207c0ccbc1efe53f2d | |
parent | b3a0b779783c4c8a9dea52192215e65f8716dd44 (diff) |
Formerly devio.c.~4~
-rw-r--r-- | ext2fs/devio.c | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/ext2fs/devio.c b/ext2fs/devio.c index 1bb9b09f..aad59b7a 100644 --- a/ext2fs/devio.c +++ b/ext2fs/devio.c @@ -25,28 +25,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Write disk block ADDR with DATA of LEN bytes, waiting for completion. */ error_t -dev_write_sync (daddr_t addr, - vm_address_t data, - long len) +dev_write_sync (daddr_t addr, vm_address_t data, long len) { - int foo; - assert (!diskfs_readonly); - if (device_write (device_port, 0, addr, (io_buf_ptr_t) data, len, &foo) - || foo != len) - return EIO; - return 0; -} - -/* Write diskblock ADDR with DATA of LEN bytes; don't bother waiting - for completion. */ -error_t -dev_write (daddr_t addr, - vm_address_t data, - long len) -{ - assert (!diskfs_readonly); - if (device_write_request (device_port, MACH_PORT_NULL, 0, addr, - (io_buf_ptr_t) data, len)) + int written; + if (diskfs_readonly) + return EROFS; + if (device_write (device_port, 0, addr, (io_buf_ptr_t) data, len, &written) + || written != len) return EIO; return 0; } @@ -56,14 +41,11 @@ static int deverr; /* Read disk block ADDR; put the address of the data in DATA; read LEN bytes. Always *DATA should be a full page no matter what. */ error_t -dev_read_sync (daddr_t addr, - vm_address_t *data, - long len) +dev_read_sync (daddr_t addr, vm_address_t *data, long len) { - int foo; - deverr = device_read (device_port, 0, addr, len, (io_buf_ptr_t *)data, - (u_int *)&foo); - if (deverr || foo != len) + u_int read; + if (device_read (device_port, 0, addr, len, (io_buf_ptr_t *)data, &read) + || read != len) return EIO; return 0; } |