blob: cf1a1e499e116de3b97a73c1a599eb01af0f4ed4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/**
* @file
*
* @brief Default Read IO Vector Handler
*
* @ingroup LibIOFSHandler
*/
/*
* COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
*
* Copyright (c) 2013 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/libio_.h>
ssize_t rtems_filesystem_default_readv(
rtems_libio_t *iop,
const struct iovec *iov,
int iovcnt,
ssize_t total
)
{
int v;
total = 0;
for ( v = 0 ; v < iovcnt ; ++v ) {
size_t len = iov[ v ].iov_len;
if ( len > 0 ) {
ssize_t bytes = ( *iop->pathinfo.handlers->read_h )(
iop,
iov[ v ].iov_base,
len
);
if ( bytes < 0 )
return -1;
total += bytes;
if ( bytes != ( ssize_t ) len )
break;
}
}
return total;
}
|