Commit 9ecf4dc5 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse: add type glue for v22 and v23 protocol extensions.

parent a868fcda
...@@ -51,6 +51,7 @@ const ( ...@@ -51,6 +51,7 @@ const (
_OP_BATCH_FORGET = int32(42) _OP_BATCH_FORGET = int32(42)
_OP_FALLOCATE = int32(43) // protocol version 19. _OP_FALLOCATE = int32(43) // protocol version 19.
_OP_READDIRPLUS = int32(44) // protocol version 21. _OP_READDIRPLUS = int32(44) // protocol version 21.
_OP_FUSE_RENAME2 = int32(45) // protocol version 23.
// The following entries don't have to be compatible across Go-FUSE versions. // The following entries don't have to be compatible across Go-FUSE versions.
_OP_NOTIFY_ENTRY = int32(100) _OP_NOTIFY_ENTRY = int32(100)
...@@ -98,6 +99,14 @@ func doInit(server *Server, req *request) { ...@@ -98,6 +99,14 @@ func doInit(server *Server, req *request) {
out.Minor = input.Minor out.Minor = input.Minor
} }
if out.Minor <= 22 {
tweaked := *req.handler
// v8-v22 don't have TimeGran and further fields.
tweaked.OutputSize = 24
req.handler = &tweaked
}
req.outData = unsafe.Pointer(out) req.outData = unsafe.Pointer(out)
req.status = OK req.status = OK
} }
......
...@@ -24,21 +24,24 @@ func init() { ...@@ -24,21 +24,24 @@ func init() {
READ_LOCKOWNER: "LOCKOWNER", READ_LOCKOWNER: "LOCKOWNER",
} }
initFlagNames = map[int64]string{ initFlagNames = map[int64]string{
CAP_ASYNC_READ: "ASYNC_READ", CAP_ASYNC_READ: "ASYNC_READ",
CAP_POSIX_LOCKS: "POSIX_LOCKS", CAP_POSIX_LOCKS: "POSIX_LOCKS",
CAP_FILE_OPS: "FILE_OPS", CAP_FILE_OPS: "FILE_OPS",
CAP_ATOMIC_O_TRUNC: "ATOMIC_O_TRUNC", CAP_ATOMIC_O_TRUNC: "ATOMIC_O_TRUNC",
CAP_EXPORT_SUPPORT: "EXPORT_SUPPORT", CAP_EXPORT_SUPPORT: "EXPORT_SUPPORT",
CAP_BIG_WRITES: "BIG_WRITES", CAP_BIG_WRITES: "BIG_WRITES",
CAP_DONT_MASK: "DONT_MASK", CAP_DONT_MASK: "DONT_MASK",
CAP_SPLICE_WRITE: "SPLICE_WRITE", CAP_SPLICE_WRITE: "SPLICE_WRITE",
CAP_SPLICE_MOVE: "SPLICE_MOVE", CAP_SPLICE_MOVE: "SPLICE_MOVE",
CAP_SPLICE_READ: "SPLICE_READ", CAP_SPLICE_READ: "SPLICE_READ",
CAP_FLOCK_LOCKS: "FLOCK_LOCKS", CAP_FLOCK_LOCKS: "FLOCK_LOCKS",
CAP_IOCTL_DIR: "IOCTL_DIR", CAP_IOCTL_DIR: "IOCTL_DIR",
CAP_AUTO_INVAL_DATA: "AUTO_INVAL_DATA", CAP_AUTO_INVAL_DATA: "AUTO_INVAL_DATA",
CAP_READDIRPLUS: "READDIRPLUS", CAP_READDIRPLUS: "READDIRPLUS",
CAP_READDIRPLUS_AUTO: "READDIRPLUS_AUTO", CAP_READDIRPLUS_AUTO: "READDIRPLUS_AUTO",
CAP_FUSE_ASYNC_DIO: "ASYNC_DIO",
CAP_FUSE_WRITEBACK_CACHE: "WRITEBACK_CACHE",
CAP_FUSE_NO_OPEN_SUPPORT: "NO_OPEN_SUPPORT",
} }
releaseFlagNames = map[int64]string{ releaseFlagNames = map[int64]string{
RELEASE_FLUSH: "FLUSH", RELEASE_FLUSH: "FLUSH",
...@@ -155,10 +158,11 @@ func (me *InitIn) string() string { ...@@ -155,10 +158,11 @@ func (me *InitIn) string() string {
} }
func (me *InitOut) string() string { func (me *InitOut) string() string {
return fmt.Sprintf("{%d.%d Ra 0x%x %s %d/%d Wr 0x%x}", return fmt.Sprintf("{%d.%d Ra 0x%x %s %d/%d Wr 0x%x Tg 0x%x}",
me.Major, me.Minor, me.MaxReadAhead, me.Major, me.Minor, me.MaxReadAhead,
FlagString(initFlagNames, int64(me.Flags), ""), FlagString(initFlagNames, int64(me.Flags), ""),
me.CongestionThreshold, me.MaxBackground, me.MaxWrite) me.CongestionThreshold, me.MaxBackground, me.MaxWrite,
me.TimeGran)
} }
func (s *FsyncIn) string() string { func (s *FsyncIn) string() string {
......
...@@ -61,6 +61,13 @@ type RenameIn struct { ...@@ -61,6 +61,13 @@ type RenameIn struct {
Newdir uint64 Newdir uint64
} }
type Rename2In struct {
InHeader
Newdir uint64
Flags uint32
Padding uint32
}
type LinkIn struct { type LinkIn struct {
InHeader InHeader
Oldnodeid uint64 Oldnodeid uint64
...@@ -82,6 +89,7 @@ const ( // SetAttrIn.Valid ...@@ -82,6 +89,7 @@ const ( // SetAttrIn.Valid
FATTR_ATIME_NOW = (1 << 7) FATTR_ATIME_NOW = (1 << 7)
FATTR_MTIME_NOW = (1 << 8) FATTR_MTIME_NOW = (1 << 8)
FATTR_LOCKOWNER = (1 << 9) FATTR_LOCKOWNER = (1 << 9)
FATTR_CTIME = (1 << 10)
) )
type SetAttrInCommon struct { type SetAttrInCommon struct {
...@@ -94,10 +102,10 @@ type SetAttrInCommon struct { ...@@ -94,10 +102,10 @@ type SetAttrInCommon struct {
LockOwner uint64 LockOwner uint64
Atime uint64 Atime uint64
Mtime uint64 Mtime uint64
Unused2 uint64 Ctime uint64
Atimensec uint32 Atimensec uint32
Mtimensec uint32 Mtimensec uint32
Unused3 uint32 Ctimensec uint32
Mode uint32 Mode uint32
Unused4 uint32 Unused4 uint32
Owner Owner
...@@ -135,21 +143,24 @@ type OpenOut struct { ...@@ -135,21 +143,24 @@ type OpenOut struct {
// To be set in InitIn/InitOut.Flags. // To be set in InitIn/InitOut.Flags.
const ( const (
CAP_ASYNC_READ = (1 << 0) CAP_ASYNC_READ = (1 << 0)
CAP_POSIX_LOCKS = (1 << 1) CAP_POSIX_LOCKS = (1 << 1)
CAP_FILE_OPS = (1 << 2) CAP_FILE_OPS = (1 << 2)
CAP_ATOMIC_O_TRUNC = (1 << 3) CAP_ATOMIC_O_TRUNC = (1 << 3)
CAP_EXPORT_SUPPORT = (1 << 4) CAP_EXPORT_SUPPORT = (1 << 4)
CAP_BIG_WRITES = (1 << 5) CAP_BIG_WRITES = (1 << 5)
CAP_DONT_MASK = (1 << 6) CAP_DONT_MASK = (1 << 6)
CAP_SPLICE_WRITE = (1 << 7) CAP_SPLICE_WRITE = (1 << 7)
CAP_SPLICE_MOVE = (1 << 8) CAP_SPLICE_MOVE = (1 << 8)
CAP_SPLICE_READ = (1 << 9) CAP_SPLICE_READ = (1 << 9)
CAP_FLOCK_LOCKS = (1 << 10) CAP_FLOCK_LOCKS = (1 << 10)
CAP_IOCTL_DIR = (1 << 11) CAP_IOCTL_DIR = (1 << 11)
CAP_AUTO_INVAL_DATA = (1 << 12) CAP_AUTO_INVAL_DATA = (1 << 12)
CAP_READDIRPLUS = (1 << 13) CAP_READDIRPLUS = (1 << 13)
CAP_READDIRPLUS_AUTO = (1 << 14) CAP_READDIRPLUS_AUTO = (1 << 14)
CAP_FUSE_ASYNC_DIO = (1 << 15)
CAP_FUSE_WRITEBACK_CACHE = (1 << 16)
CAP_FUSE_NO_OPEN_SUPPORT = (1 << 17)
) )
type InitIn struct { type InitIn struct {
...@@ -169,6 +180,8 @@ type InitOut struct { ...@@ -169,6 +180,8 @@ type InitOut struct {
MaxBackground uint16 MaxBackground uint16
CongestionThreshold uint16 CongestionThreshold uint16
MaxWrite uint32 MaxWrite uint32
TimeGran uint32
Unused [9]uint32
} }
type _CuseInitIn struct { type _CuseInitIn struct {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment