Also updated licenses. Closes #4400 --- bsps/arm/csb337/umon/tfsDriver.c | 2 +- cpukit/Makefile.am | 4 +-- cpukit/include/rtems/confdefs/libio.h | 4 +-- cpukit/include/rtems/imfs.h | 7 +++-- cpukit/include/rtems/libio.h | 21 +++++++-------- cpukit/libcsupport/src/__usrenv.c | 9 +++---- cpukit/libfs/src/defaults/default_ops.c | 2 +- cpukit/libfs/src/defaults/default_utime.c | 32 ---------------------- cpukit/libfs/src/defaults/default_utimens.c | 33 +++++++++++++++++++++++ cpukit/libfs/src/dosfs/msdos_init.c | 11 ++++---- cpukit/libfs/src/ftpfs/ftpfs.c | 2 +- cpukit/libfs/src/ftpfs/tftpDriver.c | 2 +- cpukit/libfs/src/imfs/imfs_init.c | 4 +-- cpukit/libfs/src/imfs/imfs_utime.c | 41 ---------------------------- cpukit/libfs/src/imfs/imfs_utimens.c | 42 +++++++++++++++++++++++++++++ cpukit/libfs/src/jffs2/src/fs-rtems.c | 11 ++++---- cpukit/libfs/src/rfs/rtems-rfs-rtems.c | 16 +++++------ spec/build/cpukit/librtemscpu.yml | 4 +-- 18 files changed, 120 insertions(+), 127 deletions(-) delete mode 100644 cpukit/libfs/src/defaults/default_utime.c create mode 100644 cpukit/libfs/src/defaults/default_utimens.c delete mode 100644 cpukit/libfs/src/imfs/imfs_utime.c create mode 100644 cpukit/libfs/src/imfs/imfs_utimens.c
diff --git a/bsps/arm/csb337/umon/tfsDriver.c b/bsps/arm/csb337/umon/tfsDriver.c index 0195346..caf3a4b 100644 --- a/bsps/arm/csb337/umon/tfsDriver.c +++ b/bsps/arm/csb337/umon/tfsDriver.c @@ -657,7 +657,7 @@ static const rtems_filesystem_operations_table rtems_tfs_ops = { .mount_h = rtems_filesystem_default_mount, .unmount_h = rtems_filesystem_default_unmount, .fsunmount_me_h = rtems_filesystem_default_fsunmount, - .utime_h = rtems_filesystem_default_utime, + .utimens_h = rtems_filesystem_default_utimens, .symlink_h = rtems_filesystem_default_symlink, .readlink_h = rtems_filesystem_default_readlink, .rename_h = rtems_filesystem_default_rename, diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am index 29b4207..c144773 100644 --- a/cpukit/Makefile.am +++ b/cpukit/Makefile.am @@ -377,7 +377,7 @@ librtemscpu_a_SOURCES += libfs/src/defaults/default_rmnod.c librtemscpu_a_SOURCES += libfs/src/defaults/default_statvfs.c librtemscpu_a_SOURCES += libfs/src/defaults/default_symlink.c librtemscpu_a_SOURCES += libfs/src/defaults/default_unmount.c -librtemscpu_a_SOURCES += libfs/src/defaults/default_utime.c +librtemscpu_a_SOURCES += libfs/src/defaults/default_utimens.c librtemscpu_a_SOURCES += libfs/src/defaults/default_write.c librtemscpu_a_SOURCES += libfs/src/defaults/default_writev.c librtemscpu_a_SOURCES += libfs/src/dosfs/fat.c @@ -434,7 +434,7 @@ librtemscpu_a_SOURCES += libfs/src/imfs/imfs_stat.c librtemscpu_a_SOURCES += libfs/src/imfs/imfs_stat_file.c librtemscpu_a_SOURCES += libfs/src/imfs/imfs_symlink.c librtemscpu_a_SOURCES += libfs/src/imfs/imfs_unmount.c -librtemscpu_a_SOURCES += libfs/src/imfs/imfs_utime.c +librtemscpu_a_SOURCES += libfs/src/imfs/imfs_utimens.c librtemscpu_a_SOURCES += libfs/src/imfs/ioman.c librtemscpu_a_SOURCES += libfs/src/pipe/fifo.c librtemscpu_a_SOURCES += libfs/src/pipe/pipe.c diff --git a/cpukit/include/rtems/confdefs/libio.h b/cpukit/include/rtems/confdefs/libio.h index 16a4fb69..1b84f8c 100644 --- a/cpukit/include/rtems/confdefs/libio.h +++ b/cpukit/include/rtems/confdefs/libio.h @@ -231,9 +231,9 @@ static const rtems_filesystem_operations_table IMFS_root_ops = { #endif rtems_filesystem_default_fsunmount, #ifdef CONFIGURE_IMFS_DISABLE_UTIME - rtems_filesystem_default_utime, + rtems_filesystem_default_utimens, #else - IMFS_utime, + IMFS_utimens, #endif #ifdef CONFIGURE_IMFS_DISABLE_SYMLINK rtems_filesystem_default_symlink, diff --git a/cpukit/include/rtems/imfs.h b/cpukit/include/rtems/imfs.h index b2a9868..6e0d5d5 100644 --- a/cpukit/include/rtems/imfs.h +++ b/cpukit/include/rtems/imfs.h @@ -5,7 +5,7 @@ */ /* - * COPYRIGHT (c) 1989-2011. + * COPYRIGHT (c) 1989-2011, 2021. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -954,10 +954,9 @@ extern int device_ftruncate( * This routine is the implementation of the utime() system * call for the IMFS. */ -extern int IMFS_utime( +extern int IMFS_utimens( const rtems_filesystem_location_info_t *loc, - time_t actime, - time_t modtime + struct timespec times[2] ); /** diff --git a/cpukit/include/rtems/libio.h b/cpukit/include/rtems/libio.h index 519e797..99543ba 100644 --- a/cpukit/include/rtems/libio.h +++ b/cpukit/include/rtems/libio.h @@ -11,7 +11,7 @@ */ /* - * COPYRIGHT (c) 1989-2008. + * COPYRIGHT (c) 1989-2008, 2021. * On-Line Applications Research Corporation (OAR). * * Modifications to support reference counting in the file system are @@ -375,18 +375,16 @@ typedef int (*rtems_filesystem_rmnod_t)( * @brief Set node access and modification times. * * @param[in] loc The location of the node. - * @param[in] actime Access time for the node. - * @param[in] modtime Modification for the node. + * @param[in] times Access and modification times for the node * * @retval 0 Successful operation. * @retval -1 An error occurred. The errno is set to indicate the error. * - * @see rtems_filesystem_default_utime(). + * @see rtems_filesystem_default_utimens(). */ -typedef int (*rtems_filesystem_utime_t)( +typedef int (*rtems_filesystem_utimens_t)( const rtems_filesystem_location_info_t *loc, - time_t actime, - time_t modtime + struct timespec times[2] ); /** @@ -484,7 +482,7 @@ struct _rtems_filesystem_operations_table { rtems_filesystem_mount_t mount_h; rtems_filesystem_unmount_t unmount_h; rtems_filesystem_fsunmount_me_t fsunmount_me_h; - rtems_filesystem_utime_t utime_h; + rtems_filesystem_utimens_t utimens_h; rtems_filesystem_symlink_t symlink_h; rtems_filesystem_readlink_t readlink_h; rtems_filesystem_rename_t rename_h; @@ -644,12 +642,11 @@ void rtems_filesystem_default_fsunmount( /** * @retval -1 Always. The errno is set to ENOTSUP. * - * @see rtems_filesystem_utime_t. + * @see rtems_filesystem_utimens_t. */ -int rtems_filesystem_default_utime( +int rtems_filesystem_default_utimens( const rtems_filesystem_location_info_t *loc, - time_t actime, - time_t modtime + struct timespec times[2] ); /** diff --git a/cpukit/libcsupport/src/__usrenv.c b/cpukit/libcsupport/src/__usrenv.c index 5c25eaa..13b5700 100644 --- a/cpukit/libcsupport/src/__usrenv.c +++ b/cpukit/libcsupport/src/__usrenv.c @@ -6,7 +6,7 @@ */ /* - * COPYRIGHT (c) 1989-2008. + * COPYRIGHT (c) 1989-2008, 2021. * On-Line Applications Research Corporation (OAR). * * Modifications to support reference counting in the file system are @@ -145,10 +145,9 @@ static void null_op_fsunmount_me( /* Do nothing */ } -static int null_op_utime( +static int null_op_utimens( const rtems_filesystem_location_info_t *loc, - time_t actime, - time_t modtime + struct timespec times[2] ) { return -1; @@ -207,7 +206,7 @@ static const rtems_filesystem_operations_table null_ops = { .mount_h = null_op_mount, .unmount_h = null_op_unmount, .fsunmount_me_h = null_op_fsunmount_me, - .utime_h = null_op_utime, + .utimens_h = null_op_utimens, .symlink_h = null_op_symlink, .readlink_h = null_op_readlink, .rename_h = null_op_rename, diff --git a/cpukit/libfs/src/defaults/default_ops.c b/cpukit/libfs/src/defaults/default_ops.c index 63ad2ce..de317a2 100644 --- a/cpukit/libfs/src/defaults/default_ops.c +++ b/cpukit/libfs/src/defaults/default_ops.c @@ -36,7 +36,7 @@ const rtems_filesystem_operations_table rtems_filesystem_operations_default = { .mount_h = rtems_filesystem_default_mount, .unmount_h = rtems_filesystem_default_unmount, .fsunmount_me_h = rtems_filesystem_default_fsunmount, - .utime_h = rtems_filesystem_default_utime, + .utimens_h = rtems_filesystem_default_utimens, .symlink_h = rtems_filesystem_default_symlink, .readlink_h = rtems_filesystem_default_readlink, .rename_h = rtems_filesystem_default_rename, diff --git a/cpukit/libfs/src/defaults/default_utime.c b/cpukit/libfs/src/defaults/default_utime.c deleted file mode 100644 index aaf4e44..0000000 --- a/cpukit/libfs/src/defaults/default_utime.c +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @file - * - * @ingroup LibIOFSOps File System Operations - * - * @brief RTEMS Default File System sets file access and modification times - */ - -/* - * COPYRIGHT (c) 2010. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <rtems/libio_.h> -#include <rtems/seterr.h> - -int rtems_filesystem_default_utime( - const rtems_filesystem_location_info_t *loc, - time_t actime, - time_t modtime -) -{ - rtems_set_errno_and_return_minus_one( ENOTSUP ); -} diff --git a/cpukit/libfs/src/defaults/default_utimens.c b/cpukit/libfs/src/defaults/default_utimens.c new file mode 100644 index 0000000..f71c156 --- /dev/null +++ b/cpukit/libfs/src/defaults/default_utimens.c @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup LibIOFSOps File System Operations + * + * @brief RTEMS Default File System sets file access and modification times + */ + +/* + * COPYRIGHT (c) 2010, 2021. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <rtems/libio_.h> +#include <rtems/seterr.h> + +int rtems_filesystem_default_utimens( + const rtems_filesystem_location_info_t *loc, + struct timespec times[2] +) +{ + rtems_set_errno_and_return_minus_one( ENOTSUP ); +} diff --git a/cpukit/libfs/src/dosfs/msdos_init.c b/cpukit/libfs/src/dosfs/msdos_init.c index 67b16b6..a96b973 100644 --- a/cpukit/libfs/src/dosfs/msdos_init.c +++ b/cpukit/libfs/src/dosfs/msdos_init.c @@ -36,18 +36,17 @@ static int msdos_clone_node_info(rtems_filesystem_location_info_t *loc) return fat_file_reopen(fat_fd); } -static int msdos_utime( +static int msdos_utimens( const rtems_filesystem_location_info_t *loc, - time_t actime, - time_t modtime + struct timespec times[2] ) { fat_file_fd_t *fat_fd = loc->node_access; - if (actime != modtime) + if (times[0].tv_sec != times[1].tv_sec) rtems_set_errno_and_return_minus_one( ENOTSUP ); - fat_file_set_mtime(fat_fd, modtime); + fat_file_set_mtime(fat_fd, times[1].tv_sec); return RC_OK; } @@ -67,7 +66,7 @@ const rtems_filesystem_operations_table msdos_ops = { .mount_h = rtems_filesystem_default_mount, .unmount_h = rtems_filesystem_default_unmount, .fsunmount_me_h = msdos_shut_down, - .utime_h = msdos_utime, + .utimens_h = msdos_utimens, .symlink_h = rtems_filesystem_default_symlink, .readlink_h = rtems_filesystem_default_readlink, .rename_h = msdos_rename, diff --git a/cpukit/libfs/src/ftpfs/ftpfs.c b/cpukit/libfs/src/ftpfs/ftpfs.c index 5e0cb95..a0ee0fa 100644 --- a/cpukit/libfs/src/ftpfs/ftpfs.c +++ b/cpukit/libfs/src/ftpfs/ftpfs.c @@ -1384,7 +1384,7 @@ static const rtems_filesystem_operations_table rtems_ftpfs_ops = { .mount_h = rtems_filesystem_default_mount, .unmount_h = rtems_filesystem_default_unmount, .fsunmount_me_h = rtems_ftpfs_unmount_me, - .utime_h = rtems_filesystem_default_utime, + .utimens_h = rtems_filesystem_default_utimens, .symlink_h = rtems_filesystem_default_symlink, .readlink_h = rtems_filesystem_default_readlink, .rename_h = rtems_filesystem_default_rename, diff --git a/cpukit/libfs/src/ftpfs/tftpDriver.c b/cpukit/libfs/src/ftpfs/tftpDriver.c index 7cbb402..bc0e74a 100644 --- a/cpukit/libfs/src/ftpfs/tftpDriver.c +++ b/cpukit/libfs/src/ftpfs/tftpDriver.c @@ -1039,7 +1039,7 @@ static const rtems_filesystem_operations_table rtems_tftp_ops = { .mount_h = rtems_filesystem_default_mount, .unmount_h = rtems_filesystem_default_unmount, .fsunmount_me_h = rtems_tftpfs_shutdown, - .utime_h = rtems_filesystem_default_utime, + .utimens_h = rtems_filesystem_default_utimens, .symlink_h = rtems_filesystem_default_symlink, .readlink_h = rtems_filesystem_default_readlink, .rename_h = rtems_filesystem_default_rename, diff --git a/cpukit/libfs/src/imfs/imfs_init.c b/cpukit/libfs/src/imfs/imfs_init.c index 1b9b769..5b8d3dd 100644 --- a/cpukit/libfs/src/imfs/imfs_init.c +++ b/cpukit/libfs/src/imfs/imfs_init.c @@ -7,7 +7,7 @@ */ /* - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-1999, 2021. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -40,7 +40,7 @@ static const rtems_filesystem_operations_table IMFS_ops = { .mount_h = IMFS_mount, .unmount_h = IMFS_unmount, .fsunmount_me_h = IMFS_fsunmount, - .utime_h = IMFS_utime, + .utimens_h = IMFS_utimens, .symlink_h = IMFS_symlink, .readlink_h = IMFS_readlink, .rename_h = IMFS_rename, diff --git a/cpukit/libfs/src/imfs/imfs_utime.c b/cpukit/libfs/src/imfs/imfs_utime.c deleted file mode 100644 index 21e5139..0000000 --- a/cpukit/libfs/src/imfs/imfs_utime.c +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file - * - * @ingroup IMFS - * - * @brief Set IMFS File Access and Modification Times - */ - -/* - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <rtems/imfs.h> - -#include <sys/time.h> - -int IMFS_utime( - const rtems_filesystem_location_info_t *loc, - time_t actime, - time_t modtime -) -{ - IMFS_jnode_t *the_jnode; - - the_jnode = (IMFS_jnode_t *) loc->node_access; - - the_jnode->stat_atime = actime; - the_jnode->stat_mtime = modtime; - the_jnode->stat_ctime = time( NULL ); - - return 0; -} diff --git a/cpukit/libfs/src/imfs/imfs_utimens.c b/cpukit/libfs/src/imfs/imfs_utimens.c new file mode 100644 index 0000000..92f2528 --- /dev/null +++ b/cpukit/libfs/src/imfs/imfs_utimens.c @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup IMFS + * + * @brief Set IMFS File Access and Modification Times + */ + +/* + * COPYRIGHT (c) 1989-1999, 2021. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <rtems/imfs.h> + +#include <sys/time.h> + +int IMFS_utimens( + const rtems_filesystem_location_info_t *loc, + struct timespec times[2] +) +{ + IMFS_jnode_t *the_jnode; + + the_jnode = (IMFS_jnode_t *) loc->node_access; + + the_jnode->stat_atime = times[0].tv_sec; + the_jnode->stat_mtime = times[1].tv_sec; + the_jnode->stat_ctime = time( NULL ); + + return 0; +} diff --git a/cpukit/libfs/src/jffs2/src/fs-rtems.c b/cpukit/libfs/src/jffs2/src/fs-rtems.c index aae208c..8bc3d85 100644 --- a/cpukit/libfs/src/jffs2/src/fs-rtems.c +++ b/cpukit/libfs/src/jffs2/src/fs-rtems.c @@ -1118,10 +1118,9 @@ static int rtems_jffs2_statvfs( return 0; } -static int rtems_jffs2_utime( +static int rtems_jffs2_utimens( const rtems_filesystem_location_info_t *loc, - time_t actime, - time_t modtime + struct timespec times[2] ) { struct _inode *inode = rtems_jffs2_get_inode_by_location(loc); @@ -1129,8 +1128,8 @@ static int rtems_jffs2_utime( int eno; iattr.ia_valid = ATTR_ATIME | ATTR_MTIME | ATTR_CTIME; - iattr.ia_atime = actime; - iattr.ia_mtime = modtime; + iattr.ia_atime = times[0].tv_sec; + iattr.ia_mtime = times[1].tv_sec; iattr.ia_ctime = get_seconds(); eno = -jffs2_do_setattr(inode, &iattr); @@ -1186,7 +1185,7 @@ static const rtems_filesystem_operations_table rtems_jffs2_ops = { .mount_h = rtems_filesystem_default_mount, .unmount_h = rtems_filesystem_default_unmount, .fsunmount_me_h = rtems_jffs2_fsunmount, - .utime_h = rtems_jffs2_utime, + .utimens_h = rtems_jffs2_utimens, .symlink_h = rtems_jffs2_symlink, .readlink_h = rtems_jffs2_readlink, .rename_h = rtems_jffs2_rename, diff --git a/cpukit/libfs/src/rfs/rtems-rfs-rtems.c b/cpukit/libfs/src/rfs/rtems-rfs-rtems.c index 35db9ee..0efab2c 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-rtems.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-rtems.c @@ -296,16 +296,14 @@ rtems_rfs_rtems_chown (const rtems_filesystem_location_info_t *pathloc, * This routine is the implementation of the utime() system call for the * RFS. * - * @param pathloc - * @param atime - * @param mtime + * @param pathloc The path to the file to be modified + * @param times The times to update the file to * return int */ static int -rtems_rfs_rtems_utime(const rtems_filesystem_location_info_t* pathloc, - time_t atime, - time_t mtime) +rtems_rfs_rtems_utimens(const rtems_filesystem_location_info_t* pathloc, + struct timespec times[2]) { rtems_rfs_file_system* fs = rtems_rfs_rtems_pathloc_dev (pathloc); rtems_rfs_ino ino = rtems_rfs_rtems_get_pathloc_ino (pathloc); @@ -318,8 +316,8 @@ rtems_rfs_rtems_utime(const rtems_filesystem_location_info_t* pathloc, return rtems_rfs_rtems_error ("utime: read inode", rc); } - rtems_rfs_inode_set_atime (&inode, atime); - rtems_rfs_inode_set_mtime (&inode, mtime); + rtems_rfs_inode_set_atime (&inode, times[0].tv_sec); + rtems_rfs_inode_set_mtime (&inode, times[1].tv_sec); rc = rtems_rfs_inode_close (fs, &inode); if (rc) @@ -735,7 +733,7 @@ const rtems_filesystem_operations_table rtems_rfs_ops = .mount_h = rtems_filesystem_default_mount, .unmount_h = rtems_filesystem_default_unmount, .fsunmount_me_h = rtems_rfs_rtems_shutdown, - .utime_h = rtems_rfs_rtems_utime, + .utimens_h = rtems_rfs_rtems_utimens, .symlink_h = rtems_rfs_rtems_symlink, .readlink_h = rtems_rfs_rtems_readlink, .rename_h = rtems_rfs_rtems_rename, diff --git a/spec/build/cpukit/librtemscpu.yml b/spec/build/cpukit/librtemscpu.yml index 9639051..6df98c9 100644 --- a/spec/build/cpukit/librtemscpu.yml +++ b/spec/build/cpukit/librtemscpu.yml @@ -804,7 +804,7 @@ source: - cpukit/libfs/src/defaults/default_statvfs.c - cpukit/libfs/src/defaults/default_symlink.c - cpukit/libfs/src/defaults/default_unmount.c -- cpukit/libfs/src/defaults/default_utime.c +- cpukit/libfs/src/defaults/default_utimens.c - cpukit/libfs/src/defaults/default_write.c - cpukit/libfs/src/defaults/default_writev.c - cpukit/libfs/src/dosfs/fat.c @@ -861,7 +861,7 @@ source: - cpukit/libfs/src/imfs/imfs_stat_file.c - cpukit/libfs/src/imfs/imfs_symlink.c - cpukit/libfs/src/imfs/imfs_unmount.c -- cpukit/libfs/src/imfs/imfs_utime.c +- cpukit/libfs/src/imfs/imfs_utimens.c - cpukit/libfs/src/imfs/ioman.c - cpukit/libfs/src/pipe/fifo.c - cpukit/libfs/src/pipe/pipe.c -- 1.8.3.1 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel