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/block07/init.c

    rd56e68b r24b94c4  
    88
    99/*
    10  * Copyright (c) 2009
    11  * embedded brains GmbH
    12  * Obere Lagerstr. 30
    13  * D-82178 Puchheim
    14  * Germany
    15  * <rtems@embedded-brains.de>
     10 * Copyright (c) 2009, 2018 embedded brains GmbH.  All rights reserved.
     11 *
     12 *  embedded brains GmbH
     13 *  Dornierstr. 4
     14 *  82178 Puchheim
     15 *  Germany
     16 *  <rtems@embedded-brains.de>
    1617 *
    1718 * The license and distribution terms for this file may be
     
    2829#include <sys/stat.h>
    2930#include <fcntl.h>
     31#include <unistd.h>
    3032
    3133#include "tmacros.h"
     
    3436#include <rtems/ramdisk.h>
    3537#include <rtems/bdbuf.h>
    36 #include <rtems/diskdevs.h>
    3738
    3839const char rtems_test_name[] = "BLOCK 7";
    39 
    40 /* forward declarations to avoid warnings */
    41 static rtems_task Init(rtems_task_argument argument);
    4240
    4341#define ASSERT_SC(sc) rtems_test_assert((sc) == RTEMS_SUCCESSFUL)
     
    159157}
    160158
     159static void do_ramdisk_register(
     160  uint32_t media_block_size,
     161  rtems_blkdev_bnum media_block_count,
     162  const char *disk,
     163  rtems_disk_device **dd
     164)
     165{
     166  rtems_status_code sc;
     167  int fd;
     168  int rv;
     169
     170  sc = ramdisk_register(media_block_size, media_block_count, false, disk);
     171  ASSERT_SC(sc);
     172
     173  fd = open(disk, O_RDWR);
     174  rtems_test_assert(fd >= 0);
     175
     176  rv = rtems_disk_fd_get_disk_device(fd, dd);
     177  rtems_test_assert(rv == 0);
     178
     179  rv = close(fd);
     180  rtems_test_assert(rv == 0);
     181}
     182
    161183static rtems_task Init(rtems_task_argument argument)
    162184{
     
    164186  rtems_task_priority cur_prio = 0;
    165187  rtems_bdbuf_buffer *bd = NULL;
    166   dev_t dev = 0;
    167188
    168189  TEST_BEGIN();
    169190
    170   sc = rtems_disk_io_initialize();
    171   ASSERT_SC(sc);
    172 
    173   sc = ramdisk_register(BLOCK_SIZE_A, BLOCK_COUNT, false, "/dev/rda", &dev);
    174   ASSERT_SC(sc);
    175 
    176   dd = rtems_disk_obtain(dev);
    177   rtems_test_assert(dd != NULL);
     191  do_ramdisk_register(BLOCK_SIZE_A, BLOCK_COUNT, "/dev/rda", &dd);
    178192
    179193  sc = rtems_task_create(
     
    266280
    267281#define CONFIGURE_MAXIMUM_TASKS 4
    268 #define CONFIGURE_MAXIMUM_DRIVERS 2
    269282
    270283#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
Note: See TracChangeset for help on using the changeset viewer.