summaryrefslogtreecommitdiff
path: root/libdiskfs/io-map.c
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1999-09-08 08:42:56 +0000
committerThomas Bushnell <thomas@gnu.org>1999-09-08 08:42:56 +0000
commitbd1306f7f3c4441bbb057b031f251e2f31317d79 (patch)
treeb589e9ba67b8bf6cace1ead0de4295e3faaecf0d /libdiskfs/io-map.c
parent6c70c6d345509bf6690b4443ba36974d2c6a147b (diff)
1999-09-07 Thomas Bushnell, BSG <tb@mit.edu>
* io-map-segment.c: New file. Guts from io-map.c. * io-map.c (diskfs_S_io_map): Just call diskfs_S_io_map_segment. * diskfs.h (diskfs_get_filemap): New parameter `index'. * rdwr-internal.c (_diskfs_rdwr_internal): Pass additional parameter to diskfs_get_filemap. * Makefile (IOSRCS): Add io-map-segment.c.
Diffstat (limited to 'libdiskfs/io-map.c')
-rw-r--r--libdiskfs/io-map.c44
1 files changed, 2 insertions, 42 deletions
diff --git a/libdiskfs/io-map.c b/libdiskfs/io-map.c
index 6268f2c5..acd8adc6 100644
--- a/libdiskfs/io-map.c
+++ b/libdiskfs/io-map.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1997 Free Software Foundation
+ Copyright (C) 1994, 1997, 1999 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -28,46 +28,6 @@ diskfs_S_io_map (struct protid *cred,
memory_object_t *wrobj,
mach_msg_type_name_t *wrtype)
{
- int flags;
- struct node *node;
-
- if (!cred)
- return EOPNOTSUPP;
-
- *wrobj = *rdobj = MACH_PORT_NULL;
-
- node = cred->po->np;
- flags = cred->po->openstat & (O_READ | O_WRITE);
-
- mutex_lock (&node->lock);
- switch (flags)
- {
- case O_READ | O_WRITE:
- *wrobj = *rdobj = diskfs_get_filemap (node, VM_PROT_READ |VM_PROT_WRITE);
- if (*wrobj == MACH_PORT_NULL)
- goto error;
- mach_port_mod_refs (mach_task_self (), *rdobj, MACH_PORT_RIGHT_SEND, 1);
- break;
- case O_READ:
- *rdobj = diskfs_get_filemap (node, VM_PROT_READ);
- if (*rdobj == MACH_PORT_NULL)
- goto error;
- break;
- case O_WRITE:
- *wrobj = diskfs_get_filemap (node, VM_PROT_WRITE);
- if (*wrobj == MACH_PORT_NULL)
- goto error;
- break;
- }
- mutex_unlock (&node->lock);
-
- *rdtype = MACH_MSG_TYPE_MOVE_SEND;
- *wrtype = MACH_MSG_TYPE_MOVE_SEND;
-
- return 0;
-
-error:
- mutex_unlock (&node->lock);
- return errno;
+ return diskfs_S_io_map_segment (cred, 0, rdobj, rdtype, wrobj, wrtype);
}