Index: cpukit/ChangeLog
===================================================================
--- cpukit/ChangeLog	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/ChangeLog	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -1,2 +1,70 @@
+2009-06-12	Chris Johns <chrisj@rtems.org>
+
+	* libblock/src/bdbuf.c: Update comments.
+	* libblock/src/bdpart.c, libblock/src/ide_part_table.c: Get the
+	device from the rdev field of the stat buf.
+	* libcsupport/include/rtems/libio.h: Add a path length to evalpath
+	handler. Add parent locations to rmmod and unlink handlers.
+	* libcsupport/include/rtems/libio_.h: Add a path length to
+	rtems_filesystem_evaluate_path. Add
+	rtems_filesystem_evaluate_relative_path, rtems_filesystem_dirname,
+	and rtems_filesystem_prefix_separators. Remove
+	rtems_filesystem_evaluate_parent.
+	* libcsupport/src/base_fs.c, libcsupport/src/chdir.c,
+	libcsupport/src/chmod.c, libcsupport/src/chown.c,
+	libcsupport/src/chroot.c, libcsupport/src/fchdir.c,
+	libcsupport/src/link.c, libcsupport/src/mount.c,
+	libcsupport/src/open.c, libcsupport/src/privateenv.c,
+	libcsupport/src/readlink.c, libcsupport/src/unmount.c,
+	libcsupport/src/utime.c, libcsupport/src/unmount.c,
+	libcsupport/src/utime.c, libfs/src/devfs/devfs.h,
+	libfs/src/devfs/devfs_eval.c, libfs/src/devfs/devstat.c,
+	libfs/src/dosfs/msdos_create.c, libfs/src/dosfs/msdos_misc.c,
+	libfs/src/imfs/imfs.h, libfs/src/imfs/imfs_eval.c,
+	libfs/src/imfs/imfs_load_tar.c, libfs/src/imfs/ioman.c,
+	libfs/src/pipe/pipe.c, libmisc/fsmount/fsmount.c,
+	libnetworking/lib/ftpfs.c: Add the length parameter to the eval
+	call.
+	* libcsupport/src/eval.c: Add rtems_filesystem_prefix_separators,
+	rtems_filesystem_dirname,
+	rtems_filesystem_evaluate_relative_path. Add the length parameter
+	to the eval call.
+	* libcsupport/src/rmdir.c: Find the parent pathloc then the node
+	pathloc from that node. Remove the call to find the parent given
+	the node pathloc.
+	* libcsupport/src/stat.c: Add the length parameter to the eval
+	call. Set the device into the rdev field.
+	* libcsupport/src/unlink.c: Find the parent pathloc then the node
+	pathloc from that node. Remove the call to find the parent given
+	the node pathloc.
+	* libfs/src/dosfs/fat.c, libfs/src/dosfs/msdos_format.c: Get the
+	disk device number from the stat rdev field.
+	* libfs/src/dosfs/msdos.h: Add the length parameter to the eval
+	call. Add the parent pathloc to the rmnod handler.
+	* libfs/src/dosfs/msdos_dir.c: Add the parent pathloc to the rmnod
+	handler.
+	* libfs/src/dosfs/msdos_eval.c: Add the length parameter to the
+	eval and token call.
+	* libfs/src/imfs/imfs_directory.c: Add the parent pathloc to the
+	rmnod handler.
+	* libfs/src/imfs/imfs_fchmod.c: Do not test the mode flags for
+	only the allowed flags. Add the missing flags spec'ed in the POSIX
+	standard.
+	* libfs/src/imfs/imfs_fsunmount.c, libfs/src/imfs/imfs_rmnod.c,
+	libfs/src/imfs/imfs_unlink.c, libfs/src/imfs/memfile.c: Add the
+	parent node. Currently ignored in the IMFS.
+	* libfs/src/imfs/imfs_stat.c: Return the device number in the rdev
+	field.
+	* libfs/src/imfs/imfs_mknod.c, libfs/src/imfs/imfs_symlink.c : Add
+	the length parameter to the token call.
+	* libfs/src/nfsclient/src/nfs.c: Add the length parameter to the
+	eval call and parent node to the rmnod and unlink command.
+	* libmisc/shell/internal.h: Remove the libc mounter decl to make
+	public.
+	* libmisc/shell/main_mount.c: Add support for hooking external
+	mount support for new file systems.
+	* libmisc/shell/shell.h: Add helper functions for the mount
+	command.
+
 2009-06-11	Joel Sherrill <joel.sherrill@OARcorp.com>
 
Index: cpukit/libblock/src/bdbuf.c
===================================================================
--- cpukit/libblock/src/bdbuf.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libblock/src/bdbuf.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -1937,5 +1937,5 @@
  * there are buffers to be written. If the transfer fails place the buffers
  * back on the modified list and try again later. The pool is unlocked while
- * the buffers are beign written to disk.
+ * the buffers are being written to disk.
  *
  * @param pid The pool id to process modified buffers on.
@@ -1966,6 +1966,6 @@
   /*
    * When the sync is for a device limit the sync to that device. If the sync
-   * is for a buffer handle the devices in the order on the sync list. This
-   * means the dev is -1.
+   * is for a buffer handle process the devices in the order on the sync
+   * list. This means the dev is -1.
    */
   if (pool->sync_active)
@@ -1973,5 +1973,5 @@
 
   /*
-   * If we have any buffers in the sync queue move then to the modified
+   * If we have any buffers in the sync queue move them to the modified
    * list. The first sync buffer will select the device we use.
    */
@@ -1991,12 +1991,12 @@
 
   /*
-   * We have all the buffers that have been modified for this device so
-   * the pool can be unlocked because the state is set to TRANSFER.
-   */
-
+   * We have all the buffers that have been modified for this device so the
+   * pool can be unlocked because the state of each buffer has been set to
+   * TRANSFER.
+   */
   rtems_bdbuf_unlock_pool (pool);
 
   /*
-   * If there are buffers to transfer to the media tranfer them.
+   * If there are buffers to transfer to the media transfer them.
    */
   if (rtems_chain_is_empty (&transfer))
@@ -2005,6 +2005,6 @@
   {
     /*
-     * Obtain the disk device. Release the pool mutex to avoid a dead
-     * lock.
+     * Obtain the disk device. The pool's mutex has been released to avoid a
+     * dead lock.
      */
     dd = rtems_disk_obtain (dev);
@@ -2021,12 +2021,11 @@
       /*
        * Take as many buffers as configured and pass to the driver. Note, the
-       * API to the drivers has the array of buffers and if a chain was passed
+       * API to the drivers has an array of buffers and if a chain was passed
        * we could have just passed the list. If the driver API is updated it
        * should be possible to make this change with little effect in this
        * code. The array that is passed is broken in design and should be
-       * removed. Merging to members of a struct into the first member is
+       * removed. Merging members of a struct into the first member is
        * trouble waiting to happen.
        */
-
       write_req->status = RTEMS_RESOURCE_IN_USE;
       write_req->error = 0;
Index: cpukit/libblock/src/bdpart.c
===================================================================
--- cpukit/libblock/src/bdpart.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libblock/src/bdpart.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -111,4 +111,7 @@
 }
 
+/*
+ * FIXME: This code should the deviceio interface and not the bdbug interface.
+ */
 static rtems_status_code rtems_bdpart_get_disk_data(
   const char *disk_name,
@@ -129,5 +132,5 @@
     return RTEMS_INVALID_NAME;
   }
-  *disk = st.st_dev;
+  *disk = st.st_rdev;
 
   /* Get disk begin, end and block size */
Index: cpukit/libblock/src/ide_part_table.c
===================================================================
--- cpukit/libblock/src/ide_part_table.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libblock/src/ide_part_table.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -468,5 +468,5 @@
 
     strncpy (disk_desc->dev_name, dev_name, 15);
-    disk_desc->dev = dev_stat.st_dev;
+    disk_desc->dev = dev_stat.st_rdev;
     disk_desc->sector_size = (dev_stat.st_blksize) ? dev_stat.st_blksize :
                                               RTEMS_IDE_SECTOR_SIZE;
Index: cpukit/libcsupport/include/rtems/libio.h
===================================================================
--- cpukit/libcsupport/include/rtems/libio.h	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/include/rtems/libio.h	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -129,4 +129,5 @@
 
 typedef int (*rtems_filesystem_rmnod_t)(
+ rtems_filesystem_location_info_t      *parent_loc,   /* IN */
  rtems_filesystem_location_info_t      *pathloc       /* IN */
 );
@@ -175,4 +176,5 @@
 typedef int (*rtems_filesystem_evalpath_t)(
   const char                        *pathname,      /* IN     */
+  int                                pathnamelen,   /* IN     */
   int                                flags,         /* IN     */
   rtems_filesystem_location_info_t  *pathloc        /* IN/OUT */
@@ -192,5 +194,6 @@
 
 typedef int (*rtems_filesystem_unlink_t)(
- rtems_filesystem_location_info_t  *pathloc       /* IN */
+ rtems_filesystem_location_info_t  *parent_pathloc, /* IN */
+ rtems_filesystem_location_info_t  *pathloc         /* IN */
 );
 
@@ -327,5 +330,6 @@
    *  this will need to be used.
    *
-   *  The best option long term for this is probably an open file descriptor.
+   *  The lower layers can manage how this is managed. Leave as a
+   *  string.
    */
   char                                  *dev;
Index: cpukit/libcsupport/include/rtems/libio_.h
===================================================================
--- cpukit/libcsupport/include/rtems/libio_.h	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/include/rtems/libio_.h	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -235,6 +235,7 @@
  */
 
-int rtems_filesystem_evaluate_path(
+int rtems_filesystem_evaluate_relative_path(
   const char                        *pathname,
+  int                                pathnamelen,
   int                                flags,
   rtems_filesystem_location_info_t  *pathloc,
@@ -242,7 +243,19 @@
 );
 
-int rtems_filesystem_evaluate_parent(
+int rtems_filesystem_evaluate_path(
+  const char                        *pathname,
+  int                                pathnamelen,
   int                                flags,
-  rtems_filesystem_location_info_t  *pathloc
+  rtems_filesystem_location_info_t  *pathloc,
+  int                                follow_link
+);
+
+int rtems_filesystem_dirname(
+  const char  *pathname
+);
+
+int rtems_filesystem_prefix_separators(
+  const char  *pathname,
+  int          pathnamelen
 );
 
Index: cpukit/libcsupport/src/base_fs.c
===================================================================
--- cpukit/libcsupport/src/base_fs.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/base_fs.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -90,8 +90,8 @@
   rtems_filesystem_root        = entry->mt_fs_root;
   /* Clone the root pathloc */
-  rtems_filesystem_evaluate_path("/", 0, &loc, 0);
+  rtems_filesystem_evaluate_path("/", 1, 0, &loc, 0);
   rtems_filesystem_root        = loc;
   /* One more clone for the current node */
-  rtems_filesystem_evaluate_path("/", 0, &loc, 0);
+  rtems_filesystem_evaluate_path("/", 1, 0, &loc, 0);
   rtems_filesystem_current     = loc;
 
Index: cpukit/libcsupport/src/chdir.c
===================================================================
--- cpukit/libcsupport/src/chdir.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/chdir.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -36,5 +36,5 @@
 
   result = rtems_filesystem_evaluate_path(
-    pathname, RTEMS_LIBIO_PERMS_SEARCH, &loc, true );
+    pathname, strlen( pathname ), RTEMS_LIBIO_PERMS_SEARCH, &loc, true );
   if ( result != 0 )
      return -1;
Index: cpukit/libcsupport/src/chmod.c
===================================================================
--- cpukit/libcsupport/src/chmod.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/chmod.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -35,5 +35,5 @@
   int                              result;
 
-  status = rtems_filesystem_evaluate_path( path, 0, &loc, true );
+  status = rtems_filesystem_evaluate_path( path, strlen( path ), 0, &loc, true );
   if ( status != 0 )
     return -1;
Index: cpukit/libcsupport/src/chown.c
===================================================================
--- cpukit/libcsupport/src/chown.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/chown.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -34,5 +34,5 @@
   int                                result;
 
-  if ( rtems_filesystem_evaluate_path( path, 0x00, &loc, true ) )
+  if ( rtems_filesystem_evaluate_path( path, strlen( path ), 0x00, &loc, true ) )
     return -1;
 
Index: cpukit/libcsupport/src/chroot.c
===================================================================
--- cpukit/libcsupport/src/chroot.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/chroot.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -45,5 +45,5 @@
 
   /* clone the new root location */
-  if (rtems_filesystem_evaluate_path(".", 0, &loc, 0)) {
+  if (rtems_filesystem_evaluate_path(".", 1, 0, &loc, 0)) {
     /* our cwd has changed, though - but there is no easy way of return :-( */
     rtems_set_errno_and_return_minus_one( errno );
Index: cpukit/libcsupport/src/eval.c
===================================================================
--- cpukit/libcsupport/src/eval.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/eval.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -22,6 +22,7 @@
 #include <rtems/seterr.h>
 
-int rtems_filesystem_evaluate_path(
+int rtems_filesystem_evaluate_relative_path(
   const char                        *pathname,
+  int                                pathnamelen,
   int                                flags,
   rtems_filesystem_location_info_t  *pathloc,
@@ -43,14 +44,8 @@
     rtems_set_errno_and_return_minus_one( EIO );       /* should never happen */
 
-  /*
-   * Evaluate the path using the optable evalpath.
-   */
-
-  rtems_filesystem_get_start_loc( pathname, &i, pathloc );
-
   if ( !pathloc->ops->evalpath_h )
     rtems_set_errno_and_return_minus_one( ENOTSUP );
 
-  result = (*pathloc->ops->evalpath_h)( &pathname[i], flags, pathloc );
+  result = (*pathloc->ops->evalpath_h)( &pathname[i], pathnamelen, flags, pathloc );
 
   /*
@@ -91,5 +86,4 @@
 
         result =  (*pathloc->ops->eval_link_h)( pathloc, flags );
-
     }
   }
@@ -98,26 +92,72 @@
 }
 
-
-int rtems_filesystem_evaluate_parent(
+int rtems_filesystem_evaluate_path(
+  const char                        *pathname,
+  int                                pathnamelen,
   int                                flags,
-  rtems_filesystem_location_info_t  *pathloc
+  rtems_filesystem_location_info_t  *pathloc,
+  int                                follow_link
 )
 {
-  rtems_filesystem_location_info_t  parent;
-  int                               result;
+  int                           i;
+  int                           result;
+  rtems_filesystem_node_types_t type;
+
+  /*
+   * Verify Input parameters.
+   */
+
+  if ( !pathname )
+    rtems_set_errno_and_return_minus_one( EFAULT );
 
   if ( !pathloc )
     rtems_set_errno_and_return_minus_one( EIO );       /* should never happen */
 
-  if ( !pathloc->ops->evalpath_h )
-    rtems_set_errno_and_return_minus_one( ENOTSUP );
+  /*
+   * Evaluate the path using the optable evalpath.
+   */
 
-  parent = *pathloc;
-  result = (*pathloc->ops->evalpath_h)( "..", flags, &parent );
-  if (result != 0){
-    return -1;
+  rtems_filesystem_get_start_loc( pathname, &i, pathloc );
+
+  /*
+   * We evaluation the path relative to the start location we get got.
+   */
+  return rtems_filesystem_evaluate_relative_path( pathname,
+                                                  pathnamelen,
+                                                  flags,
+                                                  pathloc,
+                                                  follow_link );
+}
+
+int rtems_filesystem_dirname(
+  const char  *pathname
+)
+{
+  int len = strlen( pathname );
+
+  while ( len ) {
+    len--;
+    if ( rtems_filesystem_is_separator( pathname[len] ) )
+      break;
   }
-  rtems_filesystem_freenode( &parent );
 
-  return result;
+  return len;
 }
+
+int rtems_filesystem_prefix_separators(
+  const char  *pathname,
+  int          pathnamelen
+)
+{
+  /*
+   * Eat any separators at start of the path.
+   */
+  int stripped = 0;
+  while ( *pathname && pathnamelen && rtems_filesystem_is_separator( *pathname ) )
+  {
+    pathname++;
+    pathnamelen--;
+    stripped++;
+  }
+  return stripped;
+}
Index: cpukit/libcsupport/src/fchdir.c
===================================================================
--- cpukit/libcsupport/src/fchdir.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/fchdir.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -77,5 +77,5 @@
 
   /* clone the current node */
-  if (rtems_filesystem_evaluate_path(".", 0, &loc, 0)) {
+  if (rtems_filesystem_evaluate_path(".", 1, 0, &loc, 0)) {
     /* cloning failed; restore original and bail out */
     rtems_filesystem_current = saved;
Index: cpukit/libcsupport/src/link.c
===================================================================
--- cpukit/libcsupport/src/link.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/link.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -38,5 +38,6 @@
    */
 
-  result = rtems_filesystem_evaluate_path( existing, 0, &existing_loc, true );
+  result = rtems_filesystem_evaluate_path( existing, strlen( existing ),
+                                           0, &existing_loc, true );
   if ( result != 0 )
      return -1;
Index: cpukit/libcsupport/src/mount.c
===================================================================
--- cpukit/libcsupport/src/mount.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/mount.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -140,5 +140,5 @@
 
     if ( rtems_filesystem_evaluate_path(
-            mount_point, RTEMS_LIBIO_PERMS_RWX, &loc, true ) == -1 )
+           mount_point, strlen( mount_point ), RTEMS_LIBIO_PERMS_RWX, &loc, true ) == -1 )
       goto cleanup_and_bail;
 
Index: cpukit/libcsupport/src/open.c
===================================================================
--- cpukit/libcsupport/src/open.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/open.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -112,5 +112,5 @@
 
   status = rtems_filesystem_evaluate_path(
-     pathname, eval_flags, &loc, true );
+    pathname, strlen( pathname ), eval_flags, &loc, true );
 
   if ( status == -1 ) {
@@ -134,5 +134,5 @@
 
     /* Sanity check to see if the file name exists after the mknod() */
-    status = rtems_filesystem_evaluate_path( pathname, 0x0, &loc, true );
+    status = rtems_filesystem_evaluate_path( pathname, strlen( pathname ), 0x0, &loc, true );
     if ( status != 0 ) {   /* The file did not exist */
       rc = EACCES;
Index: cpukit/libcsupport/src/privateenv.c
===================================================================
--- cpukit/libcsupport/src/privateenv.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/privateenv.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -92,7 +92,7 @@
    */
 
-  rtems_filesystem_evaluate_path("/", 0, &loc, 0);
+  rtems_filesystem_evaluate_path("/", 1, 0, &loc, 0);
   rtems_filesystem_root    = loc;
-  rtems_filesystem_evaluate_path("/", 0, &loc, 0);
+  rtems_filesystem_evaluate_path("/", 1, 0, &loc, 0);
   rtems_filesystem_current = loc;
 
Index: cpukit/libcsupport/src/readlink.c
===================================================================
--- cpukit/libcsupport/src/readlink.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/readlink.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -31,5 +31,6 @@
     rtems_set_errno_and_return_minus_one( EFAULT );
 
-  result = rtems_filesystem_evaluate_path( pathname, 0, &loc, false );
+  result = rtems_filesystem_evaluate_path( pathname, strlen( pathname ),
+                                           0, &loc, false );
   if ( result != 0 )
      return -1;
Index: cpukit/libcsupport/src/rmdir.c
===================================================================
--- cpukit/libcsupport/src/rmdir.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/rmdir.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -29,18 +29,40 @@
 )
 {
+  int                               parentpathlen;
+  const char                       *name;
+  rtems_filesystem_location_info_t  parentloc;
   rtems_filesystem_location_info_t  loc;
+  int                               i;
   int                               result;
+  
+  /*
+   *  Get the parent node of the node we wish to remove. Find the parent path.
+   */
+
+  parentpathlen = rtems_filesystem_dirname ( pathname );
+
+  if ( parentpathlen == 0 )
+    rtems_filesystem_get_start_loc( pathname, &i, &parentloc );
+  else {
+    result = rtems_filesystem_evaluate_path(pathname, parentpathlen,
+                                            RTEMS_LIBIO_PERMS_WRITE,
+                                            &parentloc,
+                                            false );
+    if ( result != 0 )
+      return -1;
+  }
 
   /*
-   *  Get the node where we wish to go.
+   * Start from the parent to find the node that should be under it.
    */
-
-  result = rtems_filesystem_evaluate_path( pathname, 0, &loc, false );
-  if ( result != 0 )
-     return -1;
-
-  result = rtems_filesystem_evaluate_parent(RTEMS_LIBIO_PERMS_WRITE, &loc );
-  if (result != 0) {
-    rtems_filesystem_freenode( &loc );
+  
+  loc = parentloc;
+  name = pathname + parentpathlen;
+  name += rtems_filesystem_prefix_separators( name, strlen( name ) );
+  
+  result = rtems_filesystem_evaluate_relative_path( name , strlen( name ),
+                                                    0, &loc, false );
+  if ( result != 0 ) {
+    rtems_filesystem_freenode( &parentloc );
     return -1;
   }
@@ -52,4 +74,5 @@
   if ( !loc.ops->node_type_h ){
     rtems_filesystem_freenode( &loc );
+    rtems_filesystem_freenode( &parentloc );
     rtems_set_errno_and_return_minus_one( ENOTSUP );
   }
@@ -57,4 +80,5 @@
   if (  (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){
     rtems_filesystem_freenode( &loc );
+    rtems_filesystem_freenode( &parentloc );
     rtems_set_errno_and_return_minus_one( ENOTDIR );
   }
@@ -66,10 +90,12 @@
   if ( !loc.handlers->rmnod_h ){
     rtems_filesystem_freenode( &loc );
+    rtems_filesystem_freenode( &parentloc );
     rtems_set_errno_and_return_minus_one( ENOTSUP );
   }
 
-  result =  (*loc.handlers->rmnod_h)( &loc );
+  result =  (*loc.handlers->rmnod_h)( &parentloc, &loc );
 
   rtems_filesystem_freenode( &loc );
+  rtems_filesystem_freenode( &parentloc );
 
   return result;
Index: cpukit/libcsupport/src/stat.c
===================================================================
--- cpukit/libcsupport/src/stat.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/stat.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -60,5 +60,6 @@
     rtems_set_errno_and_return_minus_one( EFAULT );
 
-  status = rtems_filesystem_evaluate_path( path, 0, &loc, _STAT_FOLLOW_LINKS );
+  status = rtems_filesystem_evaluate_path( path, strlen( path ),
+                                           0, &loc, _STAT_FOLLOW_LINKS );
   if ( status != 0 )
     return -1;
Index: cpukit/libcsupport/src/unlink.c
===================================================================
--- cpukit/libcsupport/src/unlink.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/unlink.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -25,23 +25,46 @@
 )
 {
+  int                               parentpathlen;
+  const char                       *name;
+  rtems_filesystem_location_info_t  parentloc;
   rtems_filesystem_location_info_t  loc;
+  int                               i;
   int                               result;
 
   /*
-   * Get the node to be unlinked.
+   * Get the node to be unlinked. Find the parent path first.
    */
-
-  result = rtems_filesystem_evaluate_path( path, 0, &loc, false );
-  if ( result != 0 )
-     return -1;
-
-  result = rtems_filesystem_evaluate_parent(RTEMS_LIBIO_PERMS_WRITE, &loc );
-  if (result != 0 && errno != ENOTSUP) {
-    rtems_filesystem_freenode( &loc );
+  
+  parentpathlen = rtems_filesystem_dirname ( path );
+  
+  if ( parentpathlen == 0 )
+    rtems_filesystem_get_start_loc( path, &i, &parentloc );
+  else {
+    result = rtems_filesystem_evaluate_path( path, parentpathlen,
+                                             RTEMS_LIBIO_PERMS_WRITE,
+                                             &parentloc,
+                                             false );
+    if ( result != 0 )
+      return -1;
+  }
+  
+  /*
+   * Start from the parent to find the node that should be under it.
+   */
+  
+  loc = parentloc;
+  name = path + parentpathlen;
+  name += rtems_filesystem_prefix_separators( name, strlen( name ) );
+  
+  result = rtems_filesystem_evaluate_relative_path( name , strlen( name ),
+                                                    0, &loc, false );
+  if ( result != 0 ) {
+    rtems_filesystem_freenode( &parentloc );
     return -1;
   }
-
+  
   if ( !loc.ops->node_type_h ) {
     rtems_filesystem_freenode( &loc );
+    rtems_filesystem_freenode( &parentloc );
     rtems_set_errno_and_return_minus_one( ENOTSUP );
   }
@@ -49,4 +72,5 @@
   if (  (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) {
     rtems_filesystem_freenode( &loc );
+    rtems_filesystem_freenode( &parentloc );
     rtems_set_errno_and_return_minus_one( EISDIR );
   }
@@ -54,10 +78,12 @@
   if ( !loc.ops->unlink_h ) {
     rtems_filesystem_freenode( &loc );
+    rtems_filesystem_freenode( &parentloc );
     rtems_set_errno_and_return_minus_one( ENOTSUP );
   }
 
-  result = (*loc.ops->unlink_h)( &loc );
+  result = (*loc.ops->unlink_h)( &parentloc, &loc );
 
   rtems_filesystem_freenode( &loc );
+  rtems_filesystem_freenode( &parentloc );
 
   return result;
Index: cpukit/libcsupport/src/unmount.c
===================================================================
--- cpukit/libcsupport/src/unmount.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/unmount.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -114,5 +114,5 @@
    */
 
-  if ( rtems_filesystem_evaluate_path( path, 0x0, &loc, true ) )
+  if ( rtems_filesystem_evaluate_path( path, strlen( path ), 0x0, &loc, true ) )
     return -1;
 
Index: cpukit/libcsupport/src/utime.c
===================================================================
--- cpukit/libcsupport/src/utime.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libcsupport/src/utime.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -31,5 +31,5 @@
   int                                result;
 
-  if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, true ) )
+  if ( rtems_filesystem_evaluate_path( path, strlen( path ), 0x00, &temp_loc, true ) )
     return -1;
 
Index: cpukit/libfs/src/devfs/devfs.h
===================================================================
--- cpukit/libfs/src/devfs/devfs.h	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/devfs/devfs.h	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -196,4 +196,5 @@
 extern int devFS_evaluate_path(
   const char                        *pathname,
+  int                                pathnamelen,
   int                                flags,
   rtems_filesystem_location_info_t  *pathloc
Index: cpukit/libfs/src/devfs/devfs_eval.c
===================================================================
--- cpukit/libfs/src/devfs/devfs_eval.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/devfs/devfs_eval.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -18,4 +18,5 @@
 int devFS_evaluate_path(
   const char                        *pathname,
+  int                                pathnamelen,
   int                                flags,
   rtems_filesystem_location_info_t  *pathloc
@@ -38,5 +39,5 @@
     for (i = 0; i < rtems_device_table_size; i++){
         if ((device_name_table[i].device_name) && 
-		(strcmp(device_name_table[i].device_name, pathname) == 0)){
+		(strncmp(pathname, device_name_table[i].device_name, pathnamelen) == 0)){
             /* find the device, set proper values */
             pathloc->node_access = (void *)&device_name_table[i];
Index: cpukit/libfs/src/devfs/devstat.c
===================================================================
--- cpukit/libfs/src/devfs/devstat.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/devfs/devstat.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -31,5 +31,5 @@
     rtems_set_errno_and_return_minus_one( EFAULT );
 
-  buf->st_dev  = rtems_filesystem_make_dev_t( the_dev->major, the_dev->minor );
+  buf->st_rdev  = rtems_filesystem_make_dev_t( the_dev->major, the_dev->minor );
 
   buf->st_mode = the_dev->mode;
Index: cpukit/libfs/src/dosfs/fat.c
===================================================================
--- cpukit/libfs/src/dosfs/fat.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/dosfs/fat.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -355,9 +355,9 @@
 
     /* check that device is registred as block device and lock it */
-    vol->dd = rtems_disk_obtain(stat_buf.st_dev);
+    vol->dd = rtems_disk_obtain(stat_buf.st_rdev);
     if (vol->dd == NULL)
         rtems_set_errno_and_return_minus_one(ENOTBLK);
 
-    vol->dev = stat_buf.st_dev;
+    vol->dev = stat_buf.st_rdev;
 
     /* Read boot record */
Index: cpukit/libfs/src/dosfs/msdos.h
===================================================================
--- cpukit/libfs/src/dosfs/msdos.h	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/dosfs/msdos.h	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -229,7 +229,8 @@
 
 int msdos_eval_path(
-  const char                       *pathname, /* IN */
-  int                               flags,    /* IN */
-  rtems_filesystem_location_info_t *pathloc   /* IN/OUT */
+  const char                       *pathname,    /* IN */
+  int                               pathnamelen, /* IN */
+  int                               flags,       /* IN */
+  rtems_filesystem_location_info_t *pathloc      /* IN/OUT */
 );
 
@@ -320,5 +321,6 @@
 );
 
-int msdos_file_rmnod(rtems_filesystem_location_info_t *pathloc /* IN */);
+int msdos_file_rmnod(rtems_filesystem_location_info_t *parent_pathloc, /* IN */
+                     rtems_filesystem_location_info_t *pathloc /* IN */);
 
 int msdos_file_link(
@@ -355,5 +357,6 @@
 );
 
-int msdos_dir_rmnod(rtems_filesystem_location_info_t *pathloc /* IN */);
+int msdos_dir_rmnod(rtems_filesystem_location_info_t *parent_pathloc, /* IN */
+                    rtems_filesystem_location_info_t *pathloc /* IN */);
 
 int msdos_dir_sync(rtems_libio_t *iop);
@@ -373,4 +376,5 @@
 /* Misc prototypes */
 msdos_token_types_t msdos_get_token(const char  *path,
+                                    int          pathlen,
                                     const char **token,
                                     int         *token_len);
Index: cpukit/libfs/src/dosfs/msdos_create.c
===================================================================
--- cpukit/libfs/src/dosfs/msdos_create.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/dosfs/msdos_create.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -311,5 +311,5 @@
      * check spelling and format new node name
      */
-    if (MSDOS_NAME != msdos_get_token(name, &token, &len)) {
+    if (MSDOS_NAME != msdos_get_token(name, strlen(name), &token, &len)) {
       rtems_set_errno_and_return_minus_one(ENAMETOOLONG);
     }
Index: cpukit/libfs/src/dosfs/msdos_dir.c
===================================================================
--- cpukit/libfs/src/dosfs/msdos_dir.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/dosfs/msdos_dir.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -638,5 +638,6 @@
  */
 int
-msdos_dir_rmnod(rtems_filesystem_location_info_t *pathloc)
+msdos_dir_rmnod(rtems_filesystem_location_info_t *parent_pathloc,
+                rtems_filesystem_location_info_t *pathloc)
 {
     int                rc = RC_OK;
Index: cpukit/libfs/src/dosfs/msdos_eval.c
===================================================================
--- cpukit/libfs/src/dosfs/msdos_eval.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/dosfs/msdos_eval.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -73,4 +73,5 @@
 msdos_eval_path(
     const char                        *pathname,
+    int                                pathnamelen,
     int                                flags,
     rtems_filesystem_location_info_t  *pathloc
@@ -107,5 +108,6 @@
     while ((type != MSDOS_NO_MORE_PATH) && (type != MSDOS_INVALID_TOKEN))
     {
-        type = msdos_get_token(&pathname[i], &token, &token_len);
+        type = msdos_get_token(&pathname[i], pathnamelen, &token, &token_len);
+        pathnamelen += token_len;
         i += token_len;
 
@@ -151,4 +153,5 @@
                         rtems_semaphore_release(fs_info->vol_sema);
                         return (*pathloc->ops->evalpath_h)(&(pathname[i-token_len]),
+                                                           pathnamelen - token_len,
                                                            flags, pathloc);
                     }
@@ -289,5 +292,5 @@
     while (!done)
     {
-        type = msdos_get_token(&path[i], &token, &token_len);
+        type = msdos_get_token(&path[i], strlen(&path[i]), &token, &token_len);
         i += token_len;
         fat_fd = pathloc->node_access;
Index: cpukit/libfs/src/dosfs/msdos_file.c
===================================================================
--- cpukit/libfs/src/dosfs/msdos_file.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/dosfs/msdos_file.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -475,5 +475,6 @@
  */
 int
-msdos_file_rmnod(rtems_filesystem_location_info_t *pathloc)
+msdos_file_rmnod(rtems_filesystem_location_info_t *parent_pathloc,
+                 rtems_filesystem_location_info_t *pathloc)
 {
     int                rc = RC_OK;
Index: cpukit/libfs/src/dosfs/msdos_format.c
===================================================================
--- cpukit/libfs/src/dosfs/msdos_format.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/dosfs/msdos_format.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -917,5 +917,5 @@
   /* check that  device is registered as block device and lock it */
   if (ret_val == 0) {
-    dd = rtems_disk_obtain(stat_buf.st_dev);
+    dd = rtems_disk_obtain(stat_buf.st_rdev);
     if (dd == NULL) {
       errno = ENOTBLK;
Index: cpukit/libfs/src/dosfs/msdos_misc.c
===================================================================
--- cpukit/libfs/src/dosfs/msdos_misc.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/dosfs/msdos_misc.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -228,5 +228,8 @@
  */
 msdos_token_types_t
-msdos_get_token(const char *path, const char **ret_token, int *ret_token_len)
+msdos_get_token(const char  *path,
+                int          pathlen,
+                const char **ret_token,
+                int         *ret_token_len)
 {
     msdos_token_types_t type = MSDOS_NAME;
@@ -239,5 +242,5 @@
      *  Check for a separator.
      */
-    while (!msdos_is_separator(path[i]))
+    while (!msdos_is_separator(path[i]) && (i < pathlen))
     {
         if ( !msdos_is_valid_name_char(path[i]) )
@@ -255,5 +258,5 @@
     if ( i == 0 )
     {
-        if ( *path != '\0' )
+      if ( (*path != '\0') && pathlen )
         {
             i++;
Index: cpukit/libfs/src/imfs/imfs.h
===================================================================
--- cpukit/libfs/src/imfs/imfs.h	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/imfs.h	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -278,4 +278,5 @@
 extern IMFS_token_types IMFS_get_token(
   const char       *path,
+  int               pathlen,
   char             *token,
   int              *token_len
@@ -317,4 +318,5 @@
 extern int IMFS_eval_path(
   const char                        *pathname,     /* IN     */
+  int                               pathnamelen,   /* IN     */
   int                               flags,         /* IN     */
   rtems_filesystem_location_info_t  *pathloc       /* IN/OUT */
@@ -329,5 +331,6 @@
 
 extern int IMFS_unlink(
-  rtems_filesystem_location_info_t  *pathloc       /* IN */
+  rtems_filesystem_location_info_t  *parent_pathloc, /* IN */
+  rtems_filesystem_location_info_t  *pathloc         /* IN */
 );
 
@@ -413,5 +416,6 @@
 
 extern int imfs_dir_rmnod(
-  rtems_filesystem_location_info_t      *pathloc       /* IN */
+  rtems_filesystem_location_info_t *parent_pathloc, /* IN */
+  rtems_filesystem_location_info_t *pathloc         /* IN */
 );
 
@@ -452,5 +456,6 @@
 
 extern int memfile_rmnod(
-  rtems_filesystem_location_info_t      *pathloc       /* IN */
+  rtems_filesystem_location_info_t  *parent_pathloc, /* IN */
+  rtems_filesystem_location_info_t  *pathloc         /* IN */
 );
 
@@ -528,5 +533,6 @@
 
 extern int IMFS_rmnod(
-  rtems_filesystem_location_info_t      *pathloc       /* IN */
+  rtems_filesystem_location_info_t  *parent_pathloc, /* IN */
+  rtems_filesystem_location_info_t  *pathloc         /* IN */
 );
 
Index: cpukit/libfs/src/imfs/imfs_directory.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_directory.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/imfs_directory.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -283,5 +283,6 @@
 
 int imfs_dir_rmnod(
-  rtems_filesystem_location_info_t      *pathloc       /* IN */
+  rtems_filesystem_location_info_t  *parent_pathloc, /* IN */
+  rtems_filesystem_location_info_t  *pathloc         /* IN */
 )
 {
Index: cpukit/libfs/src/imfs/imfs_eval.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_eval.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/imfs_eval.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -207,4 +207,5 @@
   result = IMFS_eval_path(
     &jnode->info.sym_link.name[i],
+    strlen( &jnode->info.sym_link.name[i] ),
     flags,
     node
@@ -295,4 +296,5 @@
   IMFS_jnode_t                       *node;
   bool                                done = false;
+  int                                 pathlen;
   int                                 result;
 
@@ -304,10 +306,15 @@
 
   /*
+   * Get the path length.
+   */
+  pathlen = strlen( path );
+  /*
    *  Evaluate all tokens until we are done or an error occurs.
    */
-
+  
   while( !done ) {
 
-    type = IMFS_get_token( &path[i], token, &len );
+    type = IMFS_get_token( &path[i], pathlen, token, &len );
+    pathlen -= len;
     i +=  len;
 
@@ -481,4 +488,5 @@
 int IMFS_eval_path(
   const char                        *pathname,     /* IN     */
+  int                                pathnamelen,  /* IN     */
   int                                flags,        /* IN     */
   rtems_filesystem_location_info_t  *pathloc       /* IN/OUT */
@@ -511,6 +519,7 @@
   while( (type != IMFS_NO_MORE_PATH) && (type != IMFS_INVALID_TOKEN) ) {
 
-    type = IMFS_get_token( &pathname[i], token, &len );
-    i +=  len;
+    type = IMFS_get_token( &pathname[i], pathnamelen, token, &len );
+    pathnamelen -= len;
+    i += len;
 
     if ( !pathloc->node_access )
@@ -552,5 +561,7 @@
             newloc = pathloc->mt_entry->mt_point_node;
             *pathloc = newloc;
-            return (*pathloc->ops->evalpath_h)(&(pathname[i-len]),flags,pathloc);
+            return (*pathloc->ops->evalpath_h)(&(pathname[i-len]),
+                                               pathnamelen+len,
+                                               flags,pathloc);
 	  }
 	} else {
@@ -604,5 +615,7 @@
           newloc   = node->info.directory.mt_fs->mt_fs_root;
           *pathloc = newloc;
-          return (*pathloc->ops->evalpath_h)( &pathname[i-len], flags, pathloc );
+          return (*pathloc->ops->evalpath_h)( &pathname[i-len],
+                                              pathnamelen+len,
+                                              flags, pathloc );
 	}
 
@@ -646,5 +659,7 @@
       newloc   = node->info.directory.mt_fs->mt_fs_root;
       *pathloc = newloc;
-      return (*pathloc->ops->evalpath_h)( &pathname[i-len], flags, pathloc );
+      return (*pathloc->ops->evalpath_h)( &pathname[i-len],
+                                          pathnamelen+len,
+                                          flags, pathloc );
     } else {
       result = IMFS_Set_handlers( pathloc );
Index: cpukit/libfs/src/imfs/imfs_fchmod.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_fchmod.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/imfs_fchmod.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -47,9 +47,7 @@
    * Change only the RWX permissions on the jnode to mode.
    */
-  if ( mode & (~ (S_IRWXU | S_IRWXG | S_IRWXO ) ) )
-    rtems_set_errno_and_return_minus_one( EPERM );
 
-  jnode->st_mode &= ~(S_IRWXU | S_IRWXG | S_IRWXO);
-  jnode->st_mode |= mode;
+  jnode->st_mode &= ~(S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX);
+  jnode->st_mode |= mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX);
 
   IMFS_update_ctime( jnode );
Index: cpukit/libfs/src/imfs/imfs_fsunmount.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_fsunmount.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/imfs_fsunmount.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -75,10 +75,10 @@
 
      if ( jnode->type != IMFS_DIRECTORY ) {
-        result = IMFS_unlink( &loc );
+        result = IMFS_unlink( NULL, &loc );
         if (result != 0)
           return -1;
         jnode = next;
      } else if ( jnode_has_no_children( jnode ) ) {
-        result = IMFS_unlink( &loc );
+        result = IMFS_unlink( NULL, &loc );
         if (result != 0)
           return -1;
Index: cpukit/libfs/src/imfs/imfs_gtkn.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_gtkn.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/imfs_gtkn.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -27,4 +27,5 @@
 IMFS_token_types IMFS_get_token(
   const char       *path,
+  int               pathlen,
   char             *token,
   int              *token_len
@@ -39,5 +40,5 @@
    */
   c = path[i];
-  while ( (!IMFS_is_separator(c)) && (i <= IMFS_NAME_MAX) ) {
+  while ( (!IMFS_is_separator(c)) && (i < pathlen) && (i <= IMFS_NAME_MAX) ) {
 
      token[i] = c;
@@ -59,5 +60,5 @@
     token[i] = c;
 
-    if ( token[i] != '\0' ) {
+    if ( (token[i] != '\0') && pathlen ) {
       i++;
       type = IMFS_CURRENT_DIR;
Index: cpukit/libfs/src/imfs/imfs_link.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_link.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/imfs_link.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -48,5 +48,5 @@
    */
 
-  IMFS_get_token( token, new_name, &i );
+  IMFS_get_token( token, strlen( token ), new_name, &i );
 
   /*
Index: cpukit/libfs/src/imfs/imfs_load_tar.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_load_tar.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/imfs_load_tar.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -93,5 +93,6 @@
    int             status;
 
-   status = rtems_filesystem_evaluate_path(mountpoint, 0, &root_loc, 0);
+   status = rtems_filesystem_evaluate_path(mountpoint, strlen(mountpoint),
+                                           0, &root_loc, 0);
    if (status != 0)
       return(-1);
Index: cpukit/libfs/src/imfs/imfs_mknod.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_mknod.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/imfs_mknod.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -42,5 +42,5 @@
   IMFS_types_union   info;
 
-  IMFS_get_token( token, new_name, &result );
+  IMFS_get_token( token, strlen( token ), new_name, &result );
 
   /*
Index: cpukit/libfs/src/imfs/imfs_rmnod.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_rmnod.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/imfs_rmnod.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -32,5 +32,6 @@
 
 int IMFS_rmnod(
-  rtems_filesystem_location_info_t      *pathloc       /* IN */
+  rtems_filesystem_location_info_t  *parent_pathloc, /* IN */
+  rtems_filesystem_location_info_t  *pathloc         /* IN */
 )
 {
Index: cpukit/libfs/src/imfs/imfs_stat.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_stat.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/imfs_stat.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -37,6 +37,6 @@
 
     case IMFS_DEVICE:
-      io          = &the_jnode->info.device;
-      buf->st_dev = rtems_filesystem_make_dev_t( io->major, io->minor );
+      io           = &the_jnode->info.device;
+      buf->st_rdev = rtems_filesystem_make_dev_t( io->major, io->minor );
       break;
 
Index: cpukit/libfs/src/imfs/imfs_symlink.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_symlink.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/imfs_symlink.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -42,5 +42,5 @@
    */
 
-  IMFS_get_token( node_name, new_name, &i );
+  IMFS_get_token( node_name, strlen( node_name ), new_name, &i );
 
   /*
Index: cpukit/libfs/src/imfs/imfs_unlink.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_unlink.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/imfs_unlink.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -26,5 +26,6 @@
 
 int IMFS_unlink(
-  rtems_filesystem_location_info_t  *loc       /* IN */
+  rtems_filesystem_location_info_t  *parentloc, /* IN */
+  rtems_filesystem_location_info_t  *loc        /* IN */
 )
 {
@@ -61,5 +62,5 @@
     if ( node->info.hard_link.link_node->st_nlink == 1)
     {
-        result = (*the_link.handlers->rmnod_h)( &the_link );
+        result = (*the_link.handlers->rmnod_h)( parentloc, &the_link );
         if ( result != 0 )
             return -1;
@@ -76,5 +77,5 @@
    */
 
-  result = (*loc->handlers->rmnod_h)( loc );
+  result = (*loc->handlers->rmnod_h)( parentloc, loc );
 
   return result;
Index: cpukit/libfs/src/imfs/ioman.c
===================================================================
--- cpukit/libfs/src/imfs/ioman.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/ioman.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -81,5 +81,5 @@
   rtems_filesystem_node_types_t      node_type;
 
-  result = rtems_filesystem_evaluate_path( name, 0x00, &loc, true );
+  result = rtems_filesystem_evaluate_path( name, strlen( name ), 0x00, &loc, true );
   the_jnode = loc.node_access;
 
Index: cpukit/libfs/src/imfs/memfile.c
===================================================================
--- cpukit/libfs/src/imfs/memfile.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/imfs/memfile.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -1106,5 +1106,6 @@
 
 int memfile_rmnod(
-  rtems_filesystem_location_info_t      *pathloc       /* IN */
+  rtems_filesystem_location_info_t  *parent_pathloc,  /* IN */
+  rtems_filesystem_location_info_t  *pathloc          /* IN */
 )
 {
Index: cpukit/libfs/src/nfsclient/src/nfs.c
===================================================================
--- cpukit/libfs/src/nfsclient/src/nfs.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/nfsclient/src/nfs.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -1356,4 +1356,5 @@
 STATIC int nfs_do_evalpath(
 	const char                        *pathname,      /* IN     */
+	int                                pathnamelen,   /* IN     */
 	void                              *arg,
 	rtems_filesystem_location_info_t  *pathloc,       /* IN/OUT */
@@ -1376,5 +1377,6 @@
 		goto cleanup;
 	}
-	strcpy(p, pathname);
+	memset(p, 0, MAXPATHLEN+1);
+	memcpy(p, pathname, pathnamelen);
 
 	LOCK(nfsGlob.lock);
@@ -1511,5 +1513,5 @@
 				rval = pathloc->ops->evalformake_h(part, pathloc, (const char**)arg);
 			else
-				rval = pathloc->ops->evalpath_h(part, (int)arg, pathloc);
+				rval = pathloc->ops->evalpath_h(part, strlen(part), (int)arg, pathloc);
 
 			free(p);
@@ -1668,14 +1670,15 @@
 )
 {
-	return nfs_do_evalpath(path, (void*)pname, pathloc, 1 /*forMake*/);
+	return nfs_do_evalpath(path, strlen(path), (void*)pname, pathloc, 1 /*forMake*/);
 }
 
 static int nfs_evalpath(
 	const char						 *path,		  /* IN */
+	int								 pathlen,		  /* IN */
 	int								 flags,		  /* IN */
 	rtems_filesystem_location_info_t *pathloc    /* IN/OUT */
 )
 {
-	return nfs_do_evalpath(path, (void*)flags, pathloc, 0 /*not forMake*/);
+	return nfs_do_evalpath(path, pathlen, (void*)flags, pathloc, 0 /*not forMake*/);
 }
 
@@ -1730,5 +1733,6 @@
 
 static int nfs_do_unlink(
-	rtems_filesystem_location_info_t  *loc,       /* IN */
+	rtems_filesystem_location_info_t  *parent_loc,/* IN */
+  rtems_filesystem_location_info_t  *loc,       /* IN */
 	int								  proc
 )
@@ -1769,8 +1773,9 @@
 
 static int nfs_unlink(
-	rtems_filesystem_location_info_t  *loc       /* IN */
+ rtems_filesystem_location_info_t  *parent_loc, /* IN */
+ rtems_filesystem_location_info_t  *loc         /* IN */
 )
 {
-	return nfs_do_unlink(loc, NFSPROC_REMOVE);
+	return nfs_do_unlink(parent_loc, loc, NFSPROC_REMOVE);
 }
 
@@ -2358,5 +2363,5 @@
 				pathloc->handlers = &nfs_dir_file_handlers;
 
-				err = nfs_evalpath(buf, flags, pathloc);
+				err = nfs_evalpath(buf, strlen(buf), flags, pathloc);
 
 				/* according to its semantics,
@@ -2399,5 +2404,5 @@
 			rtems_filesystem_freenode(pathloc);
 
-			if (rtems_filesystem_evaluate_path(buf, flags, pathloc, 1)) {
+			if (rtems_filesystem_evaluate_path(buf, strlen(buf), flags, pathloc, 1)) {
 				/* If evalpath fails then there is no valid node
 				 * attached to pathloc; hence we must not attempt
@@ -3080,8 +3085,9 @@
  */
 static int nfs_dir_rmnod(
-	rtems_filesystem_location_info_t      *pathloc       /* IN */
+	rtems_filesystem_location_info_t      *parentpathloc, /* IN */
+	rtems_filesystem_location_info_t      *pathloc        /* IN */
 )
 {
-	return nfs_do_unlink(pathloc, NFSPROC_RMDIR);
+	return nfs_do_unlink(parentpathloc, pathloc, NFSPROC_RMDIR);
 }
 
Index: cpukit/libfs/src/pipe/pipe.c
===================================================================
--- cpukit/libfs/src/pipe/pipe.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libfs/src/pipe/pipe.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -31,5 +31,5 @@
 
   /* Create /tmp if not exists */
-  if (rtems_filesystem_evaluate_path("/tmp", RTEMS_LIBIO_PERMS_RWX, &loc, TRUE)
+  if (rtems_filesystem_evaluate_path("/tmp", 3, RTEMS_LIBIO_PERMS_RWX, &loc, TRUE)
       != 0) {
     if (errno != ENOENT)
Index: cpukit/libmisc/fsmount/fsmount.c
===================================================================
--- cpukit/libmisc/fsmount/fsmount.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libmisc/fsmount/fsmount.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -77,5 +77,6 @@
      * scan through given string, one segment at a time
      */
-    token_type = IMFS_get_token(mount_point+total_len,token,&token_len);
+    token_type = IMFS_get_token(mount_point+total_len,strlen(mount_point+total_len),
+                                token,&token_len);
     total_len += token_len;
     strncpy(tok_buffer,mount_point,total_len);
Index: cpukit/libmisc/shell/internal.h
===================================================================
--- cpukit/libmisc/shell/internal.h	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libmisc/shell/internal.h	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -30,11 +30,4 @@
 void rtems_shell_initialize_command_set(void);
 
-int rtems_shell_libc_mounter(
-  const char*                driver,
-  const char*                path,
-  rtems_shell_filesystems_t* fs,
-  rtems_filesystem_options_t options
-);
-
 void rtems_shell_print_heap_info(
   const char       *c,
Index: cpukit/libmisc/shell/main_mount.c
===================================================================
--- cpukit/libmisc/shell/main_mount.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libmisc/shell/main_mount.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -28,4 +28,28 @@
 #include <rtems/fsmount.h>
 #include "internal.h"
+
+static rtems_chain_control filesystems;
+static bool                fs_init;
+
+static void rtems_shell_mount_fsys_init()
+{
+  if (!fs_init)
+  {
+    rtems_chain_initialize_empty (&filesystems);
+    fs_init = true;
+  }
+}
+
+void rtems_shell_mount_add_fsys(rtems_shell_filesystems_t* fs)
+{
+  rtems_shell_mount_fsys_init();
+  rtems_chain_append (&filesystems, &fs->link);
+}
+
+void rtems_shell_mount_del_fsys(rtems_shell_filesystems_t* fs)
+{
+  if (fs_init)
+    rtems_chain_extract (&fs->link);
+}
 
 int rtems_shell_libc_mounter(
@@ -61,4 +85,6 @@
   char*                      mount_point = NULL;
   int                        arg;
+
+  rtems_shell_mount_fsys_init();
   
   for (arg = 1; arg < argc; arg++) {
@@ -66,5 +92,5 @@
       if (argv[arg][1] == 't') {
         rtems_shell_filesystems_t** a;
-        
+
         arg++;
         if (arg == argc) {
@@ -81,4 +107,16 @@
             fs = *a;
             break;
+          }
+        }
+
+        if (!fs && !rtems_chain_is_empty(&filesystems)) {
+          rtems_chain_node* node = filesystems.first;
+          while (!rtems_chain_is_tail (&filesystems, node)) {
+            rtems_shell_filesystems_t* f = (rtems_shell_filesystems_t*)node;
+            if (strcmp (argv[arg], f->name) == 0) {
+              fs = f;
+              break;
+            }
+            node = node->next;
           }
         }
Index: cpukit/libmisc/shell/shell.h
===================================================================
--- cpukit/libmisc/shell/shell.h	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libmisc/shell/shell.h	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -25,4 +25,5 @@
 #include <rtems/fs.h>
 #include <rtems/libio.h>
+#include <rtems/chain.h>
 
 #ifdef __cplusplus
@@ -233,4 +234,5 @@
 
 struct rtems_shell_filesystems_tt {
+  rtems_chain_node                         link;
   const char                              *name;
   int                                      driver_needed;
@@ -258,4 +260,33 @@
 );
 
+/**
+ * Helper for the mount command.
+ *
+ * @param[in] driver The path to the driver.
+ * @param[in] path The path to mount on.
+ * @param[in] fs The file system definition.
+ * @param[in] options Special file system options.
+ */
+int rtems_shell_libc_mounter(
+  const char*                driver,
+  const char*                path,
+  rtems_shell_filesystems_t* fs,
+  rtems_filesystem_options_t options
+);
+
+/**
+ * Add a new file system mount configuration to the mount command.
+ *
+ * @param[in] fs The file system mount data.
+ */
+void rtems_shell_mount_add_fsys(rtems_shell_filesystems_t* fs);
+
+/**
+ * Delete file system mount configuration from the mount command.
+ *
+ * @param[in] fs The file system mount data to remove.
+ */
+void rtems_shell_mount_del_fsys(rtems_shell_filesystems_t* fs);
+
 #ifdef __cplusplus
 }
Index: cpukit/libnetworking/lib/ftpfs.c
===================================================================
--- cpukit/libnetworking/lib/ftpfs.c	(revision 9e06eb1e96b9deb9247120797ed68b214635c2be)
+++ cpukit/libnetworking/lib/ftpfs.c	(revision 7baa484300d36a9ced34f6642501f91fd1428461)
@@ -1184,4 +1184,5 @@
 static int rtems_ftpfs_eval_path(
   const char *pathname,
+  int pathnamelen,
   int flags,
   rtems_filesystem_location_info_t *pathloc
@@ -1193,4 +1194,9 @@
    * again.  The path is used in rtems_ftpfs_open() via iop->file_info.
    */
+  pathloc->node_access = malloc(pathnamelen + 1);
+  if (pathloc->node_access) {
+    memset(pathloc->node_access, 0, pathnamelen + 1);
+    memcpy(pathloc->node_access, pathname, pathnamelen);
+  }    
   pathloc->node_access = strdup( pathname);
 
