1 /* BLURB lgpl 2 3 Coda File System 4 Release 5 5 6 Copyright (c) 1987-1999 Carnegie Mellon University 7 Additional copyrights listed below 8 9 This code is distributed "AS IS" without warranty of any kind under 10 the terms of the GNU Library General Public Licence Version 2, as 11 shown in the file LICENSE. The technical and financial contributors to 12 Coda are listed in the file CREDITS. 13 14 Additional copyrights 15 none currently 16 17 #*/ 18 19 #include <stdio.h> 20 #include <stdlib.h> 21 22 #include <rvm/rvm.h> 23 #include <rvm/rvm_segment.h> 24 #include "rvm_segment_private.h" 25 26 /* release regions of a segment */ 27 rvm_return_t rvm_release_segment(unsigned long nregions,rvm_region_def_t ** regions)28rvm_release_segment ( 29 unsigned long nregions, /* number of regions mapped */ 30 rvm_region_def_t **regions) /* array of region descriptors */ 31 { 32 rvm_region_t *region = rvm_malloc_region(); 33 rvm_return_t err = RVM_SUCCESS; 34 int i; 35 36 for (i = 0; i < nregions; i++) { 37 region->offset = (*regions)[i].offset; 38 region->length = (*regions)[i].length; 39 region->vmaddr = (*regions)[i].vmaddr; 40 41 err = rvm_unmap(region); 42 if (err != RVM_SUCCESS) 43 printf("release_segment unmap failed %s\n", rvm_return(err)); 44 45 deallocate_vm(region->vmaddr, region->length); 46 } 47 rvm_free_region(region); 48 free(*regions); 49 return err; 50 } 51 52