summaryrefslogtreecommitdiffstats
path: root/src/ifuse.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2009-11-02 13:21:16 +0100
committerGravatar Matt Colyer2009-11-02 20:53:38 -0800
commit429df523678c01ed1ff39c3d6eed88d4e11bf3c4 (patch)
treeb6fa9cb0e3fe58fa9ea8e8f0410f668cf9d34058 /src/ifuse.c
parent704abbe97857274b84adc17500d6defca7ffd33b (diff)
downloadifuse-429df523678c01ed1ff39c3d6eed88d4e11bf3c4.tar.gz
ifuse-429df523678c01ed1ff39c3d6eed88d4e11bf3c4.tar.bz2
Add support for setting modification time (ifuse_utimens).
Support for this is available since iphone OS 3.1, for devices prior to this version this operation just returns success. Signed-off-by: Matt Colyer <matt@colyer.name>
Diffstat (limited to 'src/ifuse.c')
-rw-r--r--src/ifuse.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ifuse.c b/src/ifuse.c
index cefa66c..2570760 100644
--- a/src/ifuse.c
+++ b/src/ifuse.c
@@ -332,6 +332,24 @@ static int ifuse_write(const char *path, const char *buf, size_t size, off_t off
return bytes;
}
+static int ifuse_utimens(const char *path, const struct timespec tv[2])
+{
+ afc_client_t afc = fuse_get_context()->private_data;
+ uint64_t mtime = (uint64_t)tv[1].tv_sec * (uint64_t)1000000000 + (uint64_t)tv[1].tv_nsec;
+
+ afc_error_t err = afc_set_file_time(afc, path, mtime);
+ if (err == AFC_E_UNKNOWN_PACKET_TYPE) {
+ /* ignore error for pre-3.1 devices as they do not support setting file modification times */
+ return 0;
+ }
+ if (err != AFC_E_SUCCESS) {
+ int res = get_afc_error_as_errno(err);
+ return -res;
+ }
+
+ return 0;
+}
+
static int ifuse_fsync(const char *path, int datasync, struct fuse_file_info *fi)
{
return 0;
@@ -567,6 +585,7 @@ static struct fuse_operations ifuse_oper = {
.link = ifuse_link,
.unlink = ifuse_unlink,
.rename = ifuse_rename,
+ .utimens = ifuse_utimens,
.fsync = ifuse_fsync,
.release = ifuse_release,
.init = ifuse_init_normal,