From 24b94c47713bbaadd8b8a876a2e7c7f3a9def5d8 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 30 Jul 2018 06:39:09 +0200 Subject: ramdisk: Use rtems_blkdev_create() Update #3358. --- testsuites/fstests/fsdosfsname01/init.c | 35 +++----------------------- testsuites/fstests/mdosfs_support/fs_support.c | 1 - testsuites/fstests/mrfs_support/fs_support.c | 1 - testsuites/fstests/support/ramdisk_support.c | 27 +++----------------- 4 files changed, 7 insertions(+), 57 deletions(-) (limited to 'testsuites/fstests') diff --git a/testsuites/fstests/fsdosfsname01/init.c b/testsuites/fstests/fsdosfsname01/init.c index ce6850cfa7..90db282955 100644 --- a/testsuites/fstests/fsdosfsname01/init.c +++ b/testsuites/fstests/fsdosfsname01/init.c @@ -63,18 +63,6 @@ static const char UTF8_BOM[] = {0xEF, 0xBB, 0xBF}; #define BLOCK_SIZE 512 -#define BLOCK_COUNT ( sizeof( image_bin ) / BLOCK_SIZE ) - -static ramdisk disk_image = { - .block_size = BLOCK_SIZE, - .block_num = BLOCK_COUNT, - .area = &image_bin[0], - .initialized = true, - .malloced = false, - .trace = false, - .free_at_delete_request = false -}; - static rtems_resource_snapshot before_mount; static const msdos_format_request_param_t rqdata = { @@ -981,11 +969,8 @@ static void compare_image( static void test_compatibility( void ) { int rc; - rtems_status_code sc; - dev_t dev; - char diskpath[] = "/dev/ramdisk1"; + char diskpath[] = "/dev/rdd"; rtems_dosfs_mount_options mount_opts; - rtems_device_major_number major; FILE *fp; int buffer; unsigned int index_file = 0; @@ -1002,20 +987,6 @@ static void test_compatibility( void ) mount_opts.converter = rtems_dosfs_create_utf8_converter( "CP850" ); rtems_test_assert( mount_opts.converter != NULL ); - sc = rtems_io_register_driver( 0, &ramdisk_ops, &major ); - rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - - dev = rtems_filesystem_make_dev_t( major, 1 ); - - sc = rtems_disk_create_phys( - dev, - BLOCK_SIZE, - BLOCK_COUNT, - ramdisk_ioctl, - &disk_image, - diskpath ); - rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rc = mount_and_make_target_path( diskpath, MOUNT_DIR, @@ -1416,7 +1387,8 @@ static void Init( rtems_task_argument arg ) rtems_ramdisk_config rtems_ramdisk_configuration [] = { { .block_size = BLOCK_SIZE, .block_num = BLOCK_NUM }, { .block_size = BLOCK_SIZE, .block_num = BLOCK_NUM, .location = &IMAGE_BIN_LE_SINGLEBYTE[0] }, - { .block_size = BLOCK_SIZE, .block_num = BLOCK_NUM, .location = &IMAGE_BIN_LE_MULTIBYTE[0] } + { .block_size = BLOCK_SIZE, .block_num = BLOCK_NUM, .location = &IMAGE_BIN_LE_MULTIBYTE[0] }, + { .block_size = BLOCK_SIZE, .block_num = sizeof( image_bin ) / BLOCK_SIZE, .location = image_bin } }; size_t rtems_ramdisk_configuration_size = RTEMS_ARRAY_SIZE(rtems_ramdisk_configuration); @@ -1424,7 +1396,6 @@ size_t rtems_ramdisk_configuration_size = RTEMS_ARRAY_SIZE(rtems_ramdisk_configu #define CONFIGURE_INIT_TASK_STACK_SIZE ( 1024 * 64 ) #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_DRIVERS 4 #define CONFIGURE_MAXIMUM_SEMAPHORES (2 * RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE) #define CONFIGURE_APPLICATION_EXTRA_DRIVERS RAMDISK_DRIVER_TABLE_ENTRY diff --git a/testsuites/fstests/mdosfs_support/fs_support.c b/testsuites/fstests/mdosfs_support/fs_support.c index 7b73c27b84..4395182e0f 100644 --- a/testsuites/fstests/mdosfs_support/fs_support.c +++ b/testsuites/fstests/mdosfs_support/fs_support.c @@ -87,7 +87,6 @@ void test_shutdown_filesystem(void) #define CONFIGURE_MAXIMUM_SEMAPHORES RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE #define CONFIGURE_MAXIMUM_TASKS 10 -#define CONFIGURE_MAXIMUM_DRIVERS 10 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40 #define CONFIGURE_INIT_TASK_STACK_SIZE (16 * 1024) #define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT diff --git a/testsuites/fstests/mrfs_support/fs_support.c b/testsuites/fstests/mrfs_support/fs_support.c index 28b7be9a03..24c82cbea1 100644 --- a/testsuites/fstests/mrfs_support/fs_support.c +++ b/testsuites/fstests/mrfs_support/fs_support.c @@ -66,7 +66,6 @@ test_shutdown_filesystem (void) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE #define CONFIGURE_MAXIMUM_TASKS 10 -#define CONFIGURE_MAXIMUM_DRIVERS 10 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40 #define CONFIGURE_INIT_TASK_STACK_SIZE (32 * 1024) #define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT diff --git a/testsuites/fstests/support/ramdisk_support.c b/testsuites/fstests/support/ramdisk_support.c index d7574b2853..0a07495c02 100644 --- a/testsuites/fstests/support/ramdisk_support.c +++ b/testsuites/fstests/support/ramdisk_support.c @@ -11,12 +11,9 @@ #include "config.h" #endif -#include -#include +#include #include -#include -#include #include "ramdisk_support.h" #include "fstest.h" @@ -26,17 +23,14 @@ * Ramdisk information */ -dev_t dev = 0; - void init_ramdisk (void) { int rc = 0; - rc = rtems_disk_io_initialize (); - rtems_test_assert (rc == 0); + rc = ramdisk_register (RAMDISK_BLOCK_SIZE, RAMDISK_BLOCK_COUNT, - false, RAMDISK_PATH, &dev); + false, RAMDISK_PATH); rtems_test_assert (rc == 0); } @@ -45,20 +39,7 @@ del_ramdisk (void) { int rc = 0; - rtems_device_major_number major = 0; - rtems_device_minor_number minor = 0; - rc = rtems_disk_delete (dev); + rc = unlink (RAMDISK_PATH); rtems_test_assert (rc == 0); - - rtems_filesystem_split_dev_t (dev, major, minor); - - rtems_test_assert (major >= 0); - rtems_test_assert (minor >= 0); - - rc = rtems_io_unregister_driver (major); - rtems_test_assert (rc == 0); - rc = rtems_disk_io_done (); - rtems_test_assert (rc == 0); - } -- cgit v1.2.3