Ignore:
Timestamp:
May 15, 2012, 8:06:18 AM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Children:
1c0263c
Parents:
d5d071d (diff), da154e14 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'upstream'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libfs/src/imfs/deviceio.c

    rd5d071d ra7d1992c  
    55 *  IMFS device nodes onto calls to the RTEMS Classic API IO Manager.
    66 *
    7  *  COPYRIGHT (c) 1989-2008.
     7 *  COPYRIGHT (c) 1989-2012.
    88 *  On-Line Applications Research Corporation (OAR).
    99 *
     
    1919#include "imfs.h"
    2020
    21 #include <rtems/devfs.h>
    22 
    23 /*
    24  *  device_open
    25  *
    26  *  This handler maps an open() operation onto rtems_io_open().
    27  */
     21#include <rtems/deviceio.h>
    2822
    2923int device_open(
     
    3428)
    3529{
    36   rtems_libio_open_close_args_t  args;
    37   rtems_status_code              status;
    3830  IMFS_jnode_t                  *the_jnode;
    3931
    4032  the_jnode  = iop->pathinfo.node_access;
    4133
    42   args.iop   = iop;
    43   args.flags = iop->flags;
    44   args.mode  = mode;
    45 
    46   status = rtems_io_open(
     34  return rtems_deviceio_open(
     35    iop,
     36    pathname,
     37    oflag,
     38    mode,
    4739    the_jnode->info.device.major,
    48     the_jnode->info.device.minor,
    49     (void *) &args
     40    the_jnode->info.device.minor
    5041  );
    51 
    52   return rtems_deviceio_errno( status );
    5342}
    54 
    55 /*
    56  *  device_close
    57  *
    58  *  This handler maps a close() operation onto rtems_io_close().
    59  */
    6043
    6144int device_close(
     
    6346)
    6447{
    65   rtems_libio_open_close_args_t  args;
    66   rtems_status_code              status;
    6748  IMFS_jnode_t                  *the_jnode;
    6849
    6950  the_jnode = iop->pathinfo.node_access;
    7051
    71   args.iop   = iop;
    72   args.flags = 0;
    73   args.mode  = 0;
    74 
    75   status = rtems_io_close(
     52  return rtems_deviceio_close(
     53    iop,
    7654    the_jnode->info.device.major,
    77     the_jnode->info.device.minor,
    78     (void *) &args
     55    the_jnode->info.device.minor
    7956  );
    80 
    81   return rtems_deviceio_errno( status );
    8257}
    83 
    84 /*
    85  *  device_read
    86  *
    87  *  This handler maps a read() operation onto rtems_io_read().
    88  */
    8958
    9059ssize_t device_read(
     
    9463)
    9564{
    96   rtems_libio_rw_args_t   args;
    97   rtems_status_code       status;
    9865  IMFS_jnode_t           *the_jnode;
    9966
    10067  the_jnode = iop->pathinfo.node_access;
    10168
    102   args.iop         = iop;
    103   args.offset      = iop->offset;
    104   args.buffer      = buffer;
    105   args.count       = count;
    106   args.flags       = iop->flags;
    107   args.bytes_moved = 0;
    108 
    109   status = rtems_io_read(
     69  return rtems_deviceio_read(
     70    iop,
     71    buffer,
     72    count,
    11073    the_jnode->info.device.major,
    111     the_jnode->info.device.minor,
    112     (void *) &args
     74    the_jnode->info.device.minor
    11375  );
    114 
    115   if ( status )
    116     return rtems_deviceio_errno(status);
    117 
    118   return (ssize_t) args.bytes_moved;
    11976}
    120 
    121 /*
    122  *  device_write
    123  *
    124  *  This handler maps a write() operation onto rtems_io_write().
    125  */
    12677
    12778ssize_t device_write(
     
    13182)
    13283{
    133   rtems_libio_rw_args_t   args;
    134   rtems_status_code       status;
    13584  IMFS_jnode_t           *the_jnode;
    13685
    13786  the_jnode = iop->pathinfo.node_access;
    13887
    139   args.iop         = iop;
    140   args.offset      = iop->offset;
    141   args.buffer      = (void *) buffer;
    142   args.count       = count;
    143   args.flags       = iop->flags;
    144   args.bytes_moved = 0;
    145 
    146   status = rtems_io_write(
     88  return rtems_deviceio_write(
     89    iop,
     90    buffer,
     91    count,
    14792    the_jnode->info.device.major,
    148     the_jnode->info.device.minor,
    149     (void *) &args
     93    the_jnode->info.device.minor
    15094  );
    151 
    152   if ( status )
    153     return rtems_deviceio_errno(status);
    154 
    155   return (ssize_t) args.bytes_moved;
    15695}
    15796
    158 /*
    159  *  device_ioctl
    160  *
    161  *  This handler maps an ioctl() operation onto rtems_io_ioctl().
    162  */
    163 
    16497int device_ioctl(
    165   rtems_libio_t *iop,
    166   uint32_t       command,
    167   void          *buffer
     98  rtems_libio_t   *iop,
     99  ioctl_command_t  command,
     100  void            *buffer
    168101)
    169102{
    170   rtems_libio_ioctl_args_t  args;
    171   rtems_status_code         status;
    172103  IMFS_jnode_t             *the_jnode;
    173 
    174   args.iop     = iop;
    175   args.command = command;
    176   args.buffer  = buffer;
    177104
    178105  the_jnode = iop->pathinfo.node_access;
    179106
    180   status = rtems_io_control(
     107  return rtems_deviceio_control(
     108    iop,
     109    command,
     110    buffer,
    181111    the_jnode->info.device.major,
    182     the_jnode->info.device.minor,
    183     (void *) &args
     112    the_jnode->info.device.minor
    184113  );
    185 
    186   if ( status )
    187     return rtems_deviceio_errno(status);
    188 
    189   return args.ioctl_return;
    190114}
    191 
    192 /*
    193  *  device_stat
    194  *
    195  *  The IMFS_stat() is used.
    196  */
    197 
    198 /*
    199  *  device_rmnod
    200  *
    201  *  The IMFS_rmnod() is used.
    202  */
    203115
    204116int device_ftruncate(
Note: See TracChangeset for help on using the changeset viewer.