Changeset 3278d20 in rtems


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

libtests/block13: Use rtems_blkdev_create()

Update #3358.

File:
1 edited

Legend:

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

    r5e4bab7 r3278d20  
    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
     
    2932#define BLOCK_COUNT 11
    3033#define READ_COUNT 23
     34
     35#define DISK_PATH "/disk"
    3136
    3237static int block_access_counts [BLOCK_COUNT];
     
    131136    rtems_blkdev_request_done(breq, RTEMS_SUCCESSFUL);
    132137  } else {
    133     errno = EINVAL;
    134     rv = -1;
     138    rv = rtems_blkdev_ioctl(dd, req, arg);
    135139  }
    136140
     
    182186{
    183187  rtems_status_code sc;
    184   dev_t dev = 0;
    185188  rtems_disk_device *dd;
    186 
    187   sc = rtems_disk_io_initialize();
    188   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    189 
    190   sc = rtems_disk_create_phys(
    191     dev,
     189  int fd;
     190  int rv;
     191
     192  sc = rtems_blkdev_create(
     193    DISK_PATH,
    192194    1,
    193195    BLOCK_COUNT,
    194196    test_disk_ioctl,
    195     NULL,
    196197    NULL
    197198  );
    198199  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    199200
    200   dd = rtems_disk_obtain(dev);
    201   rtems_test_assert(dd != NULL);
     201  fd = open(DISK_PATH, O_RDWR);
     202  rtems_test_assert(fd >= 0);
     203
     204  rv = rtems_disk_fd_get_disk_device(fd, &dd);
     205  rtems_test_assert(rv == 0);
     206
     207  rv = close(fd);
     208  rtems_test_assert(rv == 0);
    202209
    203210  test_read_ahead(dd);
    204211
    205   sc = rtems_disk_release(dd);
    206   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    207 
    208   sc = rtems_disk_delete(dev);
    209   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     212  rv = unlink(DISK_PATH);
     213  rtems_test_assert(rv == 0);
    210214}
    211215
     
    224228#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
    225229#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
     230
     231#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
    226232
    227233#define CONFIGURE_BDBUF_BUFFER_MIN_SIZE 1
Note: See TracChangeset for help on using the changeset viewer.