source: rtems/testsuites/fstests/support/ramdisk_support.c @ c499856

4.11
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on Mar 20, 2014 at 9:10:47 PM

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.2 KB
Line 
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.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <sys/stat.h>
15#include <fcntl.h>
16
17#include <rtems/ramdisk.h>
18#include <rtems/blkdev.h>
19#include <rtems/libio.h>
20
21#include "ramdisk_support.h"
22#include "fstest.h"
23#include "tmacros.h"
24
25/*
26 * Ramdisk information
27 */
28
29dev_t dev = 0;
30
31void
32init_ramdisk (void)
33{
34
35  int rc = 0;
36  rc = rtems_disk_io_initialize ();
37  rtems_test_assert (rc == 0);
38  rc = ramdisk_register (RAMDISK_BLOCK_SIZE, RAMDISK_BLOCK_COUNT,
39                         false, RAMDISK_PATH, &dev);
40  rtems_test_assert (rc == 0);
41}
42
43void
44del_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}
Note: See TracBrowser for help on using the repository browser.