summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--firmware/common/file.c19
-rw-r--r--firmware/drivers/fat.c6
-rw-r--r--firmware/export/fat.h7
-rw-r--r--firmware/include/file.h4
-rw-r--r--firmware/include/filesystem-native.h2
-rw-r--r--firmware/libc/include/time.h6
6 files changed, 16 insertions, 28 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c
index c090c40be5..c048d182f4 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -1123,9 +1123,11 @@ file_error:
return rc;
}
-int utime(const char *path, const struct utimbuf* times)
+/** Extensions **/
+
+int modtime(const char *path, time_t modtime)
{
- DEBUGF("utime(path=\"%s\",times->modtime=%u)\n", path, times->modtime);
+ DEBUGF("modtime(path=\"%s\",modtime=%d)\n", path, (int) modtime);
int rc, open1rc = -1;
struct filestr_base pathstr;
@@ -1133,25 +1135,22 @@ int utime(const char *path, const struct utimbuf* times)
file_internal_lock_WRITER();
- if (!times)
- FILE_ERROR(EINVAL, -1);
-
open1rc = open_stream_internal(path, FF_ANYTYPE | FF_PARENTINFO,
&pathstr, &pathinfo);
if (open1rc <= 0)
{
DEBUGF("Failed opening path: %d\n", open1rc);
if (open1rc == 0)
- FILE_ERROR(ENOENT, -2);
+ FILE_ERROR(ENOENT, -1);
else
FILE_ERROR(ERRNO, open1rc * 10 - 1);
}
- rc = fat_utime(&pathinfo.parentinfo.fatfile, pathstr.fatstr.fatfilep,
- times);
+ rc = fat_modtime(&pathinfo.parentinfo.fatfile, pathstr.fatstr.fatfilep,
+ modtime);
if (rc < 0)
{
- DEBUGF("I/O error during utime: %d\n", rc);
+ DEBUGF("I/O error during modtime: %d\n", rc);
FILE_ERROR(ERRNO, rc * 10 - 2);
}
@@ -1162,8 +1161,6 @@ file_error:
return rc;
}
-/** Extensions **/
-
/* get the binary size of a file (in bytes) */
off_t filesize(int fildes)
{
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index 28d4eb1987..0c02c8224f 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -2276,8 +2276,8 @@ fat_error:
return rc;
}
-int fat_utime(struct fat_file *parent, struct fat_file *file,
- const struct utimbuf *times)
+int fat_modtime(struct fat_file *parent, struct fat_file *file,
+ time_t modtime)
{
struct bpb * const fat_bpb = FAT_BPB(parent->volume);
@@ -2297,7 +2297,7 @@ int fat_utime(struct fat_file *parent, struct fat_file *file,
uint16_t date;
uint16_t time;
- dostime_localtime(times->modtime, &date, &time);
+ dostime_localtime(modtime, &date, &time);
ent->wrttime = htole16(time);
ent->wrtdate = htole16(date);
diff --git a/firmware/export/fat.h b/firmware/export/fat.h
index f2aae4f5f0..70152985b5 100644
--- a/firmware/export/fat.h
+++ b/firmware/export/fat.h
@@ -23,9 +23,6 @@
#include <stdbool.h>
#include <sys/types.h>
-#if defined(__PCTOOL__) || defined(SIMULATOR) || ((CONFIG_PLATFORM & PLATFORM_HOSTED) == PLATFORM_HOSTED)
-#include <utime.h>
-#endif
#include <time.h>
#include "config.h"
#include "system.h"
@@ -143,8 +140,8 @@ enum fat_remove_op /* what should fat_remove(), remove? */
int fat_remove(struct fat_file *file, enum fat_remove_op what);
int fat_rename(struct fat_file *parent, struct fat_file *file,
const unsigned char *newname);
-int fat_utime(struct fat_file *parent, struct fat_file *file,
- const struct utimbuf *utimes);
+int fat_modtime(struct fat_file *parent, struct fat_file *file,
+ time_t modtime);
/** File stream functions **/
int fat_closewrite(struct fat_filestr *filestr, uint32_t size,
diff --git a/firmware/include/file.h b/firmware/include/file.h
index f17f14f98e..02d2077977 100644
--- a/firmware/include/file.h
+++ b/firmware/include/file.h
@@ -85,8 +85,8 @@ int fdprintf(int fildes, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
#ifndef rename
#define rename FS_PREFIX(rename)
#endif
-#ifndef utime
-#define utime FS_PREFIX(utime)
+#ifndef modtime
+#define modtime FS_PREFIX(modtime)
#endif
#ifndef filesize
#define filesize FS_PREFIX(filesize)
diff --git a/firmware/include/filesystem-native.h b/firmware/include/filesystem-native.h
index 800e7bb23b..5bd61eea76 100644
--- a/firmware/include/filesystem-native.h
+++ b/firmware/include/filesystem-native.h
@@ -55,7 +55,7 @@ ssize_t read(int fildes, void *buf, size_t nbyte);
ssize_t write(int fildes, const void *buf, size_t nbyte);
int remove(const char *path);
int rename(const char *old, const char *new);
-int utime(const char *path, const struct utimbuf* times);
+int modtime(const char *path, time_t modtime);
off_t filesize(int fildes);
int fsamefile(int fildes1, int fildes2);
int relate(const char *path1, const char *path2);
diff --git a/firmware/libc/include/time.h b/firmware/libc/include/time.h
index 217b454321..4796b8b083 100644
--- a/firmware/libc/include/time.h
+++ b/firmware/libc/include/time.h
@@ -28,12 +28,6 @@ struct tm
#if !defined(_TIME_T_DEFINED) && !defined(_TIME_T_DECLARED)
typedef long time_t;
-struct utimbuf
-{
- time_t actime;
- time_t modtime;
-};
-
/* this define below is used by the mingw headers to prevent duplicate
typedefs */
#define _TIME_T_DEFINED