Set the fuse protocol fall back to 7.12 when available

The support for ioctls has been added to fuse when using protocol 7.18,
and an equivalent upgrade has been done in fuse lite with commit [ae9aee].
For old kernels, a fall back to protocol 7.8 was implemented, but this
appears not to be supported in not-so-old kernels (e.g. 2.6.35).
With this patch, the fall back protocol is set to 7.12 or to the highest
level supported by the kernel.
edge.strict_endians
Jean-Pierre André 2014-11-10 08:52:23 +01:00
parent 3a8d923c13
commit 39c7d8538d
2 changed files with 16 additions and 3 deletions

View File

@ -56,11 +56,12 @@
#define FUSE_KERNEL_MINOR_VERSION 18
/*
* For binary compatibility with old kernels we accept falling back to 7.8
* For binary compatibility with old kernels we accept falling back
* to 7.12 or earlier maximum version supported by the kernel
*/
#define FUSE_KERNEL_MAJOR_FALLBACK 7
#define FUSE_KERNEL_MINOR_FALLBACK 8
#define FUSE_KERNEL_MINOR_FALLBACK 12
/** The node ID of the root inode */
#define FUSE_ROOT_ID 1

View File

@ -1105,7 +1105,7 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
outarg.major = FUSE_KERNEL_VERSION;
/*
* Suggest using protocol 7.18 when available, and fallback
* to 7.8 when running on an old kernel.
* to 7.12 or even earlier when running on an old kernel.
* Protocol 7.12 has the ability to process the umask
* conditionnally (as needed if POSIXACLS is set)
* Protocol 7.18 has the ability to process the ioctls
@ -1119,8 +1119,20 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
outarg.flags |= FUSE_DONT_MASK;
#endif
} else {
/* Never use a version more recent than supported by the kernel */
if ((arg->major < FUSE_KERNEL_MAJOR_FALLBACK)
|| ((arg->major == FUSE_KERNEL_MAJOR_FALLBACK)
&& (arg->minor < FUSE_KERNEL_MINOR_FALLBACK))) {
outarg.major = arg->major;
outarg.minor = arg->minor;
} else {
outarg.major = FUSE_KERNEL_MAJOR_FALLBACK;
outarg.minor = FUSE_KERNEL_MINOR_FALLBACK;
#ifdef POSIXACLS
if (f->conn.want & FUSE_CAP_DONT_MASK)
outarg.flags |= FUSE_DONT_MASK;
#endif
}
}
if (f->conn.async_read)
outarg.flags |= FUSE_ASYNC_READ;