[PATCH v6 5/5] Change filesystem utime_h handler to utimens_h

Ryan Long ryan.long at oarcorp.com
Tue May 18 20:03:30 UTC 2021


Also updated licenses.

Closes #4400
Updates #3899
---
 bsps/arm/csb337/umon/tfsDriver.c            |  2 +-
 cpukit/Makefile.am                          |  4 +-
 cpukit/include/rtems/confdefs/libio.h       |  4 +-
 cpukit/include/rtems/imfs.h                 | 35 ++++++++++++-----
 cpukit/include/rtems/libio.h                | 55 +++++++++++++++++----------
 cpukit/libcsupport/src/__usrenv.c           | 39 +++++++++++++------
 cpukit/libcsupport/src/futimens.c           |  2 +-
 cpukit/libcsupport/src/utimensat.c          |  2 +-
 cpukit/libfs/src/defaults/default_ops.c     | 34 ++++++++++++-----
 cpukit/libfs/src/defaults/default_utime.c   | 32 ----------------
 cpukit/libfs/src/defaults/default_utimens.c | 49 ++++++++++++++++++++++++
 cpukit/libfs/src/dosfs/msdos_init.c         | 11 +++---
 cpukit/libfs/src/ftpfs/ftpfs.c              | 44 ++++++++++++----------
 cpukit/libfs/src/ftpfs/tftpDriver.c         |  2 +-
 cpukit/libfs/src/imfs/imfs_init.c           | 30 ++++++++++++---
 cpukit/libfs/src/imfs/imfs_utime.c          | 41 --------------------
 cpukit/libfs/src/imfs/imfs_utimens.c        | 58 +++++++++++++++++++++++++++++
 cpukit/libfs/src/jffs2/src/fs-rtems.c       | 11 +++---
 cpukit/libfs/src/rfs/rtems-rfs-rtems.c      | 16 ++++----
 spec/build/cpukit/librtemscpu.yml           |  4 +-
 20 files changed, 295 insertions(+), 180 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..57c498c 100644
--- a/cpukit/include/rtems/imfs.h
+++ b/cpukit/include/rtems/imfs.h
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
 /**
  * @file
  *
@@ -5,12 +7,28 @@
  */
 
 /*
- *  COPYRIGHT (c) 1989-2011.
- *  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.
+ * COPYRIGHT (C) 1989, 2021 On-Line Applications Research Corporation (OAR).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef _RTEMS_IMFS_H
@@ -954,10 +972,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..5379d92 100644
--- a/cpukit/include/rtems/libio.h
+++ b/cpukit/include/rtems/libio.h
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
 /**
  * @file
  *
@@ -11,15 +13,31 @@
  */
 
 /*
- *  COPYRIGHT (c) 1989-2008.
- *  On-Line Applications Research Corporation (OAR).
- *
- *  Modifications to support reference counting in the file system are
- *  Copyright (c) 2012 embedded brains GmbH.
- *
- *  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.
+ * COPYRIGHT (C) 1989, 2021 On-Line Applications Research Corporation (OAR).
+ *
+ * Modifications to support reference counting in the file system are
+ * Copyright (C) 2012 embedded brains GmbH.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef _RTEMS_RTEMS_LIBIO_H
@@ -375,18 +393,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 +500,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 +660,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..ebafa9e 100644
--- a/cpukit/libcsupport/src/__usrenv.c
+++ b/cpukit/libcsupport/src/__usrenv.c
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
 /**
  *  @file
  *
@@ -6,15 +8,31 @@
  */
 
 /*
- *  COPYRIGHT (c) 1989-2008.
- *  On-Line Applications Research Corporation (OAR).
+ * COPYRIGHT (C) 2021 On-Line Applications Research Corporation (OAR).
+ *
+ * Modifications to support reference counting in the file system are
+ * Copyright (c) 2012 embedded brains GmbH.
  *
- *  Modifications to support reference counting in the file system are
- *  Copyright (c) 2012 embedded brains GmbH.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
  *
- *  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.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -145,10 +163,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 +224,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/libcsupport/src/futimens.c b/cpukit/libcsupport/src/futimens.c
index f82c782..151e7a1 100644
--- a/cpukit/libcsupport/src/futimens.c
+++ b/cpukit/libcsupport/src/futimens.c
@@ -76,7 +76,7 @@ int futimens(
     return rv;
   }
 
-  rv = (*currentloc->mt_entry->ops->utime_h)(
+  rv = (*currentloc->mt_entry->ops->utimens_h)(
     currentloc,
     new_times
   );
diff --git a/cpukit/libcsupport/src/utimensat.c b/cpukit/libcsupport/src/utimensat.c
index 3e91b65..c053218 100644
--- a/cpukit/libcsupport/src/utimensat.c
+++ b/cpukit/libcsupport/src/utimensat.c
@@ -214,7 +214,7 @@ int utimensat(
     return rv;
   }
 
-  rv = (*currentloc->mt_entry->ops->utime_h)(
+  rv = (*currentloc->mt_entry->ops->utimens_h)(
     currentloc,
     new_times
   );
diff --git a/cpukit/libfs/src/defaults/default_ops.c b/cpukit/libfs/src/defaults/default_ops.c
index 63ad2ce..45069e7 100644
--- a/cpukit/libfs/src/defaults/default_ops.c
+++ b/cpukit/libfs/src/defaults/default_ops.c
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
 /**
  * @file
  *
@@ -7,16 +9,28 @@
  */
 
 /*
- * Copyright (c) 2010
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems at embedded-brains.de>
+ * Copyright (C) 2010 embedded brains GmbH
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
  *
- * 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.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include <rtems/libio.h>
@@ -36,7 +50,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..c2321dc
--- /dev/null
+++ b/cpukit/libfs/src/defaults/default_utimens.c
@@ -0,0 +1,49 @@
+/* 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).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#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..06d06bc 100644
--- a/cpukit/libfs/src/ftpfs/ftpfs.c
+++ b/cpukit/libfs/src/ftpfs/ftpfs.c
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
 /**
  * @file
  *
@@ -5,27 +7,29 @@
  */
 
 /*
- * Copyright (c) 2009-2012 embedded brains GmbH.
- *
- *  embedded brains GmbH
- *  Obere Lagerstr. 30
- *  82178 Puchheim
- *  Germany
- *  <rtems at embedded-brains.de>
- *
- * (c) Copyright 2002
- * Thomas Doerfler
- * IMD Ingenieurbuero fuer Microcomputertechnik
- * Herbststr. 8
- * 82178 Puchheim, Germany
- * <Thomas.Doerfler at imd-systems.de>
+ * COPYRIGHT (C) 2009-2012 embedded brains GmbH.
+ * COPYRIGHT (C) 2002 IMD Ingenieurbuero fuer Microcomputertechnik.
  *
- * This code has been created after closly inspecting "tftpdriver.c" from Eric
- * Norum.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
  *
- * 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.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -1384,7 +1388,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..8685caa 100644
--- a/cpukit/libfs/src/imfs/imfs_init.c
+++ b/cpukit/libfs/src/imfs/imfs_init.c
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
 /**
  * @file
  *
@@ -7,12 +9,28 @@
  */
 
 /*
- *  COPYRIGHT (c) 1989-1999.
- *  On-Line Applications Research Corporation (OAR).
+ * COPYRIGHT (C) 1989, 2021 On-Line Applications Research Corporation (OAR).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
  *
- *  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.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -40,7 +58,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..78cc766
--- /dev/null
+++ b/cpukit/libfs/src/imfs/imfs_utimens.c
@@ -0,0 +1,58 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup IMFS
+ *
+ * @brief Set IMFS File Access and Modification Times
+ */
+
+/*
+ * COPYRIGHT (C) 1989, 2021 On-Line Applications Research Corporation (OAR).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#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 7f36ef7..133c84c 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



More information about the devel mailing list