diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-05-14 15:19:20 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-05-15 10:01:42 +0200 |
commit | fed66f991014f40430b256d44231a7828bb8a413 (patch) | |
tree | 776084d409f4c21ed84c1c2da4d65993f10ef588 /cpukit/libfs/src/devfs | |
parent | df01da67078b4ed4787680d3987f5b40ac93d080 (diff) |
Filesystem: Add shared device IO support
The device IO file system support in IMFS, devFS, and RFS uses now a
shared implementation.
Diffstat (limited to 'cpukit/libfs/src/devfs')
-rw-r--r-- | cpukit/libfs/src/devfs/devclose.c | 23 | ||||
-rw-r--r-- | cpukit/libfs/src/devfs/devfs.h | 6 | ||||
-rw-r--r-- | cpukit/libfs/src/devfs/devioctl.c | 27 | ||||
-rw-r--r-- | cpukit/libfs/src/devfs/devopen.c | 24 | ||||
-rw-r--r-- | cpukit/libfs/src/devfs/devread.c | 28 | ||||
-rw-r--r-- | cpukit/libfs/src/devfs/devwrite.c | 28 |
6 files changed, 26 insertions, 110 deletions
diff --git a/cpukit/libfs/src/devfs/devclose.c b/cpukit/libfs/src/devfs/devclose.c index c83fab9745..83646c7619 100644 --- a/cpukit/libfs/src/devfs/devclose.c +++ b/cpukit/libfs/src/devfs/devclose.c @@ -5,33 +5,18 @@ */ #if HAVE_CONFIG_H -#include "config.h" + #include "config.h" #endif -#include <rtems.h> -#include <rtems/io.h> - #include "devfs.h" +#include <rtems/deviceio.h> + int devFS_close( rtems_libio_t *iop ) { - rtems_libio_open_close_args_t args; - rtems_status_code status; const devFS_node *np = iop->pathinfo.node_access; - args.iop = iop; - args.flags = 0; - args.mode = 0; - - status = rtems_io_close( - np->major, - np->minor, - (void *) &args - ); - - return rtems_deviceio_errno(status); + return rtems_deviceio_close( iop, np->major, np->minor ); } - - diff --git a/cpukit/libfs/src/devfs/devfs.h b/cpukit/libfs/src/devfs/devfs.h index 60ee7ab0be..4155dd6884 100644 --- a/cpukit/libfs/src/devfs/devfs.h +++ b/cpukit/libfs/src/devfs/devfs.h @@ -49,12 +49,6 @@ extern const rtems_filesystem_operations_table devFS_ops; extern const rtems_filesystem_file_handlers_r devFS_file_handlers; -/** - * This routine associates RTEMS status code with errno - */ - -extern int rtems_deviceio_errno(rtems_status_code code); - static inline const devFS_data *devFS_get_data( const rtems_filesystem_location_info_t *loc ) diff --git a/cpukit/libfs/src/devfs/devioctl.c b/cpukit/libfs/src/devfs/devioctl.c index bca82509df..e1d62c4d78 100644 --- a/cpukit/libfs/src/devfs/devioctl.c +++ b/cpukit/libfs/src/devfs/devioctl.c @@ -1,41 +1,24 @@ -#if HAVE_CONFIG_H /* * 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. */ -#include "config.h" +#if HAVE_CONFIG_H + #include "config.h" #endif -#include <rtems.h> -#include <rtems/io.h> - #include "devfs.h" +#include <rtems/deviceio.h> + int devFS_ioctl( rtems_libio_t *iop, ioctl_command_t command, void *buffer ) { - rtems_libio_ioctl_args_t args; - rtems_status_code status; const devFS_node *np = iop->pathinfo.node_access; - args.iop = iop; - args.command = command; - args.buffer = buffer; - - status = rtems_io_control( - np->major, - np->minor, - (void *) &args - ); - - if ( status ) - return rtems_deviceio_errno(status); - - return args.ioctl_return; + return rtems_deviceio_control( iop, command, buffer, np->major, np->minor ); } - diff --git a/cpukit/libfs/src/devfs/devopen.c b/cpukit/libfs/src/devfs/devopen.c index adb8fe43b1..26450ab26b 100644 --- a/cpukit/libfs/src/devfs/devopen.c +++ b/cpukit/libfs/src/devfs/devopen.c @@ -5,14 +5,13 @@ */ #if HAVE_CONFIG_H -#include "config.h" + #include "config.h" #endif -#include <rtems.h> -#include <rtems/io.h> - #include "devfs.h" +#include <rtems/deviceio.h> + int devFS_open( rtems_libio_t *iop, const char *pathname, @@ -20,19 +19,14 @@ int devFS_open( mode_t mode ) { - rtems_libio_open_close_args_t args; - rtems_status_code status; const devFS_node *np = iop->pathinfo.node_access; - args.iop = iop; - args.flags = iop->flags; - args.mode = mode; - - status = rtems_io_open( + return rtems_deviceio_open( + iop, + pathname, + oflag, + mode, np->major, - np->minor, - (void *) &args + np->minor ); - - return rtems_deviceio_errno(status); } diff --git a/cpukit/libfs/src/devfs/devread.c b/cpukit/libfs/src/devfs/devread.c index 6868a9e952..25d69b0284 100644 --- a/cpukit/libfs/src/devfs/devread.c +++ b/cpukit/libfs/src/devfs/devread.c @@ -5,40 +5,20 @@ */ #if HAVE_CONFIG_H -#include "config.h" + #include "config.h" #endif -#include <rtems.h> -#include <rtems/io.h> - #include "devfs.h" +#include <rtems/deviceio.h> + ssize_t devFS_read( rtems_libio_t *iop, void *buffer, size_t count ) { - rtems_libio_rw_args_t args; - rtems_status_code status; const devFS_node *np = iop->pathinfo.node_access; - args.iop = iop; - args.offset = iop->offset; - args.buffer = buffer; - args.count = count; - args.flags = iop->flags; - args.bytes_moved = 0; - - status = rtems_io_read( - np->major, - np->minor, - (void *) &args - ); - - if ( status ) - return rtems_deviceio_errno(status); - - return (ssize_t) args.bytes_moved; + return rtems_deviceio_read( iop, buffer, count, np->major, np->minor ); } - diff --git a/cpukit/libfs/src/devfs/devwrite.c b/cpukit/libfs/src/devfs/devwrite.c index fe48745d9f..57e7fdb221 100644 --- a/cpukit/libfs/src/devfs/devwrite.c +++ b/cpukit/libfs/src/devfs/devwrite.c @@ -5,40 +5,20 @@ */ #if HAVE_CONFIG_H -#include "config.h" + #include "config.h" #endif -#include <rtems.h> -#include <rtems/io.h> - #include "devfs.h" +#include <rtems/deviceio.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; const devFS_node *np = iop->pathinfo.node_access; - 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; + return rtems_deviceio_write( iop, buffer, count, np->major, np->minor ); } - |