Changeset bf80279 in rtems for testsuites


Ignore:
Timestamp:
Aug 3, 2018, 8:30:55 PM (16 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
698093d
Parents:
fa12e06d
git-author:
Sebastian Huber <sebastian.huber@…> (08/03/18 20:30:55)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/07/18 05:17:18)
Message:

libtests/block15: Use rtems_blkdev_create()

Update #3358.

File:
1 edited

Legend:

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

    rfa12e06d rbf80279  
    1919#include "tmacros.h"
    2020
     21#include <sys/stat.h>
     22#include <assert.h>
    2123#include <errno.h>
    22 #include <stdio.h>
     24#include <fcntl.h>
    2325#include <inttypes.h>
     26#include <stdlib.h>
     27#include <unistd.h>
    2428
    25 #include <rtems/blkdev.h>
    2629#include <rtems/bdbuf.h>
    2730
     
    4144
    4245#define BLOCK_SIZE 4
     46
     47#define DISK_PATH "/disk"
    4348
    4449static const rtems_blkdev_bnum action_sequence [ACTION_COUNT] = {
     
    9196    *(uint32_t *) arg = RTEMS_BLKDEV_CAP_MULTISECTOR_CONT;
    9297  } else {
    93     errno = EINVAL;
    94     rv = -1;
     98    rv = rtems_blkdev_ioctl(dd, req, arg);
    9599  }
    96100
     
    127131{
    128132  rtems_status_code sc;
    129   dev_t dev = 0;
    130133  rtems_disk_device *dd;
     134  int fd;
     135  int rv;
    131136
    132   sc = rtems_disk_io_initialize();
    133   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    134 
    135   sc = rtems_disk_create_phys(
    136     dev,
     137  sc = rtems_blkdev_create(
     138    DISK_PATH,
    137139    MEDIA_BLOCK_SIZE,
    138140    BLOCK_COUNT,
    139141    test_disk_ioctl,
    140     NULL,
    141142    NULL
    142143  );
    143144  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    144145
    145   dd = rtems_disk_obtain(dev);
    146   rtems_test_assert(dd != NULL);
     146  fd = open(DISK_PATH, O_RDWR);
     147  rtems_test_assert(fd >= 0);
     148
     149  rv = rtems_disk_fd_get_disk_device(fd, &dd);
     150  rtems_test_assert(rv == 0);
     151
     152  rv = close(fd);
     153  rtems_test_assert(rv == 0);
    147154
    148155  test_write_requests(dd);
    149156
    150   sc = rtems_disk_release(dd);
    151   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    152 
    153   sc = rtems_disk_delete(dev);
    154   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     157  rv = unlink(DISK_PATH);
     158  rtems_test_assert(rv == 0);
    155159}
    156160
     
    170174#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
    171175
     176#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
     177
    172178#define CONFIGURE_BDBUF_BUFFER_MIN_SIZE 1
    173179#define CONFIGURE_BDBUF_BUFFER_MAX_SIZE 4
Note: See TracChangeset for help on using the changeset viewer.