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 | #include "pmacros.h" |
---|
23 | |
---|
24 | /* |
---|
25 | * Ramdisk information |
---|
26 | */ |
---|
27 | |
---|
28 | dev_t dev = 0; |
---|
29 | |
---|
30 | void |
---|
31 | init_ramdisk (void) |
---|
32 | { |
---|
33 | |
---|
34 | int rc = 0; |
---|
35 | rc = rtems_disk_io_initialize (); |
---|
36 | rtems_test_assert (rc == 0); |
---|
37 | rc = ramdisk_register (RAMDISK_BLOCK_SIZE, RAMDISK_BLOCK_COUNT, |
---|
38 | false, RAMDISK_PATH, &dev); |
---|
39 | rtems_test_assert (rc == 0); |
---|
40 | |
---|
41 | } |
---|
42 | |
---|
43 | void |
---|
44 | del_ramdisk (void) |
---|
45 | { |
---|
46 | |
---|
47 | int rc = 0; |
---|
48 | rtems_device_major_number major = 0; |
---|
49 | rtems_device_minor_number minor = 0; |
---|
50 | |
---|
51 | rc = rtems_disk_delete (dev); |
---|
52 | rtems_test_assert (rc == 0); |
---|
53 | |
---|
54 | rtems_filesystem_split_dev_t (dev, major, minor); |
---|
55 | |
---|
56 | rtems_test_assert (major >= 0); |
---|
57 | rtems_test_assert (minor >= 0); |
---|
58 | |
---|
59 | rc = rtems_io_unregister_driver (major); |
---|
60 | rtems_test_assert (rc == 0); |
---|
61 | rc = rtems_disk_io_done (); |
---|
62 | rtems_test_assert (rc == 0); |
---|
63 | |
---|
64 | } |
---|