summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests/block08/test_disk.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-10-31 11:54:39 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-11-02 09:40:58 +0100
commit9f0a68ce5afca9d21d34bab83d42fbe4bb0cf8ef (patch)
treedb24c42e065ac766c55215f39eb729a337609cde /testsuites/libtests/block08/test_disk.c
parentbsp/mpc55xx: SMSC9218i avoid mbuf migration (diff)
downloadrtems-9f0a68ce5afca9d21d34bab83d42fbe4bb0cf8ef.tar.bz2
libblock: Block device transfer request API change
Add and use rtems_blkdev_request_done(). Block device transfer requests must signal the completion status now with rtems_blkdev_request_done(). The return value of the block device IO control will be ignored for transfer requests. The first parameter of rtems_blkdev_request_cb is now the transfer request structure. Renamed rtems_blkdev_request::req_done to rtems_blkdev_request::done to break third party drivers at compile time, otherwise this API change would result in runtime errors.
Diffstat (limited to 'testsuites/libtests/block08/test_disk.c')
-rw-r--r--testsuites/libtests/block08/test_disk.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/testsuites/libtests/block08/test_disk.c b/testsuites/libtests/block08/test_disk.c
index 3040ab3bed..f743c00b5f 100644
--- a/testsuites/libtests/block08/test_disk.c
+++ b/testsuites/libtests/block08/test_disk.c
@@ -32,18 +32,20 @@ static Objects_Id testq_id = OBJECTS_ID_NONE;
static int
test_disk_ioctl(rtems_disk_device *dd, uint32_t req, void *argp)
{
- rtems_status_code rc;
- bdbuf_test_msg msg;
- size_t msg_size;
+ rtems_status_code rc;
+ bdbuf_test_msg msg;
+ size_t msg_size;
+ rtems_blkdev_request *r;
switch (req)
{
case RTEMS_BLKIO_REQUEST:
{
- rtems_blkdev_request *r = argp;
rtems_blkdev_sg_buffer *sg;
unsigned int i;
+ r = argp;
+
printk("DISK_DRV: %s ",
r->req == RTEMS_BLKDEV_REQ_READ ? "R" :
r->req == RTEMS_BLKDEV_REQ_WRITE ? "W" : "?");
@@ -71,7 +73,8 @@ test_disk_ioctl(rtems_disk_device *dd, uint32_t req, void *argp)
if (rc != RTEMS_SUCCESSFUL)
{
printf("Error while sending a message to Test task: %u\n", rc);
- return -1;
+ rtems_blkdev_request_done(r, RTEMS_IO_ERROR);
+ return 0;
}
/* Wait for a reply from the test task */
@@ -81,27 +84,27 @@ test_disk_ioctl(rtems_disk_device *dd, uint32_t req, void *argp)
if (rc != RTEMS_SUCCESSFUL)
{
printf("Error while reading a message from Test task: %u\n", rc);
- return rc;
+ rtems_blkdev_request_done(r, RTEMS_IO_ERROR);
+ return 0;
}
if (msg.type != BDBUF_TEST_MSG_TYPE_DRIVER_REPLY)
{
printf("Unexpected message comes to test disk driver: %d\n",
msg.type);
- return -1;
+ rtems_blkdev_request_done(r, RTEMS_IO_ERROR);
+ return 0;
}
if (msg.val.driver_reply.ret_val != 0)
{
- errno = msg.val.driver_reply.ret_errno;
+ rtems_blkdev_request_done(r, RTEMS_IO_ERROR);
}
else
{
- rtems_blkdev_request *r = (rtems_blkdev_request *)argp;
-
- r->req_done(r->done_arg, msg.val.driver_reply.res_status);
+ rtems_blkdev_request_done(r, msg.val.driver_reply.res_status);
}
- return msg.val.driver_reply.ret_val;
+ return 0;
}
rtems_device_driver