diff options
Diffstat (limited to 'cpukit/libfs/src/devfs/devwrite.c')
-rw-r--r-- | cpukit/libfs/src/devfs/devwrite.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/cpukit/libfs/src/devfs/devwrite.c b/cpukit/libfs/src/devfs/devwrite.c new file mode 100644 index 0000000000..bc0822251c --- /dev/null +++ b/cpukit/libfs/src/devfs/devwrite.c @@ -0,0 +1,48 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include <rtems.h> +#include <rtems/io.h> + +#include "devfs.h" + +ssize_t devFS_write( + rtems_libio_t *iop, + const void *buffer, + size_t count +) +{ + rtems_libio_rw_args_t args; + rtems_status_code status; + rtems_driver_name_t *np; + + np = (rtems_device_name_t *)iop->file_info; + + args.iop = iop; + args.offset = iop->offset; + args.buffer = (void *) buffer; + args.count = count; + args.flags = iop->flags; + args.bytes_moved = 0; + + status = rtems_io_write( + np->major, + np->minor, + (void *) &args + ); + + if ( status ) + return rtems_deviceio_errno(status); + + return (ssize_t) args.bytes_moved; +} + |