diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2006-09-02 09:51:08 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2006-09-02 09:51:08 +0000 |
commit | fa44077613d10cf3606d3e3f845585904f6c44a7 (patch) | |
tree | 0f0d28170cfb03b3a20e48ff58b2ecb7c78f8ea7 /example | |
parent | 9ae10b743e945487e12e8377b8f9fe49d8a745ab (diff) | |
download | fuse-fa44077613d10cf3606d3e3f845585904f6c44a7.tar.gz |
fix
Diffstat (limited to 'example')
-rw-r--r-- | example/fusexmp.c | 14 | ||||
-rw-r--r-- | example/fusexmp_fh.c | 13 |
2 files changed, 20 insertions, 7 deletions
diff --git a/example/fusexmp.c b/example/fusexmp.c index a30c9fd..5f54667 100644 --- a/example/fusexmp.c +++ b/example/fusexmp.c @@ -20,6 +20,7 @@ #include <fcntl.h> #include <dirent.h> #include <errno.h> +#include <sys/time.h> #ifdef HAVE_SETXATTR #include <sys/xattr.h> #endif @@ -204,18 +205,23 @@ static int xmp_truncate(const char *path, off_t size) return 0; } -static int xmp_utime(const char *path, struct utimbuf *buf) +static int xmp_utimes(const char *path, const struct timespec ts[2]) { int res; + struct timeval tv[2]; - res = utime(path, buf); + tv[0].tv_sec = ts[0].tv_sec; + tv[0].tv_usec = ts[0].tv_nsec / 1000; + tv[1].tv_sec = ts[1].tv_sec; + tv[1].tv_usec = ts[1].tv_nsec / 1000; + + res = utimes(path, tv); if (res == -1) return -errno; return 0; } - static int xmp_open(const char *path, struct fuse_file_info *fi) { int res; @@ -351,7 +357,7 @@ static struct fuse_operations xmp_oper = { .chmod = xmp_chmod, .chown = xmp_chown, .truncate = xmp_truncate, - .utime = xmp_utime, + .utimes = xmp_utimes, .open = xmp_open, .read = xmp_read, .write = xmp_write, diff --git a/example/fusexmp_fh.c b/example/fusexmp_fh.c index c82d061..5ede6db 100644 --- a/example/fusexmp_fh.c +++ b/example/fusexmp_fh.c @@ -17,6 +17,7 @@ #include <fcntl.h> #include <dirent.h> #include <errno.h> +#include <sys/time.h> #ifdef HAVE_SETXATTR #include <sys/xattr.h> #endif @@ -239,11 +240,17 @@ static int xmp_ftruncate(const char *path, off_t size, return 0; } -static int xmp_utime(const char *path, struct utimbuf *buf) +static int xmp_utimes(const char *path, const struct timespec ts[2]) { int res; + struct timeval tv[2]; - res = utime(path, buf); + tv[0].tv_sec = ts[0].tv_sec; + tv[0].tv_usec = ts[0].tv_nsec / 1000; + tv[1].tv_sec = ts[1].tv_sec; + tv[1].tv_usec = ts[1].tv_nsec / 1000; + + res = utimes(path, tv); if (res == -1) return -errno; @@ -412,7 +419,7 @@ static struct fuse_operations xmp_oper = { .chown = xmp_chown, .truncate = xmp_truncate, .ftruncate = xmp_ftruncate, - .utime = xmp_utime, + .utimes = xmp_utimes, .create = xmp_create, .open = xmp_open, .read = xmp_read, |