source: rtems/testsuites/fstests/mdosfs_support/fs_support.c @ 24b94c4

Last change on this file since 24b94c4 was 24b94c4, checked in by Sebastian Huber <sebastian.huber@…>, on Jul 30, 2018 at 4:39:09 AM

ramdisk: Use rtems_blkdev_create()

Update #3358.

  • Property mode set to 100644
File size: 2.3 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#ifdef HAVE_CONFIG_H
10#include "config.h"
11#endif
12#include "pmacros.h"
13
14#include "fs_config.h"
15
16#include <sys/stat.h>
17#include <sys/types.h>
18
19#include <rtems/libio.h>
20#include <rtems/dosfs.h>
21#include <rtems/libcsupport.h>
22
23#include "ramdisk_support.h"
24#include "fstest.h"
25#include "fstest_support.h"
26
27#define BLOCK_SIZE 512
28
29static const msdos_format_request_param_t rqdata = {
30  .OEMName             = "RTEMS",
31  .VolLabel            = "RTEMSDisk",
32  .sectors_per_cluster = 2,
33  .fat_num             = 0,
34  .files_per_root_dir  = 0,
35  .media               = 0,
36  .quick_format        = true,
37  .skip_alignment      = 0,
38  .info_level          = 0
39};
40
41static rtems_resource_snapshot before_mount;
42
43void test_initialize_filesystem(void)
44{
45  int rc=0;
46  rc = mkdir (BASE_FOR_TEST,S_IRWXU|S_IRWXG|S_IRWXO);
47  rtems_test_assert(rc==0);
48
49  init_ramdisk();
50
51  rc=msdos_format(RAMDISK_PATH,&rqdata);
52  rtems_test_assert(rc==0);
53
54  rtems_resource_snapshot_take(&before_mount);
55
56  rc=mount(RAMDISK_PATH,
57      BASE_FOR_TEST,
58      "dosfs",
59      RTEMS_FILESYSTEM_READ_WRITE,
60      NULL);
61  rtems_test_assert(rc==0);
62}
63
64
65void test_shutdown_filesystem(void)
66{
67  int rc=0;
68  rc=unmount(BASE_FOR_TEST) ;
69  rtems_test_assert(rc==0);
70  rtems_test_assert(rtems_resource_snapshot_check(&before_mount));
71  del_ramdisk();
72}
73
74/* configuration information */
75
76/* drivers */
77#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
78#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
79
80/**
81 * Configure base RTEMS resources.
82 */
83
84#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
85
86#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
87
88#define CONFIGURE_MAXIMUM_SEMAPHORES RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE
89#define CONFIGURE_MAXIMUM_TASKS                     10
90#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS    40
91#define CONFIGURE_INIT_TASK_STACK_SIZE (16 * 1024)
92#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
93#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS     1
94
95#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
96
97#define CONFIGURE_FILESYSTEM_DOSFS
98
99#define CONFIGURE_INIT
100#include <rtems/confdefs.h>
101
Note: See TracBrowser for help on using the repository browser.