forked from Imagelibrary/rtems
Added call to freenod to let each filesystem free its own internal
node used to manage file access.
This commit is contained in:
@@ -38,12 +38,21 @@ int chdir(
|
|||||||
* Verify you can change directory into this node.
|
* Verify you can change directory into this node.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !loc.ops->node_type )
|
if ( !loc.ops->node_type ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
|
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTDIR );
|
set_errno_and_return_minus_one( ENOTDIR );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( rtems_filesystem_current.ops->freenod )
|
||||||
|
(*rtems_filesystem_current.ops->freenod)( &rtems_filesystem_current );
|
||||||
|
|
||||||
rtems_filesystem_current = loc;
|
rtems_filesystem_current = loc;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -28,13 +28,22 @@ int chmod(
|
|||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
rtems_filesystem_location_info_t loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
|
int result;
|
||||||
|
|
||||||
status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE );
|
status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE );
|
||||||
if ( status != 0 )
|
if ( status != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !loc.handlers->fchmod )
|
if ( !loc.handlers->fchmod ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*loc.handlers->fchmod)( &loc, mode );
|
result = (*loc.handlers->fchmod)( &loc, mode );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,13 +26,22 @@ int chown(
|
|||||||
gid_t group
|
gid_t group
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
|
int result;
|
||||||
|
|
||||||
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
if ( rtems_filesystem_evaluate_path( path, 0x00, &loc, TRUE ) )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !temp_loc.ops->chown )
|
if ( !loc.ops->chown ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*temp_loc.ops->chown)( &temp_loc, owner, group );
|
result = (*loc.ops->chown)( &loc, owner, group );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ int link(
|
|||||||
/*
|
/*
|
||||||
* Get the node we are linking to.
|
* Get the node we are linking to.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
result = rtems_filesystem_evaluate_path( existing, 0, &existing_loc, TRUE );
|
result = rtems_filesystem_evaluate_path( existing, 0, &existing_loc, TRUE );
|
||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
@@ -42,21 +43,47 @@ int link(
|
|||||||
|
|
||||||
rtems_filesystem_get_start_loc( new, &i, &parent_loc );
|
rtems_filesystem_get_start_loc( new, &i, &parent_loc );
|
||||||
result = (*parent_loc.ops->evalformake)( &new[i], &parent_loc, &name_start );
|
result = (*parent_loc.ops->evalformake)( &new[i], &parent_loc, &name_start );
|
||||||
if ( result != 0 )
|
if ( result != 0 ) {
|
||||||
set_errno_and_return_minus_one( result );
|
if ( existing_loc.ops->freenod )
|
||||||
|
(*existing_loc.ops->freenod)( &parent_loc );
|
||||||
|
set_errno_and_return_minus_one( result );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check to see if the caller is trying to link across file system
|
* Check to see if the caller is trying to link across file system
|
||||||
* boundaries.
|
* boundaries.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( parent_loc.mt_entry != existing_loc.mt_entry )
|
if ( parent_loc.mt_entry != existing_loc.mt_entry ) {
|
||||||
|
if ( existing_loc.ops->freenod )
|
||||||
|
(*existing_loc.ops->freenod)( &existing_loc );
|
||||||
|
|
||||||
|
if ( parent_loc.ops->freenod )
|
||||||
|
(*parent_loc.ops->freenod)( &parent_loc );
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EXDEV );
|
set_errno_and_return_minus_one( EXDEV );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !parent_loc.ops->link ) {
|
||||||
|
|
||||||
|
if ( existing_loc.ops->freenod )
|
||||||
|
(*existing_loc.ops->freenod)( &existing_loc );
|
||||||
|
|
||||||
|
if ( parent_loc.ops->freenod )
|
||||||
|
(*parent_loc.ops->freenod)( &parent_loc );
|
||||||
|
|
||||||
if ( !parent_loc.ops->link )
|
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*parent_loc.ops->link)( &existing_loc, &parent_loc, name_start );
|
result = (*parent_loc.ops->link)( &existing_loc, &parent_loc, name_start );
|
||||||
|
|
||||||
|
if ( existing_loc.ops->freenod )
|
||||||
|
(*existing_loc.ops->freenod)( &existing_loc );
|
||||||
|
|
||||||
|
if ( parent_loc.ops->freenod )
|
||||||
|
(*parent_loc.ops->freenod)( &parent_loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -52,8 +52,15 @@ int mknod(
|
|||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !temp_loc.ops->mknod )
|
if ( !temp_loc.ops->mknod ) {
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*temp_loc.ops->mknod)( name_start, mode, dev, &temp_loc );
|
result = (*temp_loc.ops->mknod)( name_start, mode, dev, &temp_loc );
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,13 +88,12 @@ int init_fs_mount_table( void );
|
|||||||
int mount(
|
int mount(
|
||||||
rtems_filesystem_mount_table_entry_t **mt_entry,
|
rtems_filesystem_mount_table_entry_t **mt_entry,
|
||||||
rtems_filesystem_operations_table *fs_ops,
|
rtems_filesystem_operations_table *fs_ops,
|
||||||
rtems_filesystem_options_t fsoptions,
|
rtems_filesystem_options_t options,
|
||||||
char *device,
|
char *device,
|
||||||
char *mount_point
|
char *mount_point
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
rtems_filesystem_options_t options;
|
|
||||||
rtems_filesystem_mount_table_entry_t *temp_mt_entry;
|
rtems_filesystem_mount_table_entry_t *temp_mt_entry;
|
||||||
|
|
||||||
/* XXX add code to check for required operations */
|
/* XXX add code to check for required operations */
|
||||||
@@ -112,8 +111,8 @@ int mount(
|
|||||||
* Are the file system options valid?
|
* Are the file system options valid?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( fsoptions != RTEMS_FILESYSTEM_READ_ONLY &&
|
if ( options != RTEMS_FILESYSTEM_READ_ONLY &&
|
||||||
fsoptions != RTEMS_FILESYSTEM_READ_WRITE ) {
|
options != RTEMS_FILESYSTEM_READ_WRITE ) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -145,7 +144,7 @@ int mount(
|
|||||||
if ( rtems_filesystem_evaluate_path(
|
if ( rtems_filesystem_evaluate_path(
|
||||||
mount_point,
|
mount_point,
|
||||||
RTEMS_LIBIO_PERMS_RWX,
|
RTEMS_LIBIO_PERMS_RWX,
|
||||||
&temp_loc ,
|
&loc,
|
||||||
TRUE ) == -1 )
|
TRUE ) == -1 )
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
|
|
||||||
@@ -153,7 +152,7 @@ int mount(
|
|||||||
* Test to see if it is a directory
|
* Test to see if it is a directory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( temp_loc.ops->node_type( &temp_loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
|
if ( loc.ops->node_type( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||||
errno = ENOTDIR;
|
errno = ENOTDIR;
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
}
|
}
|
||||||
@@ -162,7 +161,7 @@ int mount(
|
|||||||
* You can only mount one file system onto a single mount point.
|
* You can only mount one file system onto a single mount point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( search_mt_for_mount_point( &temp_loc ) == FOUND ) {
|
if ( search_mt_for_mount_point( &loc ) == FOUND ) {
|
||||||
errno = EBUSY;
|
errno = EBUSY;
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
}
|
}
|
||||||
@@ -172,22 +171,22 @@ int mount(
|
|||||||
* into the allocated mount entry
|
* into the allocated mount entry
|
||||||
*/
|
*/
|
||||||
|
|
||||||
temp_mt_entry->mt_point_node.node_access = temp_loc.node_access;
|
temp_mt_entry->mt_point_node.node_access = loc.node_access;
|
||||||
temp_mt_entry->mt_point_node.handlers = temp_loc.handlers;
|
temp_mt_entry->mt_point_node.handlers = loc.handlers;
|
||||||
temp_mt_entry->mt_point_node.ops = temp_loc.ops;
|
temp_mt_entry->mt_point_node.ops = loc.ops;
|
||||||
temp_mt_entry->mt_point_node.mt_entry = temp_loc.mt_entry;
|
temp_mt_entry->mt_point_node.mt_entry = loc.mt_entry;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This link to the parent is only done when we are dealing with system
|
* This link to the parent is only done when we are dealing with system
|
||||||
* below the base file system
|
* below the base file system
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !temp_loc.ops->mount ){
|
if ( !loc.ops->mount ){
|
||||||
errno = ENOTSUP;
|
errno = ENOTSUP;
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( temp_loc.ops->mount( temp_mt_entry ) ) {
|
if ( loc.ops->mount( temp_mt_entry ) ) {
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,11 +223,19 @@ int mount(
|
|||||||
Chain_Append( &rtems_filesystem_mount_table_control, &temp_mt_entry->Node );
|
Chain_Append( &rtems_filesystem_mount_table_control, &temp_mt_entry->Node );
|
||||||
|
|
||||||
*mt_entry = temp_mt_entry;
|
*mt_entry = temp_mt_entry;
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cleanup_and_bail:
|
cleanup_and_bail:
|
||||||
|
|
||||||
free( temp_mt_entry );
|
free( temp_mt_entry );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ int open(
|
|||||||
int rc;
|
int rc;
|
||||||
rtems_libio_t *iop = 0;
|
rtems_libio_t *iop = 0;
|
||||||
int status;
|
int status;
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
int eval_flags;
|
int eval_flags;
|
||||||
|
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ int open(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
status = rtems_filesystem_evaluate_path(
|
status = rtems_filesystem_evaluate_path(
|
||||||
pathname, eval_flags, &temp_loc, TRUE );
|
pathname, eval_flags, &loc, TRUE );
|
||||||
|
|
||||||
if ( status == -1 ) {
|
if ( status == -1 ) {
|
||||||
if ( errno != ENOENT ) {
|
if ( errno != ENOENT ) {
|
||||||
@@ -126,7 +126,7 @@ int open(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check to see if the file name exists after the mknod() */
|
/* Sanity check to see if the file name exists after the mknod() */
|
||||||
status = rtems_filesystem_evaluate_path( pathname, 0x0, &temp_loc, TRUE );
|
status = rtems_filesystem_evaluate_path( pathname, 0x0, &loc, TRUE );
|
||||||
if ( status != 0 ) { /* The file did not exist */
|
if ( status != 0 ) { /* The file did not exist */
|
||||||
rc = EACCES;
|
rc = EACCES;
|
||||||
goto done;
|
goto done;
|
||||||
@@ -139,15 +139,15 @@ int open(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill in the file control block based on the temp_loc structure
|
* Fill in the file control block based on the loc structure
|
||||||
* returned by successful path evaluation.
|
* returned by successful path evaluation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
iop->offset = 0;
|
iop->offset = 0;
|
||||||
iop->handlers = temp_loc.handlers;
|
iop->handlers = loc.handlers;
|
||||||
iop->file_info = temp_loc.node_access;
|
iop->file_info = loc.node_access;
|
||||||
iop->flags |= rtems_libio_fcntl_flags( flags );
|
iop->flags |= rtems_libio_fcntl_flags( flags );
|
||||||
iop->pathinfo = temp_loc;
|
iop->pathinfo = loc;
|
||||||
|
|
||||||
if ( !iop->handlers->open ) {
|
if ( !iop->handlers->open ) {
|
||||||
rc = ENOTSUP;
|
rc = ENOTSUP;
|
||||||
@@ -178,6 +178,10 @@ done:
|
|||||||
rtems_libio_free( iop );
|
rtems_libio_free( iop );
|
||||||
set_errno_and_return_minus_one( rc );
|
set_errno_and_return_minus_one( rc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
return iop - rtems_libio_iops;
|
return iop - rtems_libio_iops;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,21 +23,35 @@ int readlink(
|
|||||||
rtems_filesystem_location_info_t loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
if (!buf)
|
||||||
|
set_errno_and_return_minus_one( EFAULT );
|
||||||
|
|
||||||
result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE );
|
result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE );
|
||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!buf)
|
if ( !loc.ops->node_type ){
|
||||||
set_errno_and_return_minus_one( EFAULT );
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
if ( !loc.ops->node_type )
|
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK )
|
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
set_errno_and_return_minus_one( EINVAL );
|
||||||
|
}
|
||||||
|
|
||||||
if ( !loc.ops->readlink )
|
if ( !loc.ops->readlink ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*loc.ops->readlink)( &loc, buf, bufsize );
|
result = (*loc.ops->readlink)( &loc, buf, bufsize );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,18 +39,32 @@ int rmdir(
|
|||||||
* Verify you can remove this node as a directory.
|
* Verify you can remove this node as a directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !loc.ops->node_type )
|
if ( !loc.ops->node_type ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
|
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTDIR );
|
set_errno_and_return_minus_one( ENOTDIR );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use the filesystems rmnod to remove the node.
|
* Use the filesystems rmnod to remove the node.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !loc.ops->rmnod )
|
if ( !loc.ops->rmnod ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*loc.ops->rmnod)( &loc );
|
result = (*loc.ops->rmnod)( &loc );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,8 +58,11 @@ int _STAT_NAME(
|
|||||||
if ( status != 0 )
|
if ( status != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !loc.handlers->fstat )
|
if ( !loc.handlers->fstat ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Zero out the stat structure so the various support
|
* Zero out the stat structure so the various support
|
||||||
@@ -68,7 +71,12 @@ int _STAT_NAME(
|
|||||||
|
|
||||||
memset( buf, 0, sizeof(struct stat) );
|
memset( buf, 0, sizeof(struct stat) );
|
||||||
|
|
||||||
return (*loc.handlers->fstat)( &loc, buf );
|
status = (*loc.handlers->fstat)( &loc, buf );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ int symlink(
|
|||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return (*loc.ops->symlink)( &loc, actualpath, name_start);
|
result = (*loc.ops->symlink)( &loc, actualpath, name_start);
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,16 +31,30 @@ int unlink(
|
|||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !loc.ops->node_type )
|
if ( !loc.ops->node_type ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
if ( (*loc.ops->node_type)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY )
|
if ( (*loc.ops->node_type)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( EISDIR );
|
set_errno_and_return_minus_one( EISDIR );
|
||||||
|
}
|
||||||
if ( !loc.ops->unlink )
|
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
|
||||||
|
|
||||||
return (*loc.ops->unlink)( &loc );
|
if ( !loc.ops->unlink ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
|
result = (*loc.ops->unlink)( &loc );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -83,8 +83,11 @@ int unmount(
|
|||||||
* we are attempting to unmount ?
|
* we are attempting to unmount ?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry )
|
if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry ) {
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
set_errno_and_return_minus_one( EBUSY );
|
set_errno_and_return_minus_one( EBUSY );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Run the file descriptor table to determine if there are any file
|
* Run the file descriptor table to determine if there are any file
|
||||||
@@ -92,8 +95,11 @@ int unmount(
|
|||||||
* file system that we are trying to unmount
|
* file system that we are trying to unmount
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 )
|
if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 ) {
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
set_errno_and_return_minus_one( EBUSY );
|
set_errno_and_return_minus_one( EBUSY );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow the file system being mounted on to do its cleanup.
|
* Allow the file system being mounted on to do its cleanup.
|
||||||
@@ -103,15 +109,21 @@ int unmount(
|
|||||||
* XXX I will step off in space when evaluating past the end of the node.
|
* XXX I will step off in space when evaluating past the end of the node.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ( temp_mt_entry.mt_point_node.ops->unmount )( temp_loc.mt_entry ) != 0 )
|
if ((temp_mt_entry.mt_point_node.ops->unmount )( temp_loc.mt_entry ) != 0 ) {
|
||||||
return -1;
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Run the unmount function for the subordinate file system.
|
* Run the unmount function for the subordinate file system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ( temp_mt_entry.mt_fs_root.ops->fsunmount_me )( temp_loc.mt_entry ) != 0 )
|
if ((temp_mt_entry.mt_fs_root.ops->fsunmount_me )( temp_loc.mt_entry ) != 0){
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow the file system to clean up.
|
* Allow the file system to clean up.
|
||||||
@@ -130,6 +142,8 @@ int unmount(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
free( temp_loc.mt_entry );
|
free( temp_loc.mt_entry );
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|||||||
@@ -24,12 +24,18 @@ int utime(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t temp_loc;
|
||||||
|
int result;
|
||||||
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if ( !temp_loc.ops->utime )
|
if ( !temp_loc.ops->utime )
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
|
||||||
return (*temp_loc.ops->utime)( &temp_loc, times->actime, times->modtime );
|
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
result = (*temp_loc.ops->utime)( &temp_loc, times->actime, times->modtime );
|
||||||
|
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ rtems_status_code rtems_io_register_name(
|
|||||||
* rtems_io_lookup_name
|
* rtems_io_lookup_name
|
||||||
*
|
*
|
||||||
* This version is not reentrant.
|
* This version is not reentrant.
|
||||||
|
*
|
||||||
|
* XXX - This is dependent upon IMFS and should not be.
|
||||||
|
* Suggest adding a filesystem routine to fill in the device_info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtems_status_code rtems_io_lookup_name(
|
rtems_status_code rtems_io_lookup_name(
|
||||||
@@ -70,15 +73,20 @@ rtems_status_code rtems_io_lookup_name(
|
|||||||
{
|
{
|
||||||
#if !defined(RTEMS_UNIX)
|
#if !defined(RTEMS_UNIX)
|
||||||
IMFS_jnode_t *the_jnode;
|
IMFS_jnode_t *the_jnode;
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
static rtems_driver_name_t device;
|
static rtems_driver_name_t device;
|
||||||
int result;
|
int result;
|
||||||
|
rtems_filesystem_node_types_t node_type;
|
||||||
|
|
||||||
result = rtems_filesystem_evaluate_path( name, 0x00, &temp_loc, TRUE );
|
result = rtems_filesystem_evaluate_path( name, 0x00, &loc, TRUE );
|
||||||
the_jnode = temp_loc.node_access;
|
the_jnode = loc.node_access;
|
||||||
|
|
||||||
if ( (result != 0) || the_jnode->type != IMFS_DEVICE ) {
|
node_type = (*loc.ops->node_type)( &loc );
|
||||||
|
|
||||||
|
if ( (result != 0) || node_type != RTEMS_FILESYSTEM_DEVICE ) {
|
||||||
*device_info = 0;
|
*device_info = 0;
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
return RTEMS_UNSATISFIED;
|
return RTEMS_UNSATISFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,6 +95,10 @@ rtems_status_code rtems_io_lookup_name(
|
|||||||
device.major = the_jnode->info.device.major;
|
device.major = the_jnode->info.device.major;
|
||||||
device.minor = the_jnode->info.device.minor;
|
device.minor = the_jnode->info.device.minor;
|
||||||
*device_info = &device;
|
*device_info = &device;
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,12 +38,21 @@ int chdir(
|
|||||||
* Verify you can change directory into this node.
|
* Verify you can change directory into this node.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !loc.ops->node_type )
|
if ( !loc.ops->node_type ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
|
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTDIR );
|
set_errno_and_return_minus_one( ENOTDIR );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( rtems_filesystem_current.ops->freenod )
|
||||||
|
(*rtems_filesystem_current.ops->freenod)( &rtems_filesystem_current );
|
||||||
|
|
||||||
rtems_filesystem_current = loc;
|
rtems_filesystem_current = loc;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -28,13 +28,22 @@ int chmod(
|
|||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
rtems_filesystem_location_info_t loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
|
int result;
|
||||||
|
|
||||||
status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE );
|
status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE );
|
||||||
if ( status != 0 )
|
if ( status != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !loc.handlers->fchmod )
|
if ( !loc.handlers->fchmod ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*loc.handlers->fchmod)( &loc, mode );
|
result = (*loc.handlers->fchmod)( &loc, mode );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,13 +26,22 @@ int chown(
|
|||||||
gid_t group
|
gid_t group
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
|
int result;
|
||||||
|
|
||||||
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
if ( rtems_filesystem_evaluate_path( path, 0x00, &loc, TRUE ) )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !temp_loc.ops->chown )
|
if ( !loc.ops->chown ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*temp_loc.ops->chown)( &temp_loc, owner, group );
|
result = (*loc.ops->chown)( &loc, owner, group );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ rtems_status_code rtems_io_register_name(
|
|||||||
* rtems_io_lookup_name
|
* rtems_io_lookup_name
|
||||||
*
|
*
|
||||||
* This version is not reentrant.
|
* This version is not reentrant.
|
||||||
|
*
|
||||||
|
* XXX - This is dependent upon IMFS and should not be.
|
||||||
|
* Suggest adding a filesystem routine to fill in the device_info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtems_status_code rtems_io_lookup_name(
|
rtems_status_code rtems_io_lookup_name(
|
||||||
@@ -70,15 +73,20 @@ rtems_status_code rtems_io_lookup_name(
|
|||||||
{
|
{
|
||||||
#if !defined(RTEMS_UNIX)
|
#if !defined(RTEMS_UNIX)
|
||||||
IMFS_jnode_t *the_jnode;
|
IMFS_jnode_t *the_jnode;
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
static rtems_driver_name_t device;
|
static rtems_driver_name_t device;
|
||||||
int result;
|
int result;
|
||||||
|
rtems_filesystem_node_types_t node_type;
|
||||||
|
|
||||||
result = rtems_filesystem_evaluate_path( name, 0x00, &temp_loc, TRUE );
|
result = rtems_filesystem_evaluate_path( name, 0x00, &loc, TRUE );
|
||||||
the_jnode = temp_loc.node_access;
|
the_jnode = loc.node_access;
|
||||||
|
|
||||||
if ( (result != 0) || the_jnode->type != IMFS_DEVICE ) {
|
node_type = (*loc.ops->node_type)( &loc );
|
||||||
|
|
||||||
|
if ( (result != 0) || node_type != RTEMS_FILESYSTEM_DEVICE ) {
|
||||||
*device_info = 0;
|
*device_info = 0;
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
return RTEMS_UNSATISFIED;
|
return RTEMS_UNSATISFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,6 +95,10 @@ rtems_status_code rtems_io_lookup_name(
|
|||||||
device.major = the_jnode->info.device.major;
|
device.major = the_jnode->info.device.major;
|
||||||
device.minor = the_jnode->info.device.minor;
|
device.minor = the_jnode->info.device.minor;
|
||||||
*device_info = &device;
|
*device_info = &device;
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ int link(
|
|||||||
/*
|
/*
|
||||||
* Get the node we are linking to.
|
* Get the node we are linking to.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
result = rtems_filesystem_evaluate_path( existing, 0, &existing_loc, TRUE );
|
result = rtems_filesystem_evaluate_path( existing, 0, &existing_loc, TRUE );
|
||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
@@ -42,21 +43,47 @@ int link(
|
|||||||
|
|
||||||
rtems_filesystem_get_start_loc( new, &i, &parent_loc );
|
rtems_filesystem_get_start_loc( new, &i, &parent_loc );
|
||||||
result = (*parent_loc.ops->evalformake)( &new[i], &parent_loc, &name_start );
|
result = (*parent_loc.ops->evalformake)( &new[i], &parent_loc, &name_start );
|
||||||
if ( result != 0 )
|
if ( result != 0 ) {
|
||||||
set_errno_and_return_minus_one( result );
|
if ( existing_loc.ops->freenod )
|
||||||
|
(*existing_loc.ops->freenod)( &parent_loc );
|
||||||
|
set_errno_and_return_minus_one( result );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check to see if the caller is trying to link across file system
|
* Check to see if the caller is trying to link across file system
|
||||||
* boundaries.
|
* boundaries.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( parent_loc.mt_entry != existing_loc.mt_entry )
|
if ( parent_loc.mt_entry != existing_loc.mt_entry ) {
|
||||||
|
if ( existing_loc.ops->freenod )
|
||||||
|
(*existing_loc.ops->freenod)( &existing_loc );
|
||||||
|
|
||||||
|
if ( parent_loc.ops->freenod )
|
||||||
|
(*parent_loc.ops->freenod)( &parent_loc );
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EXDEV );
|
set_errno_and_return_minus_one( EXDEV );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !parent_loc.ops->link ) {
|
||||||
|
|
||||||
|
if ( existing_loc.ops->freenod )
|
||||||
|
(*existing_loc.ops->freenod)( &existing_loc );
|
||||||
|
|
||||||
|
if ( parent_loc.ops->freenod )
|
||||||
|
(*parent_loc.ops->freenod)( &parent_loc );
|
||||||
|
|
||||||
if ( !parent_loc.ops->link )
|
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*parent_loc.ops->link)( &existing_loc, &parent_loc, name_start );
|
result = (*parent_loc.ops->link)( &existing_loc, &parent_loc, name_start );
|
||||||
|
|
||||||
|
if ( existing_loc.ops->freenod )
|
||||||
|
(*existing_loc.ops->freenod)( &existing_loc );
|
||||||
|
|
||||||
|
if ( parent_loc.ops->freenod )
|
||||||
|
(*parent_loc.ops->freenod)( &parent_loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -52,8 +52,15 @@ int mknod(
|
|||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !temp_loc.ops->mknod )
|
if ( !temp_loc.ops->mknod ) {
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*temp_loc.ops->mknod)( name_start, mode, dev, &temp_loc );
|
result = (*temp_loc.ops->mknod)( name_start, mode, dev, &temp_loc );
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,13 +88,12 @@ int init_fs_mount_table( void );
|
|||||||
int mount(
|
int mount(
|
||||||
rtems_filesystem_mount_table_entry_t **mt_entry,
|
rtems_filesystem_mount_table_entry_t **mt_entry,
|
||||||
rtems_filesystem_operations_table *fs_ops,
|
rtems_filesystem_operations_table *fs_ops,
|
||||||
rtems_filesystem_options_t fsoptions,
|
rtems_filesystem_options_t options,
|
||||||
char *device,
|
char *device,
|
||||||
char *mount_point
|
char *mount_point
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
rtems_filesystem_options_t options;
|
|
||||||
rtems_filesystem_mount_table_entry_t *temp_mt_entry;
|
rtems_filesystem_mount_table_entry_t *temp_mt_entry;
|
||||||
|
|
||||||
/* XXX add code to check for required operations */
|
/* XXX add code to check for required operations */
|
||||||
@@ -112,8 +111,8 @@ int mount(
|
|||||||
* Are the file system options valid?
|
* Are the file system options valid?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( fsoptions != RTEMS_FILESYSTEM_READ_ONLY &&
|
if ( options != RTEMS_FILESYSTEM_READ_ONLY &&
|
||||||
fsoptions != RTEMS_FILESYSTEM_READ_WRITE ) {
|
options != RTEMS_FILESYSTEM_READ_WRITE ) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -145,7 +144,7 @@ int mount(
|
|||||||
if ( rtems_filesystem_evaluate_path(
|
if ( rtems_filesystem_evaluate_path(
|
||||||
mount_point,
|
mount_point,
|
||||||
RTEMS_LIBIO_PERMS_RWX,
|
RTEMS_LIBIO_PERMS_RWX,
|
||||||
&temp_loc ,
|
&loc,
|
||||||
TRUE ) == -1 )
|
TRUE ) == -1 )
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
|
|
||||||
@@ -153,7 +152,7 @@ int mount(
|
|||||||
* Test to see if it is a directory
|
* Test to see if it is a directory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( temp_loc.ops->node_type( &temp_loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
|
if ( loc.ops->node_type( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||||
errno = ENOTDIR;
|
errno = ENOTDIR;
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
}
|
}
|
||||||
@@ -162,7 +161,7 @@ int mount(
|
|||||||
* You can only mount one file system onto a single mount point.
|
* You can only mount one file system onto a single mount point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( search_mt_for_mount_point( &temp_loc ) == FOUND ) {
|
if ( search_mt_for_mount_point( &loc ) == FOUND ) {
|
||||||
errno = EBUSY;
|
errno = EBUSY;
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
}
|
}
|
||||||
@@ -172,22 +171,22 @@ int mount(
|
|||||||
* into the allocated mount entry
|
* into the allocated mount entry
|
||||||
*/
|
*/
|
||||||
|
|
||||||
temp_mt_entry->mt_point_node.node_access = temp_loc.node_access;
|
temp_mt_entry->mt_point_node.node_access = loc.node_access;
|
||||||
temp_mt_entry->mt_point_node.handlers = temp_loc.handlers;
|
temp_mt_entry->mt_point_node.handlers = loc.handlers;
|
||||||
temp_mt_entry->mt_point_node.ops = temp_loc.ops;
|
temp_mt_entry->mt_point_node.ops = loc.ops;
|
||||||
temp_mt_entry->mt_point_node.mt_entry = temp_loc.mt_entry;
|
temp_mt_entry->mt_point_node.mt_entry = loc.mt_entry;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This link to the parent is only done when we are dealing with system
|
* This link to the parent is only done when we are dealing with system
|
||||||
* below the base file system
|
* below the base file system
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !temp_loc.ops->mount ){
|
if ( !loc.ops->mount ){
|
||||||
errno = ENOTSUP;
|
errno = ENOTSUP;
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( temp_loc.ops->mount( temp_mt_entry ) ) {
|
if ( loc.ops->mount( temp_mt_entry ) ) {
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,11 +223,19 @@ int mount(
|
|||||||
Chain_Append( &rtems_filesystem_mount_table_control, &temp_mt_entry->Node );
|
Chain_Append( &rtems_filesystem_mount_table_control, &temp_mt_entry->Node );
|
||||||
|
|
||||||
*mt_entry = temp_mt_entry;
|
*mt_entry = temp_mt_entry;
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cleanup_and_bail:
|
cleanup_and_bail:
|
||||||
|
|
||||||
free( temp_mt_entry );
|
free( temp_mt_entry );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ int open(
|
|||||||
int rc;
|
int rc;
|
||||||
rtems_libio_t *iop = 0;
|
rtems_libio_t *iop = 0;
|
||||||
int status;
|
int status;
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
int eval_flags;
|
int eval_flags;
|
||||||
|
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ int open(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
status = rtems_filesystem_evaluate_path(
|
status = rtems_filesystem_evaluate_path(
|
||||||
pathname, eval_flags, &temp_loc, TRUE );
|
pathname, eval_flags, &loc, TRUE );
|
||||||
|
|
||||||
if ( status == -1 ) {
|
if ( status == -1 ) {
|
||||||
if ( errno != ENOENT ) {
|
if ( errno != ENOENT ) {
|
||||||
@@ -126,7 +126,7 @@ int open(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check to see if the file name exists after the mknod() */
|
/* Sanity check to see if the file name exists after the mknod() */
|
||||||
status = rtems_filesystem_evaluate_path( pathname, 0x0, &temp_loc, TRUE );
|
status = rtems_filesystem_evaluate_path( pathname, 0x0, &loc, TRUE );
|
||||||
if ( status != 0 ) { /* The file did not exist */
|
if ( status != 0 ) { /* The file did not exist */
|
||||||
rc = EACCES;
|
rc = EACCES;
|
||||||
goto done;
|
goto done;
|
||||||
@@ -139,15 +139,15 @@ int open(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill in the file control block based on the temp_loc structure
|
* Fill in the file control block based on the loc structure
|
||||||
* returned by successful path evaluation.
|
* returned by successful path evaluation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
iop->offset = 0;
|
iop->offset = 0;
|
||||||
iop->handlers = temp_loc.handlers;
|
iop->handlers = loc.handlers;
|
||||||
iop->file_info = temp_loc.node_access;
|
iop->file_info = loc.node_access;
|
||||||
iop->flags |= rtems_libio_fcntl_flags( flags );
|
iop->flags |= rtems_libio_fcntl_flags( flags );
|
||||||
iop->pathinfo = temp_loc;
|
iop->pathinfo = loc;
|
||||||
|
|
||||||
if ( !iop->handlers->open ) {
|
if ( !iop->handlers->open ) {
|
||||||
rc = ENOTSUP;
|
rc = ENOTSUP;
|
||||||
@@ -178,6 +178,10 @@ done:
|
|||||||
rtems_libio_free( iop );
|
rtems_libio_free( iop );
|
||||||
set_errno_and_return_minus_one( rc );
|
set_errno_and_return_minus_one( rc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
return iop - rtems_libio_iops;
|
return iop - rtems_libio_iops;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,21 +23,35 @@ int readlink(
|
|||||||
rtems_filesystem_location_info_t loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
if (!buf)
|
||||||
|
set_errno_and_return_minus_one( EFAULT );
|
||||||
|
|
||||||
result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE );
|
result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE );
|
||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!buf)
|
if ( !loc.ops->node_type ){
|
||||||
set_errno_and_return_minus_one( EFAULT );
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
if ( !loc.ops->node_type )
|
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK )
|
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
set_errno_and_return_minus_one( EINVAL );
|
||||||
|
}
|
||||||
|
|
||||||
if ( !loc.ops->readlink )
|
if ( !loc.ops->readlink ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*loc.ops->readlink)( &loc, buf, bufsize );
|
result = (*loc.ops->readlink)( &loc, buf, bufsize );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,18 +39,32 @@ int rmdir(
|
|||||||
* Verify you can remove this node as a directory.
|
* Verify you can remove this node as a directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !loc.ops->node_type )
|
if ( !loc.ops->node_type ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
|
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTDIR );
|
set_errno_and_return_minus_one( ENOTDIR );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use the filesystems rmnod to remove the node.
|
* Use the filesystems rmnod to remove the node.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !loc.ops->rmnod )
|
if ( !loc.ops->rmnod ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*loc.ops->rmnod)( &loc );
|
result = (*loc.ops->rmnod)( &loc );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,8 +58,11 @@ int _STAT_NAME(
|
|||||||
if ( status != 0 )
|
if ( status != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !loc.handlers->fstat )
|
if ( !loc.handlers->fstat ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Zero out the stat structure so the various support
|
* Zero out the stat structure so the various support
|
||||||
@@ -68,7 +71,12 @@ int _STAT_NAME(
|
|||||||
|
|
||||||
memset( buf, 0, sizeof(struct stat) );
|
memset( buf, 0, sizeof(struct stat) );
|
||||||
|
|
||||||
return (*loc.handlers->fstat)( &loc, buf );
|
status = (*loc.handlers->fstat)( &loc, buf );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ int symlink(
|
|||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return (*loc.ops->symlink)( &loc, actualpath, name_start);
|
result = (*loc.ops->symlink)( &loc, actualpath, name_start);
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,16 +31,30 @@ int unlink(
|
|||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !loc.ops->node_type )
|
if ( !loc.ops->node_type ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
if ( (*loc.ops->node_type)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY )
|
if ( (*loc.ops->node_type)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( EISDIR );
|
set_errno_and_return_minus_one( EISDIR );
|
||||||
|
}
|
||||||
if ( !loc.ops->unlink )
|
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
|
||||||
|
|
||||||
return (*loc.ops->unlink)( &loc );
|
if ( !loc.ops->unlink ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
|
result = (*loc.ops->unlink)( &loc );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -83,8 +83,11 @@ int unmount(
|
|||||||
* we are attempting to unmount ?
|
* we are attempting to unmount ?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry )
|
if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry ) {
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
set_errno_and_return_minus_one( EBUSY );
|
set_errno_and_return_minus_one( EBUSY );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Run the file descriptor table to determine if there are any file
|
* Run the file descriptor table to determine if there are any file
|
||||||
@@ -92,8 +95,11 @@ int unmount(
|
|||||||
* file system that we are trying to unmount
|
* file system that we are trying to unmount
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 )
|
if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 ) {
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
set_errno_and_return_minus_one( EBUSY );
|
set_errno_and_return_minus_one( EBUSY );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow the file system being mounted on to do its cleanup.
|
* Allow the file system being mounted on to do its cleanup.
|
||||||
@@ -103,15 +109,21 @@ int unmount(
|
|||||||
* XXX I will step off in space when evaluating past the end of the node.
|
* XXX I will step off in space when evaluating past the end of the node.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ( temp_mt_entry.mt_point_node.ops->unmount )( temp_loc.mt_entry ) != 0 )
|
if ((temp_mt_entry.mt_point_node.ops->unmount )( temp_loc.mt_entry ) != 0 ) {
|
||||||
return -1;
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Run the unmount function for the subordinate file system.
|
* Run the unmount function for the subordinate file system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ( temp_mt_entry.mt_fs_root.ops->fsunmount_me )( temp_loc.mt_entry ) != 0 )
|
if ((temp_mt_entry.mt_fs_root.ops->fsunmount_me )( temp_loc.mt_entry ) != 0){
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow the file system to clean up.
|
* Allow the file system to clean up.
|
||||||
@@ -130,6 +142,8 @@ int unmount(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
free( temp_loc.mt_entry );
|
free( temp_loc.mt_entry );
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|||||||
@@ -24,12 +24,18 @@ int utime(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t temp_loc;
|
||||||
|
int result;
|
||||||
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if ( !temp_loc.ops->utime )
|
if ( !temp_loc.ops->utime )
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
|
||||||
return (*temp_loc.ops->utime)( &temp_loc, times->actime, times->modtime );
|
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
result = (*temp_loc.ops->utime)( &temp_loc, times->actime, times->modtime );
|
||||||
|
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ rtems_status_code rtems_io_register_name(
|
|||||||
* rtems_io_lookup_name
|
* rtems_io_lookup_name
|
||||||
*
|
*
|
||||||
* This version is not reentrant.
|
* This version is not reentrant.
|
||||||
|
*
|
||||||
|
* XXX - This is dependent upon IMFS and should not be.
|
||||||
|
* Suggest adding a filesystem routine to fill in the device_info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtems_status_code rtems_io_lookup_name(
|
rtems_status_code rtems_io_lookup_name(
|
||||||
@@ -70,15 +73,20 @@ rtems_status_code rtems_io_lookup_name(
|
|||||||
{
|
{
|
||||||
#if !defined(RTEMS_UNIX)
|
#if !defined(RTEMS_UNIX)
|
||||||
IMFS_jnode_t *the_jnode;
|
IMFS_jnode_t *the_jnode;
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
static rtems_driver_name_t device;
|
static rtems_driver_name_t device;
|
||||||
int result;
|
int result;
|
||||||
|
rtems_filesystem_node_types_t node_type;
|
||||||
|
|
||||||
result = rtems_filesystem_evaluate_path( name, 0x00, &temp_loc, TRUE );
|
result = rtems_filesystem_evaluate_path( name, 0x00, &loc, TRUE );
|
||||||
the_jnode = temp_loc.node_access;
|
the_jnode = loc.node_access;
|
||||||
|
|
||||||
if ( (result != 0) || the_jnode->type != IMFS_DEVICE ) {
|
node_type = (*loc.ops->node_type)( &loc );
|
||||||
|
|
||||||
|
if ( (result != 0) || node_type != RTEMS_FILESYSTEM_DEVICE ) {
|
||||||
*device_info = 0;
|
*device_info = 0;
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
return RTEMS_UNSATISFIED;
|
return RTEMS_UNSATISFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,6 +95,10 @@ rtems_status_code rtems_io_lookup_name(
|
|||||||
device.major = the_jnode->info.device.major;
|
device.major = the_jnode->info.device.major;
|
||||||
device.minor = the_jnode->info.device.minor;
|
device.minor = the_jnode->info.device.minor;
|
||||||
*device_info = &device;
|
*device_info = &device;
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,12 +38,21 @@ int chdir(
|
|||||||
* Verify you can change directory into this node.
|
* Verify you can change directory into this node.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !loc.ops->node_type )
|
if ( !loc.ops->node_type ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
|
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTDIR );
|
set_errno_and_return_minus_one( ENOTDIR );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( rtems_filesystem_current.ops->freenod )
|
||||||
|
(*rtems_filesystem_current.ops->freenod)( &rtems_filesystem_current );
|
||||||
|
|
||||||
rtems_filesystem_current = loc;
|
rtems_filesystem_current = loc;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -28,13 +28,22 @@ int chmod(
|
|||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
rtems_filesystem_location_info_t loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
|
int result;
|
||||||
|
|
||||||
status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE );
|
status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE );
|
||||||
if ( status != 0 )
|
if ( status != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !loc.handlers->fchmod )
|
if ( !loc.handlers->fchmod ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*loc.handlers->fchmod)( &loc, mode );
|
result = (*loc.handlers->fchmod)( &loc, mode );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,13 +26,22 @@ int chown(
|
|||||||
gid_t group
|
gid_t group
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
|
int result;
|
||||||
|
|
||||||
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
if ( rtems_filesystem_evaluate_path( path, 0x00, &loc, TRUE ) )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !temp_loc.ops->chown )
|
if ( !loc.ops->chown ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*temp_loc.ops->chown)( &temp_loc, owner, group );
|
result = (*loc.ops->chown)( &loc, owner, group );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ int link(
|
|||||||
/*
|
/*
|
||||||
* Get the node we are linking to.
|
* Get the node we are linking to.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
result = rtems_filesystem_evaluate_path( existing, 0, &existing_loc, TRUE );
|
result = rtems_filesystem_evaluate_path( existing, 0, &existing_loc, TRUE );
|
||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
@@ -42,21 +43,47 @@ int link(
|
|||||||
|
|
||||||
rtems_filesystem_get_start_loc( new, &i, &parent_loc );
|
rtems_filesystem_get_start_loc( new, &i, &parent_loc );
|
||||||
result = (*parent_loc.ops->evalformake)( &new[i], &parent_loc, &name_start );
|
result = (*parent_loc.ops->evalformake)( &new[i], &parent_loc, &name_start );
|
||||||
if ( result != 0 )
|
if ( result != 0 ) {
|
||||||
set_errno_and_return_minus_one( result );
|
if ( existing_loc.ops->freenod )
|
||||||
|
(*existing_loc.ops->freenod)( &parent_loc );
|
||||||
|
set_errno_and_return_minus_one( result );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check to see if the caller is trying to link across file system
|
* Check to see if the caller is trying to link across file system
|
||||||
* boundaries.
|
* boundaries.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( parent_loc.mt_entry != existing_loc.mt_entry )
|
if ( parent_loc.mt_entry != existing_loc.mt_entry ) {
|
||||||
|
if ( existing_loc.ops->freenod )
|
||||||
|
(*existing_loc.ops->freenod)( &existing_loc );
|
||||||
|
|
||||||
|
if ( parent_loc.ops->freenod )
|
||||||
|
(*parent_loc.ops->freenod)( &parent_loc );
|
||||||
|
|
||||||
set_errno_and_return_minus_one( EXDEV );
|
set_errno_and_return_minus_one( EXDEV );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !parent_loc.ops->link ) {
|
||||||
|
|
||||||
|
if ( existing_loc.ops->freenod )
|
||||||
|
(*existing_loc.ops->freenod)( &existing_loc );
|
||||||
|
|
||||||
|
if ( parent_loc.ops->freenod )
|
||||||
|
(*parent_loc.ops->freenod)( &parent_loc );
|
||||||
|
|
||||||
if ( !parent_loc.ops->link )
|
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*parent_loc.ops->link)( &existing_loc, &parent_loc, name_start );
|
result = (*parent_loc.ops->link)( &existing_loc, &parent_loc, name_start );
|
||||||
|
|
||||||
|
if ( existing_loc.ops->freenod )
|
||||||
|
(*existing_loc.ops->freenod)( &existing_loc );
|
||||||
|
|
||||||
|
if ( parent_loc.ops->freenod )
|
||||||
|
(*parent_loc.ops->freenod)( &parent_loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -52,8 +52,15 @@ int mknod(
|
|||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !temp_loc.ops->mknod )
|
if ( !temp_loc.ops->mknod ) {
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*temp_loc.ops->mknod)( name_start, mode, dev, &temp_loc );
|
result = (*temp_loc.ops->mknod)( name_start, mode, dev, &temp_loc );
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,13 +88,12 @@ int init_fs_mount_table( void );
|
|||||||
int mount(
|
int mount(
|
||||||
rtems_filesystem_mount_table_entry_t **mt_entry,
|
rtems_filesystem_mount_table_entry_t **mt_entry,
|
||||||
rtems_filesystem_operations_table *fs_ops,
|
rtems_filesystem_operations_table *fs_ops,
|
||||||
rtems_filesystem_options_t fsoptions,
|
rtems_filesystem_options_t options,
|
||||||
char *device,
|
char *device,
|
||||||
char *mount_point
|
char *mount_point
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
rtems_filesystem_options_t options;
|
|
||||||
rtems_filesystem_mount_table_entry_t *temp_mt_entry;
|
rtems_filesystem_mount_table_entry_t *temp_mt_entry;
|
||||||
|
|
||||||
/* XXX add code to check for required operations */
|
/* XXX add code to check for required operations */
|
||||||
@@ -112,8 +111,8 @@ int mount(
|
|||||||
* Are the file system options valid?
|
* Are the file system options valid?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( fsoptions != RTEMS_FILESYSTEM_READ_ONLY &&
|
if ( options != RTEMS_FILESYSTEM_READ_ONLY &&
|
||||||
fsoptions != RTEMS_FILESYSTEM_READ_WRITE ) {
|
options != RTEMS_FILESYSTEM_READ_WRITE ) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -145,7 +144,7 @@ int mount(
|
|||||||
if ( rtems_filesystem_evaluate_path(
|
if ( rtems_filesystem_evaluate_path(
|
||||||
mount_point,
|
mount_point,
|
||||||
RTEMS_LIBIO_PERMS_RWX,
|
RTEMS_LIBIO_PERMS_RWX,
|
||||||
&temp_loc ,
|
&loc,
|
||||||
TRUE ) == -1 )
|
TRUE ) == -1 )
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
|
|
||||||
@@ -153,7 +152,7 @@ int mount(
|
|||||||
* Test to see if it is a directory
|
* Test to see if it is a directory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( temp_loc.ops->node_type( &temp_loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
|
if ( loc.ops->node_type( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||||
errno = ENOTDIR;
|
errno = ENOTDIR;
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
}
|
}
|
||||||
@@ -162,7 +161,7 @@ int mount(
|
|||||||
* You can only mount one file system onto a single mount point.
|
* You can only mount one file system onto a single mount point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( search_mt_for_mount_point( &temp_loc ) == FOUND ) {
|
if ( search_mt_for_mount_point( &loc ) == FOUND ) {
|
||||||
errno = EBUSY;
|
errno = EBUSY;
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
}
|
}
|
||||||
@@ -172,22 +171,22 @@ int mount(
|
|||||||
* into the allocated mount entry
|
* into the allocated mount entry
|
||||||
*/
|
*/
|
||||||
|
|
||||||
temp_mt_entry->mt_point_node.node_access = temp_loc.node_access;
|
temp_mt_entry->mt_point_node.node_access = loc.node_access;
|
||||||
temp_mt_entry->mt_point_node.handlers = temp_loc.handlers;
|
temp_mt_entry->mt_point_node.handlers = loc.handlers;
|
||||||
temp_mt_entry->mt_point_node.ops = temp_loc.ops;
|
temp_mt_entry->mt_point_node.ops = loc.ops;
|
||||||
temp_mt_entry->mt_point_node.mt_entry = temp_loc.mt_entry;
|
temp_mt_entry->mt_point_node.mt_entry = loc.mt_entry;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This link to the parent is only done when we are dealing with system
|
* This link to the parent is only done when we are dealing with system
|
||||||
* below the base file system
|
* below the base file system
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !temp_loc.ops->mount ){
|
if ( !loc.ops->mount ){
|
||||||
errno = ENOTSUP;
|
errno = ENOTSUP;
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( temp_loc.ops->mount( temp_mt_entry ) ) {
|
if ( loc.ops->mount( temp_mt_entry ) ) {
|
||||||
goto cleanup_and_bail;
|
goto cleanup_and_bail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,11 +223,19 @@ int mount(
|
|||||||
Chain_Append( &rtems_filesystem_mount_table_control, &temp_mt_entry->Node );
|
Chain_Append( &rtems_filesystem_mount_table_control, &temp_mt_entry->Node );
|
||||||
|
|
||||||
*mt_entry = temp_mt_entry;
|
*mt_entry = temp_mt_entry;
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cleanup_and_bail:
|
cleanup_and_bail:
|
||||||
|
|
||||||
free( temp_mt_entry );
|
free( temp_mt_entry );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ int open(
|
|||||||
int rc;
|
int rc;
|
||||||
rtems_libio_t *iop = 0;
|
rtems_libio_t *iop = 0;
|
||||||
int status;
|
int status;
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
int eval_flags;
|
int eval_flags;
|
||||||
|
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ int open(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
status = rtems_filesystem_evaluate_path(
|
status = rtems_filesystem_evaluate_path(
|
||||||
pathname, eval_flags, &temp_loc, TRUE );
|
pathname, eval_flags, &loc, TRUE );
|
||||||
|
|
||||||
if ( status == -1 ) {
|
if ( status == -1 ) {
|
||||||
if ( errno != ENOENT ) {
|
if ( errno != ENOENT ) {
|
||||||
@@ -126,7 +126,7 @@ int open(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check to see if the file name exists after the mknod() */
|
/* Sanity check to see if the file name exists after the mknod() */
|
||||||
status = rtems_filesystem_evaluate_path( pathname, 0x0, &temp_loc, TRUE );
|
status = rtems_filesystem_evaluate_path( pathname, 0x0, &loc, TRUE );
|
||||||
if ( status != 0 ) { /* The file did not exist */
|
if ( status != 0 ) { /* The file did not exist */
|
||||||
rc = EACCES;
|
rc = EACCES;
|
||||||
goto done;
|
goto done;
|
||||||
@@ -139,15 +139,15 @@ int open(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill in the file control block based on the temp_loc structure
|
* Fill in the file control block based on the loc structure
|
||||||
* returned by successful path evaluation.
|
* returned by successful path evaluation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
iop->offset = 0;
|
iop->offset = 0;
|
||||||
iop->handlers = temp_loc.handlers;
|
iop->handlers = loc.handlers;
|
||||||
iop->file_info = temp_loc.node_access;
|
iop->file_info = loc.node_access;
|
||||||
iop->flags |= rtems_libio_fcntl_flags( flags );
|
iop->flags |= rtems_libio_fcntl_flags( flags );
|
||||||
iop->pathinfo = temp_loc;
|
iop->pathinfo = loc;
|
||||||
|
|
||||||
if ( !iop->handlers->open ) {
|
if ( !iop->handlers->open ) {
|
||||||
rc = ENOTSUP;
|
rc = ENOTSUP;
|
||||||
@@ -178,6 +178,10 @@ done:
|
|||||||
rtems_libio_free( iop );
|
rtems_libio_free( iop );
|
||||||
set_errno_and_return_minus_one( rc );
|
set_errno_and_return_minus_one( rc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
return iop - rtems_libio_iops;
|
return iop - rtems_libio_iops;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,21 +23,35 @@ int readlink(
|
|||||||
rtems_filesystem_location_info_t loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
if (!buf)
|
||||||
|
set_errno_and_return_minus_one( EFAULT );
|
||||||
|
|
||||||
result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE );
|
result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE );
|
||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!buf)
|
if ( !loc.ops->node_type ){
|
||||||
set_errno_and_return_minus_one( EFAULT );
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
if ( !loc.ops->node_type )
|
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK )
|
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( EINVAL );
|
set_errno_and_return_minus_one( EINVAL );
|
||||||
|
}
|
||||||
|
|
||||||
if ( !loc.ops->readlink )
|
if ( !loc.ops->readlink ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*loc.ops->readlink)( &loc, buf, bufsize );
|
result = (*loc.ops->readlink)( &loc, buf, bufsize );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,18 +39,32 @@ int rmdir(
|
|||||||
* Verify you can remove this node as a directory.
|
* Verify you can remove this node as a directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !loc.ops->node_type )
|
if ( !loc.ops->node_type ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY )
|
if ( (*loc.ops->node_type)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTDIR );
|
set_errno_and_return_minus_one( ENOTDIR );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use the filesystems rmnod to remove the node.
|
* Use the filesystems rmnod to remove the node.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !loc.ops->rmnod )
|
if ( !loc.ops->rmnod ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
return (*loc.ops->rmnod)( &loc );
|
result = (*loc.ops->rmnod)( &loc );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,8 +58,11 @@ int _STAT_NAME(
|
|||||||
if ( status != 0 )
|
if ( status != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !loc.handlers->fstat )
|
if ( !loc.handlers->fstat ){
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Zero out the stat structure so the various support
|
* Zero out the stat structure so the various support
|
||||||
@@ -68,7 +71,12 @@ int _STAT_NAME(
|
|||||||
|
|
||||||
memset( buf, 0, sizeof(struct stat) );
|
memset( buf, 0, sizeof(struct stat) );
|
||||||
|
|
||||||
return (*loc.handlers->fstat)( &loc, buf );
|
status = (*loc.handlers->fstat)( &loc, buf );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ int symlink(
|
|||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return (*loc.ops->symlink)( &loc, actualpath, name_start);
|
result = (*loc.ops->symlink)( &loc, actualpath, name_start);
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,16 +31,30 @@ int unlink(
|
|||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ( !loc.ops->node_type )
|
if ( !loc.ops->node_type ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
if ( (*loc.ops->node_type)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY )
|
if ( (*loc.ops->node_type)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
set_errno_and_return_minus_one( EISDIR );
|
set_errno_and_return_minus_one( EISDIR );
|
||||||
|
}
|
||||||
if ( !loc.ops->unlink )
|
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
|
||||||
|
|
||||||
return (*loc.ops->unlink)( &loc );
|
if ( !loc.ops->unlink ) {
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
}
|
||||||
|
|
||||||
|
result = (*loc.ops->unlink)( &loc );
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -83,8 +83,11 @@ int unmount(
|
|||||||
* we are attempting to unmount ?
|
* we are attempting to unmount ?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry )
|
if ( rtems_filesystem_current.mt_entry == temp_loc.mt_entry ) {
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
set_errno_and_return_minus_one( EBUSY );
|
set_errno_and_return_minus_one( EBUSY );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Run the file descriptor table to determine if there are any file
|
* Run the file descriptor table to determine if there are any file
|
||||||
@@ -92,8 +95,11 @@ int unmount(
|
|||||||
* file system that we are trying to unmount
|
* file system that we are trying to unmount
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 )
|
if ( rtems_libio_is_open_files_in_fs( temp_loc.mt_entry ) == 1 ) {
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
set_errno_and_return_minus_one( EBUSY );
|
set_errno_and_return_minus_one( EBUSY );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow the file system being mounted on to do its cleanup.
|
* Allow the file system being mounted on to do its cleanup.
|
||||||
@@ -103,15 +109,21 @@ int unmount(
|
|||||||
* XXX I will step off in space when evaluating past the end of the node.
|
* XXX I will step off in space when evaluating past the end of the node.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ( temp_mt_entry.mt_point_node.ops->unmount )( temp_loc.mt_entry ) != 0 )
|
if ((temp_mt_entry.mt_point_node.ops->unmount )( temp_loc.mt_entry ) != 0 ) {
|
||||||
return -1;
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Run the unmount function for the subordinate file system.
|
* Run the unmount function for the subordinate file system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ( temp_mt_entry.mt_fs_root.ops->fsunmount_me )( temp_loc.mt_entry ) != 0 )
|
if ((temp_mt_entry.mt_fs_root.ops->fsunmount_me )( temp_loc.mt_entry ) != 0){
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow the file system to clean up.
|
* Allow the file system to clean up.
|
||||||
@@ -130,6 +142,8 @@ int unmount(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
free( temp_loc.mt_entry );
|
free( temp_loc.mt_entry );
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|||||||
@@ -24,12 +24,18 @@ int utime(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t temp_loc;
|
||||||
|
int result;
|
||||||
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if ( !temp_loc.ops->utime )
|
if ( !temp_loc.ops->utime )
|
||||||
set_errno_and_return_minus_one( ENOTSUP );
|
set_errno_and_return_minus_one( ENOTSUP );
|
||||||
|
|
||||||
return (*temp_loc.ops->utime)( &temp_loc, times->actime, times->modtime );
|
if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
result = (*temp_loc.ops->utime)( &temp_loc, times->actime, times->modtime );
|
||||||
|
|
||||||
|
if ( temp_loc.ops->freenod )
|
||||||
|
(*temp_loc.ops->freenod)( &temp_loc );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ rtems_status_code rtems_io_register_name(
|
|||||||
* rtems_io_lookup_name
|
* rtems_io_lookup_name
|
||||||
*
|
*
|
||||||
* This version is not reentrant.
|
* This version is not reentrant.
|
||||||
|
*
|
||||||
|
* XXX - This is dependent upon IMFS and should not be.
|
||||||
|
* Suggest adding a filesystem routine to fill in the device_info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtems_status_code rtems_io_lookup_name(
|
rtems_status_code rtems_io_lookup_name(
|
||||||
@@ -70,15 +73,20 @@ rtems_status_code rtems_io_lookup_name(
|
|||||||
{
|
{
|
||||||
#if !defined(RTEMS_UNIX)
|
#if !defined(RTEMS_UNIX)
|
||||||
IMFS_jnode_t *the_jnode;
|
IMFS_jnode_t *the_jnode;
|
||||||
rtems_filesystem_location_info_t temp_loc;
|
rtems_filesystem_location_info_t loc;
|
||||||
static rtems_driver_name_t device;
|
static rtems_driver_name_t device;
|
||||||
int result;
|
int result;
|
||||||
|
rtems_filesystem_node_types_t node_type;
|
||||||
|
|
||||||
result = rtems_filesystem_evaluate_path( name, 0x00, &temp_loc, TRUE );
|
result = rtems_filesystem_evaluate_path( name, 0x00, &loc, TRUE );
|
||||||
the_jnode = temp_loc.node_access;
|
the_jnode = loc.node_access;
|
||||||
|
|
||||||
if ( (result != 0) || the_jnode->type != IMFS_DEVICE ) {
|
node_type = (*loc.ops->node_type)( &loc );
|
||||||
|
|
||||||
|
if ( (result != 0) || node_type != RTEMS_FILESYSTEM_DEVICE ) {
|
||||||
*device_info = 0;
|
*device_info = 0;
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
return RTEMS_UNSATISFIED;
|
return RTEMS_UNSATISFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,6 +95,10 @@ rtems_status_code rtems_io_lookup_name(
|
|||||||
device.major = the_jnode->info.device.major;
|
device.major = the_jnode->info.device.major;
|
||||||
device.minor = the_jnode->info.device.minor;
|
device.minor = the_jnode->info.device.minor;
|
||||||
*device_info = &device;
|
*device_info = &device;
|
||||||
|
|
||||||
|
if ( loc.ops->freenod )
|
||||||
|
(*loc.ops->freenod)( &loc );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user