diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-04-10 20:57:05 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-04-10 20:57:05 +0000 |
commit | 3a5f7c387b932d9469cd4adcfbae318e32b0fc22 (patch) | |
tree | 85758d1179e592494b4e61f4d842b022762074b7 /regress/sys | |
parent | 9a7e70a9f10aa811e2cd4cf94dcda3e4cd42903d (diff) |
Add EX_CONFLICTOK flag that allows an allocation to conflict with existing
allocations, making sure that the union of all space is allocated.
ok deraadt@
Diffstat (limited to 'regress/sys')
-rw-r--r-- | regress/sys/kern/extent/extest.awk | 11 | ||||
-rw-r--r-- | regress/sys/kern/extent/extest.exp | 13 | ||||
-rw-r--r-- | regress/sys/kern/extent/tests | 26 |
3 files changed, 45 insertions, 5 deletions
diff --git a/regress/sys/kern/extent/extest.awk b/regress/sys/kern/extent/extest.awk index 5c875d44133..e803e93267d 100644 --- a/regress/sys/kern/extent/extest.awk +++ b/regress/sys/kern/extent/extest.awk @@ -1,4 +1,4 @@ -# $OpenBSD: extest.awk,v 1.1 2005/04/21 17:45:54 miod Exp $ +# $OpenBSD: extest.awk,v 1.2 2009/04/10 20:57:04 kettenis Exp $ # $NetBSD: extest.awk,v 1.6 2002/02/21 03:59:25 mrg Exp $ BEGIN { @@ -48,8 +48,13 @@ $1 == "boundary" { } $1 == "alloc_region" { - printf("error = extent_alloc_region(ex, %s, %s, 0);\n", - $2, $3) + if ($4 == "") { + flags = "0"; + } else { + flags = $4; + } + printf("error = extent_alloc_region(ex, %s, %s, %s);\n", + $2, $3, flags) printf("if (error)\n\tprintf(\"error: %%s\\n\", strerror(error));\n") } diff --git a/regress/sys/kern/extent/extest.exp b/regress/sys/kern/extent/extest.exp index c8e0a8beb98..930ba80a494 100644 --- a/regress/sys/kern/extent/extest.exp +++ b/regress/sys/kern/extent/extest.exp @@ -1,4 +1,4 @@ -# $OpenBSD: extest.exp,v 1.1 2005/04/21 17:45:54 miod Exp $ +# $OpenBSD: extest.exp,v 1.2 2009/04/10 20:57:04 kettenis Exp $ # $NetBSD: extest.exp,v 1.9 2005/03/15 18:27:23 bouyer Exp $ # real output must start in line 5 @@ -75,3 +75,14 @@ extent `test11' (0x10 - 0x20), flags = 0x2 0x14 - 0x14 0x1e - 0x1f 0x20 - 0x20 +output for test12 +error: Resource temporarily unavailable +output for test13 +extent `test13' (0x0 - 0xffffffff), flags = 0x0 + 0xfce00000 - 0xfcefffff +output for test14 +extent `test14' (0x0 - 0xffffffff), flags = 0x0 + 0xfce00000 - 0xfce010ff +output for test15 +extent `test15' (0x0 - 0xffffffff), flags = 0x0 + 0xf8000000 - 0xffffffff diff --git a/regress/sys/kern/extent/tests b/regress/sys/kern/extent/tests index 7f69a1e20fc..a5ac81d077a 100644 --- a/regress/sys/kern/extent/tests +++ b/regress/sys/kern/extent/tests @@ -1,4 +1,4 @@ -# $OpenBSD: tests,v 1.2 2005/04/22 00:38:24 miod Exp $ +# $OpenBSD: tests,v 1.3 2009/04/10 20:57:04 kettenis Exp $ # $NetBSD: tests,v 1.9 2005/03/15 18:27:23 bouyer Exp $ #fill up an extent, should coalesce into one allocation @@ -99,3 +99,27 @@ alloc_subregion 0x20 0x20 0x1 alloc_subregion 0x20 0x20 0x1 alloc_subregion 0x10 0x20 0x1 print + +# Overlapping regions should result in a failure +extent test12 0x00000000 0xffffffff +alloc_region 0xfce00000 0x100 +alloc_region 0xfce00000 0x100000 + +# But not if we specify EX_CONFLICTOK +extent test13 0x00000000 0xffffffff +alloc_region 0xfce00000 0x100 +alloc_region 0xfce00000 0x100000 EX_CONFLICTOK +print + +# Check partial overlap +extent test14 0x00000000 0xffffffff +alloc_region 0xfce00000 0x1000 +alloc_region 0xfce00100 0x1000 EX_CONFLICTOK +print + +# Check multiple overlaps +extent test15 0x00000000 0xffffffff +alloc_region 0xfce00000 0x100 +alloc_region 0xfee00000 0x100 +alloc_region 0xf8000000 0x8000000 EX_CONFLICTOK +print |