summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorRyan Long <ryan.long@oarcorp.com>2021-04-30 13:14:48 -0400
committerJoel Sherrill <joel@rtems.org>2021-05-28 14:27:40 -0500
commitea41722c92313e884368106832d3454114ba88b3 (patch)
tree9e7145c88aec146e45a2b6f8040f8767b56629f9 /cpukit
parent6171a88d9c7f90bac9a076edf3655f7c9e2efb94 (diff)
downloadrtems-ea41722c92313e884368106832d3454114ba88b3.tar.bz2
Change filesystem utime_h handler to utimens_h
Also updated licenses. Closes #4400 Updates #3899
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/Makefile.am4
-rw-r--r--cpukit/include/rtems/confdefs/libio.h4
-rw-r--r--cpukit/include/rtems/imfs.h35
-rw-r--r--cpukit/include/rtems/libio.h55
-rw-r--r--cpukit/libcsupport/src/__usrenv.c39
-rw-r--r--cpukit/libcsupport/src/futimens.c2
-rw-r--r--cpukit/libcsupport/src/utimensat.c2
-rw-r--r--cpukit/libfs/src/defaults/default_ops.c34
-rw-r--r--cpukit/libfs/src/defaults/default_utime.c32
-rw-r--r--cpukit/libfs/src/defaults/default_utimens.c49
-rw-r--r--cpukit/libfs/src/dosfs/msdos_init.c11
-rw-r--r--cpukit/libfs/src/ftpfs/ftpfs.c44
-rw-r--r--cpukit/libfs/src/ftpfs/tftpDriver.c2
-rw-r--r--cpukit/libfs/src/imfs/imfs_init.c30
-rw-r--r--cpukit/libfs/src/imfs/imfs_utime.c41
-rw-r--r--cpukit/libfs/src/imfs/imfs_utimens.c58
-rw-r--r--cpukit/libfs/src/jffs2/src/fs-rtems.c11
-rw-r--r--cpukit/libfs/src/rfs/rtems-rfs-rtems.c16
18 files changed, 292 insertions, 177 deletions
diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 7b99b78cc1..2782d58d93 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 16a4fb6962..1b84f8c20f 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 b2a9868b38..57c498cfe8 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 519e797dba..5379d92e4a 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 5c25eaa8d6..ebafa9e8b0 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 f82c78282f..151e7a168d 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 3e91b65aae..c053218ad0 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 63ad2cefe1..45069e76d7 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@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 aaf4e445b6..0000000000
--- 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 0000000000..c2321dc214
--- /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 67b16b64ed..a96b973cba 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 5e0cb95dd3..06d06bc9cc 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@embedded-brains.de>
- *
- * (c) Copyright 2002
- * Thomas Doerfler
- * IMD Ingenieurbuero fuer Microcomputertechnik
- * Herbststr. 8
- * 82178 Puchheim, Germany
- * <Thomas.Doerfler@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 7cbb402b63..bc0e74ad86 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 1b9b76912a..8685caae68 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 21e5139ce7..0000000000
--- 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 0000000000..78cc766ab0
--- /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 aae208ccef..8bc3d85cc3 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 35db9eeca1..0efab2cca6 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,