Changeset 983bfad in rtems


Ignore:
Timestamp:
Jun 24, 2010, 9:31:22 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
efd6e8e
Parents:
8bef4cc
Message:

2010-06-24 Joel Sherrill <joel.sherrilL@…>

  • 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.
Location:
cpukit
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r8bef4cc r983bfad  
     12010-06-24      Joel Sherrill <joel.sherrilL@OARcorp.com>
     2
     3        * libfs/src/imfs/imfs_creat.c, libfs/src/imfs/imfs_debug.c,
     4        libfs/src/imfs/imfs_directory.c, libfs/src/imfs/imfs_eval.c,
     5        libfs/src/imfs/imfs_fsunmount.c, libfs/src/imfs/imfs_getchild.c,
     6        libfs/src/imfs/imfs_initsupp.c, libfs/src/imfs/ioman.c,
     7        libfs/src/imfs/memfile.c: Evaluate all assert calls in IMFS. Either
     8        made them conditional on RTEMS_DEBUG or eliminated them.
     9
    1102010-06-24      Gedare Bloom <giddyup44@yahoo.com>
    211
  • cpukit/libfs/src/imfs/imfs_creat.c

    r8bef4cc r983bfad  
    1818#endif
    1919
    20 #include <assert.h>
     20#if defined(RTEMS_DEBUG)
     21  #include <assert.h>
     22#endif
    2123#include <stdlib.h>
    2224#include <string.h>
     
    100102
    101103    default:
    102       assert(0);
    103       break;
     104      #if defined(RTEMS_DEBUG)
     105        assert(0);
     106      #endif
     107      return;
    104108  }
    105109
  • cpukit/libfs/src/imfs/imfs_debug.c

    r8bef4cc r983bfad  
    1616#endif
    1717
    18 #include <assert.h>
     18#if defined(RTEMS_DEBUG)
     19  #include <assert.h>
     20#endif
    1921#include <string.h>
    2022#include <fcntl.h>
     
    5456)
    5557{
    56   assert( the_jnode );
     58  #if defined(RTEMS_DEBUG)
     59    assert( the_jnode );
     60  #endif
    5761
    5862  fprintf(stdout, "%s", the_jnode->name );
     
    9195    case IMFS_HARD_LINK:
    9296      fprintf(stdout, " links not printed\n" );
    93       assert(0);
    94       break;
     97      return;
    9598
    9699    case IMFS_SYM_LINK:
    97100      fprintf(stdout, " links not printed\n" );
    98       assert(0);
    99       break;
     101      return;
    100102
    101103    case IMFS_FIFO:
    102104      fprintf(stdout, " FIFO not printed\n" );
    103       assert(0);
    104       break;
     105      return;
    105106
    106107    default:
    107108      fprintf(stdout, " bad type %d\n", the_jnode->type );
    108       assert(0);
    109       break;
     109      return;
    110110  }
    111111  puts("");
     
    130130  int                   i;
    131131
    132   assert( the_directory );
    133 
    134   assert( level >= 0 );
    135 
    136   assert( the_directory->type == IMFS_DIRECTORY );
     132  #if defined(RTEMS_DEBUG)
     133    assert( the_directory );
     134    assert( level >= 0 );
     135    assert( the_directory->type == IMFS_DIRECTORY );
     136  #endif
    137137
    138138  the_chain = &the_directory->info.directory.Entries;
  • cpukit/libfs/src/imfs/imfs_directory.c

    r8bef4cc r983bfad  
    2424#include <stdio.h>
    2525#include <string.h>
    26 #include <assert.h>
    2726#include <dirent.h>
    2827
     
    180179 *     SEEK_CUR - offset is used as the relative byte offset from the current
    181180 *                directory position index held in the iop structure
    182  *     SEEK_END - N/A --> This will cause an assert.
     181 *     SEEK_END - N/A --> This will cause an EINVAL to be returned.
    183182 */
    184183
  • cpukit/libfs/src/imfs/imfs_eval.c

    r8bef4cc r983bfad  
    2222#include <errno.h>
    2323#include <stdlib.h>
    24 #include <assert.h>
    2524
    2625#include "imfs.h"
     
    8483
    8584  if ( !rtems_libio_is_valid_perms( flags ) ) {
    86     assert( 0 );
    8785    rtems_set_errno_and_return_minus_one( EIO );
    8886  }
     
    502500
    503501  if ( !rtems_libio_is_valid_perms( flags ) ) {
    504     assert( 0 );
    505502    rtems_set_errno_and_return_minus_one( EIO );
    506503  }
  • cpukit/libfs/src/imfs/imfs_fsunmount.c

    r8bef4cc r983bfad  
    2020#include <unistd.h>
    2121#include <stdlib.h>
    22 
    23 #include <assert.h>
    2422
    2523#include "imfs.h"
  • cpukit/libfs/src/imfs/imfs_getchild.c

    r8bef4cc r983bfad  
    1818#endif
    1919
     20#if defined(RTEMS_DEBUG)
     21  #include <assert.h>
     22#endif
    2023#include <errno.h>
    21 #include <assert.h>
    2224#include <string.h>
    2325#include "imfs.h"
     
    4042   */
    4143
    42   assert( directory );
     44  #if defined(RTEMS_DEBUG)
     45    assert( directory );
     46    assert( name );
     47  #endif
    4348  if ( !name )
    4449    return 0;
    4550
    46   assert( name );
    4751  if ( !directory )
    4852    return 0;
  • cpukit/libfs/src/imfs/imfs_initsupp.c

    r8bef4cc r983bfad  
    2020#include <unistd.h>
    2121#include <stdlib.h>
    22 
    23 #include <assert.h>
    2422
    2523#include "imfs.h"
  • cpukit/libfs/src/imfs/ioman.c

    r8bef4cc r983bfad  
    2222#include <unistd.h>
    2323#include <string.h>
    24 
    25 #include <assert.h>
    2624
    2725#include <rtems.h>
  • cpukit/libfs/src/imfs/memfile.c

    r8bef4cc r983bfad  
    2424#include <stdlib.h>
    2525#include <string.h>
    26 #include <assert.h>
    2726#include <errno.h>
    2827
     
    302301   */
    303302
    304   assert( the_jnode );
     303  #if defined(RTEMS_DEBUG)
     304    assert( the_jnode );
     305    assert( the_jnode->type == IMFS_MEMORY_FILE );
     306  #endif
    305307  if ( !the_jnode )
    306308    rtems_set_errno_and_return_minus_one( EIO );
    307309
    308   assert( the_jnode->type == IMFS_MEMORY_FILE );
    309310  if ( the_jnode->type != IMFS_MEMORY_FILE )
    310311    rtems_set_errno_and_return_minus_one( EIO );
     
    358359  block_p *block_entry_ptr;
    359360
    360   assert( the_jnode );
     361  #if defined(RTEMS_DEBUG)
     362    assert( the_jnode );
     363    assert( the_jnode->type == IMFS_MEMORY_FILE );
     364  #endif
    361365  if ( !the_jnode )
    362366    rtems_set_errno_and_return_minus_one( EIO );
    363367
    364   assert( the_jnode->type == IMFS_MEMORY_FILE );
    365368  if ( the_jnode->type != IMFS_MEMORY_FILE )
    366369    rtems_set_errno_and_return_minus_one( EIO );
     
    403406
    404407  block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
    405   assert( block_ptr );
     408  #if defined(RTEMS_DEBUG)
     409    assert( block_ptr );
     410  #endif
    406411  if ( block_ptr ) {
    407412    ptr = *block_ptr;
     
    432437   */
    433438
    434   assert( block_table );
     439  #if defined(RTEMS_DEBUG)
     440    assert( block_table );
     441  #endif
    435442  if ( !block_table )
    436443    return;
     
    491498   */
    492499
    493   assert( the_jnode );
     500  #if defined(RTEMS_DEBUG)
     501    assert( the_jnode );
     502    assert( the_jnode->type == IMFS_MEMORY_FILE );
     503  #endif
    494504  if ( !the_jnode )
    495505    rtems_set_errno_and_return_minus_one( EIO );
    496506
    497   assert( the_jnode->type == IMFS_MEMORY_FILE );
    498507  if ( the_jnode->type != IMFS_MEMORY_FILE )
    499508    rtems_set_errno_and_return_minus_one( EIO );
     
    585594   */
    586595
    587   assert( the_jnode );
     596  #if defined(RTEMS_DEBUG)
     597    assert( the_jnode );
     598    assert( the_jnode->type == IMFS_MEMORY_FILE ||
     599    assert( dest );
     600  #endif
    588601  if ( !the_jnode )
    589602    rtems_set_errno_and_return_minus_one( EIO );
    590603
    591   assert( the_jnode->type == IMFS_MEMORY_FILE ||
    592           the_jnode->type == IMFS_LINEAR_FILE );
    593604  if ( the_jnode->type != IMFS_MEMORY_FILE &&
    594605       the_jnode->type != IMFS_LINEAR_FILE )
     
    599610   */
    600611
    601   assert( dest );
    602612  if ( !dest )
    603613    rtems_set_errno_and_return_minus_one( EINVAL );
     
    659669      to_copy = my_length;
    660670    block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
    661     assert( block_ptr );
    662671    if ( !block_ptr )
    663672      return copied;
     
    676685  while ( my_length >= IMFS_MEMFILE_BYTES_PER_BLOCK ) {
    677686    block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
    678     assert( block_ptr );
    679687    if ( !block_ptr )
    680688      return copied;
     
    690698   */
    691699
    692   assert( my_length < IMFS_MEMFILE_BYTES_PER_BLOCK );
     700  #if defined(RTEMS_DEBUG)
     701    assert( my_length < IMFS_MEMFILE_BYTES_PER_BLOCK );
     702  #endif
    693703
    694704  if ( my_length ) {
    695705    block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
    696     assert( block_ptr );
    697706    if ( !block_ptr )
    698707      return copied;
     
    736745   */
    737746
    738   assert( the_jnode );
     747  #if defined(RTEMS_DEBUG)
     748    assert( source );
     749    assert( the_jnode );
     750    assert( the_jnode->type == IMFS_MEMORY_FILE );
     751  #endif
    739752  if ( !the_jnode )
    740753    rtems_set_errno_and_return_minus_one( EIO );
    741754
    742   assert( the_jnode->type == IMFS_MEMORY_FILE );
    743755  if ( the_jnode->type != IMFS_MEMORY_FILE )
    744756    rtems_set_errno_and_return_minus_one( EIO );
     
    748760   */
    749761
    750   assert( source );
    751762  if ( !source )
    752763    rtems_set_errno_and_return_minus_one( EINVAL );
     
    793804      to_copy = my_length;
    794805    block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
    795     assert( block_ptr );
    796806    if ( !block_ptr )
    797807      return copied;
    798 #if 0
    799 fprintf(stdout, "write %d at %d in %d: %*s\n", to_copy, start_offset, block, to_copy, src );
    800 #endif
     808    #if 0
     809      fprintf(
     810        stderr,
     811        "write %d at %d in %d: %*s\n",
     812        to_copy,
     813        start_offset,
     814        block,
     815        to_copy,
     816        src
     817      );
     818    #endif
    801819    memcpy( &(*block_ptr)[ start_offset ], src, to_copy );
    802820    src += to_copy;
     
    813831  while ( my_length >= IMFS_MEMFILE_BYTES_PER_BLOCK ) {
    814832    block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
    815     assert( block_ptr );
    816833    if ( !block_ptr )
    817834      return copied;
    818 #if 0
    819 fprintf(stdout, "write %d in %d: %*s\n", to_copy, block, to_copy, src );
    820 #endif
     835    #if 0
     836      fprintf(stdout, "write %d in %d: %*s\n", to_copy, block, to_copy, src );
     837    #endif
    821838    memcpy( &(*block_ptr)[ 0 ], src, to_copy );
    822839    src += to_copy;
     
    830847   */
    831848
    832   assert( my_length < IMFS_MEMFILE_BYTES_PER_BLOCK );
     849  #if defined(RTEMS_DEBUG)
     850    assert( my_length < IMFS_MEMFILE_BYTES_PER_BLOCK );
     851  #endif
    833852
    834853  to_copy = my_length;
    835854  if ( my_length ) {
    836855    block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
    837     assert( block_ptr );
    838856    if ( !block_ptr )
    839857      return copied;
    840 #if 0
    841 fprintf(stdout, "write %d in %d: %*s\n", to_copy, block, to_copy, src );
    842 #endif
     858    #if 0
     859    fprintf(stdout, "write %d in %d: %*s\n", to_copy, block, to_copy, src );
     860    #endif
    843861    memcpy( &(*block_ptr)[ 0 ], src, my_length );
    844862    my_length = 0;
     
    901919   */
    902920
    903   assert( the_jnode );
     921  #if defined(RTEMS_DEBUG)
     922    assert( the_jnode );
     923    assert( the_jnode->type == IMFS_MEMORY_FILE );
     924  #endif
    904925  if ( !the_jnode )
    905926    return NULL;
    906927
    907   assert( the_jnode->type == IMFS_MEMORY_FILE );
    908928  if ( the_jnode->type != IMFS_MEMORY_FILE )
    909929    return NULL;
     
    918938
    919939  if ( my_block <= LAST_INDIRECT ) {
    920 #if 0
    921 fprintf(stdout, "(s %d) ", block );
    922 fflush(stdout);
    923 #endif
    924940    p = info->indirect;
    925941
Note: See TracChangeset for help on using the changeset viewer.