Index: c/src/exec/libfs/ChangeLog
===================================================================
--- c/src/exec/libfs/ChangeLog	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/ChangeLog	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -1,2 +1,37 @@
+2002-01-04	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+	* src/imfs/imfs_eval.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/memfile.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_readlink.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_unlink.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_link.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_chown.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/ioman.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_mount.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_directory.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_stat.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_fchmod.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_symlink.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_mknod.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/linearfile.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_unmount.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs.h: Apply rtems_set_errno_and_return_minus_one.
+	Comment out increment_and_check_linkcounts.
+
 2001-11-27	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
 
Index: c/src/exec/libfs/src/imfs/imfs.h
===================================================================
--- c/src/exec/libfs/src/imfs/imfs.h	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/imfs.h	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -208,8 +208,11 @@
 } IMFS_fs_info_t;
 
+#if UNUSED
+/* FIXME: Unused, we might want to remove it */
 #define increment_and_check_linkcounts( _fs_info )                  \
   ((IMFS_fs_info_t * )_fs_info)->link_counts++;                     \
   if ( ((IMFS_fs_info_t * )_fs_info)->link_counts  > MAXSYMLINKS )  \
-    set_errno_and_return_minus_one( ELOOP )
+    rtems_set_errno_and_return_minus_one( ELOOP )
+#endif
 
 #define decrement_linkcounts(  _fs_info )             \
Index: c/src/exec/libfs/src/imfs/imfs_chown.c
===================================================================
--- c/src/exec/libfs/src/imfs/imfs_chown.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/imfs_chown.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -21,4 +21,5 @@
 #include <errno.h>
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 #include "imfs.h"
 
@@ -44,5 +45,5 @@
 
   if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) )
-    set_errno_and_return_minus_one( EPERM );
+    rtems_set_errno_and_return_minus_one( EPERM );
 #endif
 
Index: c/src/exec/libfs/src/imfs/imfs_directory.c
===================================================================
--- c/src/exec/libfs/src/imfs/imfs_directory.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/imfs_directory.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -29,4 +29,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 /*
@@ -198,5 +199,5 @@
                       /* is not a permitted operation                     */
       default:
-        set_errno_and_return_minus_one( EINVAL );
+        rtems_set_errno_and_return_minus_one( EINVAL );
         break;
   }
@@ -294,5 +295,5 @@
 
   if ( ! Chain_Is_empty( &the_jnode->info.directory.Entries ) )
-     set_errno_and_return_minus_one( ENOTEMPTY );
+     rtems_set_errno_and_return_minus_one( ENOTEMPTY );
 
   /* 
@@ -301,5 +302,5 @@
 
   if ( pathloc->mt_entry->mt_fs_root.node_access == pathloc->node_access )
-     set_errno_and_return_minus_one( EBUSY );
+     rtems_set_errno_and_return_minus_one( EBUSY );
 
   /* 
@@ -308,5 +309,5 @@
 
    if ( the_jnode->info.directory.mt_fs != NULL )
-     set_errno_and_return_minus_one( EBUSY );          
+     rtems_set_errno_and_return_minus_one( EBUSY );          
  
   /* 
Index: c/src/exec/libfs/src/imfs/imfs_eval.c
===================================================================
--- c/src/exec/libfs/src/imfs/imfs_eval.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/imfs_eval.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -26,4 +26,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 #define RTEMS_LIBIO_PERMS_RX (RTEMS_LIBIO_PERMS_SEARCH | RTEMS_LIBIO_PERMS_READ)
@@ -81,5 +82,5 @@
   if ( !rtems_libio_is_valid_perms( flags ) ) {
     assert( 0 );
-    set_errno_and_return_minus_one( EIO );    
+    rtems_set_errno_and_return_minus_one( EIO );    
   }
 
@@ -151,5 +152,5 @@
 
   if ( !IMFS_evaluate_permission( node, flags ) )
-    set_errno_and_return_minus_one( EACCES );
+    rtems_set_errno_and_return_minus_one( EACCES );
 
   return result;
@@ -213,5 +214,5 @@
 
   if ( !IMFS_evaluate_permission( node, flags ) )
-    set_errno_and_return_minus_one( EACCES );
+    rtems_set_errno_and_return_minus_one( EACCES );
 
   return result;
@@ -242,5 +243,5 @@
     if ( rtems_filesystem_link_counts > MAXSYMLINK ) {
       rtems_filesystem_link_counts = 0;
-      set_errno_and_return_minus_one( ELOOP );
+      rtems_set_errno_and_return_minus_one( ELOOP );
     }
 
@@ -308,5 +309,5 @@
     
     if ( !pathloc->node_access )
-      set_errno_and_return_minus_one( ENOENT );
+      rtems_set_errno_and_return_minus_one( ENOENT );
 
     /*
@@ -317,5 +318,5 @@
       if ( node->type == IMFS_DIRECTORY )
         if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
-           set_errno_and_return_minus_one( EACCES );
+           rtems_set_errno_and_return_minus_one( EACCES );
 
     node = pathloc->node_access;
@@ -353,5 +354,5 @@
 
           if ( !node->Parent )
-            set_errno_and_return_minus_one( ENOENT );
+            rtems_set_errno_and_return_minus_one( ENOENT );
 
           node = node->Parent;
@@ -379,5 +380,5 @@
         node = pathloc->node_access;
         if ( !node )
-          set_errno_and_return_minus_one( ENOTDIR ); 
+          rtems_set_errno_and_return_minus_one( ENOTDIR ); 
 
         /*
@@ -386,5 +387,5 @@
 
         if ( node->type != IMFS_DIRECTORY )
-          set_errno_and_return_minus_one( ENOTDIR );
+          rtems_set_errno_and_return_minus_one( ENOTDIR );
 
 	/*
@@ -418,9 +419,9 @@
  
       case IMFS_NO_MORE_PATH:
-        set_errno_and_return_minus_one( EEXIST );
+        rtems_set_errno_and_return_minus_one( EEXIST );
         break;
 
       case IMFS_INVALID_TOKEN:
-        set_errno_and_return_minus_one( ENAMETOOLONG );
+        rtems_set_errno_and_return_minus_one( ENAMETOOLONG );
         break;
 
@@ -439,5 +440,5 @@
   for( ; path[i] != '\0'; i++) {
     if ( !IMFS_is_separator( path[ i ] ) ) 
-      set_errno_and_return_minus_one( ENOENT );
+      rtems_set_errno_and_return_minus_one( ENOENT );
   }
 
@@ -453,5 +454,5 @@
   node = pathloc->node_access;
   if ( node->type != IMFS_DIRECTORY )
-    set_errno_and_return_minus_one( ENOTDIR );
+    rtems_set_errno_and_return_minus_one( ENOTDIR );
 
   /*
@@ -460,5 +461,5 @@
 
   if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_WX ) )
-    set_errno_and_return_minus_one( EACCES );
+    rtems_set_errno_and_return_minus_one( EACCES );
   
   return result;
@@ -490,5 +491,5 @@
   if ( !rtems_libio_is_valid_perms( flags ) ) {
     assert( 0 );
-    set_errno_and_return_minus_one( EIO );    
+    rtems_set_errno_and_return_minus_one( EIO );    
   }
 
@@ -510,5 +511,5 @@
     
     if ( !pathloc->node_access )
-      set_errno_and_return_minus_one( ENOENT );
+      rtems_set_errno_and_return_minus_one( ENOENT );
 
     /*
@@ -518,5 +519,5 @@
       if ( node->type == IMFS_DIRECTORY )
         if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
-           set_errno_and_return_minus_one( EACCES );
+           rtems_set_errno_and_return_minus_one( EACCES );
 
     node = pathloc->node_access;
@@ -552,5 +553,5 @@
 
           if ( !node->Parent )
-            set_errno_and_return_minus_one( ENOENT );
+            rtems_set_errno_and_return_minus_one( ENOENT );
 
           node = node->Parent;
@@ -573,5 +574,5 @@
           node = pathloc->node_access;
           if ( !node )
-            set_errno_and_return_minus_one( ENOTDIR );
+            rtems_set_errno_and_return_minus_one( ENOTDIR );
 
 	} else if ( node->type == IMFS_SYM_LINK ) {
@@ -589,5 +590,5 @@
 
        if ( node->type != IMFS_DIRECTORY )
-          set_errno_and_return_minus_one( ENOTDIR );
+          rtems_set_errno_and_return_minus_one( ENOTDIR );
 
 	/*
@@ -608,5 +609,5 @@
         node = IMFS_find_match_in_dir( node, token );
         if ( !node )
-          set_errno_and_return_minus_one( ENOENT );
+          rtems_set_errno_and_return_minus_one( ENOENT );
 
 	/*
@@ -622,5 +623,5 @@
 
       case IMFS_INVALID_TOKEN:
-        set_errno_and_return_minus_one( ENAMETOOLONG );
+        rtems_set_errno_and_return_minus_one( ENAMETOOLONG );
         break;
 
@@ -654,5 +655,5 @@
 
   if ( !IMFS_evaluate_permission( pathloc, flags ) )
-    set_errno_and_return_minus_one( EACCES );
+    rtems_set_errno_and_return_minus_one( EACCES );
 
   return result;
Index: c/src/exec/libfs/src/imfs/imfs_fchmod.c
===================================================================
--- c/src/exec/libfs/src/imfs/imfs_fchmod.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/imfs_fchmod.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -19,4 +19,5 @@
 
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 #include "imfs.h"
 
@@ -40,5 +41,5 @@
 
   if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) )
-    set_errno_and_return_minus_one( EPERM );
+    rtems_set_errno_and_return_minus_one( EPERM );
 #endif
 
@@ -47,5 +48,5 @@
    */
   if ( mode & (~ (S_IRWXU | S_IRWXG | S_IRWXO ) ) )
-    set_errno_and_return_minus_one( EPERM );
+    rtems_set_errno_and_return_minus_one( EPERM );
 
   /*
Index: c/src/exec/libfs/src/imfs/imfs_link.c
===================================================================
--- c/src/exec/libfs/src/imfs/imfs_link.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/imfs_link.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -23,4 +23,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_link(
@@ -41,5 +42,5 @@
   info.hard_link.link_node = to_loc->node_access;
   if ( info.hard_link.link_node->st_nlink >= LINK_MAX )
-    set_errno_and_return_minus_one( EMLINK );
+    rtems_set_errno_and_return_minus_one( EMLINK );
  
   /*
@@ -62,5 +63,5 @@
 
   if ( !new_node )
-    set_errno_and_return_minus_one( ENOMEM );
+    rtems_set_errno_and_return_minus_one( ENOMEM );
 
   /*
Index: c/src/exec/libfs/src/imfs/imfs_mknod.c
===================================================================
--- c/src/exec/libfs/src/imfs/imfs_mknod.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/imfs_mknod.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -27,4 +27,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_mknod(
@@ -55,5 +56,5 @@
     rtems_filesystem_split_dev_t( dev, info.device.major, info.device.minor );
   } else  {
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
   }
  
@@ -71,5 +72,5 @@
 
   if ( !new_node )
-    set_errno_and_return_minus_one( ENOMEM );
+    rtems_set_errno_and_return_minus_one( ENOMEM );
 
   return 0;
Index: c/src/exec/libfs/src/imfs/imfs_mount.c
===================================================================
--- c/src/exec/libfs/src/imfs/imfs_mount.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/imfs_mount.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -27,4 +27,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_mount(
@@ -41,5 +42,5 @@
   
   if ( node->type != IMFS_DIRECTORY )
-    set_errno_and_return_minus_one( ENOTDIR );
+    rtems_set_errno_and_return_minus_one( ENOTDIR );
 
   /*
Index: c/src/exec/libfs/src/imfs/imfs_readlink.c
===================================================================
--- c/src/exec/libfs/src/imfs/imfs_readlink.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/imfs_readlink.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -22,4 +22,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_readlink(
@@ -35,5 +36,5 @@
 
   if ( node->type != IMFS_SYM_LINK )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   for( i=0; ((i<bufsize) && (node->info.sym_link.name[i] != '\0')); i++ )
Index: c/src/exec/libfs/src/imfs/imfs_stat.c
===================================================================
--- c/src/exec/libfs/src/imfs/imfs_stat.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/imfs_stat.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -21,4 +21,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_stat(
@@ -50,5 +51,5 @@
    
     default:
-      set_errno_and_return_minus_one( ENOTSUP );
+      rtems_set_errno_and_return_minus_one( ENOTSUP );
       break;
   }
Index: c/src/exec/libfs/src/imfs/imfs_symlink.c
===================================================================
--- c/src/exec/libfs/src/imfs/imfs_symlink.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/imfs_symlink.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -23,4 +23,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_symlink(
@@ -56,5 +57,5 @@
 
   if ( !new_node )
-    set_errno_and_return_minus_one( ENOMEM );
+    rtems_set_errno_and_return_minus_one( ENOMEM );
 
   return 0;
Index: c/src/exec/libfs/src/imfs/imfs_unlink.c
===================================================================
--- c/src/exec/libfs/src/imfs/imfs_unlink.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/imfs_unlink.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -23,4 +23,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_unlink(
@@ -47,5 +48,5 @@
 
     if ( !node->info.hard_link.link_node )
-      set_errno_and_return_minus_one( EINVAL );
+      rtems_set_errno_and_return_minus_one( EINVAL );
 
     the_link = *loc;
Index: c/src/exec/libfs/src/imfs/imfs_unmount.c
===================================================================
--- c/src/exec/libfs/src/imfs/imfs_unmount.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/imfs_unmount.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -28,4 +28,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_unmount(
@@ -42,5 +43,5 @@
 
   if ( node->type != IMFS_DIRECTORY )
-    set_errno_and_return_minus_one( ENOTDIR );
+    rtems_set_errno_and_return_minus_one( ENOTDIR );
 
   /* 
@@ -49,5 +50,5 @@
 
   if ( node->info.directory.mt_fs == NULL )
-    set_errno_and_return_minus_one( EINVAL );  /* XXX */
+    rtems_set_errno_and_return_minus_one( EINVAL );  /* XXX */
 
   /* 
Index: c/src/exec/libfs/src/imfs/ioman.c
===================================================================
--- c/src/exec/libfs/src/imfs/ioman.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/ioman.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -26,4 +26,5 @@
 #include <rtems.h>
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 #include "imfs.h"
 
@@ -85,5 +86,5 @@
   if ( !loc.ops->node_type_h ) {
     rtems_filesystem_freenode( &loc );
-    set_errno_and_return_minus_one( ENOTSUP );
+    rtems_set_errno_and_return_minus_one( ENOTSUP );
   }
 
Index: c/src/exec/libfs/src/imfs/linearfile.c
===================================================================
--- c/src/exec/libfs/src/imfs/linearfile.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/linearfile.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -29,4 +29,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 /*
@@ -56,9 +57,9 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_LINEAR_FILE );
   if ( the_jnode->type != IMFS_LINEAR_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   /*
@@ -69,5 +70,5 @@
   assert( dest );
   if ( !dest )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   /*
Index: c/src/exec/libfs/src/imfs/memfile.c
===================================================================
--- c/src/exec/libfs/src/imfs/memfile.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/exec/libfs/src/imfs/memfile.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -30,4 +30,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 #define MEMFILE_STATIC 
@@ -209,5 +210,5 @@
   else {  /* Must be a block file (IMFS_MEMORY_FILE). */
     if (IMFS_memfile_extend( the_jnode, iop->offset ))
-      set_errno_and_return_minus_one( ENOSPC );
+      rtems_set_errno_and_return_minus_one( ENOSPC );
 
     iop->size = the_jnode->info.file.size;
@@ -283,12 +284,12 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   if ( new_length >= IMFS_MEMFILE_MAXIMUM_SIZE )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   if ( new_length <= the_jnode->info.file.size )
@@ -311,5 +312,5 @@
           IMFS_memfile_remove_block( the_jnode, block );
        }
-       set_errno_and_return_minus_one( ENOSPC );
+       rtems_set_errno_and_return_minus_one( ENOSPC );
     }
   }
@@ -339,9 +340,9 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   block_entry_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 1 );
@@ -470,9 +471,9 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   /*
@@ -564,5 +565,5 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE ||
@@ -570,5 +571,5 @@
   if ( the_jnode->type != IMFS_MEMORY_FILE &&
        the_jnode->type != IMFS_LINEAR_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   /*
@@ -578,5 +579,5 @@
   assert( dest );
   if ( !dest )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   /*
@@ -586,5 +587,5 @@
   my_length = length;
   if ( !my_length )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   /*
@@ -715,9 +716,9 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   /*
@@ -727,5 +728,5 @@
   assert( source );
   if ( !source )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
 
@@ -736,5 +737,5 @@
   my_length = length;
   if ( !my_length )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   /*
@@ -747,5 +748,5 @@
     status = IMFS_memfile_extend( the_jnode, last_byte );
     if ( status )
-      set_errno_and_return_minus_one( ENOSPC );
+      rtems_set_errno_and_return_minus_one( ENOSPC );
   }
 
Index: c/src/libfs/ChangeLog
===================================================================
--- c/src/libfs/ChangeLog	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/ChangeLog	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -1,2 +1,37 @@
+2002-01-04	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+	* src/imfs/imfs_eval.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/memfile.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_readlink.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_unlink.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_link.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_chown.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/ioman.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_mount.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_directory.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_stat.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_fchmod.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_symlink.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_mknod.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/linearfile.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_unmount.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs.h: Apply rtems_set_errno_and_return_minus_one.
+	Comment out increment_and_check_linkcounts.
+
 2001-11-27	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
 
Index: c/src/libfs/src/imfs/imfs.h
===================================================================
--- c/src/libfs/src/imfs/imfs.h	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/imfs.h	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -208,8 +208,11 @@
 } IMFS_fs_info_t;
 
+#if UNUSED
+/* FIXME: Unused, we might want to remove it */
 #define increment_and_check_linkcounts( _fs_info )                  \
   ((IMFS_fs_info_t * )_fs_info)->link_counts++;                     \
   if ( ((IMFS_fs_info_t * )_fs_info)->link_counts  > MAXSYMLINKS )  \
-    set_errno_and_return_minus_one( ELOOP )
+    rtems_set_errno_and_return_minus_one( ELOOP )
+#endif
 
 #define decrement_linkcounts(  _fs_info )             \
Index: c/src/libfs/src/imfs/imfs_chown.c
===================================================================
--- c/src/libfs/src/imfs/imfs_chown.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/imfs_chown.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -21,4 +21,5 @@
 #include <errno.h>
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 #include "imfs.h"
 
@@ -44,5 +45,5 @@
 
   if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) )
-    set_errno_and_return_minus_one( EPERM );
+    rtems_set_errno_and_return_minus_one( EPERM );
 #endif
 
Index: c/src/libfs/src/imfs/imfs_directory.c
===================================================================
--- c/src/libfs/src/imfs/imfs_directory.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/imfs_directory.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -29,4 +29,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 /*
@@ -198,5 +199,5 @@
                       /* is not a permitted operation                     */
       default:
-        set_errno_and_return_minus_one( EINVAL );
+        rtems_set_errno_and_return_minus_one( EINVAL );
         break;
   }
@@ -294,5 +295,5 @@
 
   if ( ! Chain_Is_empty( &the_jnode->info.directory.Entries ) )
-     set_errno_and_return_minus_one( ENOTEMPTY );
+     rtems_set_errno_and_return_minus_one( ENOTEMPTY );
 
   /* 
@@ -301,5 +302,5 @@
 
   if ( pathloc->mt_entry->mt_fs_root.node_access == pathloc->node_access )
-     set_errno_and_return_minus_one( EBUSY );
+     rtems_set_errno_and_return_minus_one( EBUSY );
 
   /* 
@@ -308,5 +309,5 @@
 
    if ( the_jnode->info.directory.mt_fs != NULL )
-     set_errno_and_return_minus_one( EBUSY );          
+     rtems_set_errno_and_return_minus_one( EBUSY );          
  
   /* 
Index: c/src/libfs/src/imfs/imfs_eval.c
===================================================================
--- c/src/libfs/src/imfs/imfs_eval.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/imfs_eval.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -26,4 +26,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 #define RTEMS_LIBIO_PERMS_RX (RTEMS_LIBIO_PERMS_SEARCH | RTEMS_LIBIO_PERMS_READ)
@@ -81,5 +82,5 @@
   if ( !rtems_libio_is_valid_perms( flags ) ) {
     assert( 0 );
-    set_errno_and_return_minus_one( EIO );    
+    rtems_set_errno_and_return_minus_one( EIO );    
   }
 
@@ -151,5 +152,5 @@
 
   if ( !IMFS_evaluate_permission( node, flags ) )
-    set_errno_and_return_minus_one( EACCES );
+    rtems_set_errno_and_return_minus_one( EACCES );
 
   return result;
@@ -213,5 +214,5 @@
 
   if ( !IMFS_evaluate_permission( node, flags ) )
-    set_errno_and_return_minus_one( EACCES );
+    rtems_set_errno_and_return_minus_one( EACCES );
 
   return result;
@@ -242,5 +243,5 @@
     if ( rtems_filesystem_link_counts > MAXSYMLINK ) {
       rtems_filesystem_link_counts = 0;
-      set_errno_and_return_minus_one( ELOOP );
+      rtems_set_errno_and_return_minus_one( ELOOP );
     }
 
@@ -308,5 +309,5 @@
     
     if ( !pathloc->node_access )
-      set_errno_and_return_minus_one( ENOENT );
+      rtems_set_errno_and_return_minus_one( ENOENT );
 
     /*
@@ -317,5 +318,5 @@
       if ( node->type == IMFS_DIRECTORY )
         if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
-           set_errno_and_return_minus_one( EACCES );
+           rtems_set_errno_and_return_minus_one( EACCES );
 
     node = pathloc->node_access;
@@ -353,5 +354,5 @@
 
           if ( !node->Parent )
-            set_errno_and_return_minus_one( ENOENT );
+            rtems_set_errno_and_return_minus_one( ENOENT );
 
           node = node->Parent;
@@ -379,5 +380,5 @@
         node = pathloc->node_access;
         if ( !node )
-          set_errno_and_return_minus_one( ENOTDIR ); 
+          rtems_set_errno_and_return_minus_one( ENOTDIR ); 
 
         /*
@@ -386,5 +387,5 @@
 
         if ( node->type != IMFS_DIRECTORY )
-          set_errno_and_return_minus_one( ENOTDIR );
+          rtems_set_errno_and_return_minus_one( ENOTDIR );
 
 	/*
@@ -418,9 +419,9 @@
  
       case IMFS_NO_MORE_PATH:
-        set_errno_and_return_minus_one( EEXIST );
+        rtems_set_errno_and_return_minus_one( EEXIST );
         break;
 
       case IMFS_INVALID_TOKEN:
-        set_errno_and_return_minus_one( ENAMETOOLONG );
+        rtems_set_errno_and_return_minus_one( ENAMETOOLONG );
         break;
 
@@ -439,5 +440,5 @@
   for( ; path[i] != '\0'; i++) {
     if ( !IMFS_is_separator( path[ i ] ) ) 
-      set_errno_and_return_minus_one( ENOENT );
+      rtems_set_errno_and_return_minus_one( ENOENT );
   }
 
@@ -453,5 +454,5 @@
   node = pathloc->node_access;
   if ( node->type != IMFS_DIRECTORY )
-    set_errno_and_return_minus_one( ENOTDIR );
+    rtems_set_errno_and_return_minus_one( ENOTDIR );
 
   /*
@@ -460,5 +461,5 @@
 
   if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_WX ) )
-    set_errno_and_return_minus_one( EACCES );
+    rtems_set_errno_and_return_minus_one( EACCES );
   
   return result;
@@ -490,5 +491,5 @@
   if ( !rtems_libio_is_valid_perms( flags ) ) {
     assert( 0 );
-    set_errno_and_return_minus_one( EIO );    
+    rtems_set_errno_and_return_minus_one( EIO );    
   }
 
@@ -510,5 +511,5 @@
     
     if ( !pathloc->node_access )
-      set_errno_and_return_minus_one( ENOENT );
+      rtems_set_errno_and_return_minus_one( ENOENT );
 
     /*
@@ -518,5 +519,5 @@
       if ( node->type == IMFS_DIRECTORY )
         if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
-           set_errno_and_return_minus_one( EACCES );
+           rtems_set_errno_and_return_minus_one( EACCES );
 
     node = pathloc->node_access;
@@ -552,5 +553,5 @@
 
           if ( !node->Parent )
-            set_errno_and_return_minus_one( ENOENT );
+            rtems_set_errno_and_return_minus_one( ENOENT );
 
           node = node->Parent;
@@ -573,5 +574,5 @@
           node = pathloc->node_access;
           if ( !node )
-            set_errno_and_return_minus_one( ENOTDIR );
+            rtems_set_errno_and_return_minus_one( ENOTDIR );
 
 	} else if ( node->type == IMFS_SYM_LINK ) {
@@ -589,5 +590,5 @@
 
        if ( node->type != IMFS_DIRECTORY )
-          set_errno_and_return_minus_one( ENOTDIR );
+          rtems_set_errno_and_return_minus_one( ENOTDIR );
 
 	/*
@@ -608,5 +609,5 @@
         node = IMFS_find_match_in_dir( node, token );
         if ( !node )
-          set_errno_and_return_minus_one( ENOENT );
+          rtems_set_errno_and_return_minus_one( ENOENT );
 
 	/*
@@ -622,5 +623,5 @@
 
       case IMFS_INVALID_TOKEN:
-        set_errno_and_return_minus_one( ENAMETOOLONG );
+        rtems_set_errno_and_return_minus_one( ENAMETOOLONG );
         break;
 
@@ -654,5 +655,5 @@
 
   if ( !IMFS_evaluate_permission( pathloc, flags ) )
-    set_errno_and_return_minus_one( EACCES );
+    rtems_set_errno_and_return_minus_one( EACCES );
 
   return result;
Index: c/src/libfs/src/imfs/imfs_fchmod.c
===================================================================
--- c/src/libfs/src/imfs/imfs_fchmod.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/imfs_fchmod.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -19,4 +19,5 @@
 
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 #include "imfs.h"
 
@@ -40,5 +41,5 @@
 
   if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) )
-    set_errno_and_return_minus_one( EPERM );
+    rtems_set_errno_and_return_minus_one( EPERM );
 #endif
 
@@ -47,5 +48,5 @@
    */
   if ( mode & (~ (S_IRWXU | S_IRWXG | S_IRWXO ) ) )
-    set_errno_and_return_minus_one( EPERM );
+    rtems_set_errno_and_return_minus_one( EPERM );
 
   /*
Index: c/src/libfs/src/imfs/imfs_link.c
===================================================================
--- c/src/libfs/src/imfs/imfs_link.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/imfs_link.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -23,4 +23,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_link(
@@ -41,5 +42,5 @@
   info.hard_link.link_node = to_loc->node_access;
   if ( info.hard_link.link_node->st_nlink >= LINK_MAX )
-    set_errno_and_return_minus_one( EMLINK );
+    rtems_set_errno_and_return_minus_one( EMLINK );
  
   /*
@@ -62,5 +63,5 @@
 
   if ( !new_node )
-    set_errno_and_return_minus_one( ENOMEM );
+    rtems_set_errno_and_return_minus_one( ENOMEM );
 
   /*
Index: c/src/libfs/src/imfs/imfs_mknod.c
===================================================================
--- c/src/libfs/src/imfs/imfs_mknod.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/imfs_mknod.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -27,4 +27,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_mknod(
@@ -55,5 +56,5 @@
     rtems_filesystem_split_dev_t( dev, info.device.major, info.device.minor );
   } else  {
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
   }
  
@@ -71,5 +72,5 @@
 
   if ( !new_node )
-    set_errno_and_return_minus_one( ENOMEM );
+    rtems_set_errno_and_return_minus_one( ENOMEM );
 
   return 0;
Index: c/src/libfs/src/imfs/imfs_mount.c
===================================================================
--- c/src/libfs/src/imfs/imfs_mount.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/imfs_mount.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -27,4 +27,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_mount(
@@ -41,5 +42,5 @@
   
   if ( node->type != IMFS_DIRECTORY )
-    set_errno_and_return_minus_one( ENOTDIR );
+    rtems_set_errno_and_return_minus_one( ENOTDIR );
 
   /*
Index: c/src/libfs/src/imfs/imfs_readlink.c
===================================================================
--- c/src/libfs/src/imfs/imfs_readlink.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/imfs_readlink.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -22,4 +22,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_readlink(
@@ -35,5 +36,5 @@
 
   if ( node->type != IMFS_SYM_LINK )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   for( i=0; ((i<bufsize) && (node->info.sym_link.name[i] != '\0')); i++ )
Index: c/src/libfs/src/imfs/imfs_stat.c
===================================================================
--- c/src/libfs/src/imfs/imfs_stat.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/imfs_stat.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -21,4 +21,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_stat(
@@ -50,5 +51,5 @@
    
     default:
-      set_errno_and_return_minus_one( ENOTSUP );
+      rtems_set_errno_and_return_minus_one( ENOTSUP );
       break;
   }
Index: c/src/libfs/src/imfs/imfs_symlink.c
===================================================================
--- c/src/libfs/src/imfs/imfs_symlink.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/imfs_symlink.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -23,4 +23,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_symlink(
@@ -56,5 +57,5 @@
 
   if ( !new_node )
-    set_errno_and_return_minus_one( ENOMEM );
+    rtems_set_errno_and_return_minus_one( ENOMEM );
 
   return 0;
Index: c/src/libfs/src/imfs/imfs_unlink.c
===================================================================
--- c/src/libfs/src/imfs/imfs_unlink.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/imfs_unlink.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -23,4 +23,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_unlink(
@@ -47,5 +48,5 @@
 
     if ( !node->info.hard_link.link_node )
-      set_errno_and_return_minus_one( EINVAL );
+      rtems_set_errno_and_return_minus_one( EINVAL );
 
     the_link = *loc;
Index: c/src/libfs/src/imfs/imfs_unmount.c
===================================================================
--- c/src/libfs/src/imfs/imfs_unmount.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/imfs_unmount.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -28,4 +28,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_unmount(
@@ -42,5 +43,5 @@
 
   if ( node->type != IMFS_DIRECTORY )
-    set_errno_and_return_minus_one( ENOTDIR );
+    rtems_set_errno_and_return_minus_one( ENOTDIR );
 
   /* 
@@ -49,5 +50,5 @@
 
   if ( node->info.directory.mt_fs == NULL )
-    set_errno_and_return_minus_one( EINVAL );  /* XXX */
+    rtems_set_errno_and_return_minus_one( EINVAL );  /* XXX */
 
   /* 
Index: c/src/libfs/src/imfs/ioman.c
===================================================================
--- c/src/libfs/src/imfs/ioman.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/ioman.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -26,4 +26,5 @@
 #include <rtems.h>
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 #include "imfs.h"
 
@@ -85,5 +86,5 @@
   if ( !loc.ops->node_type_h ) {
     rtems_filesystem_freenode( &loc );
-    set_errno_and_return_minus_one( ENOTSUP );
+    rtems_set_errno_and_return_minus_one( ENOTSUP );
   }
 
Index: c/src/libfs/src/imfs/linearfile.c
===================================================================
--- c/src/libfs/src/imfs/linearfile.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/linearfile.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -29,4 +29,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 /*
@@ -56,9 +57,9 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_LINEAR_FILE );
   if ( the_jnode->type != IMFS_LINEAR_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   /*
@@ -69,5 +70,5 @@
   assert( dest );
   if ( !dest )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   /*
Index: c/src/libfs/src/imfs/memfile.c
===================================================================
--- c/src/libfs/src/imfs/memfile.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ c/src/libfs/src/imfs/memfile.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -30,4 +30,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 #define MEMFILE_STATIC 
@@ -209,5 +210,5 @@
   else {  /* Must be a block file (IMFS_MEMORY_FILE). */
     if (IMFS_memfile_extend( the_jnode, iop->offset ))
-      set_errno_and_return_minus_one( ENOSPC );
+      rtems_set_errno_and_return_minus_one( ENOSPC );
 
     iop->size = the_jnode->info.file.size;
@@ -283,12 +284,12 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   if ( new_length >= IMFS_MEMFILE_MAXIMUM_SIZE )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   if ( new_length <= the_jnode->info.file.size )
@@ -311,5 +312,5 @@
           IMFS_memfile_remove_block( the_jnode, block );
        }
-       set_errno_and_return_minus_one( ENOSPC );
+       rtems_set_errno_and_return_minus_one( ENOSPC );
     }
   }
@@ -339,9 +340,9 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   block_entry_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 1 );
@@ -470,9 +471,9 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   /*
@@ -564,5 +565,5 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE ||
@@ -570,5 +571,5 @@
   if ( the_jnode->type != IMFS_MEMORY_FILE &&
        the_jnode->type != IMFS_LINEAR_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   /*
@@ -578,5 +579,5 @@
   assert( dest );
   if ( !dest )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   /*
@@ -586,5 +587,5 @@
   my_length = length;
   if ( !my_length )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   /*
@@ -715,9 +716,9 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   /*
@@ -727,5 +728,5 @@
   assert( source );
   if ( !source )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
 
@@ -736,5 +737,5 @@
   my_length = length;
   if ( !my_length )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   /*
@@ -747,5 +748,5 @@
     status = IMFS_memfile_extend( the_jnode, last_byte );
     if ( status )
-      set_errno_and_return_minus_one( ENOSPC );
+      rtems_set_errno_and_return_minus_one( ENOSPC );
   }
 
Index: cpukit/libfs/ChangeLog
===================================================================
--- cpukit/libfs/ChangeLog	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/ChangeLog	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -1,2 +1,37 @@
+2002-01-04	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+	* src/imfs/imfs_eval.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/memfile.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_readlink.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_unlink.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_link.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_chown.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/ioman.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_mount.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_directory.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_stat.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_fchmod.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_symlink.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_mknod.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/linearfile.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs_unmount.c: Include <rtems/seterr.h>.
+	Apply rtems_set_errno_and_return_minus_one.
+	* src/imfs/imfs.h: Apply rtems_set_errno_and_return_minus_one.
+	Comment out increment_and_check_linkcounts.
+
 2001-11-27	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
 
Index: cpukit/libfs/src/imfs/imfs.h
===================================================================
--- cpukit/libfs/src/imfs/imfs.h	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/imfs.h	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -208,8 +208,11 @@
 } IMFS_fs_info_t;
 
+#if UNUSED
+/* FIXME: Unused, we might want to remove it */
 #define increment_and_check_linkcounts( _fs_info )                  \
   ((IMFS_fs_info_t * )_fs_info)->link_counts++;                     \
   if ( ((IMFS_fs_info_t * )_fs_info)->link_counts  > MAXSYMLINKS )  \
-    set_errno_and_return_minus_one( ELOOP )
+    rtems_set_errno_and_return_minus_one( ELOOP )
+#endif
 
 #define decrement_linkcounts(  _fs_info )             \
Index: cpukit/libfs/src/imfs/imfs_chown.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_chown.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/imfs_chown.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -21,4 +21,5 @@
 #include <errno.h>
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 #include "imfs.h"
 
@@ -44,5 +45,5 @@
 
   if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) )
-    set_errno_and_return_minus_one( EPERM );
+    rtems_set_errno_and_return_minus_one( EPERM );
 #endif
 
Index: cpukit/libfs/src/imfs/imfs_directory.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_directory.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/imfs_directory.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -29,4 +29,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 /*
@@ -198,5 +199,5 @@
                       /* is not a permitted operation                     */
       default:
-        set_errno_and_return_minus_one( EINVAL );
+        rtems_set_errno_and_return_minus_one( EINVAL );
         break;
   }
@@ -294,5 +295,5 @@
 
   if ( ! Chain_Is_empty( &the_jnode->info.directory.Entries ) )
-     set_errno_and_return_minus_one( ENOTEMPTY );
+     rtems_set_errno_and_return_minus_one( ENOTEMPTY );
 
   /* 
@@ -301,5 +302,5 @@
 
   if ( pathloc->mt_entry->mt_fs_root.node_access == pathloc->node_access )
-     set_errno_and_return_minus_one( EBUSY );
+     rtems_set_errno_and_return_minus_one( EBUSY );
 
   /* 
@@ -308,5 +309,5 @@
 
    if ( the_jnode->info.directory.mt_fs != NULL )
-     set_errno_and_return_minus_one( EBUSY );          
+     rtems_set_errno_and_return_minus_one( EBUSY );          
  
   /* 
Index: cpukit/libfs/src/imfs/imfs_eval.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_eval.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/imfs_eval.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -26,4 +26,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 #define RTEMS_LIBIO_PERMS_RX (RTEMS_LIBIO_PERMS_SEARCH | RTEMS_LIBIO_PERMS_READ)
@@ -81,5 +82,5 @@
   if ( !rtems_libio_is_valid_perms( flags ) ) {
     assert( 0 );
-    set_errno_and_return_minus_one( EIO );    
+    rtems_set_errno_and_return_minus_one( EIO );    
   }
 
@@ -151,5 +152,5 @@
 
   if ( !IMFS_evaluate_permission( node, flags ) )
-    set_errno_and_return_minus_one( EACCES );
+    rtems_set_errno_and_return_minus_one( EACCES );
 
   return result;
@@ -213,5 +214,5 @@
 
   if ( !IMFS_evaluate_permission( node, flags ) )
-    set_errno_and_return_minus_one( EACCES );
+    rtems_set_errno_and_return_minus_one( EACCES );
 
   return result;
@@ -242,5 +243,5 @@
     if ( rtems_filesystem_link_counts > MAXSYMLINK ) {
       rtems_filesystem_link_counts = 0;
-      set_errno_and_return_minus_one( ELOOP );
+      rtems_set_errno_and_return_minus_one( ELOOP );
     }
 
@@ -308,5 +309,5 @@
     
     if ( !pathloc->node_access )
-      set_errno_and_return_minus_one( ENOENT );
+      rtems_set_errno_and_return_minus_one( ENOENT );
 
     /*
@@ -317,5 +318,5 @@
       if ( node->type == IMFS_DIRECTORY )
         if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
-           set_errno_and_return_minus_one( EACCES );
+           rtems_set_errno_and_return_minus_one( EACCES );
 
     node = pathloc->node_access;
@@ -353,5 +354,5 @@
 
           if ( !node->Parent )
-            set_errno_and_return_minus_one( ENOENT );
+            rtems_set_errno_and_return_minus_one( ENOENT );
 
           node = node->Parent;
@@ -379,5 +380,5 @@
         node = pathloc->node_access;
         if ( !node )
-          set_errno_and_return_minus_one( ENOTDIR ); 
+          rtems_set_errno_and_return_minus_one( ENOTDIR ); 
 
         /*
@@ -386,5 +387,5 @@
 
         if ( node->type != IMFS_DIRECTORY )
-          set_errno_and_return_minus_one( ENOTDIR );
+          rtems_set_errno_and_return_minus_one( ENOTDIR );
 
 	/*
@@ -418,9 +419,9 @@
  
       case IMFS_NO_MORE_PATH:
-        set_errno_and_return_minus_one( EEXIST );
+        rtems_set_errno_and_return_minus_one( EEXIST );
         break;
 
       case IMFS_INVALID_TOKEN:
-        set_errno_and_return_minus_one( ENAMETOOLONG );
+        rtems_set_errno_and_return_minus_one( ENAMETOOLONG );
         break;
 
@@ -439,5 +440,5 @@
   for( ; path[i] != '\0'; i++) {
     if ( !IMFS_is_separator( path[ i ] ) ) 
-      set_errno_and_return_minus_one( ENOENT );
+      rtems_set_errno_and_return_minus_one( ENOENT );
   }
 
@@ -453,5 +454,5 @@
   node = pathloc->node_access;
   if ( node->type != IMFS_DIRECTORY )
-    set_errno_and_return_minus_one( ENOTDIR );
+    rtems_set_errno_and_return_minus_one( ENOTDIR );
 
   /*
@@ -460,5 +461,5 @@
 
   if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_WX ) )
-    set_errno_and_return_minus_one( EACCES );
+    rtems_set_errno_and_return_minus_one( EACCES );
   
   return result;
@@ -490,5 +491,5 @@
   if ( !rtems_libio_is_valid_perms( flags ) ) {
     assert( 0 );
-    set_errno_and_return_minus_one( EIO );    
+    rtems_set_errno_and_return_minus_one( EIO );    
   }
 
@@ -510,5 +511,5 @@
     
     if ( !pathloc->node_access )
-      set_errno_and_return_minus_one( ENOENT );
+      rtems_set_errno_and_return_minus_one( ENOENT );
 
     /*
@@ -518,5 +519,5 @@
       if ( node->type == IMFS_DIRECTORY )
         if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
-           set_errno_and_return_minus_one( EACCES );
+           rtems_set_errno_and_return_minus_one( EACCES );
 
     node = pathloc->node_access;
@@ -552,5 +553,5 @@
 
           if ( !node->Parent )
-            set_errno_and_return_minus_one( ENOENT );
+            rtems_set_errno_and_return_minus_one( ENOENT );
 
           node = node->Parent;
@@ -573,5 +574,5 @@
           node = pathloc->node_access;
           if ( !node )
-            set_errno_and_return_minus_one( ENOTDIR );
+            rtems_set_errno_and_return_minus_one( ENOTDIR );
 
 	} else if ( node->type == IMFS_SYM_LINK ) {
@@ -589,5 +590,5 @@
 
        if ( node->type != IMFS_DIRECTORY )
-          set_errno_and_return_minus_one( ENOTDIR );
+          rtems_set_errno_and_return_minus_one( ENOTDIR );
 
 	/*
@@ -608,5 +609,5 @@
         node = IMFS_find_match_in_dir( node, token );
         if ( !node )
-          set_errno_and_return_minus_one( ENOENT );
+          rtems_set_errno_and_return_minus_one( ENOENT );
 
 	/*
@@ -622,5 +623,5 @@
 
       case IMFS_INVALID_TOKEN:
-        set_errno_and_return_minus_one( ENAMETOOLONG );
+        rtems_set_errno_and_return_minus_one( ENAMETOOLONG );
         break;
 
@@ -654,5 +655,5 @@
 
   if ( !IMFS_evaluate_permission( pathloc, flags ) )
-    set_errno_and_return_minus_one( EACCES );
+    rtems_set_errno_and_return_minus_one( EACCES );
 
   return result;
Index: cpukit/libfs/src/imfs/imfs_fchmod.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_fchmod.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/imfs_fchmod.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -19,4 +19,5 @@
 
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 #include "imfs.h"
 
@@ -40,5 +41,5 @@
 
   if ( ( st_uid != jnode->st_uid ) && ( st_uid != 0 ) )
-    set_errno_and_return_minus_one( EPERM );
+    rtems_set_errno_and_return_minus_one( EPERM );
 #endif
 
@@ -47,5 +48,5 @@
    */
   if ( mode & (~ (S_IRWXU | S_IRWXG | S_IRWXO ) ) )
-    set_errno_and_return_minus_one( EPERM );
+    rtems_set_errno_and_return_minus_one( EPERM );
 
   /*
Index: cpukit/libfs/src/imfs/imfs_link.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_link.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/imfs_link.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -23,4 +23,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_link(
@@ -41,5 +42,5 @@
   info.hard_link.link_node = to_loc->node_access;
   if ( info.hard_link.link_node->st_nlink >= LINK_MAX )
-    set_errno_and_return_minus_one( EMLINK );
+    rtems_set_errno_and_return_minus_one( EMLINK );
  
   /*
@@ -62,5 +63,5 @@
 
   if ( !new_node )
-    set_errno_and_return_minus_one( ENOMEM );
+    rtems_set_errno_and_return_minus_one( ENOMEM );
 
   /*
Index: cpukit/libfs/src/imfs/imfs_mknod.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_mknod.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/imfs_mknod.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -27,4 +27,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_mknod(
@@ -55,5 +56,5 @@
     rtems_filesystem_split_dev_t( dev, info.device.major, info.device.minor );
   } else  {
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
   }
  
@@ -71,5 +72,5 @@
 
   if ( !new_node )
-    set_errno_and_return_minus_one( ENOMEM );
+    rtems_set_errno_and_return_minus_one( ENOMEM );
 
   return 0;
Index: cpukit/libfs/src/imfs/imfs_mount.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_mount.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/imfs_mount.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -27,4 +27,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_mount(
@@ -41,5 +42,5 @@
   
   if ( node->type != IMFS_DIRECTORY )
-    set_errno_and_return_minus_one( ENOTDIR );
+    rtems_set_errno_and_return_minus_one( ENOTDIR );
 
   /*
Index: cpukit/libfs/src/imfs/imfs_readlink.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_readlink.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/imfs_readlink.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -22,4 +22,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_readlink(
@@ -35,5 +36,5 @@
 
   if ( node->type != IMFS_SYM_LINK )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   for( i=0; ((i<bufsize) && (node->info.sym_link.name[i] != '\0')); i++ )
Index: cpukit/libfs/src/imfs/imfs_stat.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_stat.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/imfs_stat.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -21,4 +21,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_stat(
@@ -50,5 +51,5 @@
    
     default:
-      set_errno_and_return_minus_one( ENOTSUP );
+      rtems_set_errno_and_return_minus_one( ENOTSUP );
       break;
   }
Index: cpukit/libfs/src/imfs/imfs_symlink.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_symlink.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/imfs_symlink.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -23,4 +23,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_symlink(
@@ -56,5 +57,5 @@
 
   if ( !new_node )
-    set_errno_and_return_minus_one( ENOMEM );
+    rtems_set_errno_and_return_minus_one( ENOMEM );
 
   return 0;
Index: cpukit/libfs/src/imfs/imfs_unlink.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_unlink.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/imfs_unlink.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -23,4 +23,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_unlink(
@@ -47,5 +48,5 @@
 
     if ( !node->info.hard_link.link_node )
-      set_errno_and_return_minus_one( EINVAL );
+      rtems_set_errno_and_return_minus_one( EINVAL );
 
     the_link = *loc;
Index: cpukit/libfs/src/imfs/imfs_unmount.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_unmount.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/imfs_unmount.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -28,4 +28,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 int IMFS_unmount(
@@ -42,5 +43,5 @@
 
   if ( node->type != IMFS_DIRECTORY )
-    set_errno_and_return_minus_one( ENOTDIR );
+    rtems_set_errno_and_return_minus_one( ENOTDIR );
 
   /* 
@@ -49,5 +50,5 @@
 
   if ( node->info.directory.mt_fs == NULL )
-    set_errno_and_return_minus_one( EINVAL );  /* XXX */
+    rtems_set_errno_and_return_minus_one( EINVAL );  /* XXX */
 
   /* 
Index: cpukit/libfs/src/imfs/ioman.c
===================================================================
--- cpukit/libfs/src/imfs/ioman.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/ioman.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -26,4 +26,5 @@
 #include <rtems.h>
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 #include "imfs.h"
 
@@ -85,5 +86,5 @@
   if ( !loc.ops->node_type_h ) {
     rtems_filesystem_freenode( &loc );
-    set_errno_and_return_minus_one( ENOTSUP );
+    rtems_set_errno_and_return_minus_one( ENOTSUP );
   }
 
Index: cpukit/libfs/src/imfs/linearfile.c
===================================================================
--- cpukit/libfs/src/imfs/linearfile.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/linearfile.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -29,4 +29,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 /*
@@ -56,9 +57,9 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_LINEAR_FILE );
   if ( the_jnode->type != IMFS_LINEAR_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   /*
@@ -69,5 +70,5 @@
   assert( dest );
   if ( !dest )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   /*
Index: cpukit/libfs/src/imfs/memfile.c
===================================================================
--- cpukit/libfs/src/imfs/memfile.c	(revision a02224e0e646c750c3fbd477d9d20e8560f06d3b)
+++ cpukit/libfs/src/imfs/memfile.c	(revision b2709481ece1ccb8aa43b099d3a8e859a4cf68f6)
@@ -30,4 +30,5 @@
 #include "imfs.h"
 #include <rtems/libio_.h>
+#include <rtems/seterr.h>
 
 #define MEMFILE_STATIC 
@@ -209,5 +210,5 @@
   else {  /* Must be a block file (IMFS_MEMORY_FILE). */
     if (IMFS_memfile_extend( the_jnode, iop->offset ))
-      set_errno_and_return_minus_one( ENOSPC );
+      rtems_set_errno_and_return_minus_one( ENOSPC );
 
     iop->size = the_jnode->info.file.size;
@@ -283,12 +284,12 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   if ( new_length >= IMFS_MEMFILE_MAXIMUM_SIZE )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   if ( new_length <= the_jnode->info.file.size )
@@ -311,5 +312,5 @@
           IMFS_memfile_remove_block( the_jnode, block );
        }
-       set_errno_and_return_minus_one( ENOSPC );
+       rtems_set_errno_and_return_minus_one( ENOSPC );
     }
   }
@@ -339,9 +340,9 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   block_entry_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 1 );
@@ -470,9 +471,9 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   /*
@@ -564,5 +565,5 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE ||
@@ -570,5 +571,5 @@
   if ( the_jnode->type != IMFS_MEMORY_FILE &&
        the_jnode->type != IMFS_LINEAR_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   /*
@@ -578,5 +579,5 @@
   assert( dest );
   if ( !dest )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   /*
@@ -586,5 +587,5 @@
   my_length = length;
   if ( !my_length )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   /*
@@ -715,9 +716,9 @@
   assert( the_jnode );
   if ( !the_jnode )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
-    set_errno_and_return_minus_one( EIO );
+    rtems_set_errno_and_return_minus_one( EIO );
 
   /*
@@ -727,5 +728,5 @@
   assert( source );
   if ( !source )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
 
@@ -736,5 +737,5 @@
   my_length = length;
   if ( !my_length )
-    set_errno_and_return_minus_one( EINVAL );
+    rtems_set_errno_and_return_minus_one( EINVAL );
 
   /*
@@ -747,5 +748,5 @@
     status = IMFS_memfile_extend( the_jnode, last_byte );
     if ( status )
-      set_errno_and_return_minus_one( ENOSPC );
+      rtems_set_errno_and_return_minus_one( ENOSPC );
   }
 
