diff options
Diffstat (limited to 'libstore/enc.c')
-rw-r--r-- | libstore/enc.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/libstore/enc.c b/libstore/enc.c index 9706dfc9..d5002a0e 100644 --- a/libstore/enc.c +++ b/libstore/enc.c @@ -1,9 +1,7 @@ /* Store wire encoding/decoding - Copyright (C) 1996 Free Software Foundation, Inc. - + Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> - This file is part of the GNU Hurd. The GNU Hurd is free software; you can redistribute it and/or @@ -18,9 +16,10 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ #include <string.h> +#include <sys/mman.h> #include "store.h" @@ -62,26 +61,38 @@ store_enc_dealloc (struct store_enc *enc) } if (enc->ports != enc->init_ports) - vm_deallocate (mach_task_self (), - (vm_address_t)enc->ports, - enc->num_ports * sizeof (*enc->ports)); + munmap ((caddr_t) enc->ports, enc->num_ports * sizeof (*enc->ports)); } if (enc->ints && enc->num_ints > 0 && enc->ints != enc->init_ints) - vm_deallocate (mach_task_self (), - (vm_address_t)enc->ints, - enc->num_ints * sizeof (*enc->ints)); + munmap ((caddr_t) enc->ints, enc->num_ints * sizeof (*enc->ints)); if (enc->offsets && enc->num_offsets > 0 && enc->offsets != enc->init_offsets) - vm_deallocate (mach_task_self (), - (vm_address_t)enc->offsets, - enc->num_offsets * sizeof (*enc->offsets)); + munmap ((caddr_t) enc->offsets, enc->num_offsets * sizeof (*enc->offsets)); if (enc->data && enc->data_len > 0 && enc->data != enc->init_data) - vm_deallocate (mach_task_self (), - (vm_address_t)enc->data, enc->data_len); + munmap (enc->data, enc->data_len); /* For good measure... */ bzero (enc, sizeof (*enc)); } + +/* Copy out the parameters from ENC into the given variables suitably for + returning from a file_get_storage_info rpc, and deallocate ENC. */ +void +store_enc_return (struct store_enc *enc, + mach_port_t **ports, mach_msg_type_number_t *num_ports, + int **ints, mach_msg_type_number_t *num_ints, + off_t **offsets, mach_msg_type_number_t *num_offsets, + char **data, mach_msg_type_number_t *data_len) +{ + *ports = enc->ports; + *num_ports = enc->num_ports; + *ints = enc->ints; + *num_ints = enc->num_ints; + *offsets = enc->offsets; + *num_offsets = enc->num_offsets; + *data = enc->data; + *data_len = enc->data_len; +} |