<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2010-07-30)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-07-30 Joel Sherrill <joel.sherrill@oarcorp.com>
* libcsupport/src/fstat.c, libcsupport/src/rmdir.c,
libfs/src/imfs/imfs.h, libfs/src/imfs/imfs_creat.c,
libfs/src/imfs/imfs_debug.c, libfs/src/imfs/imfs_getchild.c,
libfs/src/imfs/memfile.c: Add IMFS_assert. Clean up and remove all
checks which are redundant with system call layer. Formatting.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2538&r2=text&tr2=1.2539&diff_format=h">M</a></td><td width='1%'>1.2539</td><td width='100%'>cpukit/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/src/fstat.c.diff?r1=text&tr1=1.13&r2=text&tr2=1.14&diff_format=h">M</a></td><td width='1%'>1.14</td><td width='100%'>cpukit/libcsupport/src/fstat.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/src/rmdir.c.diff?r1=text&tr1=1.18&r2=text&tr2=1.19&diff_format=h">M</a></td><td width='1%'>1.19</td><td width='100%'>cpukit/libcsupport/src/rmdir.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/imfs/imfs.h.diff?r1=text&tr1=1.46&r2=text&tr2=1.47&diff_format=h">M</a></td><td width='1%'>1.47</td><td width='100%'>cpukit/libfs/src/imfs/imfs.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/imfs/imfs_creat.c.diff?r1=text&tr1=1.18&r2=text&tr2=1.19&diff_format=h">M</a></td><td width='1%'>1.19</td><td width='100%'>cpukit/libfs/src/imfs/imfs_creat.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/imfs/imfs_debug.c.diff?r1=text&tr1=1.16&r2=text&tr2=1.17&diff_format=h">M</a></td><td width='1%'>1.17</td><td width='100%'>cpukit/libfs/src/imfs/imfs_debug.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/imfs/imfs_getchild.c.diff?r1=text&tr1=1.11&r2=text&tr2=1.12&diff_format=h">M</a></td><td width='1%'>1.12</td><td width='100%'>cpukit/libfs/src/imfs/imfs_getchild.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/imfs/memfile.c.diff?r1=text&tr1=1.37&r2=text&tr2=1.38&diff_format=h">M</a></td><td width='1%'>1.38</td><td width='100%'>cpukit/libfs/src/imfs/memfile.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2538 rtems/cpukit/ChangeLog:1.2539
--- rtems/cpukit/ChangeLog:1.2538 Fri Jul 30 13:53:05 2010
+++ rtems/cpukit/ChangeLog Fri Jul 30 17:36:31 2010
</font><font color='#997700'>@@ -1,3 +1,11 @@
</font><font color='#000088'>+2010-07-30 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * libcsupport/src/fstat.c, libcsupport/src/rmdir.c,
+ libfs/src/imfs/imfs.h, libfs/src/imfs/imfs_creat.c,
+ libfs/src/imfs/imfs_debug.c, libfs/src/imfs/imfs_getchild.c,
+ libfs/src/imfs/memfile.c: Add IMFS_assert. Clean up and remove all
+ checks which are redundant with system call layer. Formatting.
+
</font> 2010-07-30 Gedare Bloom <giddyup44@yahoo.com>
PR 1599/cpukit
<font color='#006600'>diff -u rtems/cpukit/libcsupport/src/fstat.c:1.13 rtems/cpukit/libcsupport/src/fstat.c:1.14
--- rtems/cpukit/libcsupport/src/fstat.c:1.13 Thu Jul 15 03:10:47 2010
+++ rtems/cpukit/libcsupport/src/fstat.c Fri Jul 30 17:36:32 2010
</font><font color='#997700'>@@ -32,14 +32,12 @@
</font> /*
* Check to see if we were passed a valid pointer.
*/
<font color='#880000'>-
</font> if ( !sbuf )
rtems_set_errno_and_return_minus_one( EFAULT );
/*
* Now process the stat() request.
*/
<font color='#880000'>-
</font> iop = rtems_libio_iop( fd );
rtems_libio_check_fd( fd );
rtems_libio_check_is_open(iop);
<font color='#006600'>diff -u rtems/cpukit/libcsupport/src/rmdir.c:1.18 rtems/cpukit/libcsupport/src/rmdir.c:1.19
--- rtems/cpukit/libcsupport/src/rmdir.c:1.18 Thu Jul 1 10:12:37 2010
+++ rtems/cpukit/libcsupport/src/rmdir.c Fri Jul 30 17:36:32 2010
</font><font color='#997700'>@@ -74,7 +74,7 @@
</font> /*
* Verify you can remove this node as a directory.
*/
<font color='#880000'>- if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){
</font><font color='#000088'>+ if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
</font> rtems_filesystem_freenode( &loc );
if ( free_parentloc )
rtems_filesystem_freenode( &parentloc );
<font color='#006600'>diff -u rtems/cpukit/libfs/src/imfs/imfs.h:1.46 rtems/cpukit/libfs/src/imfs/imfs.h:1.47
--- rtems/cpukit/libfs/src/imfs/imfs.h:1.46 Thu Jul 15 03:59:46 2010
+++ rtems/cpukit/libfs/src/imfs/imfs.h Fri Jul 30 17:36:32 2010
</font><font color='#997700'>@@ -560,6 +560,17 @@
</font> rtems_filesystem_location_info_t *pathloc /* IN */
);
<font color='#000088'>+/*
+ * Turn on IMFS assertions when RTEMS_DEBUG is defined.
+ */
+#ifdef RTEMS_DEBUG
+ #include <assert.h>
+
+ #define IMFS_assert(_x) assert(_X)
+#else
+ #define IMFS_assert(_x)
+#endif
+
</font> #ifdef __cplusplus
}
#endif
<font color='#006600'>diff -u rtems/cpukit/libfs/src/imfs/imfs_creat.c:1.18 rtems/cpukit/libfs/src/imfs/imfs_creat.c:1.19
--- rtems/cpukit/libfs/src/imfs/imfs_creat.c:1.18 Thu Jul 15 03:46:06 2010
+++ rtems/cpukit/libfs/src/imfs/imfs_creat.c Fri Jul 30 17:36:32 2010
</font><font color='#997700'>@@ -17,9 +17,6 @@
</font> #include "config.h"
#endif
<font color='#880000'>-#if defined(RTEMS_DEBUG)
- #include <assert.h>
-#endif
</font> #include <stdlib.h>
#include <string.h>
#include "imfs.h"
<font color='#997700'>@@ -101,16 +98,13 @@
</font> break;
default:
<font color='#880000'>- #if defined(RTEMS_DEBUG)
- assert(0);
- #endif
</font><font color='#000088'>+ IMFS_assert(0);
</font> break;
}
/*
* This node MUST have a parent, so put it in that directory list.
*/
<font color='#880000'>-
</font> node->Parent = parent;
node->st_ino = ++fs_info->ino_count;
<font color='#006600'>diff -u rtems/cpukit/libfs/src/imfs/imfs_debug.c:1.16 rtems/cpukit/libfs/src/imfs/imfs_debug.c:1.17
--- rtems/cpukit/libfs/src/imfs/imfs_debug.c:1.16 Thu Jul 15 03:59:46 2010
+++ rtems/cpukit/libfs/src/imfs/imfs_debug.c Fri Jul 30 17:36:32 2010
</font><font color='#997700'>@@ -15,9 +15,6 @@
</font> #include "config.h"
#endif
<font color='#880000'>-#if defined(RTEMS_DEBUG)
- #include <assert.h>
-#endif
</font> #include <string.h>
#include <fcntl.h>
#include <errno.h>
<font color='#997700'>@@ -36,14 +33,11 @@
</font> *
* This routine prints the contents of the specified jnode.
*/
<font color='#880000'>-
</font> void IMFS_print_jnode(
IMFS_jnode_t *the_jnode
)
{
<font color='#880000'>- #if defined(RTEMS_DEBUG)
- assert( the_jnode );
- #endif
</font><font color='#000088'>+ IMFS_assert( the_jnode );
</font>
fprintf(stdout, "%s", the_jnode->name );
switch( the_jnode->type ) {
<font color='#997700'>@@ -104,7 +98,6 @@
</font> * directory is encountered, then this routine will recurse to process
* the subdirectory.
*/
<font color='#880000'>-
</font> void IMFS_dump_directory(
IMFS_jnode_t *the_directory,
int level
<font color='#997700'>@@ -115,11 +108,9 @@
</font> IMFS_jnode_t *the_jnode;
int i;
<font color='#880000'>- #if defined(RTEMS_DEBUG)
- assert( the_directory );
- assert( level >= 0 );
- assert( the_directory->type == IMFS_DIRECTORY );
- #endif
</font><font color='#000088'>+ IMFS_assert( the_directory );
+ IMFS_assert( level >= 0 );
+ IMFS_assert( the_directory->type == IMFS_DIRECTORY );
</font>
the_chain = &the_directory->info.directory.Entries;
<font color='#997700'>@@ -152,7 +143,7 @@
</font> fprintf(stdout, "*************** Dump of Entire IMFS ***************\n" );
fprintf(stdout, "/\n" );
IMFS_dump_directory( rtems_filesystem_root.node_access, 0 );
<font color='#880000'>- fprintf(stdout, "*************** End of Dump ***************\n" );
</font><font color='#000088'>+ fprintf(stdout, "*************** End of Dump ***************\n" );
</font> }
/*
<font color='#997700'>@@ -162,7 +153,6 @@
</font> * using the IMFS memory file type.
*
*/
<font color='#880000'>-
</font> int IMFS_memfile_maximum_size( void )
{
return IMFS_MEMFILE_MAXIMUM_SIZE;
<font color='#006600'>diff -u rtems/cpukit/libfs/src/imfs/imfs_getchild.c:1.11 rtems/cpukit/libfs/src/imfs/imfs_getchild.c:1.12
--- rtems/cpukit/libfs/src/imfs/imfs_getchild.c:1.11 Thu Jun 24 16:31:22 2010
+++ rtems/cpukit/libfs/src/imfs/imfs_getchild.c Fri Jul 30 17:36:32 2010
</font><font color='#997700'>@@ -17,9 +17,6 @@
</font> #include "config.h"
#endif
<font color='#880000'>-#if defined(RTEMS_DEBUG)
- #include <assert.h>
-#endif
</font> #include <errno.h>
#include <string.h>
#include "imfs.h"
<font color='#997700'>@@ -40,16 +37,8 @@
</font> * Check for fatal errors. A NULL directory show a problem in the
* the IMFS code.
*/
<font color='#880000'>-
- #if defined(RTEMS_DEBUG)
- assert( directory );
- assert( name );
- #endif
- if ( !name )
- return 0;
-
- if ( !directory )
- return 0;
</font><font color='#000088'>+ IMFS_assert( directory );
+ IMFS_assert( name );
</font>
/*
* Check for "." and ".."
<font color='#006600'>diff -u rtems/cpukit/libfs/src/imfs/memfile.c:1.37 rtems/cpukit/libfs/src/imfs/memfile.c:1.38
--- rtems/cpukit/libfs/src/imfs/memfile.c:1.37 Thu Jul 15 03:10:48 2010
+++ rtems/cpukit/libfs/src/imfs/memfile.c Fri Jul 30 17:36:32 2010
</font><font color='#997700'>@@ -31,16 +31,11 @@
</font> #include <rtems/libio_.h>
#include <rtems/seterr.h>
<font color='#880000'>-#if defined(RTEMS_DEBUG)
- #include <assert.h>
-#endif
-
</font> #define MEMFILE_STATIC
/*
* Prototypes of private routines
*/
<font color='#880000'>-
</font> MEMFILE_STATIC int IMFS_memfile_extend(
IMFS_jnode_t *the_jnode,
off_t new_length
<font color='#997700'>@@ -88,7 +83,6 @@
</font> * This routine processes the open() system call. Note that there is
* nothing special to be done at open() time.
*/
<font color='#880000'>-
</font> int memfile_open(
rtems_libio_t *iop,
const char *pathname,
<font color='#997700'>@@ -130,7 +124,6 @@
</font> * This routine processes the close() system call. Note that there is
* nothing to flush or memory to free at this point.
*/
<font color='#880000'>-
</font> int memfile_close(
rtems_libio_t *iop
)
<font color='#997700'>@@ -152,7 +145,6 @@
</font> *
* This routine processes the read() system call.
*/
<font color='#880000'>-
</font> ssize_t memfile_read(
rtems_libio_t *iop,
void *buffer,
<font color='#997700'>@@ -171,7 +163,6 @@
</font> *
* This routine processes the write() system call.
*/
<font color='#880000'>-
</font> ssize_t memfile_write(
rtems_libio_t *iop,
const void *buffer,
<font color='#997700'>@@ -196,7 +187,6 @@
</font> *
* NOTE: No ioctl()'s are supported for in-memory files.
*/
<font color='#880000'>-
</font> int memfile_ioctl(
rtems_libio_t *iop,
uint32_t command,
<font color='#997700'>@@ -215,7 +205,6 @@
</font> *
* This routine processes the lseek() system call.
*/
<font color='#880000'>-
</font> rtems_off64_t memfile_lseek(
rtems_libio_t *iop,
rtems_off64_t offset,
<font color='#997700'>@@ -250,7 +239,6 @@
</font> *
* This routine processes the ftruncate() system call.
*/
<font color='#880000'>-
</font> int memfile_ftruncate(
rtems_libio_t *iop,
rtems_off64_t length
<font color='#997700'>@@ -274,7 +262,6 @@
</font> * deleted. So we leave the previously allocated blocks in place for
* future use and just set the length.
*/
<font color='#880000'>-
</font> the_jnode->info.file.size = length;
iop->size = the_jnode->info.file.size;
<font color='#997700'>@@ -290,7 +277,6 @@
</font> * specified. If necessary, it will allocate memory blocks to
* extend the file.
*/
<font color='#880000'>-
</font> MEMFILE_STATIC int IMFS_memfile_extend(
IMFS_jnode_t *the_jnode,
off_t new_length
<font color='#997700'>@@ -303,38 +289,34 @@
</font> /*
* Perform internal consistency checks
*/
<font color='#000088'>+ IMFS_assert( the_jnode );
+ IMFS_assert( the_jnode->type == IMFS_MEMORY_FILE );
</font>
<font color='#880000'>- #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 );
-
- if ( the_jnode->type != IMFS_MEMORY_FILE )
- rtems_set_errno_and_return_minus_one( EIO );
-
</font><font color='#000088'>+ /*
+ * Verify new file size is supported
+ */
</font> if ( new_length >= IMFS_MEMFILE_MAXIMUM_SIZE )
rtems_set_errno_and_return_minus_one( EINVAL );
<font color='#000088'>+ /*
+ * Verify new file size is actually larger than current size
+ */
</font> if ( new_length <= the_jnode->info.file.size )
return 0;
/*
* Calculate the number of range of blocks to allocate
*/
<font color='#880000'>-
</font> new_blocks = new_length / IMFS_MEMFILE_BYTES_PER_BLOCK;
old_blocks = the_jnode->info.file.size / IMFS_MEMFILE_BYTES_PER_BLOCK;
/*
* Now allocate each of those blocks.
*/
<font color='#880000'>-
</font> for ( block=old_blocks ; block<=new_blocks ; block++ ) {
if ( IMFS_memfile_addblock( the_jnode, block ) ) {
for ( ; block>=old_blocks ; block-- ) {
<font color='#880000'>- IMFS_memfile_remove_block( the_jnode, block );
</font><font color='#000088'>+ IMFS_memfile_remove_block( the_jnode, block );
</font> }
rtems_set_errno_and_return_minus_one( ENOSPC );
}
<font color='#997700'>@@ -343,7 +325,6 @@
</font> /*
* Set the new length of the file.
*/
<font color='#880000'>-
</font> the_jnode->info.file.size = new_length;
return 0;
}
<font color='#997700'>@@ -353,7 +334,6 @@
</font> *
* This routine adds a single block to the specified in-memory file.
*/
<font color='#880000'>-
</font> MEMFILE_STATIC int IMFS_memfile_addblock(
IMFS_jnode_t *the_jnode,
unsigned int block
<font color='#997700'>@@ -362,30 +342,24 @@
</font> block_p memory;
block_p *block_entry_ptr;
<font color='#880000'>- #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 );
-
- if ( the_jnode->type != IMFS_MEMORY_FILE )
- rtems_set_errno_and_return_minus_one( EIO );
</font><font color='#000088'>+ IMFS_assert( the_jnode );
+ IMFS_assert( the_jnode->type == IMFS_MEMORY_FILE );
</font>
<font color='#000088'>+ /*
+ * Obtain the pointer for the specified block number
+ */
</font> block_entry_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 1 );
if ( *block_entry_ptr )
return 0;
<font color='#880000'>-#if 0
- fprintf(stdout, "%d %p", block, block_entry_ptr );
- fflush(stdout);
-#endif
-
</font><font color='#000088'>+ /*
+ * There is no memory for this block number so allocate it.
+ */
</font> memory = memfile_alloc_block();
if ( !memory )
return 1;
<font color='#880000'>- *block_entry_ptr = memory;
</font>
<font color='#000088'>+ *block_entry_ptr = memory;
</font> return 0;
}
<font color='#997700'>@@ -399,7 +373,6 @@
</font> * block from the middle of a file would be exceptionally
* dangerous and the results unpredictable.
*/
<font color='#880000'>-
</font> MEMFILE_STATIC int IMFS_memfile_remove_block(
IMFS_jnode_t *the_jnode,
unsigned int block
<font color='#997700'>@@ -409,14 +382,11 @@
</font> block_p ptr;
block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
<font color='#880000'>- #if defined(RTEMS_DEBUG)
- assert( block_ptr );
- #endif
- if ( block_ptr ) {
- ptr = *block_ptr;
- *block_ptr = 0;
- memfile_free_block( ptr );
- }
</font><font color='#000088'>+ IMFS_assert( block_ptr );
+
+ ptr = *block_ptr;
+ *block_ptr = 0;
+ memfile_free_block( ptr );
</font>
return 1;
}
<font color='#997700'>@@ -427,7 +397,6 @@
</font> * This is a support routine for IMFS_memfile_remove. It frees all the
* blocks in one of the indirection tables.
*/
<font color='#880000'>-
</font> void memfile_free_blocks_in_table(
block_p **block_table,
int entries
<font color='#997700'>@@ -439,17 +408,11 @@
</font> /*
* Perform internal consistency checks
*/
<font color='#880000'>-
- #if defined(RTEMS_DEBUG)
- assert( block_table );
- #endif
- if ( !block_table )
- return;
</font><font color='#000088'>+ IMFS_assert( block_table );
</font>
/*
* Now go through all the slots in the table and free the memory.
*/
<font color='#880000'>-
</font> b = *block_table;
for ( i=0 ; i<entries ; i++ ) {
<font color='#997700'>@@ -463,7 +426,6 @@
</font> * Now that all the blocks in the block table are free, we can
* free the block table itself.
*/
<font color='#880000'>-
</font> memfile_free_block( *block_table );
*block_table = 0;
}
<font color='#997700'>@@ -486,7 +448,6 @@
</font> * Regardless until the IMFS implementation is proven, it
* is better to stick to simple, easy to understand algorithms.
*/
<font color='#880000'>-
</font> int IMFS_memfile_remove(
IMFS_jnode_t *the_jnode
)
<font color='#997700'>@@ -500,22 +461,13 @@
</font> /*
* Perform internal consistency checks
*/
<font color='#880000'>-
- #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 );
-
- if ( the_jnode->type != IMFS_MEMORY_FILE )
- rtems_set_errno_and_return_minus_one( EIO );
</font><font color='#000088'>+ IMFS_assert( the_jnode );
+ IMFS_assert( the_jnode->type == IMFS_MEMORY_FILE );
</font>
/*
* Eventually this could be set smarter at each call to
* memfile_free_blocks_in_table to greatly speed this up.
*/
<font color='#880000'>-
</font> to_free = IMFS_MEMFILE_BLOCK_SLOTS;
/*
<font color='#997700'>@@ -524,7 +476,6 @@
</font> * + doubly indirect
* + triply indirect
*/
<font color='#880000'>-
</font> info = &the_jnode->info.file;
if ( info->indirect ) {
<font color='#997700'>@@ -532,7 +483,6 @@
</font> }
if ( info->doubly_indirect ) {
<font color='#880000'>-
</font> for ( i=0 ; i<IMFS_MEMFILE_BLOCK_SLOTS ; i++ ) {
if ( info->doubly_indirect[i] ) {
memfile_free_blocks_in_table(
<font color='#997700'>@@ -574,7 +524,6 @@
</font> * reading the data between offset and the end of the file (truncated
* read).
*/
<font color='#880000'>-
</font> MEMFILE_STATIC ssize_t IMFS_memfile_read(
IMFS_jnode_t *the_jnode,
off_t start,
<font color='#997700'>@@ -596,39 +545,17 @@
</font> /*
* Perform internal consistency checks
*/
<font color='#880000'>-
- #if defined(RTEMS_DEBUG)
- assert( the_jnode );
- assert( the_jnode->type == IMFS_MEMORY_FILE ||
</font><font color='#000088'>+ IMFS_assert( the_jnode );
+ IMFS_assert( the_jnode->type == IMFS_MEMORY_FILE ||
</font> the_jnode->type != IMFS_LINEAR_FILE );
<font color='#880000'>- assert( dest );
- #endif
- if ( !the_jnode )
- rtems_set_errno_and_return_minus_one( EIO );
-
- if ( the_jnode->type != IMFS_MEMORY_FILE &&
- the_jnode->type != IMFS_LINEAR_FILE )
- rtems_set_errno_and_return_minus_one( EIO );
-
- /*
- * Error checks on arguments
- */
-
- if ( !dest )
- rtems_set_errno_and_return_minus_one( EINVAL );
-
- /*
- * If there is nothing to read, then quick exit.
- */
-
- my_length = length;
- if ( !my_length )
- rtems_set_errno_and_return_minus_one( EINVAL );
</font><font color='#000088'>+ IMFS_assert( dest );
</font>
/*
* Linear files (as created from a tar file are easier to handle
* than block files).
*/
<font color='#000088'>+ my_length = length;
+
</font> if (the_jnode->type == IMFS_LINEAR_FILE) {
unsigned char *file_ptr;
<font color='#997700'>@@ -648,7 +575,6 @@
</font> * If the last byte we are supposed to read is past the end of this
* in memory file, then shorten the length to read.
*/
<font color='#880000'>-
</font> last_byte = start + length;
if ( last_byte > the_jnode->info.file.size )
my_length = the_jnode->info.file.size - start;
<font color='#997700'>@@ -665,7 +591,6 @@
</font> /*
* Phase 1: possibly the last part of one block
*/
<font color='#880000'>-
</font> start_offset = start % IMFS_MEMFILE_BYTES_PER_BLOCK;
block = start / IMFS_MEMFILE_BYTES_PER_BLOCK;
if ( start_offset ) {
<font color='#997700'>@@ -685,7 +610,6 @@
</font> /*
* Phase 2: all of zero of more blocks
*/
<font color='#880000'>-
</font> to_copy = IMFS_MEMFILE_BYTES_PER_BLOCK;
while ( my_length >= IMFS_MEMFILE_BYTES_PER_BLOCK ) {
block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
<font color='#997700'>@@ -701,10 +625,7 @@
</font> /*
* Phase 3: possibly the first part of one block
*/
<font color='#880000'>-
- #if defined(RTEMS_DEBUG)
- assert( my_length < IMFS_MEMFILE_BYTES_PER_BLOCK );
- #endif
</font><font color='#000088'>+ IMFS_assert( my_length < IMFS_MEMFILE_BYTES_PER_BLOCK );
</font>
if ( my_length ) {
block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
<font color='#997700'>@@ -725,7 +646,6 @@
</font> * This routine writes the specified data buffer into the in memory
* file pointed to by the_jnode. The file is extended as needed.
*/
<font color='#880000'>-
</font> MEMFILE_STATIC ssize_t IMFS_memfile_write(
IMFS_jnode_t *the_jnode,
off_t start,
<font color='#997700'>@@ -748,40 +668,17 @@
</font> /*
* Perform internal consistency checks
*/
<font color='#880000'>-
- #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 );
-
- if ( the_jnode->type != IMFS_MEMORY_FILE )
- rtems_set_errno_and_return_minus_one( EIO );
-
- /*
- * Error check arguments
- */
-
- if ( !source )
- rtems_set_errno_and_return_minus_one( EINVAL );
-
-
- /*
- * If there is nothing to write, then quick exit.
- */
</font><font color='#000088'>+ IMFS_assert( source );
+ IMFS_assert( the_jnode );
+ IMFS_assert( the_jnode->type == IMFS_MEMORY_FILE );
</font>
my_length = length;
<font color='#880000'>- if ( !my_length )
- rtems_set_errno_and_return_minus_one( EINVAL );
-
</font> /*
* If the last byte we are supposed to write is past the end of this
* in memory file, then extend the length.
*/
<font color='#880000'>- last_byte = start + length;
</font><font color='#000088'>+ last_byte = start + my_length;
</font> if ( last_byte > the_jnode->info.file.size ) {
status = IMFS_memfile_extend( the_jnode, last_byte );
if ( status )
<font color='#997700'>@@ -800,7 +697,6 @@
</font> /*
* Phase 1: possibly the last part of one block
*/
<font color='#880000'>-
</font> start_offset = start % IMFS_MEMFILE_BYTES_PER_BLOCK;
block = start / IMFS_MEMFILE_BYTES_PER_BLOCK;
if ( start_offset ) {
<font color='#997700'>@@ -850,10 +746,7 @@
</font> /*
* Phase 3: possibly the first part of one block
*/
<font color='#880000'>-
- #if defined(RTEMS_DEBUG)
- assert( my_length < IMFS_MEMFILE_BYTES_PER_BLOCK );
- #endif
</font><font color='#000088'>+ IMFS_assert( my_length < IMFS_MEMFILE_BYTES_PER_BLOCK );
</font>
to_copy = my_length;
if ( my_length ) {
<font color='#997700'>@@ -880,7 +773,6 @@
</font> * number. If that block has not been allocated and "malloc_it" is
* TRUE, then the block is allocated. Otherwise, it is an error.
*/
<font color='#880000'>-
</font> #if 0
block_p *IMFS_memfile_get_block_pointer_DEBUG(
IMFS_jnode_t *the_jnode,
<font color='#997700'>@@ -922,25 +814,15 @@
</font> /*
* Perform internal consistency checks
*/
<font color='#880000'>-
- #if defined(RTEMS_DEBUG)
- assert( the_jnode );
- assert( the_jnode->type == IMFS_MEMORY_FILE );
- #endif
- if ( !the_jnode )
- return NULL;
-
- if ( the_jnode->type != IMFS_MEMORY_FILE )
- return NULL;
</font><font color='#000088'>+ IMFS_assert( the_jnode );
+ IMFS_assert( the_jnode->type == IMFS_MEMORY_FILE );
</font>
info = &the_jnode->info.file;
<font color='#880000'>-
</font> my_block = block;
/*
* Is the block number in the simple indirect portion?
*/
<font color='#880000'>-
</font> if ( my_block <= LAST_INDIRECT ) {
p = info->indirect;
<font color='#997700'>@@ -966,11 +848,6 @@
</font> */
if ( my_block <= LAST_DOUBLY_INDIRECT ) {
<font color='#880000'>-#if 0
-fprintf(stdout, "(d %d) ", block );
-fflush(stdout);
-#endif
-
</font> my_block -= FIRST_DOUBLY_INDIRECT;
singly = my_block % IMFS_MEMFILE_BLOCK_SLOTS;
<font color='#997700'>@@ -1004,22 +881,12 @@
</font> if ( !p )
return 0;
<font color='#880000'>-#if 0
-fprintf(stdout, "(d %d %d %d %d %p %p) ", block, my_block, doubly,
- singly, p, &p[singly] );
-fflush(stdout);
-#endif
</font> return (block_p *)&p[ singly ];
}
<font color='#880000'>-#if 0
-fprintf(stdout, "(t %d) ", block );
-fflush(stdout);
-#endif
</font> /*
* Is the block number in the triply indirect portion?
*/
<font color='#880000'>-
</font> if ( my_block <= LAST_TRIPLY_INDIRECT ) {
my_block -= FIRST_TRIPLY_INDIRECT;
<font color='#997700'>@@ -1059,10 +926,6 @@
</font> if ( !p )
return 0;
<font color='#880000'>-#if 0
-fprintf(stdout, "(t %d %d %d %d %d) ", block, my_block, triply, doubly, singly );
-fflush(stdout);
-#endif
</font> p1 = (block_p *) p[ triply ];
if ( !p1 )
return 0;
<font color='#997700'>@@ -1077,7 +940,6 @@
</font> /*
* This means the requested block number is out of range.
*/
<font color='#880000'>-
</font> return 0;
}
<font color='#997700'>@@ -1086,7 +948,6 @@
</font> *
* Allocate a block for an in-memory file.
*/
<font color='#880000'>-
</font> int memfile_blocks_allocated = 0;
void *memfile_alloc_block(void)
<font color='#997700'>@@ -1105,15 +966,10 @@
</font> *
* Free a block from an in-memory file.
*/
<font color='#880000'>-
</font> void memfile_free_block(
void *memory
)
{
<font color='#880000'>-#if 0
-fprintf(stdout, "(d %p) ", memory );
-fflush(stdout);
-#endif
</font> free(memory);
memfile_blocks_allocated--;
}
</pre>
<p> </p>
<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>