Index: c/src/lib/libbsp/shared/umon/tfsDriver.c
===================================================================
--- c/src/lib/libbsp/shared/umon/tfsDriver.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ c/src/lib/libbsp/shared/umon/tfsDriver.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -93,6 +93,6 @@
   }
 
+  mt_entry->ops = &rtems_tfs_ops;
   mt_entry->mt_fs_root->location.handlers = &rtems_tfs_handlers;
-  mt_entry->mt_fs_root->location.ops = &rtems_tfs_ops;
   mt_entry->mt_fs_root->location.node_access = root_path;
 
Index: cpukit/include/rtems/fs.h
===================================================================
--- cpukit/include/rtems/fs.h	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/include/rtems/fs.h	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -54,5 +54,4 @@
    void                                    *node_access_2;
    const rtems_filesystem_file_handlers_r  *handlers;
-   const rtems_filesystem_operations_table *ops;
    rtems_filesystem_mount_table_entry_t    *mt_entry;
 } rtems_filesystem_location_info_t;
Index: cpukit/libblock/src/bdbuf.c
===================================================================
--- cpukit/libblock/src/bdbuf.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libblock/src/bdbuf.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -2854,5 +2854,6 @@
     else
     {
-      while (*prev != NULL && cur == (*prev)->avl.right)
+      while (*prev != NULL
+             && (cur == (*prev)->avl.right || (*prev)->avl.right == NULL))
       {
         /* Up */
Index: cpukit/libblock/src/blkdev-imfs.c
===================================================================
--- cpukit/libblock/src/blkdev-imfs.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libblock/src/blkdev-imfs.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -76,4 +76,5 @@
 
   if (remaining >= 0) {
+    iop->offset += count;
     rv = (ssize_t) count;
   } else {
@@ -135,4 +136,5 @@
 
   if (remaining >= 0) {
+    iop->offset += count;
     rv = (ssize_t) count;
   } else {
Index: cpukit/libcsupport/Makefile.am
===================================================================
--- cpukit/libcsupport/Makefile.am	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/Makefile.am	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -25,4 +25,5 @@
 ## rtems
 include_rtems_HEADERS += include/rtems/assoc.h
+include_rtems_HEADERS += include/rtems/deviceio.h
 include_rtems_HEADERS += include/rtems/error.h
 include_rtems_HEADERS += include/rtems/libcsupport.h
@@ -128,4 +129,6 @@
     src/sup_fs_mount_iterate.c \
     src/sup_fs_node_type.c \
+    src/sup_fs_deviceio.c \
+    src/sup_fs_deviceerrno.c \
     src/clonenode.c \
     src/freenode.c \
Index: cpukit/libcsupport/include/rtems/deviceio.h
===================================================================
--- cpukit/libcsupport/include/rtems/deviceio.h	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
+++ cpukit/libcsupport/include/rtems/deviceio.h	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -0,0 +1,56 @@
+/*
+ *  COPYRIGHT (c) 1989-2012.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  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.
+ */
+
+#ifndef _RTEMS_DEVICEIO_H
+#define _RTEMS_DEVICEIO_H
+
+#include <rtems/libio.h>
+
+int rtems_deviceio_errno( rtems_status_code status );
+
+int rtems_deviceio_open(
+  rtems_libio_t *iop,
+  const char *path,
+  int oflag,
+  mode_t mode,
+  rtems_device_major_number major,
+  rtems_device_minor_number minor
+);
+
+int rtems_deviceio_close(
+  rtems_libio_t *iop,
+  rtems_device_major_number major,
+  rtems_device_minor_number minor
+);
+
+ssize_t rtems_deviceio_read(
+  rtems_libio_t *iop,
+  void *buf,
+  size_t nbyte,
+  rtems_device_major_number major,
+  rtems_device_minor_number minor
+);
+
+ssize_t rtems_deviceio_write(
+  rtems_libio_t *iop,
+  const void *buf,
+  size_t nbyte,
+  rtems_device_major_number major,
+  rtems_device_minor_number minor
+);
+
+int rtems_deviceio_control(
+  rtems_libio_t *iop,
+  ioctl_command_t command,
+  void *buffer,
+  rtems_device_major_number major,
+  rtems_device_minor_number minor
+);
+
+#endif /* _RTEMS_DEVICEIO_H */
Index: cpukit/libcsupport/include/rtems/libio.h
===================================================================
--- cpukit/libcsupport/include/rtems/libio.h	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/include/rtems/libio.h	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -70,5 +70,5 @@
  */
 typedef void (*rtems_filesystem_mt_entry_lock_t)(
-  rtems_filesystem_mount_table_entry_t *mt_entry
+  const rtems_filesystem_mount_table_entry_t *mt_entry
 );
 
@@ -81,5 +81,5 @@
  */
 typedef void (*rtems_filesystem_mt_entry_unlock_t)(
-  rtems_filesystem_mount_table_entry_t *mt_entry
+  const rtems_filesystem_mount_table_entry_t *mt_entry
 );
 
@@ -524,5 +524,5 @@
  */
 void rtems_filesystem_default_lock(
-  rtems_filesystem_mount_table_entry_t *mt_entry
+  const rtems_filesystem_mount_table_entry_t *mt_entry
 );
 
@@ -533,5 +533,5 @@
  */
 void rtems_filesystem_default_unlock(
-  rtems_filesystem_mount_table_entry_t *mt_entry
+  const rtems_filesystem_mount_table_entry_t *mt_entry
 );
 
@@ -787,4 +787,6 @@
  * @brief Reads from a node.
  *
+ * This handler is responsible to update the offset field of the IO descriptor.
+ *
  * @param[in, out] iop The IO pointer.
  * @param[out] buffer The buffer for read data.
@@ -805,4 +807,6 @@
  * @brief Writes to a node.
  *
+ * This handler is responsible to update the offset field of the IO descriptor.
+ *
  * @param[in, out] iop The IO pointer.
  * @param[out] buffer The buffer for write data.
@@ -833,7 +837,7 @@
  */
 typedef int (*rtems_filesystem_ioctl_t)(
-  rtems_libio_t *iop,
-  uint32_t       request,
-  void          *buffer
+  rtems_libio_t   *iop,
+  ioctl_command_t  request,
+  void            *buffer
 );
 
@@ -1009,7 +1013,7 @@
  */
 int rtems_filesystem_default_ioctl(
-  rtems_libio_t *iop,
-  uint32_t       command,
-  void          *buffer
+  rtems_libio_t   *iop,
+  ioctl_command_t  request,
+  void            *buffer
 );
 
@@ -1063,15 +1067,4 @@
   off_t offset,
   int whence
-);
-
-/**
- * @retval 0 Always.
- *
- * @see rtems_filesystem_lseek_t.
- */
-off_t rtems_filesystem_default_lseek_file(
-  rtems_libio_t *iop,
-  off_t          offset,
-  int            whence
 );
 
@@ -1237,5 +1230,5 @@
 typedef struct {
   rtems_libio_t          *iop;
-  uint32_t                command;
+  ioctl_command_t         command;
   void                   *buffer;
   int                     ioctl_return;
@@ -1439,4 +1432,7 @@
 struct rtems_filesystem_mount_table_entry_tt {
   rtems_chain_node                       mt_node;
+  void                                  *fs_info;
+  const rtems_filesystem_operations_table *ops;
+  const void                            *immutable_fs_info;
   rtems_chain_control                    location_chain;
   rtems_filesystem_global_location_t    *mt_point_node;
@@ -1444,6 +1440,4 @@
   bool                                   mounted;
   bool                                   writeable;
-  void                                  *fs_info;
-  const void                            *immutable_fs_info;
   rtems_filesystem_limits_and_options_t  pathconf_limits_and_options;
 
Index: cpukit/libcsupport/include/rtems/libio_.h
===================================================================
--- cpukit/libcsupport/include/rtems/libio_.h	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/include/rtems/libio_.h	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -251,5 +251,7 @@
 )
 {
-  (*loc->ops->lock_h)( loc->mt_entry );
+  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
+
+  (*mt_entry->ops->lock_h)( mt_entry );
 }
 
@@ -258,5 +260,7 @@
 )
 {
-  (*loc->ops->unlock_h)( loc->mt_entry );
+  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
+
+  (*mt_entry->ops->unlock_h)( mt_entry );
 }
 
@@ -583,7 +587,9 @@
 )
 {
-  return (*loc->ops->are_nodes_equal_h)(
+  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
+
+  return (*mt_entry->ops->are_nodes_equal_h)(
     loc,
-    &loc->mt_entry->mt_fs_root->location
+    &mt_entry->mt_fs_root->location
   );
 }
Index: cpukit/libcsupport/include/sys/ioccom.h
===================================================================
--- cpukit/libcsupport/include/sys/ioccom.h	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/include/sys/ioccom.h	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -107,12 +107,9 @@
 #define FIOGETOWN       _IOR('f', 123, int)     /* get owner */
 
+typedef uint32_t ioctl_command_t;
+
 #ifndef _KERNEL
 
 #include <sys/cdefs.h>
-
-#ifndef __ioctl_command_defined
-typedef u_int32_t ioctl_command_t;
-#define __ioctl_command_defined
-#endif
 
 __BEGIN_DECLS
Index: cpukit/libcsupport/preinstall.am
===================================================================
--- cpukit/libcsupport/preinstall.am	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/preinstall.am	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -72,4 +72,8 @@
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/assoc.h
 
+$(PROJECT_INCLUDE)/rtems/deviceio.h: include/rtems/deviceio.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/deviceio.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/deviceio.h
+
 $(PROJECT_INCLUDE)/rtems/error.h: include/rtems/error.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/error.h
Index: cpukit/libcsupport/src/__usrenv.c
===================================================================
--- cpukit/libcsupport/src/__usrenv.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/__usrenv.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -52,5 +52,5 @@
 
 static void null_op_lock_or_unlock(
-  rtems_filesystem_mount_table_entry_t *mt_entry
+  const rtems_filesystem_mount_table_entry_t *mt_entry
 )
 {
@@ -221,4 +221,5 @@
     }
   },
+  .ops = &null_ops,
   .mt_point_node = &rtems_filesystem_global_location_null,
   .mt_fs_root = &rtems_filesystem_global_location_null,
@@ -234,5 +235,4 @@
     },
     .handlers = &rtems_filesystem_null_handlers,
-    .ops = &null_ops,
     .mt_entry = &rtems_filesystem_null_mt_entry
   },
Index: cpukit/libcsupport/src/_rename_r.c
===================================================================
--- cpukit/libcsupport/src/_rename_r.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/_rename_r.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -58,5 +58,5 @@
   );
   if ( rv == 0 ) {
-    rv = (*new_currentloc->ops->rename_h)(
+    rv = (*new_currentloc->mt_entry->ops->rename_h)(
       &old_parentloc,
       old_currentloc,
Index: cpukit/libcsupport/src/chmod.c
===================================================================
--- cpukit/libcsupport/src/chmod.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/chmod.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -26,5 +26,5 @@
     rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
 
-  rv = (*currentloc->ops->fchmod_h)( currentloc, mode );
+  rv = (*currentloc->mt_entry->ops->fchmod_h)( currentloc, mode );
 
   rtems_filesystem_eval_path_cleanup( &ctx );
Index: cpukit/libcsupport/src/chown.c
===================================================================
--- cpukit/libcsupport/src/chown.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/chown.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -33,10 +33,7 @@
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
+  const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
 
-  rv = (*currentloc->ops->chown_h)(
-    currentloc,
-    owner,
-    group
-  );
+  rv = (*ops->chown_h)( currentloc, owner, group );
 
   rtems_filesystem_eval_path_cleanup( &ctx );
Index: cpukit/libcsupport/src/chroot.c
===================================================================
--- cpukit/libcsupport/src/chroot.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/chroot.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -50,5 +50,7 @@
       rtems_filesystem_global_location_obtain( &new_current_loc );
     rtems_filesystem_node_types_t type =
-      (*new_root_loc->location.ops->node_type_h)( &new_root_loc->location );
+      (*new_root_loc->location.mt_entry->ops->node_type_h)(
+        &new_root_loc->location
+      );
 
     if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
Index: cpukit/libcsupport/src/clonenode.c
===================================================================
--- cpukit/libcsupport/src/clonenode.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/clonenode.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -27,5 +27,5 @@
 
   clone = rtems_filesystem_location_copy( clone, master );
-  rv = (*clone->ops->clonenod_h)( clone );
+  rv = (*clone->mt_entry->ops->clonenod_h)( clone );
   if ( rv != 0 ) {
     rtems_filesystem_location_remove_from_mt_entry( clone );
Index: cpukit/libcsupport/src/fchmod.c
===================================================================
--- cpukit/libcsupport/src/fchmod.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/fchmod.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -29,5 +29,5 @@
   if (iop->pathinfo.mt_entry->writeable) {
     rtems_filesystem_instance_lock( &iop->pathinfo );
-    rv = (*iop->pathinfo.ops->fchmod_h)( &iop->pathinfo, mode );
+    rv = (*iop->pathinfo.mt_entry->ops->fchmod_h)( &iop->pathinfo, mode );
     rtems_filesystem_instance_unlock( &iop->pathinfo );
   } else {
Index: cpukit/libcsupport/src/fchown.c
===================================================================
--- cpukit/libcsupport/src/fchown.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/fchown.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -29,5 +29,9 @@
   if (iop->pathinfo.mt_entry->writeable) {
     rtems_filesystem_instance_lock( &iop->pathinfo );
-    rv = (*iop->pathinfo.ops->chown_h)( &iop->pathinfo, owner, group );
+    rv = (*iop->pathinfo.mt_entry->ops->chown_h)(
+      &iop->pathinfo,
+      owner,
+      group
+    );
     rtems_filesystem_instance_unlock( &iop->pathinfo );
   } else {
Index: cpukit/libcsupport/src/freenode.c
===================================================================
--- cpukit/libcsupport/src/freenode.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/freenode.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -22,5 +22,5 @@
 {
   rtems_filesystem_instance_lock( loc );
-  (*loc->ops->freenod_h)( loc );
+  (*loc->mt_entry->ops->freenod_h)( loc );
   rtems_filesystem_instance_unlock( loc );
   rtems_filesystem_location_remove_from_mt_entry( loc );
Index: cpukit/libcsupport/src/link.c
===================================================================
--- cpukit/libcsupport/src/link.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/link.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -37,5 +37,5 @@
   );
   if ( rv == 0 ) {
-    rv = (*currentloc_2->ops->link_h)(
+    rv = (*currentloc_2->mt_entry->ops->link_h)(
       currentloc_2,
       currentloc_1,
Index: cpukit/libcsupport/src/mknod.c
===================================================================
--- cpukit/libcsupport/src/mknod.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/mknod.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -48,5 +48,7 @@
   
   if ( rv == 0 ) {
-    rv = (*parentloc->ops->mknod_h)( parentloc, name, namelen, mode, dev );
+    const rtems_filesystem_operations_table *ops = parentloc->mt_entry->ops;
+
+    rv = (*ops->mknod_h)( parentloc, name, namelen, mode, dev );
   }
 
Index: cpukit/libcsupport/src/mount.c
===================================================================
--- cpukit/libcsupport/src/mount.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/mount.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -123,5 +123,5 @@
     mt_point_node = rtems_filesystem_location_transform_to_global( &targetloc );
     mt_entry->mt_point_node = mt_point_node;
-    rv = (*mt_point_node->location.ops->mount_h)( mt_entry );
+    rv = (*mt_point_node->location.mt_entry->ops->mount_h)( mt_entry );
     if ( rv == 0 ) {
       rtems_filesystem_mt_lock();
@@ -219,5 +219,5 @@
 
           if ( rv != 0 ) {
-            (*mt_entry->mt_fs_root->location.ops->fsunmount_me_h)( mt_entry );
+            (*mt_entry->ops->fsunmount_me_h)( mt_entry );
           }
         }
Index: cpukit/libcsupport/src/open.c
===================================================================
--- cpukit/libcsupport/src/open.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/open.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -86,5 +86,5 @@
       rtems_filesystem_eval_path_get_currentloc( &ctx );
     rtems_filesystem_node_types_t type =
-      (*currentloc->ops->node_type_h)( currentloc );
+      (*currentloc->mt_entry->ops->node_type_h)( currentloc );
 
     if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
Index: cpukit/libcsupport/src/read.c
===================================================================
--- cpukit/libcsupport/src/read.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/read.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -23,5 +23,4 @@
 )
 {
-  ssize_t      rc;
   rtems_libio_t *iop;
 
@@ -36,10 +35,5 @@
    *  Now process the read().
    */
-  rc = (*iop->pathinfo.handlers->read_h)( iop, buffer, count );
-
-  if ( rc > 0 )
-    iop->offset += rc;
-
-  return rc;
+  return (*iop->pathinfo.handlers->read_h)( iop, buffer, count );
 }
 
Index: cpukit/libcsupport/src/readlink.c
===================================================================
--- cpukit/libcsupport/src/readlink.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/readlink.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -25,9 +25,9 @@
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
-  rtems_filesystem_node_types_t type =
-    (*currentloc->ops->node_type_h)( currentloc );
+  const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
+  rtems_filesystem_node_types_t type = (*ops->node_type_h)( currentloc );
 
   if ( type == RTEMS_FILESYSTEM_SYM_LINK ) {
-    rv = (*currentloc->ops->readlink_h)( currentloc, buf, bufsize );
+    rv = (*ops->readlink_h)( currentloc, buf, bufsize );
   } else {
     rtems_filesystem_eval_path_error( &ctx, EINVAL );
Index: cpukit/libcsupport/src/readv.c
===================================================================
--- cpukit/libcsupport/src/readv.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/readv.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -107,5 +107,4 @@
 
     if ( bytes > 0 ) {
-      iop->offset += bytes;
       total       += bytes;
     }
Index: cpukit/libcsupport/src/rmdir.c
===================================================================
--- cpukit/libcsupport/src/rmdir.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/rmdir.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -35,12 +35,9 @@
       parent_eval_flags
     );
-  rtems_filesystem_node_types_t type =
-    (*currentloc->ops->node_type_h)( currentloc );
+  const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
+  rtems_filesystem_node_types_t type = (*ops->node_type_h)( currentloc );
 
   if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
-    rv = (*currentloc->ops->rmnod_h)(
-      &parentloc,
-      currentloc
-    );
+    rv = (*ops->rmnod_h)( &parentloc, currentloc );
   } else {
     rtems_filesystem_eval_path_error( &ctx, ENOTDIR );
Index: cpukit/libcsupport/src/statvfs.c
===================================================================
--- cpukit/libcsupport/src/statvfs.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/statvfs.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -30,5 +30,5 @@
   memset( buf, 0, sizeof( *buf ) );
 
-  rv = (*currentloc->ops->statvfs_h)( currentloc, buf );
+  rv = (*currentloc->mt_entry->ops->statvfs_h)( currentloc, buf );
 
   rtems_filesystem_eval_path_cleanup( &ctx );
Index: cpukit/libcsupport/src/sup_fs_deviceerrno.c
===================================================================
--- cpukit/libcsupport/src/sup_fs_deviceerrno.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
+++ cpukit/libcsupport/src/sup_fs_deviceerrno.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -0,0 +1,70 @@
+/*
+ *  IMFS Device Node Handlers
+ *
+ *  This file contains the set of handlers used to map operations on
+ *  IMFS device nodes onto calls to the RTEMS Classic API IO Manager.
+ *
+ *  COPYRIGHT (c) 1989-2008.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  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.
+ */
+
+#if HAVE_CONFIG_H
+  #include "config.h"
+#endif
+
+#include <rtems/deviceio.h>
+
+#include <errno.h>
+
+static const int status_code_to_errno [RTEMS_STATUS_CODES_LAST + 1] = {
+  [RTEMS_SUCCESSFUL]               = 0,
+  [RTEMS_TASK_EXITTED]             = EIO,
+  [RTEMS_MP_NOT_CONFIGURED]        = EIO,
+  [RTEMS_INVALID_NAME]             = EINVAL,
+  [RTEMS_INVALID_ID]               = EIO,
+  [RTEMS_TOO_MANY]                 = EIO,
+  [RTEMS_TIMEOUT]                  = ETIMEDOUT,
+  [RTEMS_OBJECT_WAS_DELETED]       = EIO,
+  [RTEMS_INVALID_SIZE]             = EIO,
+  [RTEMS_INVALID_ADDRESS]          = EIO,
+  [RTEMS_INVALID_NUMBER]           = EBADF,
+  [RTEMS_NOT_DEFINED]              = EIO,
+  [RTEMS_RESOURCE_IN_USE]          = EBUSY,
+  [RTEMS_UNSATISFIED]              = ENODEV,
+  [RTEMS_INCORRECT_STATE]          = EIO,
+  [RTEMS_ALREADY_SUSPENDED]        = EIO,
+  [RTEMS_ILLEGAL_ON_SELF]          = EIO,
+  [RTEMS_ILLEGAL_ON_REMOTE_OBJECT] = EIO,
+  [RTEMS_CALLED_FROM_ISR]          = EIO,
+  [RTEMS_INVALID_PRIORITY]         = EIO,
+  [RTEMS_INVALID_CLOCK]            = EINVAL,
+  [RTEMS_INVALID_NODE]             = EINVAL,
+  [RTEMS_NOT_CONFIGURED]           = ENOSYS,
+  [RTEMS_NOT_OWNER_OF_RESOURCE]    = EPERM,
+  [RTEMS_NOT_IMPLEMENTED]          = ENOSYS,
+  [RTEMS_INTERNAL_ERROR]           = EIO,
+  [RTEMS_NO_MEMORY]                = ENOMEM,
+  [RTEMS_IO_ERROR]                 = EIO,
+  [RTEMS_PROXY_BLOCKING]           = EIO
+};
+
+int rtems_deviceio_errno(rtems_status_code sc)
+{
+  if (sc == RTEMS_SUCCESSFUL) {
+    return 0;
+  } else {
+    int eno = EINVAL;
+
+    if ((unsigned) sc <= RTEMS_STATUS_CODES_LAST) {
+      eno = status_code_to_errno [sc];
+    }
+
+    errno = eno;
+
+    return -1;
+  }
+}
Index: cpukit/libcsupport/src/sup_fs_deviceio.c
===================================================================
--- cpukit/libcsupport/src/sup_fs_deviceio.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
+++ cpukit/libcsupport/src/sup_fs_deviceio.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -0,0 +1,132 @@
+/*
+ *  COPYRIGHT (c) 1989-2012.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  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.
+ */
+
+#if HAVE_CONFIG_H
+  #include "config.h"
+#endif
+
+#include <rtems/deviceio.h>
+
+int rtems_deviceio_open(
+  rtems_libio_t *iop,
+  const char *path,
+  int oflag,
+  mode_t mode,
+  rtems_device_major_number major,
+  rtems_device_minor_number minor
+)
+{
+  rtems_status_code status;
+  rtems_libio_open_close_args_t args;
+
+  args.iop = iop;
+  args.flags = iop->flags;
+  args.mode = mode;
+
+  status = rtems_io_open( major, minor, &args );
+
+  return rtems_deviceio_errno( status );
+}
+
+int rtems_deviceio_close(
+  rtems_libio_t *iop,
+  rtems_device_major_number major,
+  rtems_device_minor_number minor
+)
+{
+  rtems_status_code status;
+  rtems_libio_open_close_args_t args;
+
+  args.iop = iop;
+  args.flags = 0;
+  args.mode = 0;
+
+  status = rtems_io_close( major, minor, &args );
+
+  return rtems_deviceio_errno( status );
+}
+
+ssize_t rtems_deviceio_read(
+  rtems_libio_t *iop,
+  void *buf,
+  size_t nbyte,
+  rtems_device_major_number major,
+  rtems_device_minor_number minor
+)
+{
+  rtems_status_code status;
+  rtems_libio_rw_args_t args;
+
+  args.iop = iop;
+  args.offset = iop->offset;
+  args.buffer = buf;
+  args.count = nbyte;
+  args.flags = iop->flags;
+  args.bytes_moved = 0;
+
+  status = rtems_io_read( major, minor, &args );
+  if ( status == RTEMS_SUCCESSFUL ) {
+    iop->offset += args.bytes_moved;
+
+    return (ssize_t) args.bytes_moved;
+  } else {
+    return rtems_deviceio_errno( status );
+  }
+}
+
+ssize_t rtems_deviceio_write(
+  rtems_libio_t *iop,
+  const void *buf,
+  size_t nbyte,
+  rtems_device_major_number major,
+  rtems_device_minor_number minor
+)
+{
+  rtems_status_code status;
+  rtems_libio_rw_args_t args;
+
+  args.iop = iop;
+  args.offset = iop->offset;
+  args.buffer = buf;
+  args.count = nbyte;
+  args.flags = iop->flags;
+  args.bytes_moved = 0;
+
+  status = rtems_io_write( major, minor, &args );
+  if ( status == RTEMS_SUCCESSFUL ) {
+    iop->offset += args.bytes_moved;
+
+    return (ssize_t) args.bytes_moved;
+  } else {
+    return rtems_deviceio_errno( status );
+  }
+}
+
+int rtems_deviceio_control(
+  rtems_libio_t *iop,
+  ioctl_command_t command,
+  void *buffer,
+  rtems_device_major_number major,
+  rtems_device_minor_number minor
+)
+{
+  rtems_status_code status;
+  rtems_libio_ioctl_args_t args;
+
+  args.iop = iop;
+  args.command = command;
+  args.buffer = buffer;
+
+  status = rtems_io_control( major, minor, &args );
+  if ( status == RTEMS_SUCCESSFUL ) {
+    return args.ioctl_return;
+  } else {
+    return rtems_deviceio_errno(status);
+  }
+}
Index: cpukit/libcsupport/src/sup_fs_eval_path.c
===================================================================
--- cpukit/libcsupport/src/sup_fs_eval_path.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/sup_fs_eval_path.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -105,5 +105,5 @@
 
   while (ctx->pathlen > 0) {
-    (*ctx->currentloc.ops->eval_path_h)(ctx);
+    (*ctx->currentloc.mt_entry->ops->eval_path_h)(ctx);
   }
 
@@ -261,5 +261,5 @@
       ++ctx->recursionlevel;
       while (ctx->pathlen > 0) {
-        (*ctx->currentloc.ops->eval_path_h)(ctx);
+        (*ctx->currentloc.mt_entry->ops->eval_path_h)(ctx);
       }
       --ctx->recursionlevel;
@@ -298,5 +298,5 @@
   rtems_filesystem_mt_entry_declare_lock_context(lock_context);
 
-  (*loc->ops->freenod_h)(loc);
+  (*loc->mt_entry->ops->freenod_h)(loc);
 
   rtems_filesystem_mt_entry_lock(lock_context);
Index: cpukit/libcsupport/src/sup_fs_eval_path_generic.c
===================================================================
--- cpukit/libcsupport/src/sup_fs_eval_path_generic.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/sup_fs_eval_path_generic.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -21,8 +21,9 @@
 static bool is_fs_root( const rtems_filesystem_location_info_t *loc )
 {
+  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
   const rtems_filesystem_location_info_t *mt_fs_root =
-    &loc->mt_entry->mt_fs_root->location;
+    &mt_entry->mt_fs_root->location;
 
-  return (*loc->ops->are_nodes_equal_h)( loc, mt_fs_root );
+  return (*mt_entry->ops->are_nodes_equal_h)( loc, mt_fs_root );
 }
 
@@ -32,8 +33,9 @@
 )
 {
+  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
   const rtems_filesystem_location_info_t *rootloc = &ctx->rootloc->location;
 
-  return loc->mt_entry == rootloc->mt_entry
-    && (*loc->ops->are_nodes_equal_h)( loc, rootloc );
+  return mt_entry == rootloc->mt_entry
+    && (*mt_entry->ops->are_nodes_equal_h)( loc, rootloc );
 }
 
Index: cpukit/libcsupport/src/sup_fs_location.c
===================================================================
--- cpukit/libcsupport/src/sup_fs_location.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/sup_fs_location.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -34,5 +34,4 @@
   dst->node_access_2 = src->node_access_2;
   dst->handlers = src->handlers;
-  dst->ops = src->ops;
   dst->mt_entry = src->mt_entry;
   rtems_filesystem_location_add_to_mt_entry(dst);
@@ -214,5 +213,5 @@
   rtems_filesystem_mt_unlock();
   rtems_filesystem_global_location_release(mt_entry->mt_point_node);
-  (*mt_entry->mt_fs_root->location.ops->fsunmount_me_h)(mt_entry);
+  (*mt_entry->ops->fsunmount_me_h)(mt_entry);
   free(mt_entry);
 }
Index: cpukit/libcsupport/src/sup_fs_node_type.c
===================================================================
--- cpukit/libcsupport/src/sup_fs_node_type.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/sup_fs_node_type.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -26,5 +26,5 @@
 
   rtems_filesystem_instance_lock(loc);
-  type = (*loc->ops->node_type_h)(loc);
+  type = (*loc->mt_entry->ops->node_type_h)(loc);
   rtems_filesystem_instance_unlock(loc);
 
Index: cpukit/libcsupport/src/symlink.c
===================================================================
--- cpukit/libcsupport/src/symlink.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/symlink.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -28,5 +28,5 @@
     rtems_filesystem_eval_path_start( &ctx, path2, eval_flags );
 
-  rv = (*currentloc->ops->symlink_h)(
+  rv = (*currentloc->mt_entry->ops->symlink_h)(
     currentloc,
     rtems_filesystem_eval_path_get_token( &ctx ),
Index: cpukit/libcsupport/src/unlink.c
===================================================================
--- cpukit/libcsupport/src/unlink.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/unlink.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -35,9 +35,7 @@
       parent_eval_flags
     );
+  const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
 
-  rv = (*currentloc->ops->rmnod_h)(
-    &parentloc,
-    currentloc
-  );
+  rv = (*ops->rmnod_h)( &parentloc, currentloc );
 
   rtems_filesystem_eval_path_cleanup_with_parent( &ctx, &parentloc );
Index: cpukit/libcsupport/src/unmount.c
===================================================================
--- cpukit/libcsupport/src/unmount.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/unmount.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -33,5 +33,8 @@
 
   if ( rtems_filesystem_location_is_root( currentloc ) ) {
-    rv = (*mt_entry->mt_point_node->location.ops->unmount_h)( mt_entry );
+    const rtems_filesystem_operations_table *mt_point_ops =
+      mt_entry->mt_point_node->location.mt_entry->ops;
+
+    rv = (*mt_point_ops->unmount_h)( mt_entry );
     if ( rv == 0 ) {
       rtems_filesystem_mt_entry_declare_lock_context( lock_context );
Index: cpukit/libcsupport/src/utime.c
===================================================================
--- cpukit/libcsupport/src/utime.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/utime.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -39,5 +39,5 @@
   }
 
-  rv = (*currentloc->ops->utime_h)(
+  rv = (*currentloc->mt_entry->ops->utime_h)(
     currentloc,
     times->actime,
Index: cpukit/libcsupport/src/write.c
===================================================================
--- cpukit/libcsupport/src/write.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/write.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -30,5 +30,4 @@
 )
 {
-  ssize_t  rc;
   rtems_libio_t     *iop;
 
@@ -43,9 +42,4 @@
    *  Now process the write() request.
    */
-  rc = (*iop->pathinfo.handlers->write_h)( iop, buffer, count );
-
-  if ( rc > 0 )
-    iop->offset += rc;
-
-  return rc;
+  return (*iop->pathinfo.handlers->write_h)( iop, buffer, count );
 }
Index: cpukit/libcsupport/src/writev.c
===================================================================
--- cpukit/libcsupport/src/writev.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libcsupport/src/writev.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -114,5 +114,4 @@
 
     if ( bytes > 0 ) {
-      iop->offset += bytes;
       total       += bytes;
     }
Index: cpukit/libfs/Makefile.am
===================================================================
--- cpukit/libfs/Makefile.am	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/Makefile.am	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -38,5 +38,5 @@
 libimfs_a_SOURCES =
 
-libimfs_a_SOURCES += src/imfs/deviceerrno.c src/imfs/deviceio.c \
+libimfs_a_SOURCES += src/imfs/deviceio.c \
     src/imfs/fifoimfs_init.c src/imfs/imfs_chown.c src/imfs/imfs_config.c \
     src/imfs/imfs_creat.c src/imfs/imfs_debug.c src/imfs/imfs_directory.c \
Index: cpukit/libfs/src/defaults/default_ioctl.c
===================================================================
--- cpukit/libfs/src/defaults/default_ioctl.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/defaults/default_ioctl.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -8,12 +8,14 @@
  */
 
-#include <rtems/libio.h>
+#if HAVE_CONFIG_H
+  #include "config.h"
+#endif
+
 #include <rtems/libio_.h>
-#include <rtems/seterr.h>
 
 int rtems_filesystem_default_ioctl(
-  rtems_libio_t *iop,
-  uint32_t       command,
-  void          *buffer
+  rtems_libio_t   *iop,
+  ioctl_command_t  request,
+  void            *buffer
 )
 {
Index: cpukit/libfs/src/defaults/default_lock_and_unlock.c
===================================================================
--- cpukit/libfs/src/defaults/default_lock_and_unlock.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/defaults/default_lock_and_unlock.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -20,5 +20,5 @@
 
 void rtems_filesystem_default_lock(
-  rtems_filesystem_mount_table_entry_t *mt_entry
+  const rtems_filesystem_mount_table_entry_t *mt_entry
 )
 {
@@ -27,5 +27,5 @@
 
 void rtems_filesystem_default_unlock(
-  rtems_filesystem_mount_table_entry_t *mt_entry
+  const rtems_filesystem_mount_table_entry_t *mt_entry
 )
 {
Index: cpukit/libfs/src/devfs/devclose.c
===================================================================
--- cpukit/libfs/src/devfs/devclose.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/devfs/devclose.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -6,11 +6,10 @@
 
 #if HAVE_CONFIG_H
-#include "config.h"
+  #include "config.h"
 #endif
 
-#include <rtems.h>
-#include <rtems/io.h>
+#include "devfs.h"
 
-#include "devfs.h"
+#include <rtems/deviceio.h>
 
 int devFS_close(
@@ -18,20 +17,6 @@
 )
 {
-  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 );
 }
-
-
Index: cpukit/libfs/src/devfs/devfs.h
===================================================================
--- cpukit/libfs/src/devfs/devfs.h	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/devfs/devfs.h	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -50,15 +50,9 @@
 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
 )
 {
-  return loc->mt_entry->immutable_fs_info;
+  return (const devFS_data *) loc->mt_entry->immutable_fs_info;
 }
 
@@ -138,7 +132,7 @@
 
 extern int devFS_ioctl(
-  rtems_libio_t *iop,
-  uint32_t       command,
-  void          *buffer
+  rtems_libio_t   *iop,
+  ioctl_command_t  command,
+  void            *buffer
 );
 
Index: cpukit/libfs/src/devfs/devfs_init.c
===================================================================
--- cpukit/libfs/src/devfs/devfs_init.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/devfs/devfs_init.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -57,7 +57,7 @@
 
   if (data != NULL) {
+    mt_entry->ops = &devFS_ops;
     mt_entry->immutable_fs_info = data;
     mt_entry->mt_fs_root->location.handlers = &devFS_file_handlers;
-    mt_entry->mt_fs_root->location.ops = &devFS_ops;
   } else {
     errno = EINVAL;
Index: cpukit/libfs/src/devfs/devfs_show.c
===================================================================
--- cpukit/libfs/src/devfs/devfs_show.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/devfs/devfs_show.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -15,5 +15,5 @@
   rtems_filesystem_location_info_t *rootloc = &rtems_filesystem_root->location;
 
-  if (rootloc->ops == &devFS_ops) {
+  if (rootloc->mt_entry->ops == &devFS_ops) {
     const devFS_data *data = devFS_get_data(rootloc);
     size_t i = 0;
Index: cpukit/libfs/src/devfs/devioctl.c
===================================================================
--- cpukit/libfs/src/devfs/devioctl.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/devfs/devioctl.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -1,3 +1,2 @@
-#if HAVE_CONFIG_H
 /*
  *  The license and distribution terms for this file may be
@@ -6,36 +5,20 @@
  */
 
-#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,
-  uint32_t       command,
-  void          *buffer
+  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 );
 }
-
Index: cpukit/libfs/src/devfs/devopen.c
===================================================================
--- cpukit/libfs/src/devfs/devopen.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/devfs/devopen.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -6,11 +6,10 @@
 
 #if HAVE_CONFIG_H
-#include "config.h"
+  #include "config.h"
 #endif
 
-#include <rtems.h>
-#include <rtems/io.h>
+#include "devfs.h"
 
-#include "devfs.h"
+#include <rtems/deviceio.h>
 
 int devFS_open(
@@ -21,18 +20,13 @@
 )
 {
-  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);
 }
Index: cpukit/libfs/src/devfs/devread.c
===================================================================
--- cpukit/libfs/src/devfs/devread.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/devfs/devread.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -6,11 +6,10 @@
 
 #if HAVE_CONFIG_H
-#include "config.h"
+  #include "config.h"
 #endif
 
-#include <rtems.h>
-#include <rtems/io.h>
+#include "devfs.h"
 
-#include "devfs.h"
+#include <rtems/deviceio.h>
 
 ssize_t devFS_read(
@@ -20,25 +19,6 @@
 )
 {
-  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 );
 }
-
Index: cpukit/libfs/src/devfs/devwrite.c
===================================================================
--- cpukit/libfs/src/devfs/devwrite.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/devfs/devwrite.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -6,11 +6,10 @@
 
 #if HAVE_CONFIG_H
-#include "config.h"
+  #include "config.h"
 #endif
 
-#include <rtems.h>
-#include <rtems/io.h>
+#include "devfs.h"
 
-#include "devfs.h"
+#include <rtems/deviceio.h>
 
 ssize_t devFS_write(
@@ -20,25 +19,6 @@
 )
 {
-  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 );
 }
-
Index: cpukit/libfs/src/dosfs/msdos.h
===================================================================
--- cpukit/libfs/src/dosfs/msdos.h	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/dosfs/msdos.h	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -253,7 +253,7 @@
 );
 
-void msdos_lock(rtems_filesystem_mount_table_entry_t *mt_entry);
-
-void msdos_unlock(rtems_filesystem_mount_table_entry_t *mt_entry);
+void msdos_lock(const rtems_filesystem_mount_table_entry_t *mt_entry);
+
+void msdos_unlock(const rtems_filesystem_mount_table_entry_t *mt_entry);
 
 int msdos_initialize_support(
Index: cpukit/libfs/src/dosfs/msdos_file.c
===================================================================
--- cpukit/libfs/src/dosfs/msdos_file.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/dosfs/msdos_file.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -118,4 +118,6 @@
     ret = fat_file_read(iop->pathinfo.mt_entry, fat_fd, iop->offset, count,
                         buffer);
+    if (ret > 0)
+        iop->offset += ret;
 
     rtems_semaphore_release(fs_info->vol_sema);
@@ -164,6 +166,7 @@
      * file was extended
      */
-    if (iop->offset + ret > fat_fd->fat_file_size)
-        fat_fd->fat_file_size = iop->offset + ret;
+    iop->offset += ret;
+    if (iop->offset > fat_fd->fat_file_size)
+        fat_fd->fat_file_size = iop->offset;
 
     rtems_semaphore_release(fs_info->vol_sema);
@@ -274,5 +277,4 @@
     int                rc = RC_OK;
     rtems_status_code  sc = RTEMS_SUCCESSFUL;
-    fat_file_fd_t     *fat_fd = iop->pathinfo.node_access;
     msdos_fs_info_t   *fs_info = iop->pathinfo.mt_entry->fs_info;
 
Index: cpukit/libfs/src/dosfs/msdos_init.c
===================================================================
--- cpukit/libfs/src/dosfs/msdos_init.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/dosfs/msdos_init.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -52,5 +52,5 @@
 };
 
-void msdos_lock(rtems_filesystem_mount_table_entry_t *mt_entry)
+void msdos_lock(const rtems_filesystem_mount_table_entry_t *mt_entry)
 {
   msdos_fs_info_t *fs_info = mt_entry->fs_info;
@@ -65,5 +65,5 @@
 }
 
-void msdos_unlock(rtems_filesystem_mount_table_entry_t *mt_entry)
+void msdos_unlock(const rtems_filesystem_mount_table_entry_t *mt_entry)
 {
   msdos_fs_info_t *fs_info = mt_entry->fs_info;
Index: cpukit/libfs/src/dosfs/msdos_initsupp.c
===================================================================
--- cpukit/libfs/src/dosfs/msdos_initsupp.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/dosfs/msdos_initsupp.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -142,5 +142,5 @@
     temp_mt_entry->mt_fs_root->location.node_access = fat_fd;
     temp_mt_entry->mt_fs_root->location.handlers = directory_handlers;
-    temp_mt_entry->mt_fs_root->location.ops = op_table;
+    temp_mt_entry->ops = op_table;
 
     return rc;
Index: ukit/libfs/src/imfs/deviceerrno.c
===================================================================
--- cpukit/libfs/src/imfs/deviceerrno.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- *  IMFS Device Node Handlers
- *
- *  This file contains the set of handlers used to map operations on
- *  IMFS device nodes onto calls to the RTEMS Classic API IO Manager.
- *
- *  COPYRIGHT (c) 1989-2008.
- *  On-Line Applications Research Corporation (OAR).
- *
- *  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.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <errno.h>
-
-#include <rtems.h>
-#include <rtems/libio.h>
-#include <rtems/devfs.h>
-
-static const int status_code_to_errno [RTEMS_STATUS_CODES_LAST + 1] = {
-  [RTEMS_SUCCESSFUL]               = 0,
-  [RTEMS_TASK_EXITTED]             = EIO,
-  [RTEMS_MP_NOT_CONFIGURED]        = EIO,
-  [RTEMS_INVALID_NAME]             = EINVAL,
-  [RTEMS_INVALID_ID]               = EIO,
-  [RTEMS_TOO_MANY]                 = EIO,
-  [RTEMS_TIMEOUT]                  = ETIMEDOUT,
-  [RTEMS_OBJECT_WAS_DELETED]       = EIO,
-  [RTEMS_INVALID_SIZE]             = EIO,
-  [RTEMS_INVALID_ADDRESS]          = EIO,
-  [RTEMS_INVALID_NUMBER]           = EBADF,
-  [RTEMS_NOT_DEFINED]              = EIO,
-  [RTEMS_RESOURCE_IN_USE]          = EBUSY,
-  [RTEMS_UNSATISFIED]              = ENODEV,
-  [RTEMS_INCORRECT_STATE]          = EIO,
-  [RTEMS_ALREADY_SUSPENDED]        = EIO,
-  [RTEMS_ILLEGAL_ON_SELF]          = EIO,
-  [RTEMS_ILLEGAL_ON_REMOTE_OBJECT] = EIO,
-  [RTEMS_CALLED_FROM_ISR]          = EIO,
-  [RTEMS_INVALID_PRIORITY]         = EIO,
-  [RTEMS_INVALID_CLOCK]            = EINVAL,
-  [RTEMS_INVALID_NODE]             = EINVAL,
-  [RTEMS_NOT_CONFIGURED]           = ENOSYS,
-  [RTEMS_NOT_OWNER_OF_RESOURCE]    = EPERM,
-  [RTEMS_NOT_IMPLEMENTED]          = ENOSYS,
-  [RTEMS_INTERNAL_ERROR]           = EIO,
-  [RTEMS_NO_MEMORY]                = ENOMEM,
-  [RTEMS_IO_ERROR]                 = EIO,
-  [RTEMS_PROXY_BLOCKING]           = EIO
-};
-
-int rtems_deviceio_errno(rtems_status_code sc)
-{
-  if (sc == RTEMS_SUCCESSFUL) {
-    return 0;
-  } else {
-    int eno = EINVAL;
-
-    if ((unsigned) sc <= RTEMS_STATUS_CODES_LAST) {
-      eno = status_code_to_errno [sc];
-    }
-
-    errno = eno;
-
-    return -1;
-  }
-}
Index: cpukit/libfs/src/imfs/deviceio.c
===================================================================
--- cpukit/libfs/src/imfs/deviceio.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/imfs/deviceio.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -5,5 +5,5 @@
  *  IMFS device nodes onto calls to the RTEMS Classic API IO Manager.
  *
- *  COPYRIGHT (c) 1989-2008.
+ *  COPYRIGHT (c) 1989-2012.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -19,11 +19,5 @@
 #include "imfs.h"
 
-#include <rtems/devfs.h>
-
-/*
- *  device_open
- *
- *  This handler maps an open() operation onto rtems_io_open().
- */
+#include <rtems/deviceio.h>
 
 int device_open(
@@ -34,28 +28,17 @@
 )
 {
-  rtems_libio_open_close_args_t  args;
-  rtems_status_code              status;
   IMFS_jnode_t                  *the_jnode;
 
   the_jnode  = 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,
     the_jnode->info.device.major,
-    the_jnode->info.device.minor,
-    (void *) &args
+    the_jnode->info.device.minor
   );
-
-  return rtems_deviceio_errno( status );
 }
-
-/*
- *  device_close
- *
- *  This handler maps a close() operation onto rtems_io_close().
- */
 
 int device_close(
@@ -63,28 +46,14 @@
 )
 {
-  rtems_libio_open_close_args_t  args;
-  rtems_status_code              status;
   IMFS_jnode_t                  *the_jnode;
 
   the_jnode = iop->pathinfo.node_access;
 
-  args.iop   = iop;
-  args.flags = 0;
-  args.mode  = 0;
-
-  status = rtems_io_close(
+  return rtems_deviceio_close(
+    iop,
     the_jnode->info.device.major,
-    the_jnode->info.device.minor,
-    (void *) &args
+    the_jnode->info.device.minor
   );
-
-  return rtems_deviceio_errno( status );
 }
-
-/*
- *  device_read
- *
- *  This handler maps a read() operation onto rtems_io_read().
- */
 
 ssize_t device_read(
@@ -94,34 +63,16 @@
 )
 {
-  rtems_libio_rw_args_t   args;
-  rtems_status_code       status;
   IMFS_jnode_t           *the_jnode;
 
   the_jnode = 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(
+  return rtems_deviceio_read(
+    iop,
+    buffer,
+    count,
     the_jnode->info.device.major,
-    the_jnode->info.device.minor,
-    (void *) &args
+    the_jnode->info.device.minor
   );
-
-  if ( status )
-    return rtems_deviceio_errno(status);
-
-  return (ssize_t) args.bytes_moved;
 }
-
-/*
- *  device_write
- *
- *  This handler maps a write() operation onto rtems_io_write().
- */
 
 ssize_t device_write(
@@ -131,74 +82,35 @@
 )
 {
-  rtems_libio_rw_args_t   args;
-  rtems_status_code       status;
   IMFS_jnode_t           *the_jnode;
 
   the_jnode = 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(
+  return rtems_deviceio_write(
+    iop,
+    buffer,
+    count,
     the_jnode->info.device.major,
-    the_jnode->info.device.minor,
-    (void *) &args
+    the_jnode->info.device.minor
   );
-
-  if ( status )
-    return rtems_deviceio_errno(status);
-
-  return (ssize_t) args.bytes_moved;
 }
 
-/*
- *  device_ioctl
- *
- *  This handler maps an ioctl() operation onto rtems_io_ioctl().
- */
-
 int device_ioctl(
-  rtems_libio_t *iop,
-  uint32_t       command,
-  void          *buffer
+  rtems_libio_t   *iop,
+  ioctl_command_t  command,
+  void            *buffer
 )
 {
-  rtems_libio_ioctl_args_t  args;
-  rtems_status_code         status;
   IMFS_jnode_t             *the_jnode;
-
-  args.iop     = iop;
-  args.command = command;
-  args.buffer  = buffer;
 
   the_jnode = iop->pathinfo.node_access;
 
-  status = rtems_io_control(
+  return rtems_deviceio_control(
+    iop,
+    command,
+    buffer,
     the_jnode->info.device.major,
-    the_jnode->info.device.minor,
-    (void *) &args
+    the_jnode->info.device.minor
   );
-
-  if ( status )
-    return rtems_deviceio_errno(status);
-
-  return args.ioctl_return;
 }
-
-/*
- *  device_stat
- *
- *  The IMFS_stat() is used.
- */
-
-/*
- *  device_rmnod
- *
- *  The IMFS_rmnod() is used.
- */
 
 int device_ftruncate(
Index: cpukit/libfs/src/imfs/imfs.h
===================================================================
--- cpukit/libfs/src/imfs/imfs.h	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/imfs/imfs.h	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -436,10 +436,4 @@
 );
 
-extern int memfile_ioctl(
-  rtems_libio_t *iop,             /* IN  */
-  uint32_t       command,         /* IN  */
-  void          *buffer           /* IN  */
-);
-
 extern int device_open(
   rtems_libio_t *iop,            /* IN  */
@@ -466,7 +460,7 @@
 
 extern int device_ioctl(
-  rtems_libio_t *iop,               /* IN  */
-  uint32_t       command,           /* IN  */
-  void          *buffer             /* IN  */
+  rtems_libio_t   *iop,
+  ioctl_command_t  command,
+  void            *buffer
 );
 
Index: cpukit/libfs/src/imfs/imfs_fifo.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_fifo.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/imfs/imfs_fifo.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -84,7 +84,7 @@
 
 static int IMFS_fifo_ioctl(
-  rtems_libio_t *iop,
-  uint32_t       command,
-  void          *buffer
+  rtems_libio_t   *iop,
+  ioctl_command_t  command,
+  void            *buffer
 )
 {
Index: cpukit/libfs/src/imfs/imfs_handlers_memfile.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_handlers_memfile.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/imfs/imfs_handlers_memfile.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -34,5 +34,5 @@
   memfile_read,
   memfile_write,
-  memfile_ioctl,
+  rtems_filesystem_default_ioctl,
   rtems_filesystem_default_lseek_file,
   IMFS_stat_file,
Index: cpukit/libfs/src/imfs/imfs_initsupp.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_initsupp.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/imfs/imfs_initsupp.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -80,7 +80,7 @@
     if ( root_node != NULL ) {
       mt_entry->fs_info = fs_info;
+      mt_entry->ops = op_table;
       mt_entry->pathconf_limits_and_options = IMFS_LIMITS_AND_OPTIONS;
       mt_entry->mt_fs_root->location.node_access = root_node;
-      mt_entry->mt_fs_root->location.ops = op_table;
       IMFS_Set_handlers( &mt_entry->mt_fs_root->location );
     } else {
Index: cpukit/libfs/src/imfs/imfs_load_tar.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_load_tar.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/imfs/imfs_load_tar.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -102,5 +102,9 @@
      RTEMS_FS_MAKE | RTEMS_FS_EXCLUSIVE
    );
-   if (rootloc.ops != &IMFS_ops && rootloc.ops != &fifoIMFS_ops) {
+
+   if (
+     rootloc.mt_entry->ops != &IMFS_ops
+       && rootloc.mt_entry->ops != &fifoIMFS_ops
+   ) {
      rv = -1;
    }
Index: cpukit/libfs/src/imfs/memfile.c
===================================================================
--- cpukit/libfs/src/imfs/memfile.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/imfs/memfile.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -122,8 +122,14 @@
 {
   IMFS_jnode_t   *the_jnode;
+  ssize_t         status;
 
   the_jnode = iop->pathinfo.node_access;
 
-  return IMFS_memfile_read( the_jnode, iop->offset, buffer, count );
+  status = IMFS_memfile_read( the_jnode, iop->offset, buffer, count );
+
+  if ( status > 0 )
+    iop->offset += status;
+
+  return status;
 }
 
@@ -149,21 +155,8 @@
   status = IMFS_memfile_write( the_jnode, iop->offset, buffer, count );
 
+  if ( status > 0 )
+    iop->offset += status;
+
   return status;
-}
-
-/*
- *  memfile_ioctl
- *
- *  This routine processes the ioctl() system call.
- *
- *  NOTE:  No ioctl()'s are supported for in-memory files.
- */
-int memfile_ioctl(
-  rtems_libio_t *iop,
-  uint32_t       command,
-  void          *buffer
-)
-{
-  return 0;
 }
 
Index: cpukit/libfs/src/nfsclient/src/nfs.c
===================================================================
--- cpukit/libfs/src/nfsclient/src/nfs.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/nfsclient/src/nfs.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -1754,5 +1754,5 @@
 	rootNode = 0;
 
-	mt_entry->mt_fs_root->location.ops		 = &nfs_fs_ops;
+	mt_entry->ops = &nfs_fs_ops;
 	mt_entry->mt_fs_root->location.handlers	 = &nfs_dir_file_handlers;
 	mt_entry->pathconf_limits_and_options = nfs_limits_and_options;
@@ -2087,9 +2087,9 @@
 }
 
-static void nfs_lock(rtems_filesystem_mount_table_entry_t *mt_entry)
-{
-}
-
-static void nfs_unlock(rtems_filesystem_mount_table_entry_t *mt_entry)
+static void nfs_lock(const rtems_filesystem_mount_table_entry_t *mt_entry)
+{
+}
+
+static void nfs_unlock(const rtems_filesystem_mount_table_entry_t *mt_entry)
 {
 }
@@ -2312,4 +2312,8 @@
 	} while (count > 0);
 
+	if (rv > 0) {
+		iop->offset = offset;
+	}
+
 	return rv;
 }
@@ -2419,4 +2423,6 @@
 
 	node->age = nowSeconds();
+
+	iop->offset += count;
 
 	return count;
Index: cpukit/libfs/src/pipe/fifo.c
===================================================================
--- cpukit/libfs/src/pipe/fifo.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/pipe/fifo.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -613,8 +613,8 @@
  */
 int pipe_ioctl(
-  pipe_control_t *pipe,
-  uint32_t        cmd,
-  void           *buffer,
-  rtems_libio_t  *iop
+  pipe_control_t  *pipe,
+  ioctl_command_t  cmd,
+  void            *buffer,
+  rtems_libio_t   *iop
 )
 {
Index: cpukit/libfs/src/pipe/pipe.h
===================================================================
--- cpukit/libfs/src/pipe/pipe.h	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/pipe/pipe.h	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -99,8 +99,8 @@
  */
 extern int pipe_ioctl(
-  pipe_control_t *pipe,
-  uint32_t        cmd,
-  void           *buffer,
-  rtems_libio_t  *iop
+  pipe_control_t  *pipe,
+  ioctl_command_t  cmd,
+  void            *buffer,
+  rtems_libio_t   *iop
 );
 
Index: cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c
===================================================================
--- cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -19,9 +19,19 @@
 
 #if HAVE_CONFIG_H
-#include "config.h"
+  #include "config.h"
 #endif
 
-#include <rtems/devfs.h>
 #include "rtems-rfs-rtems.h"
+
+#include <rtems/deviceio.h>
+
+static void
+rtems_rfs_rtems_device_get_major_and_minor ( const rtems_libio_t       *iop,
+                                             rtems_device_major_number *major,
+                                             rtems_device_minor_number *minor)
+{
+  *major = iop->data0;
+  *minor = (rtems_device_minor_number) iop->data1;
+}
 
 /**
@@ -40,11 +50,9 @@
                               mode_t         mode)
 {
-  rtems_libio_open_close_args_t args;
   rtems_rfs_file_system*        fs = rtems_rfs_rtems_pathloc_dev (&iop->pathinfo);
   rtems_rfs_ino                 ino = rtems_rfs_rtems_get_iop_ino (iop);
   rtems_rfs_inode_handle        inode;
-  int                           major;
-  int                           minor;
-  rtems_status_code             status;
+  rtems_device_major_number     major;
+  rtems_device_minor_number     minor;
   int                           rc;
 
@@ -71,13 +79,7 @@
 
   iop->data0 = major;
-  iop->data1 = (void*)((intptr_t) minor);
+  iop->data1 = (void *) minor;
 
-  args.iop   = iop;
-  args.flags = iop->flags;
-  args.mode  = mode;
-
-  status = rtems_io_open (major, minor, (void *) &args);
-
-  return rtems_deviceio_errno (status);
+  return rtems_deviceio_open (iop, pathname, oflag, mode, minor, major);
 }
 
@@ -92,19 +94,10 @@
 rtems_rfs_rtems_device_close (rtems_libio_t* iop)
 {
-  rtems_libio_open_close_args_t args;
-  rtems_status_code             status;
-  int                           major;
-  int                           minor;
+  rtems_device_major_number     major;
+  rtems_device_minor_number     minor;
 
-  major = (int) iop->data0;
-  minor = (intptr_t) iop->data1;
+  rtems_rfs_rtems_device_get_major_and_minor (iop, &major, &minor);
 
-  args.iop   = iop;
-  args.flags = 0;
-  args.mode  = 0;
-
-  status = rtems_io_close (major, minor, (void *) &args);
-
-  return rtems_deviceio_errno (status);
+  return rtems_deviceio_close (iop, major, minor);
 }
 
@@ -121,24 +114,10 @@
 rtems_rfs_rtems_device_read (rtems_libio_t* iop, void* buffer, size_t count)
 {
-  rtems_libio_rw_args_t args;
-  rtems_status_code     status;
-  int                   major;
-  int                   minor;
+  rtems_device_major_number major;
+  rtems_device_minor_number minor;
 
-  major = (int) iop->data0;
-  minor = (intptr_t) iop->data1;
+  rtems_rfs_rtems_device_get_major_and_minor (iop, &major, &minor);
 
-  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 (major, minor, (void *) &args);
-  if (status)
-    return rtems_deviceio_errno (status);
-
-  return (ssize_t) args.bytes_moved;
+  return rtems_deviceio_read (iop, buffer, count, major, minor);
 }
 
@@ -157,24 +136,10 @@
                               size_t         count)
 {
-  rtems_libio_rw_args_t args;
-  rtems_status_code     status;
-  int                   major;
-  int                   minor;
+  rtems_device_major_number major;
+  rtems_device_minor_number minor;
 
-  major = (int) iop->data0;
-  minor = (intptr_t) iop->data1;
+  rtems_rfs_rtems_device_get_major_and_minor (iop, &major, &minor);
 
-  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 (major, minor, (void *) &args);
-  if (status)
-    return rtems_deviceio_errno (status);
-
-  return (ssize_t) args.bytes_moved;
+  return rtems_deviceio_write (iop, buffer, count, major, minor);
 }
 
@@ -189,25 +154,14 @@
 
 static int
-rtems_rfs_rtems_device_ioctl (rtems_libio_t* iop,
-                              uint32_t       command,
-                              void*          buffer)
+rtems_rfs_rtems_device_ioctl (rtems_libio_t*  iop,
+                              ioctl_command_t command,
+                              void*           buffer)
 {
-  rtems_libio_ioctl_args_t args;
-  rtems_status_code        status;
-  int                      major;
-  int                      minor;
+  rtems_device_major_number major;
+  rtems_device_minor_number minor;
 
-  major = (int) iop->data0;
-  minor = (intptr_t) iop->data1;
+  rtems_rfs_rtems_device_get_major_and_minor (iop, &major, &minor);
 
-  args.iop     = iop;
-  args.command = command;
-  args.buffer  = buffer;
-
-  status = rtems_io_control (major, minor, (void *) &args);
-  if (status)
-    return rtems_deviceio_errno (status);
-
-  return args.ioctl_return;
+  return rtems_deviceio_control (iop, command, buffer, major, minor);
 }
 
Index: cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c
===================================================================
--- cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/rfs/rtems-rfs-rtems-file.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -164,4 +164,7 @@
   }
 
+  if (read >= 0)
+    iop->offset = pos + read;
+
   rtems_rfs_rtems_unlock (rtems_rfs_file_fs (file));
 
@@ -221,5 +224,4 @@
       return rtems_rfs_rtems_error ("file-write: write append seek", rc);
     }
-    iop->offset = pos;
   }
 
@@ -252,23 +254,10 @@
   }
 
+  if (write >= 0)
+    iop->offset = pos + write;
+
   rtems_rfs_rtems_unlock (rtems_rfs_file_fs (file));
 
   return write;
-}
-
-/**
- * This routine processes the ioctl() system call.
- *
- * @note  No ioctl()'s are currently supported for RFS files.
- *
- * @param iop
- * @param command
- * @param buffer
- */
-
-static int
-rtems_rfs_rtems_file_ioctl (rtems_libio_t* iop, uint32_t command, void* buffer)
-{
-  return 0;
 }
 
@@ -352,5 +341,5 @@
   .read_h      = rtems_rfs_rtems_file_read,
   .write_h     = rtems_rfs_rtems_file_write,
-  .ioctl_h     = rtems_rfs_rtems_file_ioctl,
+  .ioctl_h     = rtems_filesystem_default_ioctl,
   .lseek_h     = rtems_rfs_rtems_file_lseek,
   .fstat_h     = rtems_rfs_rtems_fstat,
Index: cpukit/libfs/src/rfs/rtems-rfs-rtems.c
===================================================================
--- cpukit/libfs/src/rfs/rtems-rfs-rtems.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libfs/src/rfs/rtems-rfs-rtems.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -74,5 +74,7 @@
 
 static void
-rtems_rfs_rtems_lock_by_mt_entry (rtems_filesystem_mount_table_entry_t *mt_entry)
+rtems_rfs_rtems_lock_by_mt_entry (
+  const rtems_filesystem_mount_table_entry_t *mt_entry
+)
 {
   rtems_rfs_file_system* fs = mt_entry->fs_info;
@@ -82,5 +84,7 @@
 
 static void
-rtems_rfs_rtems_unlock_by_mt_entry (rtems_filesystem_mount_table_entry_t *mt_entry)
+rtems_rfs_rtems_unlock_by_mt_entry (
+  const rtems_filesystem_mount_table_entry_t *mt_entry
+)
 {
   rtems_rfs_file_system* fs = mt_entry->fs_info;
@@ -915,9 +919,8 @@
   }
 
-  mt_entry->fs_info = fs;
-
+  mt_entry->fs_info                          = fs;
+  mt_entry->ops                              = &rtems_rfs_ops;
   mt_entry->mt_fs_root->location.node_access = (void*) RTEMS_RFS_ROOT_INO;
   mt_entry->mt_fs_root->location.handlers    = &rtems_rfs_rtems_dir_handlers;
-  mt_entry->mt_fs_root->location.ops         = &rtems_rfs_ops;
 
   rtems_rfs_rtems_unlock (fs);
Index: cpukit/libnetworking/lib/ftpfs.c
===================================================================
--- cpukit/libnetworking/lib/ftpfs.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libnetworking/lib/ftpfs.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -1195,5 +1195,5 @@
   /* Set handler and oparations table */
   e->mt_fs_root->location.handlers = &rtems_ftpfs_root_handlers;
-  e->mt_fs_root->location.ops = &rtems_ftpfs_ops;
+  e->ops = &rtems_ftpfs_ops;
 
   /* We maintain no real file system nodes, so there is no real root */
Index: cpukit/libnetworking/lib/tftpDriver.c
===================================================================
--- cpukit/libnetworking/lib/tftpDriver.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libnetworking/lib/tftpDriver.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -206,5 +206,5 @@
   mt_entry->mt_fs_root->location.node_access = root_path;
   mt_entry->mt_fs_root->location.handlers = &rtems_tftp_handlers;
-  mt_entry->mt_fs_root->location.ops = &rtems_tftp_ops;
+  mt_entry->ops = &rtems_tftp_ops;
   
   /*
Index: cpukit/libnetworking/rtems/rtems_bsdnet_internal.h
===================================================================
--- cpukit/libnetworking/rtems/rtems_bsdnet_internal.h	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libnetworking/rtems/rtems_bsdnet_internal.h	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -23,10 +23,4 @@
 typedef	unsigned int		vm_size_t;
 
-#ifndef __ioctl_command_defined
-typedef u_int32_t ioctl_command_t;
-#define __ioctl_command_defined
-#endif
-
-
 #define _BSD_OFF_T_	int32_t
 #define _BSD_PID_T_	rtems_id
@@ -39,4 +33,5 @@
 
 #include <sys/time.h>
+#include <sys/ioctl.h>
 
 struct mdproc {
Index: cpukit/libnetworking/rtems/rtems_syscall.c
===================================================================
--- cpukit/libnetworking/rtems/rtems_syscall.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ cpukit/libnetworking/rtems/rtems_syscall.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -89,5 +89,4 @@
   iop->data1 = so;
   iop->pathinfo.handlers = &socket_handlers;
-  iop->pathinfo.ops = &rtems_filesystem_operations_default;
   iop->pathinfo.mt_entry = &rtems_filesystem_null_mt_entry;
   rtems_filesystem_location_add_to_mt_entry(&iop->pathinfo);
Index: testsuites/fstests/fsnofs01/init.c
===================================================================
--- testsuites/fstests/fsnofs01/init.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ testsuites/fstests/fsnofs01/init.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -54,5 +54,4 @@
   rtems_test_assert(null_loc->location.node_access_2 == local_loc->node_access_2);
   rtems_test_assert(null_loc->location.handlers == local_loc->handlers);
-  rtems_test_assert(null_loc->location.ops == local_loc->ops);
   rtems_test_assert(null_loc->location.mt_entry == local_loc->mt_entry);
 }
Index: testsuites/libtests/Makefile.am
===================================================================
--- testsuites/libtests/Makefile.am	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ testsuites/libtests/Makefile.am	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -12,5 +12,5 @@
     termios06 termios07 termios08 \
     rtems++ tztest block01 block02 block03 block04 block05 block06 block07 \
-    block08 block09 block10 block11 stringto01 \
+    block08 block09 block10 block11 block12 stringto01 \
     tar01 tar02 tar03 \
     math mathf mathl complex \
Index: testsuites/libtests/block12/Makefile.am
===================================================================
--- testsuites/libtests/block12/Makefile.am	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
+++ testsuites/libtests/block12/Makefile.am	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -0,0 +1,19 @@
+rtems_tests_PROGRAMS = block12
+block12_SOURCES = init.c
+
+dist_rtems_tests_DATA = block12.scn block12.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(block12_OBJECTS)
+LINK_LIBS = $(block12_LDLIBS)
+
+block12$(EXEEXT): $(block12_OBJECTS) $(block12_DEPENDENCIES)
+	@rm -f block12$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
Index: testsuites/libtests/block12/block12.scn
===================================================================
--- testsuites/libtests/block12/block12.scn	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
+++ testsuites/libtests/block12/block12.scn	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -0,0 +1,2 @@
+*** TEST BLOCK 12 ***
+*** END OF TEST BLOCK 12 ***
Index: testsuites/libtests/block12/init.c
===================================================================
--- testsuites/libtests/block12/init.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
+++ testsuites/libtests/block12/init.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Obere Lagerstr. 30
+ *  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.com/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+  #include "config.h"
+#endif
+
+#include "tmacros.h"
+
+#include <errno.h>
+#include <string.h>
+
+#include <rtems/blkdev.h>
+#include <rtems/bdbuf.h>
+
+#define BLOCK_COUNT 15
+
+static int block_access_counts [BLOCK_COUNT];
+
+static int expected_block_access_counts [BLOCK_COUNT] = {
+  2, 0, 2, 0, 2, 0, 2, 2, 2, 0, 2, 0, 2, 0, 2
+};
+
+static const rtems_blkdev_bnum read_sequence [] = {
+  0, 2, 4, 6, 8, 10, 12, 14, 7
+};
+
+static int test_disk_ioctl(rtems_disk_device *dd, uint32_t req, void *arg)
+{
+  int rv = 0;
+
+  if (req == RTEMS_BLKIO_REQUEST) {
+    rtems_blkdev_request *breq = arg;
+    rtems_blkdev_sg_buffer *sg = breq->bufs;
+    uint32_t i;
+
+    rtems_test_assert(breq->req == RTEMS_BLKDEV_REQ_READ);
+
+    for (i = 0; i < breq->bufnum; ++i) {
+      rtems_blkdev_bnum block = sg [i].block;
+
+      rtems_test_assert(block < BLOCK_COUNT);
+
+      ++block_access_counts [block];
+    }
+
+    breq->req_done(breq->done_arg, RTEMS_SUCCESSFUL);
+  } else {
+    errno = EINVAL;
+    rv = -1;
+  }
+
+  return rv;
+}
+
+static void do_read_sequence(rtems_disk_device *dd)
+{
+  size_t i;
+
+  for (i = 0; i < sizeof(read_sequence) / sizeof(read_sequence [0]); ++i) {
+    rtems_status_code sc;
+    rtems_bdbuf_buffer *bd;
+
+    sc = rtems_bdbuf_read(dd, read_sequence [i], &bd);
+    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+    sc = rtems_bdbuf_release(bd);
+    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+  }
+}
+
+static void test(void)
+{
+  rtems_status_code sc;
+  dev_t dev = 0;
+  rtems_disk_device *dd;
+
+  sc = rtems_disk_io_initialize();
+  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+  sc = rtems_disk_create_phys(
+    dev,
+    1,
+    BLOCK_COUNT,
+    test_disk_ioctl,
+    NULL,
+    NULL
+  );
+  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+  dd = rtems_disk_obtain(dev);
+  rtems_test_assert(dd != NULL);
+
+  do_read_sequence(dd);
+  rtems_bdbuf_purge_dev(dd);
+  do_read_sequence(dd);
+
+  rtems_test_assert(
+    memcmp(
+      block_access_counts,
+      expected_block_access_counts,
+      sizeof(block_access_counts)
+    ) == 0
+  );
+
+  sc = rtems_disk_release(dd);
+  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+  sc = rtems_disk_delete(dev);
+  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
+static void Init(rtems_task_argument arg)
+{
+  puts("\n\n*** TEST BLOCK 12 ***");
+
+  test();
+
+  puts("*** END OF TEST BLOCK 12 ***");
+
+  rtems_test_exit(0);
+}
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
+
+#define CONFIGURE_BDBUF_BUFFER_MIN_SIZE 1
+#define CONFIGURE_BDBUF_BUFFER_MAX_SIZE 1
+#define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE BLOCK_COUNT
+
+#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
+
+#define CONFIGURE_MAXIMUM_TASKS 2
+
+#define CONFIGURE_EXTRA_TASK_STACKS (8 * 1024)
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
Index: testsuites/libtests/configure.ac
===================================================================
--- testsuites/libtests/configure.ac	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ testsuites/libtests/configure.ac	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -56,4 +56,5 @@
 block10/Makefile
 block11/Makefile
+block12/Makefile
 bspcmdline01/Makefile
 cpuuse/Makefile
Index: testsuites/psxtests/psxfile01/test.c
===================================================================
--- testsuites/psxtests/psxfile01/test.c	(revision d5d071d5e2e201859f91fae0993772e1bc426469)
+++ testsuites/psxtests/psxfile01/test.c	(revision a7d1992c8313eeb5e67bd0f7eebe35e61a103b8a)
@@ -335,7 +335,5 @@
   fd = open( "/tmp/john", O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO );
   rtems_test_assert( fd != -1 );
-
-  puts("tcdrain /tmp/john" );
-  status = tcdrain( fd );
+  status = close( fd );
   rtems_test_assert( status == 0 );
 
