mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-26 00:14:03 +08:00
2010-07-01 Jennifer Averett <Jennifer.Averett@OARcorp.com>
* libcsupport/src/chdir.c, libcsupport/src/chmod.c, libcsupport/src/chown.c, libcsupport/src/close.c, libcsupport/src/eval.c, libcsupport/src/fchdir.c, libcsupport/src/fchmod.c, libcsupport/src/fchown.c, libcsupport/src/fcntl.c, libcsupport/src/fdatasync.c, libcsupport/src/freenode.c, libcsupport/src/fstat.c, libcsupport/src/fsync.c, libcsupport/src/ftruncate.c, libcsupport/src/ioctl.c, libcsupport/src/link.c, libcsupport/src/lseek.c, libcsupport/src/mknod.c, libcsupport/src/mount.c, libcsupport/src/open.c, libcsupport/src/read.c, libcsupport/src/readlink.c, libcsupport/src/readv.c, libcsupport/src/rmdir.c, libcsupport/src/stat.c, libcsupport/src/statvfs.c, libcsupport/src/symlink.c, libcsupport/src/unlink.c, libcsupport/src/unmount.c, libcsupport/src/write.c: Removed filesystem checks for NULL methods checks from the main posix rountines. These are now required to have at a miminum default routines in the tables.
This commit is contained in:
@@ -1,3 +1,24 @@
|
||||
2010-07-01 Jennifer Averett <Jennifer.Averett@OARcorp.com>
|
||||
|
||||
* libcsupport/src/chdir.c, libcsupport/src/chmod.c,
|
||||
libcsupport/src/chown.c, libcsupport/src/close.c,
|
||||
libcsupport/src/eval.c, libcsupport/src/fchdir.c,
|
||||
libcsupport/src/fchmod.c, libcsupport/src/fchown.c,
|
||||
libcsupport/src/fcntl.c, libcsupport/src/fdatasync.c,
|
||||
libcsupport/src/freenode.c, libcsupport/src/fstat.c,
|
||||
libcsupport/src/fsync.c, libcsupport/src/ftruncate.c,
|
||||
libcsupport/src/ioctl.c, libcsupport/src/link.c,
|
||||
libcsupport/src/lseek.c, libcsupport/src/mknod.c,
|
||||
libcsupport/src/mount.c, libcsupport/src/open.c,
|
||||
libcsupport/src/read.c, libcsupport/src/readlink.c,
|
||||
libcsupport/src/readv.c, libcsupport/src/rmdir.c,
|
||||
libcsupport/src/stat.c, libcsupport/src/statvfs.c,
|
||||
libcsupport/src/symlink.c, libcsupport/src/unlink.c,
|
||||
libcsupport/src/unmount.c, libcsupport/src/write.c: Removed
|
||||
filesystem checks for NULL methods checks from the main posix
|
||||
rountines. These are now required to have at a miminum default
|
||||
routines in the tables.
|
||||
|
||||
2010-07-01 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* libcsupport/include/rtems/libio_.h: Removed
|
||||
|
||||
@@ -44,11 +44,6 @@ int chdir(
|
||||
/*
|
||||
* Verify you can change directory into this node.
|
||||
*/
|
||||
if ( !loc.ops->node_type_h ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTDIR );
|
||||
|
||||
@@ -38,16 +38,6 @@ int chmod(
|
||||
if ( status != 0 )
|
||||
return -1;
|
||||
|
||||
if ( !loc.handlers ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
rtems_set_errno_and_return_minus_one( EBADF );
|
||||
}
|
||||
|
||||
if ( !loc.handlers->fchmod_h ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*loc.handlers->fchmod_h)( &loc, mode );
|
||||
|
||||
rtems_filesystem_freenode( &loc );
|
||||
|
||||
@@ -36,11 +36,6 @@ int chown(
|
||||
if ( rtems_filesystem_evaluate_path( path, strlen( path ), 0x00, &loc, true ) )
|
||||
return -1;
|
||||
|
||||
if ( !loc.ops->chown_h ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*loc.ops->chown_h)( &loc, owner, group );
|
||||
|
||||
rtems_filesystem_freenode( &loc );
|
||||
|
||||
@@ -29,8 +29,7 @@ int close(
|
||||
rtems_libio_check_is_open(iop);
|
||||
|
||||
rc = RTEMS_SUCCESSFUL;
|
||||
if ( iop->handlers->close_h )
|
||||
rc = (*iop->handlers->close_h)( iop );
|
||||
rc = (*iop->handlers->close_h)( iop );
|
||||
|
||||
rtems_filesystem_freenode( &iop->pathinfo );
|
||||
rtems_libio_free( iop );
|
||||
|
||||
@@ -42,9 +42,6 @@ int rtems_filesystem_evaluate_relative_path(
|
||||
if ( !pathloc )
|
||||
rtems_set_errno_and_return_minus_one( EIO ); /* should never happen */
|
||||
|
||||
if ( !pathloc->ops->evalpath_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
result = (*pathloc->ops->evalpath_h)( pathname, pathnamelen, flags, pathloc );
|
||||
|
||||
/*
|
||||
@@ -54,21 +51,11 @@ int rtems_filesystem_evaluate_relative_path(
|
||||
|
||||
if ( (result == 0) && follow_link ) {
|
||||
|
||||
if ( !pathloc->ops->node_type_h ){
|
||||
rtems_filesystem_freenode( pathloc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
type = (*pathloc->ops->node_type_h)( pathloc );
|
||||
|
||||
if ( ( type == RTEMS_FILESYSTEM_HARD_LINK ) ||
|
||||
( type == RTEMS_FILESYSTEM_SYM_LINK ) ) {
|
||||
|
||||
if ( !pathloc->ops->eval_link_h ){
|
||||
rtems_filesystem_freenode( pathloc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
/* what to do with the valid node pathloc points to
|
||||
* if eval_link_h fails?
|
||||
* Let the FS implementation deal with this case. It
|
||||
|
||||
@@ -45,14 +45,6 @@ int fchdir(
|
||||
* Verify you can change directory into this node.
|
||||
*/
|
||||
|
||||
if ( !iop->pathinfo.ops ) {
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( !iop->pathinfo.ops->node_type_h ) {
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( (*iop->pathinfo.ops->node_type_h)( &iop->pathinfo ) !=
|
||||
RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||
rtems_set_errno_and_return_minus_one( ENOTDIR );
|
||||
|
||||
@@ -41,8 +41,5 @@ int fchmod(
|
||||
|
||||
rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
|
||||
|
||||
if ( !iop->handlers->fchmod_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
return (*iop->pathinfo.handlers->fchmod_h)( &iop->pathinfo, mode );
|
||||
}
|
||||
|
||||
@@ -38,8 +38,5 @@ int fchown(
|
||||
|
||||
rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
|
||||
|
||||
if ( !iop->pathinfo.ops->chown_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
return (*iop->pathinfo.ops->chown_h)( &iop->pathinfo, owner, group );
|
||||
}
|
||||
|
||||
@@ -140,12 +140,10 @@ static int vfcntl(
|
||||
*/
|
||||
|
||||
if (ret >= 0) {
|
||||
if (iop->handlers->fcntl_h) {
|
||||
int err = (*iop->handlers->fcntl_h)( cmd, iop );
|
||||
if (err) {
|
||||
errno = err;
|
||||
ret = -1;
|
||||
}
|
||||
int err = (*iop->handlers->fcntl_h)( cmd, iop );
|
||||
if (err) {
|
||||
errno = err;
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -35,8 +35,5 @@ int fdatasync(
|
||||
* Now process the fdatasync().
|
||||
*/
|
||||
|
||||
if ( !iop->handlers->fdatasync_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
return (*iop->handlers->fdatasync_h)( iop );
|
||||
}
|
||||
|
||||
@@ -16,7 +16,5 @@
|
||||
|
||||
void rtems_filesystem_freenode( rtems_filesystem_location_info_t *_node )
|
||||
{
|
||||
if ( _node->ops )
|
||||
if ( _node->ops->freenod_h )
|
||||
_node->ops->freenod_h(_node );
|
||||
_node->ops->freenod_h(_node );
|
||||
}
|
||||
|
||||
@@ -44,12 +44,6 @@ int fstat(
|
||||
rtems_libio_check_fd( fd );
|
||||
rtems_libio_check_is_open(iop);
|
||||
|
||||
if ( !iop->handlers )
|
||||
rtems_set_errno_and_return_minus_one( EBADF );
|
||||
|
||||
if ( !iop->handlers->fstat_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
/*
|
||||
* Zero out the stat structure so the various support
|
||||
* versions of stat don't have to.
|
||||
|
||||
@@ -35,11 +35,5 @@ int fsync(
|
||||
* Now process the fsync().
|
||||
*/
|
||||
|
||||
if ( !iop->handlers )
|
||||
rtems_set_errno_and_return_minus_one( EBADF );
|
||||
|
||||
if ( !iop->handlers->fsync_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
return (*iop->handlers->fsync_h)( iop );
|
||||
}
|
||||
|
||||
@@ -42,16 +42,10 @@ int ftruncate(
|
||||
*/
|
||||
|
||||
loc = iop->pathinfo;
|
||||
if ( !loc.ops->node_type_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
if ( (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY )
|
||||
rtems_set_errno_and_return_minus_one( EISDIR );
|
||||
|
||||
rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE );
|
||||
|
||||
if ( !iop->handlers->ftruncate_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
return (*iop->handlers->ftruncate_h)( iop, length );
|
||||
}
|
||||
|
||||
@@ -47,13 +47,6 @@ int ioctl(
|
||||
/*
|
||||
* Now process the ioctl().
|
||||
*/
|
||||
|
||||
if ( !iop->handlers )
|
||||
rtems_set_errno_and_return_minus_one( EBADF );
|
||||
|
||||
if ( !iop->handlers->ioctl_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
rc = (*iop->handlers->ioctl_h)( iop, command, buffer );
|
||||
|
||||
return rc;
|
||||
|
||||
@@ -48,11 +48,6 @@ int link(
|
||||
|
||||
rtems_filesystem_get_start_loc( new, &i, &parent_loc );
|
||||
|
||||
if ( !parent_loc.ops->evalformake_h ) {
|
||||
rtems_filesystem_freenode( &existing_loc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*parent_loc.ops->evalformake_h)( &new[i], &parent_loc, &name_start );
|
||||
if ( result != 0 ) {
|
||||
rtems_filesystem_freenode( &existing_loc );
|
||||
@@ -70,12 +65,6 @@ int link(
|
||||
rtems_set_errno_and_return_minus_one( EXDEV );
|
||||
}
|
||||
|
||||
if ( !parent_loc.ops->link_h ) {
|
||||
rtems_filesystem_freenode( &existing_loc );
|
||||
rtems_filesystem_freenode( &parent_loc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*parent_loc.ops->link_h)( &existing_loc, &parent_loc, name_start );
|
||||
|
||||
rtems_filesystem_freenode( &existing_loc );
|
||||
|
||||
@@ -34,13 +34,6 @@ off_t lseek(
|
||||
iop = rtems_libio_iop( fd );
|
||||
rtems_libio_check_is_open(iop);
|
||||
|
||||
/*
|
||||
* Check as many errors as possible before touching iop->offset.
|
||||
*/
|
||||
|
||||
if ( !iop->handlers->lseek_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
/*
|
||||
* Now process the lseek().
|
||||
*/
|
||||
|
||||
@@ -45,10 +45,6 @@ int mknod(
|
||||
|
||||
rtems_filesystem_get_start_loc( pathname, &i, &temp_loc );
|
||||
|
||||
if ( !temp_loc.ops->evalformake_h ) {
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*temp_loc.ops->evalformake_h)(
|
||||
&pathname[i],
|
||||
&temp_loc,
|
||||
@@ -57,11 +53,6 @@ int mknod(
|
||||
if ( result != 0 )
|
||||
return -1;
|
||||
|
||||
if ( !temp_loc.ops->mknod_h ) {
|
||||
rtems_filesystem_freenode( &temp_loc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*temp_loc.ops->mknod_h)( name_start, mode, dev, &temp_loc );
|
||||
|
||||
rtems_filesystem_freenode( &temp_loc );
|
||||
|
||||
@@ -175,15 +175,6 @@ int mount(
|
||||
|
||||
loc_to_free = &loc;
|
||||
|
||||
/*
|
||||
* Test for node_type_h
|
||||
*/
|
||||
|
||||
if (!loc.ops->node_type_h) {
|
||||
errno = ENOTSUP;
|
||||
goto cleanup_and_bail;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test to see if it is a directory
|
||||
*/
|
||||
@@ -220,11 +211,6 @@ int mount(
|
||||
* below the base file system
|
||||
*/
|
||||
|
||||
if ( !loc.ops->mount_h ){
|
||||
errno = ENOTSUP;
|
||||
goto cleanup_and_bail;
|
||||
}
|
||||
|
||||
if ( loc.ops->mount_h( mt_entry ) ) {
|
||||
goto cleanup_and_bail;
|
||||
}
|
||||
@@ -248,9 +234,7 @@ int mount(
|
||||
/*
|
||||
* Try to undo the mount operation
|
||||
*/
|
||||
if ( loc.ops->unmount_h ) {
|
||||
loc.ops->unmount_h( mt_entry );
|
||||
}
|
||||
loc.ops->unmount_h( mt_entry );
|
||||
goto cleanup_and_bail;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,11 +158,6 @@ int open(
|
||||
iop->flags |= rtems_libio_fcntl_flags( flags );
|
||||
iop->pathinfo = loc;
|
||||
|
||||
if ( !iop->handlers || !iop->handlers->open_h ) {
|
||||
rc = ENOTSUP;
|
||||
goto done;
|
||||
}
|
||||
|
||||
rc = (*iop->handlers->open_h)( iop, pathname, flags, mode );
|
||||
if ( rc ) {
|
||||
rc = errno;
|
||||
|
||||
@@ -40,9 +40,6 @@ ssize_t read(
|
||||
/*
|
||||
* Now process the read().
|
||||
*/
|
||||
if ( !iop->handlers->read_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
rc = (*iop->handlers->read_h)( iop, buffer, count );
|
||||
|
||||
if ( rc > 0 )
|
||||
|
||||
@@ -35,21 +35,11 @@ ssize_t readlink(
|
||||
if ( result != 0 )
|
||||
return -1;
|
||||
|
||||
if ( !loc.ops->node_type_h ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
}
|
||||
|
||||
if ( !loc.ops->readlink_h ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*loc.ops->readlink_h)( &loc, buf, bufsize );
|
||||
|
||||
rtems_filesystem_freenode( &loc );
|
||||
|
||||
@@ -54,9 +54,6 @@ ssize_t readv(
|
||||
if ( iovcnt > IOV_MAX )
|
||||
rtems_set_errno_and_return_minus_one( EINVAL );
|
||||
|
||||
if ( !iop->handlers->read_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
/*
|
||||
* OpenGroup says that you are supposed to return EINVAL if the
|
||||
* sum of the iov_len values in the iov array would overflow a
|
||||
|
||||
@@ -74,14 +74,6 @@ int rmdir(
|
||||
/*
|
||||
* Verify you can remove this node as a directory.
|
||||
*/
|
||||
|
||||
if ( !loc.ops->node_type_h ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
if ( free_parentloc )
|
||||
rtems_filesystem_freenode( &parentloc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
if ( free_parentloc )
|
||||
@@ -93,13 +85,6 @@ int rmdir(
|
||||
* Use the filesystems rmnod to remove the node.
|
||||
*/
|
||||
|
||||
if ( !loc.handlers->rmnod_h ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
if ( free_parentloc )
|
||||
rtems_filesystem_freenode( &parentloc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*loc.handlers->rmnod_h)( &parentloc, &loc );
|
||||
|
||||
rtems_filesystem_freenode( &loc );
|
||||
|
||||
@@ -62,11 +62,6 @@ int _STAT_NAME(
|
||||
if ( status != 0 )
|
||||
return -1;
|
||||
|
||||
if ( !loc.handlers->fstat_h ){
|
||||
rtems_filesystem_freenode( &loc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
/*
|
||||
* Zero out the stat structure so the various support
|
||||
* versions of stat don't have to.
|
||||
|
||||
@@ -42,9 +42,6 @@ statvfs (const char *path, struct statvfs *sb)
|
||||
mt_entry = loc.mt_entry;
|
||||
fs_mount_root = &mt_entry->mt_fs_root;
|
||||
|
||||
if ( !fs_mount_root->ops->statvfs_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
memset (sb, 0, sizeof (struct statvfs));
|
||||
|
||||
result = ( fs_mount_root->ops->statvfs_h )( fs_mount_root, sb );
|
||||
|
||||
@@ -30,19 +30,10 @@ int symlink(
|
||||
|
||||
rtems_filesystem_get_start_loc( sympath, &i, &loc );
|
||||
|
||||
if ( !loc.ops->evalformake_h ) {
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*loc.ops->evalformake_h)( &sympath[i], &loc, &name_start );
|
||||
if ( result != 0 )
|
||||
return -1;
|
||||
|
||||
if ( !loc.ops->symlink_h ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
result = (*loc.ops->symlink_h)( &loc, actualpath, name_start);
|
||||
|
||||
rtems_filesystem_freenode( &loc );
|
||||
|
||||
@@ -67,13 +67,6 @@ int unlink(
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( !loc.ops->node_type_h ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
if ( free_parentloc )
|
||||
rtems_filesystem_freenode( &parentloc );
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
}
|
||||
|
||||
if ( (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) {
|
||||
rtems_filesystem_freenode( &loc );
|
||||
if ( free_parentloc )
|
||||
|
||||
@@ -87,17 +87,6 @@ int unmount(
|
||||
|
||||
rtems_filesystem_freenode( &loc );
|
||||
|
||||
/*
|
||||
* Verify Unmount is supported by both filesystems.
|
||||
*/
|
||||
|
||||
if ( !fs_mount_loc->ops->unmount_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
if ( !fs_root_loc->ops->fsunmount_me_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
|
||||
/*
|
||||
* Verify the current node is not in this filesystem.
|
||||
* XXX - Joel I have a question here wasn't code added
|
||||
|
||||
@@ -47,9 +47,6 @@ ssize_t write(
|
||||
/*
|
||||
* Now process the write() request.
|
||||
*/
|
||||
if ( !iop->handlers->write_h )
|
||||
rtems_set_errno_and_return_minus_one( ENOTSUP );
|
||||
|
||||
rc = (*iop->handlers->write_h)( iop, buffer, count );
|
||||
|
||||
if ( rc > 0 )
|
||||
|
||||
Reference in New Issue
Block a user