drop the minix_ prefixes for mmap and munmap

also cleanup of various minix-specific changes, cleanup of
mmap-related testing.

Change-Id: I289a4fc50cf8a13df4a6082038d860853a4bd024
This commit is contained in:
Ben Gras
2013-11-22 16:38:29 +01:00
committed by Lionel Sambuc
parent b0cab62bd2
commit dda632a24f
34 changed files with 197 additions and 180 deletions

View File

@@ -103,7 +103,7 @@ static void *alloc_dma_memory(size_t size)
if (contig)
ptr = alloc_contig(size, 0, NULL);
else
ptr = minix_mmap(NULL, size, PROT_READ | PROT_WRITE,
ptr = mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_PREALLOC | MAP_ANON, -1, 0);
if (ptr == MAP_FAILED)
@@ -118,7 +118,7 @@ static void free_dma_memory(void *ptr, size_t size)
if (contig)
free_contig(ptr, size);
else
minix_munmap(ptr, size);
munmap(ptr, size);
}
static int set_result(result_t *res, int type, ssize_t value)

View File

@@ -58,7 +58,7 @@ static void alloc_buf(struct buf *buf, phys_bytes next)
* very unlikely that the actual piece of memory will end up
* being physically contiguous with the last piece.
*/
tmp = minix_mmap((void *) (buf->addr + len + PAGE_SIZE), len,
tmp = mmap((void *) (buf->addr + len + PAGE_SIZE), len,
PROT_READ | PROT_WRITE, MAP_ANON | MAP_PREALLOC |
MAP_CONTIG, -1, 0L);
@@ -66,7 +66,7 @@ static void alloc_buf(struct buf *buf, phys_bytes next)
panic("unable to allocate temporary buffer");
}
addr = (vir_bytes) minix_mmap((void *) buf->addr, len,
addr = (vir_bytes) mmap((void *) buf->addr, len,
PROT_READ | PROT_WRITE, flags, -1, 0L);
if (addr != buf->addr)
@@ -75,7 +75,7 @@ static void alloc_buf(struct buf *buf, phys_bytes next)
if (!prealloc)
return;
if ((r = minix_munmap(tmp, len)) != OK)
if ((r = munmap(tmp, len)) != OK)
panic("unable to unmap buffer (%d)", errno);
if ((r = sys_umap(SELF, VM_D, addr, len, &buf->phys)) < 0)
@@ -92,9 +92,9 @@ static void alloc_buf(struct buf *buf, phys_bytes next)
* unmapped the temporary memory also, there's a small chance we'll end
* up with a different physical page this time. Who knows.
*/
minix_munmap((void *) addr, len);
munmap((void *) addr, len);
addr = (vir_bytes) minix_mmap((void *) buf->addr, len,
addr = (vir_bytes) mmap((void *) buf->addr, len,
PROT_READ | PROT_WRITE, flags, -1, 0L);
if (addr != buf->addr)
@@ -147,7 +147,7 @@ static void free_bufs(struct buf *buf, int count)
for (i = 0; i < count; i++) {
for (j = 0; j < buf[i].pages; j++) {
r = minix_munmap((void *) (buf[i].addr + j * PAGE_SIZE),
r = munmap((void *) (buf[i].addr + j * PAGE_SIZE),
PAGE_SIZE);
if (r != OK)
@@ -664,7 +664,7 @@ static void test_vector2(void)
got_result("invalid virtual vector pointer");
/* Test unallocated virtual vector. */
vvecp = (struct vumap_vir *) minix_mmap(NULL, PAGE_SIZE,
vvecp = (struct vumap_vir *) mmap(NULL, PAGE_SIZE,
PROT_READ | PROT_WRITE, MAP_ANON, -1, 0L);
if (vvecp == MAP_FAILED)
@@ -677,7 +677,7 @@ static void test_vector2(void)
got_result("unallocated virtual vector pointer");
minix_munmap((void *) vvecp, PAGE_SIZE);
munmap((void *) vvecp, PAGE_SIZE);
/* Test invalid physical vector pointer. */
r = do_vumap(SELF, vvec, 2, 0, VUA_READ, NULL, &pcount);
@@ -687,7 +687,7 @@ static void test_vector2(void)
got_result("invalid physical vector pointer");
/* Test unallocated physical vector. */
pvecp = (struct vumap_phys *) minix_mmap(NULL, PAGE_SIZE,
pvecp = (struct vumap_phys *) mmap(NULL, PAGE_SIZE,
PROT_READ | PROT_WRITE, MAP_ANON, -1, 0L);
if (pvecp == MAP_FAILED)
@@ -705,7 +705,7 @@ static void test_vector2(void)
got_result("unallocated physical vector pointer");
minix_munmap((void *) pvecp, PAGE_SIZE);
munmap((void *) pvecp, PAGE_SIZE);
free_bufs(buf, 2);
}

View File

@@ -21,27 +21,17 @@ badones= # list of tests that failed
# Programs that require setuid
setuids="test11 test33 test43 test44 test46 test56 test60 test61 test65 \
test69 test76 test77 test78" # test73"
test69 test76 test73 test77 test78"
# Scripts that require to be run as root
rootscripts="testisofs testvnd"
alltests="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 \
61 62 63 64 65 66 67 68 69 70 71 72 75 76 77 78 79 \
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 \
sh1 sh2 interp mfs isofs vnd"
tests_no=`expr 0`
# test mmap only if enabled in sysenv
filemap=1 # the default is on
if sysenv filemap >/dev/null
then filemap=`sysenv filemap`
fi
if [ "$filemap" -ne 0 ]
then alltests="$alltests 74"
fi
# If root, make sure the setuid tests have the correct permissions
# and make the dir bin-owned.
if [ "$ROOT" ]

View File

@@ -31,16 +31,16 @@ main(int argc, char *argv[])
start(44);
for(i = 0; i < CHUNKS; i++) {
v[i] = minix_mmap(vaddr, CHUNKSIZE, PROT_READ|PROT_WRITE, 0,
v[i] = mmap(vaddr, CHUNKSIZE, PROT_READ|PROT_WRITE, 0,
-1, 0);
if(v[i] == MAP_FAILED) {
perror("minix_mmap");
fprintf(stderr, "minix_mmap failed\n");
perror("mmap");
fprintf(stderr, "mmap failed\n");
quit();
}
if(v[i] != vaddr) {
fprintf(stderr,
"minix_mmap said 0x%p but i wanted 0x%p\n",
"mmap said 0x%p but i wanted 0x%p\n",
v[i], vaddr);
quit();
}

View File

@@ -33,7 +33,7 @@ int main (int argc, char *argv[])
if(f == 0) {
/* child: use up as much memory as we can */
while((addrs[i++ % NADDRS] = minix_mmap(0, LEN, PROT_READ|PROT_WRITE,
while((addrs[i++ % NADDRS] = mmap(0, LEN, PROT_READ|PROT_WRITE,
MAP_PREALLOC|MAP_CONTIG|MAP_ANON, -1, 0)) != MAP_FAILED)
;
exit(0);

View File

@@ -47,7 +47,7 @@ readblock(int b, int blocksize, u32_t seed, char *data)
}
}
if((mmapdata = minix_mmap(NULL, blocksize, PROT_READ, MAP_PRIVATE | MAP_FILE,
if((mmapdata = mmap(NULL, blocksize, PROT_READ, MAP_PRIVATE | MAP_FILE,
fd, offset)) == MAP_FAILED) {
perror("mmap");
return -1;
@@ -65,7 +65,7 @@ readblock(int b, int blocksize, u32_t seed, char *data)
return -1;
}
if(minix_munmap(mmapdata, blocksize) < 0) {
if(munmap(mmapdata, blocksize) < 0) {
perror("munmap");
return -1;
}
@@ -79,7 +79,7 @@ void basic_regression(void)
{
void *block;
#define BLOCKSIZE (PAGE_SIZE*10)
block = minix_mmap(0, BLOCKSIZE, PROT_READ | PROT_WRITE,
block = mmap(0, BLOCKSIZE, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, 0);
if(block == MAP_FAILED) { e(1); exit(1); }
@@ -87,7 +87,7 @@ void basic_regression(void)
memset(block, 0, BLOCKSIZE);
/* shrink from bottom */
minix_munmap(block, PAGE_SIZE);
munmap(block, PAGE_SIZE);
}
int

View File

@@ -33,9 +33,9 @@ int dowriteblock(int b, int blocksize, u32_t seed, char *block)
if((bdata = vm_map_cacheblock(MYDEV, dev_off,
VMC_NO_INODE, 0, NULL, blocksize)) == MAP_FAILED) {
if((bdata = minix_mmap(0, blocksize,
if((bdata = mmap(0, blocksize,
PROT_READ|PROT_WRITE, MAP_ANON, -1, 0)) == MAP_FAILED) {
printf("minix_mmap failed\n");
printf("mmap failed\n");
exit(1);
}
mustset = 1;
@@ -49,8 +49,8 @@ int dowriteblock(int b, int blocksize, u32_t seed, char *block)
exit(1);
}
if(minix_munmap(bdata, blocksize) < 0) {
printf("dowriteblock: minix_munmap failed %d\n", r);
if(munmap(bdata, blocksize) < 0) {
printf("dowriteblock: munmap failed %d\n", r);
exit(1);
}
@@ -69,8 +69,8 @@ int readblock(int b, int blocksize, u32_t seed, char *block)
memcpy(block, bdata, blocksize);
if(minix_munmap(bdata, blocksize) < 0) {
printf("dowriteblock: minix_munmap failed\n");
if(munmap(bdata, blocksize) < 0) {
printf("dowriteblock: munmap failed\n");
exit(1);
}