Ignore:
Timestamp:
Jul 30, 2018, 4:39:09 AM (17 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
16f3f10
Parents:
d56e68b
git-author:
Sebastian Huber <sebastian.huber@…> (07/30/18 04:39:09)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/07/18 05:17:16)
Message:

ramdisk: Use rtems_blkdev_create()

Update #3358.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/block03/init.c

    rd56e68b r24b94c4  
    88
    99/*
    10  * Copyright (c) 2009-2012 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2009, 2018 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
    13  *  Obere Lagerstr. 30
     13 *  Dornierstr. 4
    1414 *  82178 Puchheim
    1515 *  Germany
     
    3131#include <rtems/ramdisk.h>
    3232#include <rtems/bdbuf.h>
    33 #include <rtems/diskdevs.h>
     33
     34#include <sys/stat.h>
     35#include <fcntl.h>
     36#include <unistd.h>
    3437
    3538const char rtems_test_name[] = "BLOCK 3";
    36 
    37 /* forward declarations to avoid warnings */
    38 static rtems_task Init(rtems_task_argument argument);
    3939
    4040#define ASSERT_SC(sc) rtems_test_assert((sc) == RTEMS_SUCCESSFUL)
     
    125125}
    126126
     127static void do_ramdisk_register(
     128  uint32_t media_block_size,
     129  rtems_blkdev_bnum media_block_count,
     130  const char *disk,
     131  rtems_disk_device **dd
     132)
     133{
     134  rtems_status_code sc;
     135  int fd;
     136  int rv;
     137
     138  sc = ramdisk_register(media_block_size, media_block_count, false, disk);
     139  ASSERT_SC(sc);
     140
     141  fd = open(disk, O_RDWR);
     142  rtems_test_assert(fd >= 0);
     143
     144  rv = rtems_disk_fd_get_disk_device(fd, dd);
     145  rtems_test_assert(rv == 0);
     146
     147  rv = close(fd);
     148  rtems_test_assert(rv == 0);
     149}
     150
    127151static rtems_task Init(rtems_task_argument argument)
    128152{
    129153  rtems_status_code sc = RTEMS_SUCCESSFUL;
    130154  rtems_bdbuf_buffer *bd = NULL;
    131   dev_t dev = 0;
    132155
    133156  TEST_BEGIN();
    134157
    135   sc = rtems_disk_io_initialize();
    136   ASSERT_SC(sc);
    137 
    138   sc = ramdisk_register(BLOCK_SIZE, BLOCK_COUNT, false, "/dev/rda", &dev);
    139   ASSERT_SC(sc);
    140 
    141   dd = rtems_disk_obtain(dev);
    142   rtems_test_assert(dd != NULL);
     158  do_ramdisk_register(BLOCK_SIZE, BLOCK_COUNT, "/dev/rda", &dd);
    143159
    144160  sc = rtems_task_create(
     
    188204#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
    189205
     206#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
     207
    190208#define CONFIGURE_MAXIMUM_TASKS 3
    191 #define CONFIGURE_MAXIMUM_DRIVERS 2
    192209
    193210#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
Note: See TracChangeset for help on using the changeset viewer.