source: rtems/cpukit/libfs/src/defaults/default_writev.c @ 0ec9bbc

5
Last change on this file since 0ec9bbc was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

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