From ea1b1d896de3b60c0d05adbcc10cac2a7f4a38ac Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Sat, 16 Jul 2022 21:14:20 +1000 Subject: [PATCH] disable asynchronous reading/writing --- fusefile.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/fusefile.c b/fusefile.c index a0f0981..b9d3b2d 100644 --- a/fusefile.c +++ b/fusefile.c @@ -225,6 +225,7 @@ static int fusefile_read(const char *path, char *buf, size_t size, #if DEBUG print_source( &sources.array[i] ); #endif + times.atime = time( 0 ); size_t b = off - sources.array[i].start + sources.array[i].from; size_t n = sources.array[i].to - b; if ( n > size ) { @@ -252,7 +253,6 @@ static int fusefile_read(const char *path, char *buf, size_t size, off += r; size -= r; } - times.atime = time( 0 ); return rr; } @@ -411,6 +411,19 @@ static int fusefile_truncate(const char *path, off_t len) { return -EIO; } +void *fusefile_init(struct fuse_conn_info *fci) { +#if DEBUG + fprintf( stderr, "fusefile_init( %d, %d )\n", fci->async_read, fci->want ); +#endif + // Disable asynchronous reading + fci->async_read = 0; + fci->want &= ~FUSE_CAP_ASYNC_READ; +#if DEBUG + fprintf( stderr, "fusefile_init( %d, %d )\n", fci->async_read, fci->want ); +#endif + return 0; +} + static struct fuse_operations fusefile_oper = { .getattr = fusefile_getattr, .chmod = fusefile_chmod, @@ -426,7 +439,7 @@ static struct fuse_operations fusefile_oper = { .truncate = fusefile_truncate, //.truncate = fusefile_truncate, //.release = fusefile_release, - //void *(*init) (struct fuse_conn_info *conn); + .init = fusefile_init, }; static void usage() { -- 2.39.2