1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2011. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.com/license/LICENSE. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #ifdef HAVE_CONFIG_H |
---|
13 | #include "config.h" |
---|
14 | #endif |
---|
15 | |
---|
16 | #include <rtems/ramdisk.h> |
---|
17 | #include <rtems/blkdev.h> |
---|
18 | #include <rtems/libio.h> |
---|
19 | |
---|
20 | #include "ramdisk_support.h" |
---|
21 | #include "fstest.h" |
---|
22 | /* |
---|
23 | * Ramdisk information |
---|
24 | */ |
---|
25 | |
---|
26 | dev_t dev = 0; |
---|
27 | |
---|
28 | void |
---|
29 | init_ramdisk (void) |
---|
30 | { |
---|
31 | |
---|
32 | int rc = 0; |
---|
33 | rc = rtems_disk_io_initialize (); |
---|
34 | rtems_test_assert (rc == 0); |
---|
35 | rc = ramdisk_register (RAMDISK_BLOCK_SIZE, RAMDISK_BLOCK_COUNT, |
---|
36 | false, RAMDISK_PATH, &dev); |
---|
37 | rtems_test_assert (rc == 0); |
---|
38 | |
---|
39 | } |
---|
40 | |
---|
41 | void |
---|
42 | del_ramdisk (void) |
---|
43 | { |
---|
44 | |
---|
45 | int rc = 0; |
---|
46 | rtems_device_major_number major = 0; |
---|
47 | rtems_device_minor_number minor = 0; |
---|
48 | |
---|
49 | rc = rtems_disk_delete (dev); |
---|
50 | rtems_test_assert (rc == 0); |
---|
51 | |
---|
52 | rtems_filesystem_split_dev_t (dev, major, minor); |
---|
53 | |
---|
54 | rtems_test_assert (major >= 0); |
---|
55 | rtems_test_assert (minor >= 0); |
---|
56 | |
---|
57 | rc = rtems_io_unregister_driver (major); |
---|
58 | rtems_test_assert (rc == 0); |
---|
59 | rc = rtems_disk_io_done (); |
---|
60 | rtems_test_assert (rc == 0); |
---|
61 | |
---|
62 | } |
---|