Changeset 70502b48 in rtems for testsuites


Ignore:
Timestamp:
Mar 20, 2018, 3:07:14 PM (21 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
7bf072b
Parents:
c4d35fb
git-author:
Sebastian Huber <sebastian.huber@…> (03/20/18 15:07:14)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/18/18 08:44:18)
Message:

libtests/block05: Use rtems_blkdev_create()

Update #3358.

File:
1 edited

Legend:

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

    rc4d35fb r70502b48  
    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
     
    2525#endif
    2626
    27 #include "tmacros.h"
     27#include <sys/stat.h>
     28#include <errno.h>
     29#include <fcntl.h>
    2830#include <stdarg.h>
    29 #include <errno.h>
    3031
    3132#include <rtems.h>
    3233#include <rtems/bspIo.h>
    3334#include <rtems/bdbuf.h>
    34 #include <rtems/diskdevs.h>
     35#include <rtems/blkdev.h>
     36
     37#include <tmacros.h>
    3538
    3639const char rtems_test_name[] = "BLOCK 5";
     
    395398
    396399static void disk_register(
     400  const char *dev,
    397401  uint32_t block_size,
    398402  rtems_blkdev_bnum block_count,
     
    400404)
    401405{
    402   rtems_status_code sc = RTEMS_SUCCESSFUL;
    403   rtems_device_major_number major = 0;
    404   dev_t dev = 0;
    405 
    406   sc = rtems_io_register_driver(0, &disk_ops, &major);
    407   ASSERT_SC(sc);
    408 
    409   dev = rtems_filesystem_make_dev_t(major, 0);
    410 
    411   sc = rtems_disk_create_phys(
     406  rtems_status_code sc;
     407  int rv;
     408  int fd;
     409
     410  sc = rtems_blkdev_create(
    412411    dev,
    413412    block_size,
    414413    block_count,
    415414    disk_ioctl,
    416     NULL,
    417415    NULL
    418416  );
    419417  ASSERT_SC(sc);
    420418
    421   *dd_ptr = rtems_disk_obtain(dev);
    422   rtems_test_assert(*dd_ptr!= NULL);
     419  fd = open(dev, O_RDWR);
     420  rtems_test_assert(rv >= 0);
     421
     422  rv = rtems_disk_fd_get_disk_device(fd, dd_ptr);
     423  rtems_test_assert(rv == 0);
     424
     425  rv = close(fd);
     426  rtems_test_assert(rv == 0);
    423427}
    424428
     
    432436  task_id_init = rtems_task_self();
    433437
    434   sc = rtems_disk_io_initialize();
    435   ASSERT_SC(sc);
    436 
    437   disk_register(BLOCK_SIZE_A, BLOCK_COUNT_A, &dd_a);
    438 
    439   disk_register(BLOCK_SIZE_B, BLOCK_COUNT_B, &dd_b);
     438  disk_register("dd_b", BLOCK_SIZE_A, BLOCK_COUNT_A, &dd_a);
     439
     440  disk_register("dd_a", BLOCK_SIZE_B, BLOCK_COUNT_B, &dd_b);
    440441
    441442  sc = rtems_task_create(
     
    518519#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
    519520
     521#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5
     522
    520523#define CONFIGURE_MAXIMUM_TASKS 4
    521524#define CONFIGURE_MAXIMUM_DRIVERS 4
Note: See TracChangeset for help on using the changeset viewer.