Changeset fa12e06d in rtems


Ignore:
Timestamp:
Aug 3, 2018, 8:28:31 PM (15 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
bf80279
Parents:
3278d20
git-author:
Sebastian Huber <sebastian.huber@…> (08/03/18 20:28:31)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/07/18 05:17:18)
Message:

libtests/block14: Use rtems_blkdev_create()

Update #3358.

File:
1 edited

Legend:

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

    r3278d20 rfa12e06d  
    11/*
    2  * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
     2 * Copyright (c) 2012, 2018 embedded brains GmbH.  All rights reserved.
    33 *
    44 *  embedded brains GmbH
    5  *  Obere Lagerstr. 30
     5 *  Dornierstr. 4
    66 *  82178 Puchheim
    77 *  Germany
     
    1919#include "tmacros.h"
    2020
     21#include <sys/stat.h>
     22#include <assert.h>
    2123#include <errno.h>
     24#include <fcntl.h>
    2225#include <string.h>
    23 
    24 #include <rtems/blkdev.h>
     26#include <unistd.h>
     27
    2528#include <rtems/bdbuf.h>
    2629
     
    3033
    3134#define BLOCK_COUNT 6
     35
     36#define DISK_PATH "/disk"
    3237
    3338typedef struct {
     
    110115    rtems_blkdev_request_done(breq, sc);
    111116  } else {
    112     errno = EINVAL;
    113     rv = -1;
     117    rv = rtems_blkdev_ioctl(dd, req, arg);
    114118  }
    115119
     
    162166{
    163167  rtems_status_code sc;
    164   dev_t dev = 0;
    165168  rtems_disk_device *dd;
    166 
    167   sc = rtems_disk_io_initialize();
    168   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    169 
    170   sc = rtems_disk_create_phys(
    171     dev,
     169  int fd;
     170  int rv;
     171
     172  sc = rtems_blkdev_create(
     173    DISK_PATH,
    172174    1,
    173175    BLOCK_COUNT,
    174176    test_disk_ioctl,
    175     NULL,
    176177    NULL
    177178  );
    178179  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    179180
    180   dd = rtems_disk_obtain(dev);
    181   rtems_test_assert(dd != NULL);
     181  fd = open(DISK_PATH, O_RDWR);
     182  rtems_test_assert(fd >= 0);
     183
     184  rv = rtems_disk_fd_get_disk_device(fd, &dd);
     185  rtems_test_assert(rv == 0);
     186
     187  rv = close(fd);
     188  rtems_test_assert(rv == 0);
    182189
    183190  test_actions(dd);
    184191
    185   sc = rtems_disk_release(dd);
    186   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    187 
    188   sc = rtems_disk_delete(dev);
    189   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     192  rv = unlink(DISK_PATH);
     193  rtems_test_assert(rv == 0);
    190194}
    191195
     
    204208#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
    205209#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
     210
     211#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
    206212
    207213#define CONFIGURE_BDBUF_BUFFER_MIN_SIZE 1
Note: See TracChangeset for help on using the changeset viewer.