From bd1306f7f3c4441bbb057b031f251e2f31317d79 Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Wed, 8 Sep 1999 08:42:56 +0000 Subject: 1999-09-07 Thomas Bushnell, BSG * 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. --- libdiskfs/io-map.c | 44 ++------------------------------------------ 1 file changed, 2 insertions(+), 42 deletions(-) (limited to 'libdiskfs/io-map.c') 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); } -- cgit v1.2.3