fuse: reserve byteswapped init opcodes
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 4 Sep 2019 12:36:33 +0000 (08:36 -0400)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 12 Sep 2019 12:59:41 +0000 (14:59 +0200)
virtio fs tunnels fuse over a virtio channel.  One issue is two sides might
be speaking different endian-ness. To detects this, host side looks at the
opcode value in the FUSE_INIT command.  Works fine at the moment but might
fail if a future version of fuse will use such an opcode for
initialization.  Let's reserve this opcode so we remember and don't do
this.

Same for CUSE_INIT.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
include/uapi/linux/fuse.h

index 2971d29a42e4a46892ede858e3910ac2a4a45498..df2e12fb33812fc5f1639196a67954ba9efb79f2 100644 (file)
@@ -425,6 +425,10 @@ enum fuse_opcode {
 
        /* CUSE specific operations */
        CUSE_INIT               = 4096,
+
+       /* Reserved opcodes: helpful to detect structure endian-ness */
+       CUSE_INIT_BSWAP_RESERVED        = 1048576,      /* CUSE_INIT << 8 */
+       FUSE_INIT_BSWAP_RESERVED        = 436207616,    /* FUSE_INIT << 24 */
 };
 
 enum fuse_notify_code {