summaryrefslogtreecommitdiff
path: root/storeio
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-09-14 17:32:07 +0000
committerMiles Bader <miles@gnu.org>1996-09-14 17:32:07 +0000
commit67af0339a48b8e02d1d1341ced524f202df17b6b (patch)
tree4e25557f9533d249329dd074e2b62bd7585bb44f /storeio
parent3395c2ad30f10a9c8717376c886fa4d86b3618ed (diff)
(dev_rw): Return EINVAL instead of EIO for too-large offsets.
(dev_open, dev_close): Remove ifdef'd-out code for allocating DEV's buffer with valloc; other things depend on it being vm_allocated.
Diffstat (limited to 'storeio')
-rw-r--r--storeio/dev.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/storeio/dev.c b/storeio/dev.c
index d9a4e083..6297f3b7 100644
--- a/storeio/dev.c
+++ b/storeio/dev.c
@@ -151,13 +151,8 @@ dev_open (struct store_parsed *name, int flags, struct dev **dev)
return err;
}
-#if 0 /* valloc doesn't work */
- new->buf = valloc (new->store->block_size);
- if (new->buf == 0)
-#else
if (vm_allocate (mach_task_self (),
(vm_address_t *)&new->buf, new->store->block_size, 1))
-#endif
{
store_free (new->store);
free (new);
@@ -184,12 +179,8 @@ dev_close (struct dev *dev)
dev_buf_discard (dev);
-#if 0
- free (dev->buf);
-#else
vm_deallocate (mach_task_self (),
(vm_address_t)dev->buf, dev->store->block_size);
-#endif
store_free (dev->store);
@@ -290,10 +281,8 @@ dev_rw (struct dev *dev, off_t offs, size_t len, size_t *amount,
error_t err;
unsigned block_mask = dev->block_mask;
- if (offs < 0)
+ if (offs < 0 || offs > dev->store->size)
return EINVAL;
- else if (offs > dev->store->size)
- return EIO;
else if (offs + len > dev->store->size)
len = dev->store->size - offs;