diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuse.c | 19 | ||||
-rw-r--r-- | lib/fuse_lowlevel.c | 18 |
2 files changed, 26 insertions, 11 deletions
@@ -753,15 +753,22 @@ static int do_truncate(struct fuse *f, const char *path, struct stat *attr, return err; } -static int do_utime(struct fuse *f, const char *path, struct stat *attr) +static int do_utimes(struct fuse *f, const char *path, struct stat *attr) { int err; - struct utimbuf buf; - buf.actime = attr->st_atime; - buf.modtime = attr->st_mtime; + err = -ENOSYS; - if (f->op.utime) + if (f->op.utimes) { + struct timespec tv[2]; + tv[0] = attr->st_atim; + tv[1] = attr->st_mtim; + err = f->op.utimes(path, tv); + } else if (f->op.utime) { + struct utimbuf buf; + buf.actime = attr->st_atime; + buf.modtime = attr->st_mtime; err = f->op.utime(path, &buf); + } return err; } @@ -788,7 +795,7 @@ static void fuse_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr, if (!err && (valid & FUSE_SET_ATTR_SIZE)) err = do_truncate(f, path, attr, fi); if (!err && (valid & (FUSE_SET_ATTR_ATIME | FUSE_SET_ATTR_MTIME)) == (FUSE_SET_ATTR_ATIME | FUSE_SET_ATTR_MTIME)) - err = do_utime(f, path, attr); + err = do_utimes(f, path, attr); if (!err) err = f->op.getattr(path, &buf); } diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 677ef79..cd1e571 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -868,20 +868,25 @@ static void do_interrupt(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) pthread_mutex_unlock(&f->lock); } -static void check_interrupt(struct fuse_ll *f, struct fuse_req *req) +static struct fuse_req *check_interrupt(struct fuse_ll *f, struct fuse_req *req) { struct fuse_req *curr; for (curr = f->interrupts.next; curr != &f->interrupts; curr = curr->next) { if (curr->u.i.unique == req->unique) { + req->interrupted = 1; list_del_req(curr); free(curr); - return; + return NULL; } } curr = f->interrupts.next; - if (curr != &f->interrupts) - fuse_reply_err(curr, EAGAIN); + if (curr != &f->interrupts) { + list_del_req(curr); + list_init_req(curr); + return curr; + } else + return NULL; } static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) @@ -1062,10 +1067,13 @@ static void fuse_ll_process(void *data, const char *buf, size_t len, fuse_reply_err(req, ENOSYS); else { if (in->opcode != FUSE_INTERRUPT) { + struct fuse_req *intr; pthread_mutex_lock(&f->lock); - check_interrupt(f, req); + intr = check_interrupt(f, req); list_add_req(req, &f->list); pthread_mutex_unlock(&f->lock); + if (intr) + fuse_reply_err(intr, EAGAIN); } fuse_ll_ops[in->opcode].func(req, in->nodeid, inarg); } |