Index: cpukit/ChangeLog
===================================================================
--- cpukit/ChangeLog	(revision 8bef4ccfb07a48ece38301b9740875f5cd9e0cad)
+++ cpukit/ChangeLog	(revision 983bfad2108c3cdd9f100c6f0d1cde00343056dc)
@@ -1,2 +1,11 @@
+2010-06-24	Joel Sherrill <joel.sherrilL@OARcorp.com>
+
+	* libfs/src/imfs/imfs_creat.c, libfs/src/imfs/imfs_debug.c,
+	libfs/src/imfs/imfs_directory.c, libfs/src/imfs/imfs_eval.c,
+	libfs/src/imfs/imfs_fsunmount.c, libfs/src/imfs/imfs_getchild.c,
+	libfs/src/imfs/imfs_initsupp.c, libfs/src/imfs/ioman.c,
+	libfs/src/imfs/memfile.c: Evaluate all assert calls in IMFS. Either
+	made them conditional on RTEMS_DEBUG or eliminated them.
+
 2010-06-24	Gedare Bloom <giddyup44@yahoo.com>
 
Index: cpukit/libfs/src/imfs/imfs_creat.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_creat.c	(revision 8bef4ccfb07a48ece38301b9740875f5cd9e0cad)
+++ cpukit/libfs/src/imfs/imfs_creat.c	(revision 983bfad2108c3cdd9f100c6f0d1cde00343056dc)
@@ -18,5 +18,7 @@
 #endif
 
-#include <assert.h>
+#if defined(RTEMS_DEBUG)
+  #include <assert.h>
+#endif
 #include <stdlib.h>
 #include <string.h>
@@ -100,6 +102,8 @@
 
     default:
-      assert(0);
-      break;
+      #if defined(RTEMS_DEBUG)
+        assert(0);
+      #endif
+      return;
   }
 
Index: cpukit/libfs/src/imfs/imfs_debug.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_debug.c	(revision 8bef4ccfb07a48ece38301b9740875f5cd9e0cad)
+++ cpukit/libfs/src/imfs/imfs_debug.c	(revision 983bfad2108c3cdd9f100c6f0d1cde00343056dc)
@@ -16,5 +16,7 @@
 #endif
 
-#include <assert.h>
+#if defined(RTEMS_DEBUG)
+  #include <assert.h>
+#endif
 #include <string.h>
 #include <fcntl.h>
@@ -54,5 +56,7 @@
 )
 {
-  assert( the_jnode );
+  #if defined(RTEMS_DEBUG)
+    assert( the_jnode );
+  #endif
 
   fprintf(stdout, "%s", the_jnode->name );
@@ -91,21 +95,17 @@
     case IMFS_HARD_LINK:
       fprintf(stdout, " links not printed\n" );
-      assert(0);
-      break;
+      return;
 
     case IMFS_SYM_LINK:
       fprintf(stdout, " links not printed\n" );
-      assert(0);
-      break;
+      return;
 
     case IMFS_FIFO:
       fprintf(stdout, " FIFO not printed\n" );
-      assert(0);
-      break;
+      return;
 
     default:
       fprintf(stdout, " bad type %d\n", the_jnode->type );
-      assert(0);
-      break;
+      return;
   }
   puts("");
@@ -130,9 +130,9 @@
   int                   i;
 
-  assert( the_directory );
-
-  assert( level >= 0 );
-
-  assert( the_directory->type == IMFS_DIRECTORY );
+  #if defined(RTEMS_DEBUG)
+    assert( the_directory );
+    assert( level >= 0 );
+    assert( the_directory->type == IMFS_DIRECTORY );
+  #endif
 
   the_chain = &the_directory->info.directory.Entries;
Index: cpukit/libfs/src/imfs/imfs_directory.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_directory.c	(revision 8bef4ccfb07a48ece38301b9740875f5cd9e0cad)
+++ cpukit/libfs/src/imfs/imfs_directory.c	(revision 983bfad2108c3cdd9f100c6f0d1cde00343056dc)
@@ -24,5 +24,4 @@
 #include <stdio.h>
 #include <string.h>
-#include <assert.h>
 #include <dirent.h>
 
@@ -180,5 +179,5 @@
  *     SEEK_CUR - offset is used as the relative byte offset from the current
  *                directory position index held in the iop structure
- *     SEEK_END - N/A --> This will cause an assert.
+ *     SEEK_END - N/A --> This will cause an EINVAL to be returned.
  */
 
Index: cpukit/libfs/src/imfs/imfs_eval.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_eval.c	(revision 8bef4ccfb07a48ece38301b9740875f5cd9e0cad)
+++ cpukit/libfs/src/imfs/imfs_eval.c	(revision 983bfad2108c3cdd9f100c6f0d1cde00343056dc)
@@ -22,5 +22,4 @@
 #include <errno.h>
 #include <stdlib.h>
-#include <assert.h>
 
 #include "imfs.h"
@@ -84,5 +83,4 @@
 
   if ( !rtems_libio_is_valid_perms( flags ) ) {
-    assert( 0 );
     rtems_set_errno_and_return_minus_one( EIO );
   }
@@ -502,5 +500,4 @@
 
   if ( !rtems_libio_is_valid_perms( flags ) ) {
-    assert( 0 );
     rtems_set_errno_and_return_minus_one( EIO );
   }
Index: cpukit/libfs/src/imfs/imfs_fsunmount.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_fsunmount.c	(revision 8bef4ccfb07a48ece38301b9740875f5cd9e0cad)
+++ cpukit/libfs/src/imfs/imfs_fsunmount.c	(revision 983bfad2108c3cdd9f100c6f0d1cde00343056dc)
@@ -20,6 +20,4 @@
 #include <unistd.h>
 #include <stdlib.h>
-
-#include <assert.h>
 
 #include "imfs.h"
Index: cpukit/libfs/src/imfs/imfs_getchild.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_getchild.c	(revision 8bef4ccfb07a48ece38301b9740875f5cd9e0cad)
+++ cpukit/libfs/src/imfs/imfs_getchild.c	(revision 983bfad2108c3cdd9f100c6f0d1cde00343056dc)
@@ -18,6 +18,8 @@
 #endif
 
+#if defined(RTEMS_DEBUG)
+  #include <assert.h>
+#endif
 #include <errno.h>
-#include <assert.h>
 #include <string.h>
 #include "imfs.h"
@@ -40,9 +42,11 @@
    */
 
-  assert( directory );
+  #if defined(RTEMS_DEBUG)
+    assert( directory );
+    assert( name );
+  #endif
   if ( !name )
     return 0;
 
-  assert( name );
   if ( !directory )
     return 0;
Index: cpukit/libfs/src/imfs/imfs_initsupp.c
===================================================================
--- cpukit/libfs/src/imfs/imfs_initsupp.c	(revision 8bef4ccfb07a48ece38301b9740875f5cd9e0cad)
+++ cpukit/libfs/src/imfs/imfs_initsupp.c	(revision 983bfad2108c3cdd9f100c6f0d1cde00343056dc)
@@ -20,6 +20,4 @@
 #include <unistd.h>
 #include <stdlib.h>
-
-#include <assert.h>
 
 #include "imfs.h"
Index: cpukit/libfs/src/imfs/ioman.c
===================================================================
--- cpukit/libfs/src/imfs/ioman.c	(revision 8bef4ccfb07a48ece38301b9740875f5cd9e0cad)
+++ cpukit/libfs/src/imfs/ioman.c	(revision 983bfad2108c3cdd9f100c6f0d1cde00343056dc)
@@ -22,6 +22,4 @@
 #include <unistd.h>
 #include <string.h>
-
-#include <assert.h>
 
 #include <rtems.h>
Index: cpukit/libfs/src/imfs/memfile.c
===================================================================
--- cpukit/libfs/src/imfs/memfile.c	(revision 8bef4ccfb07a48ece38301b9740875f5cd9e0cad)
+++ cpukit/libfs/src/imfs/memfile.c	(revision 983bfad2108c3cdd9f100c6f0d1cde00343056dc)
@@ -24,5 +24,4 @@
 #include <stdlib.h>
 #include <string.h>
-#include <assert.h>
 #include <errno.h>
 
@@ -302,9 +301,11 @@
    */
 
-  assert( the_jnode );
+  #if defined(RTEMS_DEBUG)
+    assert( the_jnode );
+    assert( the_jnode->type == IMFS_MEMORY_FILE );
+  #endif
   if ( !the_jnode )
     rtems_set_errno_and_return_minus_one( EIO );
 
-  assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
     rtems_set_errno_and_return_minus_one( EIO );
@@ -358,9 +359,11 @@
   block_p *block_entry_ptr;
 
-  assert( the_jnode );
+  #if defined(RTEMS_DEBUG)
+    assert( the_jnode );
+    assert( the_jnode->type == IMFS_MEMORY_FILE );
+  #endif
   if ( !the_jnode )
     rtems_set_errno_and_return_minus_one( EIO );
 
-  assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
     rtems_set_errno_and_return_minus_one( EIO );
@@ -403,5 +406,7 @@
 
   block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
-  assert( block_ptr );
+  #if defined(RTEMS_DEBUG)
+    assert( block_ptr );
+  #endif
   if ( block_ptr ) {
     ptr = *block_ptr;
@@ -432,5 +437,7 @@
    */
 
-  assert( block_table );
+  #if defined(RTEMS_DEBUG)
+    assert( block_table );
+  #endif
   if ( !block_table )
     return;
@@ -491,9 +498,11 @@
    */
 
-  assert( the_jnode );
+  #if defined(RTEMS_DEBUG)
+    assert( the_jnode );
+    assert( the_jnode->type == IMFS_MEMORY_FILE );
+  #endif
   if ( !the_jnode )
     rtems_set_errno_and_return_minus_one( EIO );
 
-  assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
     rtems_set_errno_and_return_minus_one( EIO );
@@ -585,10 +594,12 @@
    */
 
-  assert( the_jnode );
+  #if defined(RTEMS_DEBUG)
+    assert( the_jnode );
+    assert( the_jnode->type == IMFS_MEMORY_FILE ||
+    assert( dest );
+  #endif
   if ( !the_jnode )
     rtems_set_errno_and_return_minus_one( EIO );
 
-  assert( the_jnode->type == IMFS_MEMORY_FILE ||
-          the_jnode->type == IMFS_LINEAR_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE &&
        the_jnode->type != IMFS_LINEAR_FILE )
@@ -599,5 +610,4 @@
    */
 
-  assert( dest );
   if ( !dest )
     rtems_set_errno_and_return_minus_one( EINVAL );
@@ -659,5 +669,4 @@
       to_copy = my_length;
     block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
-    assert( block_ptr );
     if ( !block_ptr )
       return copied;
@@ -676,5 +685,4 @@
   while ( my_length >= IMFS_MEMFILE_BYTES_PER_BLOCK ) {
     block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
-    assert( block_ptr );
     if ( !block_ptr )
       return copied;
@@ -690,9 +698,10 @@
    */
 
-  assert( my_length < IMFS_MEMFILE_BYTES_PER_BLOCK );
+  #if defined(RTEMS_DEBUG)
+    assert( my_length < IMFS_MEMFILE_BYTES_PER_BLOCK );
+  #endif
 
   if ( my_length ) {
     block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
-    assert( block_ptr );
     if ( !block_ptr )
       return copied;
@@ -736,9 +745,12 @@
    */
 
-  assert( the_jnode );
+  #if defined(RTEMS_DEBUG)
+    assert( source );
+    assert( the_jnode );
+    assert( the_jnode->type == IMFS_MEMORY_FILE );
+  #endif
   if ( !the_jnode )
     rtems_set_errno_and_return_minus_one( EIO );
 
-  assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
     rtems_set_errno_and_return_minus_one( EIO );
@@ -748,5 +760,4 @@
    */
 
-  assert( source );
   if ( !source )
     rtems_set_errno_and_return_minus_one( EINVAL );
@@ -793,10 +804,17 @@
       to_copy = my_length;
     block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
-    assert( block_ptr );
     if ( !block_ptr )
       return copied;
-#if 0
-fprintf(stdout, "write %d at %d in %d: %*s\n", to_copy, start_offset, block, to_copy, src );
-#endif
+    #if 0
+      fprintf(
+        stderr,
+        "write %d at %d in %d: %*s\n",
+        to_copy,
+        start_offset,
+        block,
+        to_copy,
+        src
+      );
+    #endif
     memcpy( &(*block_ptr)[ start_offset ], src, to_copy );
     src += to_copy;
@@ -813,10 +831,9 @@
   while ( my_length >= IMFS_MEMFILE_BYTES_PER_BLOCK ) {
     block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
-    assert( block_ptr );
     if ( !block_ptr )
       return copied;
-#if 0
-fprintf(stdout, "write %d in %d: %*s\n", to_copy, block, to_copy, src );
-#endif
+    #if 0
+      fprintf(stdout, "write %d in %d: %*s\n", to_copy, block, to_copy, src );
+    #endif
     memcpy( &(*block_ptr)[ 0 ], src, to_copy );
     src += to_copy;
@@ -830,15 +847,16 @@
    */
 
-  assert( my_length < IMFS_MEMFILE_BYTES_PER_BLOCK );
+  #if defined(RTEMS_DEBUG)
+    assert( my_length < IMFS_MEMFILE_BYTES_PER_BLOCK );
+  #endif
 
   to_copy = my_length;
   if ( my_length ) {
     block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
-    assert( block_ptr );
     if ( !block_ptr )
       return copied;
-#if 0
-fprintf(stdout, "write %d in %d: %*s\n", to_copy, block, to_copy, src );
-#endif
+    #if 0
+    fprintf(stdout, "write %d in %d: %*s\n", to_copy, block, to_copy, src );
+    #endif
     memcpy( &(*block_ptr)[ 0 ], src, my_length );
     my_length = 0;
@@ -901,9 +919,11 @@
    */
 
-  assert( the_jnode );
+  #if defined(RTEMS_DEBUG)
+    assert( the_jnode );
+    assert( the_jnode->type == IMFS_MEMORY_FILE );
+  #endif
   if ( !the_jnode )
     return NULL;
 
-  assert( the_jnode->type == IMFS_MEMORY_FILE );
   if ( the_jnode->type != IMFS_MEMORY_FILE )
     return NULL;
@@ -918,8 +938,4 @@
 
   if ( my_block <= LAST_INDIRECT ) {
-#if 0
-fprintf(stdout, "(s %d) ", block );
-fflush(stdout);
-#endif
     p = info->indirect;
 
