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
} }
......
...@@ -39,6 +39,9 @@ func init() { ...@@ -39,6 +39,9 @@ func init() {
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
...@@ -150,6 +158,9 @@ const ( ...@@ -150,6 +158,9 @@ const (
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