forked from Imagelibrary/rtems
2001-10-17 Till Straumann <strauman@SLAC.Stanford.EDU>
* These changes were discussed and reviewed by many people but the primary people were Jennifer Averett <jennifer@OARcorp.com> and Eugeny Mints <jack@oktet.ru>. * libc/utime.c: Add missing call to rtems_filesystem_freenode() at verification that utime is supported by the filesystem. * libc/link.c: Remove calls to freenode when the node was not successfully allocated. * libc/unmount.c: In the method file_systems_below_this_mountpoint() added calls to correctly free fs_root_loc when a failure occurs. * libc/open.c: Add freenode calls upon failure. * libc/open.c, lib/libc/close.c: (PENDING -- NOT INCLUDED THIS TIMER) Modifications the move the freenode from open() to close() (also part of this patch) are pending further discussion.
This commit is contained in:
@@ -48,14 +48,12 @@ int link(
|
|||||||
|
|
||||||
if ( !parent_loc.ops->evalformake_h ) {
|
if ( !parent_loc.ops->evalformake_h ) {
|
||||||
rtems_filesystem_freenode( &existing_loc );
|
rtems_filesystem_freenode( &existing_loc );
|
||||||
rtems_filesystem_freenode( &parent_loc );
|
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
}
|
}
|
||||||
|
|
||||||
result = (*parent_loc.ops->evalformake_h)( &new[i], &parent_loc, &name_start );
|
result = (*parent_loc.ops->evalformake_h)( &new[i], &parent_loc, &name_start );
|
||||||
if ( result != 0 ) {
|
if ( result != 0 ) {
|
||||||
rtems_filesystem_freenode( &existing_loc );
|
rtems_filesystem_freenode( &existing_loc );
|
||||||
rtems_filesystem_freenode( &parent_loc );
|
|
||||||
set_errno_and_return_minus_one( result );
|
set_errno_and_return_minus_one( result );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ int open(
|
|||||||
rtems_libio_t *iop = 0;
|
rtems_libio_t *iop = 0;
|
||||||
int status;
|
int status;
|
||||||
rtems_filesystem_location_info_t loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
|
rtems_filesystem_location_info_t *loc_to_free = NULL;
|
||||||
int eval_flags;
|
int eval_flags;
|
||||||
|
|
||||||
|
|
||||||
@@ -138,9 +139,12 @@ int open(
|
|||||||
} else if ((flags & (O_EXCL|O_CREAT)) == (O_EXCL|O_CREAT)) {
|
} else if ((flags & (O_EXCL|O_CREAT)) == (O_EXCL|O_CREAT)) {
|
||||||
/* We were trying to create a file that already exists */
|
/* We were trying to create a file that already exists */
|
||||||
rc = EEXIST;
|
rc = EEXIST;
|
||||||
|
loc_to_free = &loc;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loc_to_free = &loc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill in the file control block based on the loc structure
|
* Fill in the file control block based on the loc structure
|
||||||
* returned by successful path evaluation.
|
* returned by successful path evaluation.
|
||||||
@@ -178,6 +182,8 @@ done:
|
|||||||
if ( rc ) {
|
if ( rc ) {
|
||||||
if ( iop )
|
if ( iop )
|
||||||
rtems_libio_free( iop );
|
rtems_libio_free( iop );
|
||||||
|
if ( loc_to_free )
|
||||||
|
rtems_filesystem_freenode( loc_to_free );
|
||||||
set_errno_and_return_minus_one( rc );
|
set_errno_and_return_minus_one( rc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -168,8 +168,10 @@ int file_systems_below_this_mountpoint(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
*fs_to_unmount = *fs_root_loc->mt_entry;
|
*fs_to_unmount = *fs_root_loc->mt_entry;
|
||||||
if ( fs_to_unmount->mt_fs_root.node_access != fs_root_loc->node_access )
|
if ( fs_to_unmount->mt_fs_root.node_access != fs_root_loc->node_access ){
|
||||||
|
rtems_filesystem_freenode(fs_root_loc);
|
||||||
set_errno_and_return_minus_one( EACCES );
|
set_errno_and_return_minus_one( EACCES );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Search the mount table for any mount entries referencing this
|
* Search the mount table for any mount entries referencing this
|
||||||
@@ -181,7 +183,8 @@ int file_systems_below_this_mountpoint(
|
|||||||
the_node = the_node->next ) {
|
the_node = the_node->next ) {
|
||||||
the_mount_entry = ( rtems_filesystem_mount_table_entry_t * )the_node;
|
the_mount_entry = ( rtems_filesystem_mount_table_entry_t * )the_node;
|
||||||
if (the_mount_entry->mt_point_node.mt_entry == fs_root_loc->mt_entry ) {
|
if (the_mount_entry->mt_point_node.mt_entry == fs_root_loc->mt_entry ) {
|
||||||
set_errno_and_return_minus_one( EBUSY );
|
rtems_filesystem_freenode(fs_root_loc);
|
||||||
|
set_errno_and_return_minus_one( EBUSY );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,10 @@ int utime(
|
|||||||
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !temp_loc.ops->utime_h )
|
if ( !temp_loc.ops->utime_h ){
|
||||||
|
rtems_filesystem_freenode( &temp_loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
result = (*temp_loc.ops->utime_h)( &temp_loc, times->actime, times->modtime );
|
result = (*temp_loc.ops->utime_h)( &temp_loc, times->actime, times->modtime );
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,19 @@
|
|||||||
|
2001-10-17 Till Straumann <strauman@SLAC.Stanford.EDU>
|
||||||
|
|
||||||
|
* These changes were discussed and reviewed by many people but the
|
||||||
|
primary people were Jennifer Averett <jennifer@OARcorp.com>
|
||||||
|
and Eugeny Mints <jack@oktet.ru>.
|
||||||
|
* libc/utime.c: Add missing call to rtems_filesystem_freenode()
|
||||||
|
at verification that utime is supported by the filesystem.
|
||||||
|
* libc/link.c: Remove calls to freenode when the node was
|
||||||
|
not successfully allocated.
|
||||||
|
* libc/unmount.c: In the method file_systems_below_this_mountpoint()
|
||||||
|
added calls to correctly free fs_root_loc when a failure occurs.
|
||||||
|
* libc/open.c: Add freenode calls upon failure.
|
||||||
|
* libc/open.c, lib/libc/close.c: (PENDING -- NOT INCLUDED THIS TIMER)
|
||||||
|
Modifications the move the freenode from open() to close() (also part
|
||||||
|
of this patch) are pending further discussion.
|
||||||
|
|
||||||
2001-10-16 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
|
2001-10-16 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
|
||||||
|
|
||||||
* include/zilog/Makefile.am: Remove.
|
* include/zilog/Makefile.am: Remove.
|
||||||
|
|||||||
@@ -48,14 +48,12 @@ int link(
|
|||||||
|
|
||||||
if ( !parent_loc.ops->evalformake_h ) {
|
if ( !parent_loc.ops->evalformake_h ) {
|
||||||
rtems_filesystem_freenode( &existing_loc );
|
rtems_filesystem_freenode( &existing_loc );
|
||||||
rtems_filesystem_freenode( &parent_loc );
|
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
}
|
}
|
||||||
|
|
||||||
result = (*parent_loc.ops->evalformake_h)( &new[i], &parent_loc, &name_start );
|
result = (*parent_loc.ops->evalformake_h)( &new[i], &parent_loc, &name_start );
|
||||||
if ( result != 0 ) {
|
if ( result != 0 ) {
|
||||||
rtems_filesystem_freenode( &existing_loc );
|
rtems_filesystem_freenode( &existing_loc );
|
||||||
rtems_filesystem_freenode( &parent_loc );
|
|
||||||
set_errno_and_return_minus_one( result );
|
set_errno_and_return_minus_one( result );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ int open(
|
|||||||
rtems_libio_t *iop = 0;
|
rtems_libio_t *iop = 0;
|
||||||
int status;
|
int status;
|
||||||
rtems_filesystem_location_info_t loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
|
rtems_filesystem_location_info_t *loc_to_free = NULL;
|
||||||
int eval_flags;
|
int eval_flags;
|
||||||
|
|
||||||
|
|
||||||
@@ -138,9 +139,12 @@ int open(
|
|||||||
} else if ((flags & (O_EXCL|O_CREAT)) == (O_EXCL|O_CREAT)) {
|
} else if ((flags & (O_EXCL|O_CREAT)) == (O_EXCL|O_CREAT)) {
|
||||||
/* We were trying to create a file that already exists */
|
/* We were trying to create a file that already exists */
|
||||||
rc = EEXIST;
|
rc = EEXIST;
|
||||||
|
loc_to_free = &loc;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loc_to_free = &loc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill in the file control block based on the loc structure
|
* Fill in the file control block based on the loc structure
|
||||||
* returned by successful path evaluation.
|
* returned by successful path evaluation.
|
||||||
@@ -178,6 +182,8 @@ done:
|
|||||||
if ( rc ) {
|
if ( rc ) {
|
||||||
if ( iop )
|
if ( iop )
|
||||||
rtems_libio_free( iop );
|
rtems_libio_free( iop );
|
||||||
|
if ( loc_to_free )
|
||||||
|
rtems_filesystem_freenode( loc_to_free );
|
||||||
set_errno_and_return_minus_one( rc );
|
set_errno_and_return_minus_one( rc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -168,8 +168,10 @@ int file_systems_below_this_mountpoint(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
*fs_to_unmount = *fs_root_loc->mt_entry;
|
*fs_to_unmount = *fs_root_loc->mt_entry;
|
||||||
if ( fs_to_unmount->mt_fs_root.node_access != fs_root_loc->node_access )
|
if ( fs_to_unmount->mt_fs_root.node_access != fs_root_loc->node_access ){
|
||||||
|
rtems_filesystem_freenode(fs_root_loc);
|
||||||
set_errno_and_return_minus_one( EACCES );
|
set_errno_and_return_minus_one( EACCES );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Search the mount table for any mount entries referencing this
|
* Search the mount table for any mount entries referencing this
|
||||||
@@ -181,7 +183,8 @@ int file_systems_below_this_mountpoint(
|
|||||||
the_node = the_node->next ) {
|
the_node = the_node->next ) {
|
||||||
the_mount_entry = ( rtems_filesystem_mount_table_entry_t * )the_node;
|
the_mount_entry = ( rtems_filesystem_mount_table_entry_t * )the_node;
|
||||||
if (the_mount_entry->mt_point_node.mt_entry == fs_root_loc->mt_entry ) {
|
if (the_mount_entry->mt_point_node.mt_entry == fs_root_loc->mt_entry ) {
|
||||||
set_errno_and_return_minus_one( EBUSY );
|
rtems_filesystem_freenode(fs_root_loc);
|
||||||
|
set_errno_and_return_minus_one( EBUSY );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,10 @@ int utime(
|
|||||||
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !temp_loc.ops->utime_h )
|
if ( !temp_loc.ops->utime_h ){
|
||||||
|
rtems_filesystem_freenode( &temp_loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
result = (*temp_loc.ops->utime_h)( &temp_loc, times->actime, times->modtime );
|
result = (*temp_loc.ops->utime_h)( &temp_loc, times->actime, times->modtime );
|
||||||
|
|
||||||
|
|||||||
@@ -48,14 +48,12 @@ int link(
|
|||||||
|
|
||||||
if ( !parent_loc.ops->evalformake_h ) {
|
if ( !parent_loc.ops->evalformake_h ) {
|
||||||
rtems_filesystem_freenode( &existing_loc );
|
rtems_filesystem_freenode( &existing_loc );
|
||||||
rtems_filesystem_freenode( &parent_loc );
|
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
}
|
}
|
||||||
|
|
||||||
result = (*parent_loc.ops->evalformake_h)( &new[i], &parent_loc, &name_start );
|
result = (*parent_loc.ops->evalformake_h)( &new[i], &parent_loc, &name_start );
|
||||||
if ( result != 0 ) {
|
if ( result != 0 ) {
|
||||||
rtems_filesystem_freenode( &existing_loc );
|
rtems_filesystem_freenode( &existing_loc );
|
||||||
rtems_filesystem_freenode( &parent_loc );
|
|
||||||
set_errno_and_return_minus_one( result );
|
set_errno_and_return_minus_one( result );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ int open(
|
|||||||
rtems_libio_t *iop = 0;
|
rtems_libio_t *iop = 0;
|
||||||
int status;
|
int status;
|
||||||
rtems_filesystem_location_info_t loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
|
rtems_filesystem_location_info_t *loc_to_free = NULL;
|
||||||
int eval_flags;
|
int eval_flags;
|
||||||
|
|
||||||
|
|
||||||
@@ -138,9 +139,12 @@ int open(
|
|||||||
} else if ((flags & (O_EXCL|O_CREAT)) == (O_EXCL|O_CREAT)) {
|
} else if ((flags & (O_EXCL|O_CREAT)) == (O_EXCL|O_CREAT)) {
|
||||||
/* We were trying to create a file that already exists */
|
/* We were trying to create a file that already exists */
|
||||||
rc = EEXIST;
|
rc = EEXIST;
|
||||||
|
loc_to_free = &loc;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loc_to_free = &loc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill in the file control block based on the loc structure
|
* Fill in the file control block based on the loc structure
|
||||||
* returned by successful path evaluation.
|
* returned by successful path evaluation.
|
||||||
@@ -178,6 +182,8 @@ done:
|
|||||||
if ( rc ) {
|
if ( rc ) {
|
||||||
if ( iop )
|
if ( iop )
|
||||||
rtems_libio_free( iop );
|
rtems_libio_free( iop );
|
||||||
|
if ( loc_to_free )
|
||||||
|
rtems_filesystem_freenode( loc_to_free );
|
||||||
set_errno_and_return_minus_one( rc );
|
set_errno_and_return_minus_one( rc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -168,8 +168,10 @@ int file_systems_below_this_mountpoint(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
*fs_to_unmount = *fs_root_loc->mt_entry;
|
*fs_to_unmount = *fs_root_loc->mt_entry;
|
||||||
if ( fs_to_unmount->mt_fs_root.node_access != fs_root_loc->node_access )
|
if ( fs_to_unmount->mt_fs_root.node_access != fs_root_loc->node_access ){
|
||||||
|
rtems_filesystem_freenode(fs_root_loc);
|
||||||
set_errno_and_return_minus_one( EACCES );
|
set_errno_and_return_minus_one( EACCES );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Search the mount table for any mount entries referencing this
|
* Search the mount table for any mount entries referencing this
|
||||||
@@ -181,7 +183,8 @@ int file_systems_below_this_mountpoint(
|
|||||||
the_node = the_node->next ) {
|
the_node = the_node->next ) {
|
||||||
the_mount_entry = ( rtems_filesystem_mount_table_entry_t * )the_node;
|
the_mount_entry = ( rtems_filesystem_mount_table_entry_t * )the_node;
|
||||||
if (the_mount_entry->mt_point_node.mt_entry == fs_root_loc->mt_entry ) {
|
if (the_mount_entry->mt_point_node.mt_entry == fs_root_loc->mt_entry ) {
|
||||||
set_errno_and_return_minus_one( EBUSY );
|
rtems_filesystem_freenode(fs_root_loc);
|
||||||
|
set_errno_and_return_minus_one( EBUSY );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,10 @@ int utime(
|
|||||||
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !temp_loc.ops->utime_h )
|
if ( !temp_loc.ops->utime_h ){
|
||||||
|
rtems_filesystem_freenode( &temp_loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
result = (*temp_loc.ops->utime_h)( &temp_loc, times->actime, times->modtime );
|
result = (*temp_loc.ops->utime_h)( &temp_loc, times->actime, times->modtime );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user