diff options
author | Alessio Balsini <balsini@google.com> | 2022-05-24 13:36:31 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-05-24 13:36:31 +0000 |
commit | 11f7e8aa5b805045a9575ea065d2e51e9f274c0a (patch) | |
tree | 93851dd88c0eb533cd0995c5d8ee49ed4e24b283 | |
parent | b7badc92971ba41a08bcd15185a95eab261107af (diff) | |
parent | aa29d43492b19179efa203338634473f697c47f5 (diff) | |
download | libfuse-11f7e8aa5b805045a9575ea065d2e51e9f274c0a.tar.gz |
Extend initialization flags and FUSE_PASSTHROUGH to 64 bits am: ab9271b86f am: 4bd6ce23e5 am: b62341d86b am: aa29d43492
Original change: https://android-review.googlesource.com/c/platform/external/libfuse/+/1964929
Change-Id: Ib2dabed97e6f2db218c60d07e1fef62f445efa6b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | include/fuse_common.h | 6 | ||||
-rw-r--r-- | lib/fuse_lowlevel.c | 22 |
2 files changed, 21 insertions, 7 deletions
diff --git a/include/fuse_common.h b/include/fuse_common.h index 3f836d7..d6fa3e2 100644 --- a/include/fuse_common.h +++ b/include/fuse_common.h @@ -409,7 +409,7 @@ struct fuse_loop_config { * * This feature is disabled by default. */ -#define FUSE_CAP_PASSTHROUGH (1 << 31) +#define FUSE_CAP_PASSTHROUGH (1LL << 63) /** * Ioctl flags @@ -473,7 +473,7 @@ struct fuse_conn_info { /** * Capability flags that the kernel supports (read-only) */ - unsigned capable; + uint64_t capable; /** * Capability flags that the filesystem wants to enable. @@ -481,7 +481,7 @@ struct fuse_conn_info { * libfuse attempts to initialize this field with * reasonable default values before calling the init() handler. */ - unsigned want; + uint64_t want; /** * Maximum number of pending "background" requests. A diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index aee22b4..2ede5f3 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -2013,6 +2013,7 @@ void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) struct fuse_session *se = req->se; size_t bufsize = se->bufsize; size_t outargsize = sizeof(outarg); + int extended_flags; (void) nodeid; if (se->debug) { @@ -2032,6 +2033,10 @@ void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) outarg.major = FUSE_KERNEL_VERSION; outarg.minor = FUSE_KERNEL_MINOR_VERSION; + extended_flags = arg->major > 7 || (arg->major == 7 && arg->minor >= 36); + fuse_log(FUSE_LOG_DEBUG, "fuse: protocol version: %u.%u, extended flags: %d\n", + arg->major, arg->minor, extended_flags); + if (arg->major < 7) { fuse_log(FUSE_LOG_ERR, "fuse: unsupported protocol version: %u.%u\n", arg->major, arg->minor); @@ -2092,8 +2097,13 @@ void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) bufsize = max_bufsize; } } - if (arg->flags & FUSE_PASSTHROUGH) - se->conn.capable |= FUSE_PASSTHROUGH; + if (extended_flags) { + if (arg->flags2 & (1 << 31)) + se->conn.capable |= FUSE_CAP_PASSTHROUGH; + } else { + if (arg->flags & (1 << 31)) + se->conn.capable |= FUSE_CAP_PASSTHROUGH; + } } else { se->conn.max_readahead = 0; } @@ -2206,8 +2216,12 @@ void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) outarg.flags |= FUSE_WRITEBACK_CACHE; if (se->conn.want & FUSE_CAP_POSIX_ACL) outarg.flags |= FUSE_POSIX_ACL; - if (se->conn.want & FUSE_CAP_PASSTHROUGH) - outarg.flags |= FUSE_PASSTHROUGH; + if (se->conn.want & FUSE_CAP_PASSTHROUGH) { + if (extended_flags) + outarg.flags2 |= (1 << 31); + else + outarg.flags |= (1 << 31); + } if (se->conn.want & FUSE_CAP_CACHE_SYMLINKS) outarg.flags |= FUSE_CACHE_SYMLINKS; if (se->conn.want & FUSE_CAP_EXPLICIT_INVAL_DATA) |