diff options
-rw-r--r-- | libdiskfs/ChangeLog | 6 | ||||
-rw-r--r-- | libdiskfs/diskfs.h | 2 | ||||
-rw-r--r-- | libdiskfs/io-map.c | 13 | ||||
-rw-r--r-- | libdiskfs/rdwr-internal.c | 5 |
4 files changed, 23 insertions, 3 deletions
diff --git a/libdiskfs/ChangeLog b/libdiskfs/ChangeLog index 6a649e08..1fbe0636 100644 --- a/libdiskfs/ChangeLog +++ b/libdiskfs/ChangeLog @@ -1,5 +1,11 @@ Wed Aug 20 14:03:41 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> + * diskfs.h: Doc fix. + + * io-map.c (diskfs_S_io_map): Cope with error return from + diskfs_get_filemap. + * rdwr-internal.c (_diskfs_rdwr_internal): Likewise. + * disk-pager.c (service_paging_requests): New args for ports_manage_port_operations_multithread. * init-first.c (master_thread_function): Likewise. diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h index 72957815..c0bf5a06 100644 --- a/libdiskfs/diskfs.h +++ b/libdiskfs/diskfs.h @@ -487,7 +487,7 @@ void diskfs_shutdown_pager (); /* The user must define this function. Return a memory object port (send right) for the file contents of NP. PROT is the maximum allowable - access. */ + access. On errors, return MACH_PORT_NULL and set errno. */ mach_port_t diskfs_get_filemap (struct node *np, vm_prot_t prot); /* The user must define this function. Return true if there are pager diff --git a/libdiskfs/io-map.c b/libdiskfs/io-map.c index c9e897c6..6268f2c5 100644 --- a/libdiskfs/io-map.c +++ b/libdiskfs/io-map.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1994 Free Software Foundation + Copyright (C) 1994, 1997 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 @@ -44,13 +44,19 @@ diskfs_S_io_map (struct protid *cred, { 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); @@ -59,4 +65,9 @@ diskfs_S_io_map (struct protid *cred, *wrtype = MACH_MSG_TYPE_MOVE_SEND; return 0; + +error: + mutex_unlock (&node->lock); + return errno; } + diff --git a/libdiskfs/rdwr-internal.c b/libdiskfs/rdwr-internal.c index 9fe42ade..046467a3 100644 --- a/libdiskfs/rdwr-internal.c +++ b/libdiskfs/rdwr-internal.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1994, 1995, 1996 Free Software Foundation + Copyright (C) 1994, 1995, 1996, 1997 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 @@ -51,6 +51,9 @@ _diskfs_rdwr_internal (struct node *np, memobj = diskfs_get_filemap (np, prot); + if (memobj == MACH_PORT_NULL) + return errno; + err = pager_memcpy (diskfs_get_filemap_pager_struct (np), memobj, offset, data, amt, prot); |