summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests/block02
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-02-28 17:19:49 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-03-13 12:24:18 +0100
commit796967c3df40a51a9028bc83d1a4b6dbeae07c3f (patch)
treeedd7251883f74506a69f76e6e9fbf173de195f50 /testsuites/libtests/block02
parentlibblock: Documentation (diff)
downloadrtems-796967c3df40a51a9028bc83d1a4b6dbeae07c3f.tar.bz2
libblock: Change bdbuf API
The functions o rtems_bdbuf_get(), o rtems_bdbuf_read(), o rtems_bdbuf_syncdev(), and o rtems_bdbuf_purge_dev(), use now the disk device instead of the device identifier. This makes bdbuf independent of rtems_disk_obtain() and rtems_disk_release(). It is the responsiblity of the file system to obtain the disk device. This also reduces the overhead to get a buffer. The key for the AVL tree uses now the disk device instead of the device identifier. The pointer is interpreted as an unsigned integer. This reduces the memory overhead and makes the comparison operation a bit faster. Removed function rtems_bdbuf_purge_major(). This function was too destructive and could have unpredictable side effects.
Diffstat (limited to 'testsuites/libtests/block02')
-rw-r--r--testsuites/libtests/block02/init.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/testsuites/libtests/block02/init.c b/testsuites/libtests/block02/init.c
index 00c83a162f..58b78d3e47 100644
--- a/testsuites/libtests/block02/init.c
+++ b/testsuites/libtests/block02/init.c
@@ -7,12 +7,13 @@
*/
/*
- * Copyright (c) 2009
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
+ * Copyright (c) 2009-2012 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -48,9 +49,9 @@
#define BLOCK_COUNT_B 1
-static dev_t dev_a;
+static const rtems_disk_device *dd_a;
-static dev_t dev_b;
+static const rtems_disk_device *dd_b;
static volatile bool sync_done = false;
@@ -67,14 +68,14 @@ static void task_low(rtems_task_argument arg)
printk("L: try access: A0\n");
- sc = rtems_bdbuf_get(dev_a, 0, &bd);
+ sc = rtems_bdbuf_get(dd_a, 0, &bd);
ASSERT_SC(sc);
rtems_test_assert(sync_done);
printk("L: access: A0\n");
- rtems_test_assert(bd->dev == dev_a);
+ rtems_test_assert(bd->dd == dd_a);
printk("*** END OF TEST BLOCK 2 ***\n");
@@ -90,7 +91,7 @@ static void task_high(rtems_task_argument arg)
printk("H: try access: A0\n");
- sc = rtems_bdbuf_get(dev_a, 0, &bd);
+ sc = rtems_bdbuf_get(dd_a, 0, &bd);
ASSERT_SC(sc);
rtems_test_assert(sync_done);
@@ -106,7 +107,7 @@ static void task_high(rtems_task_argument arg)
printk("H: try access: B0\n");
- sc = rtems_bdbuf_get(dev_b, 0, &bd);
+ sc = rtems_bdbuf_get(dd_b, 0, &bd);
ASSERT_SC(sc);
printk("H: access: B0\n");
@@ -127,6 +128,8 @@ static rtems_task Init(rtems_task_argument argument)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
rtems_bdbuf_buffer *bd = NULL;
+ dev_t dev_a = 0;
+ dev_t dev_b = 0;
printk("\n\n*** TEST BLOCK 2 ***\n");
@@ -139,6 +142,12 @@ static rtems_task Init(rtems_task_argument argument)
sc = ramdisk_register(BLOCK_SIZE_B, BLOCK_COUNT_B, false, "/dev/rdb", &dev_b);
ASSERT_SC(sc);
+ dd_a = rtems_disk_obtain(dev_a);
+ rtems_test_assert(dd_a != NULL);
+
+ dd_b = rtems_disk_obtain(dev_b);
+ rtems_test_assert(dd_b != NULL);
+
sc = rtems_task_create(
rtems_build_name(' ', 'L', 'O', 'W'),
PRIORITY_LOW,
@@ -165,7 +174,7 @@ static rtems_task Init(rtems_task_argument argument)
sc = rtems_task_start(task_id_high, task_high, 0);
ASSERT_SC(sc);
- sc = rtems_bdbuf_get(dev_a, 0, &bd);
+ sc = rtems_bdbuf_get(dd_a, 0, &bd);
ASSERT_SC(sc);
sc = rtems_bdbuf_sync(bd);