Commit b760b557 authored by Kirill Smelkov's avatar Kirill Smelkov Committed by Han-Wen Nienhuys

fuse: Correct NOTIFY constants/operation names

- it is not NOTIFY_INVAL_DELETE, but just NOTIFY_DELETE as the kernel is
  notified of entry being deleted and there is no invalidation here.
  uapi/linux/fuse.h does not use "_INVAL_" for NOTIFY_DELETE neither.

- similarly for "notify store/retrieve" _INVAL_ is not appropriate and
  neither is used in uapi/linux/fuse.h . However since we took more
  explicit approach for "notify store/retrieve" naming (see bdca0e6a
  "Add support for store notify") let's also add _CACHE suffix for
  "notify store/retrieve" operation names for consistency and for being
  less ambiguous.

- for inode/entry invalidation operations, let's use _INVAL_ in internal
  _OP_NOTIFY_*, similarly to how it is used in corresponding NOTIFY_*
  constant. For example:

	_OP_NOTIFY_ENTRY -> _OP_NOTIFY_INVAL_ENTRY	(corresponds to NOTIFY_INVAL_ENTRY)
parent 6df8ddc4
...@@ -23,9 +23,9 @@ func (code Status) String() string { ...@@ -23,9 +23,9 @@ func (code Status) String() string {
"NOTIFY_POLL", "NOTIFY_POLL",
"NOTIFY_INVAL_INODE", "NOTIFY_INVAL_INODE",
"NOTIFY_INVAL_ENTRY", "NOTIFY_INVAL_ENTRY",
"NOTIFY_INVAL_STORE", "NOTIFY_STORE_CACHE",
"NOTIFY_INVAL_RETRIEVE", "NOTIFY_RETRIEVE_CACHE",
"NOTIFY_INVAL_DELETE", "NOTIFY_DELETE",
}[-code] }[-code]
} }
return fmt.Sprintf("%d=%v", int(code), syscall.Errno(code)) return fmt.Sprintf("%d=%v", int(code), syscall.Errno(code))
......
...@@ -58,9 +58,9 @@ const ( ...@@ -58,9 +58,9 @@ const (
_OP_FUSE_RENAME2 = int32(45) // protocol version 23. _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_INVAL_ENTRY = int32(100)
_OP_NOTIFY_INODE = int32(101) _OP_NOTIFY_INVAL_INODE = int32(101)
_OP_NOTIFY_STORE = int32(102) _OP_NOTIFY_STORE_CACHE = int32(102)
_OP_NOTIFY_DELETE = int32(103) // protocol version 18 _OP_NOTIFY_DELETE = int32(103) // protocol version 18
_OPCODE_COUNT = int32(104) _OPCODE_COUNT = int32(104)
...@@ -446,7 +446,7 @@ func init() { ...@@ -446,7 +446,7 @@ func init() {
operationHandlers[i] = &operationHandler{Name: "UNKNOWN"} operationHandlers[i] = &operationHandler{Name: "UNKNOWN"}
} }
fileOps := []int32{_OP_READLINK, _OP_NOTIFY_ENTRY, _OP_NOTIFY_DELETE} fileOps := []int32{_OP_READLINK, _OP_NOTIFY_INVAL_ENTRY, _OP_NOTIFY_DELETE}
for _, op := range fileOps { for _, op := range fileOps {
operationHandlers[op].FileNameOut = true operationHandlers[op].FileNameOut = true
} }
...@@ -509,9 +509,9 @@ func init() { ...@@ -509,9 +509,9 @@ func init() {
_OP_BMAP: unsafe.Sizeof(_BmapOut{}), _OP_BMAP: unsafe.Sizeof(_BmapOut{}),
_OP_IOCTL: unsafe.Sizeof(_IoctlOut{}), _OP_IOCTL: unsafe.Sizeof(_IoctlOut{}),
_OP_POLL: unsafe.Sizeof(_PollOut{}), _OP_POLL: unsafe.Sizeof(_PollOut{}),
_OP_NOTIFY_ENTRY: unsafe.Sizeof(NotifyInvalEntryOut{}), _OP_NOTIFY_INVAL_ENTRY: unsafe.Sizeof(NotifyInvalEntryOut{}),
_OP_NOTIFY_INODE: unsafe.Sizeof(NotifyInvalInodeOut{}), _OP_NOTIFY_INVAL_INODE: unsafe.Sizeof(NotifyInvalInodeOut{}),
_OP_NOTIFY_STORE: unsafe.Sizeof(NotifyStoreOut{}), _OP_NOTIFY_STORE_CACHE: unsafe.Sizeof(NotifyStoreOut{}),
_OP_NOTIFY_DELETE: unsafe.Sizeof(NotifyInvalDeleteOut{}), _OP_NOTIFY_DELETE: unsafe.Sizeof(NotifyInvalDeleteOut{}),
} { } {
operationHandlers[op].OutputSize = sz operationHandlers[op].OutputSize = sz
...@@ -557,9 +557,9 @@ func init() { ...@@ -557,9 +557,9 @@ func init() {
_OP_DESTROY: "DESTROY", _OP_DESTROY: "DESTROY",
_OP_IOCTL: "IOCTL", _OP_IOCTL: "IOCTL",
_OP_POLL: "POLL", _OP_POLL: "POLL",
_OP_NOTIFY_ENTRY: "NOTIFY_ENTRY", _OP_NOTIFY_INVAL_ENTRY: "NOTIFY_INVAL_ENTRY",
_OP_NOTIFY_INODE: "NOTIFY_INODE", _OP_NOTIFY_INVAL_INODE: "NOTIFY_INVAL_INODE",
_OP_NOTIFY_STORE: "NOTIFY_STORE", _OP_NOTIFY_STORE_CACHE: "NOTIFY_STORE",
_OP_NOTIFY_DELETE: "NOTIFY_DELETE", _OP_NOTIFY_DELETE: "NOTIFY_DELETE",
_OP_FALLOCATE: "FALLOCATE", _OP_FALLOCATE: "FALLOCATE",
_OP_READDIRPLUS: "READDIRPLUS", _OP_READDIRPLUS: "READDIRPLUS",
...@@ -621,9 +621,9 @@ func init() { ...@@ -621,9 +621,9 @@ func init() {
_OP_SETATTR: func(ptr unsafe.Pointer) interface{} { return (*AttrOut)(ptr) }, _OP_SETATTR: func(ptr unsafe.Pointer) interface{} { return (*AttrOut)(ptr) },
_OP_INIT: func(ptr unsafe.Pointer) interface{} { return (*InitOut)(ptr) }, _OP_INIT: func(ptr unsafe.Pointer) interface{} { return (*InitOut)(ptr) },
_OP_MKDIR: func(ptr unsafe.Pointer) interface{} { return (*EntryOut)(ptr) }, _OP_MKDIR: func(ptr unsafe.Pointer) interface{} { return (*EntryOut)(ptr) },
_OP_NOTIFY_ENTRY: func(ptr unsafe.Pointer) interface{} { return (*NotifyInvalEntryOut)(ptr) }, _OP_NOTIFY_INVAL_ENTRY: func(ptr unsafe.Pointer) interface{} { return (*NotifyInvalEntryOut)(ptr) },
_OP_NOTIFY_INODE: func(ptr unsafe.Pointer) interface{} { return (*NotifyInvalInodeOut)(ptr) }, _OP_NOTIFY_INVAL_INODE: func(ptr unsafe.Pointer) interface{} { return (*NotifyInvalInodeOut)(ptr) },
_OP_NOTIFY_STORE: func(ptr unsafe.Pointer) interface{} { return (*NotifyStoreOut)(ptr) }, _OP_NOTIFY_STORE_CACHE: func(ptr unsafe.Pointer) interface{} { return (*NotifyStoreOut)(ptr) },
_OP_NOTIFY_DELETE: func(ptr unsafe.Pointer) interface{} { return (*NotifyInvalDeleteOut)(ptr) }, _OP_NOTIFY_DELETE: func(ptr unsafe.Pointer) interface{} { return (*NotifyInvalDeleteOut)(ptr) },
_OP_STATFS: func(ptr unsafe.Pointer) interface{} { return (*StatfsOut)(ptr) }, _OP_STATFS: func(ptr unsafe.Pointer) interface{} { return (*StatfsOut)(ptr) },
_OP_SYMLINK: func(ptr unsafe.Pointer) interface{} { return (*EntryOut)(ptr) }, _OP_SYMLINK: func(ptr unsafe.Pointer) interface{} { return (*EntryOut)(ptr) },
......
...@@ -454,9 +454,9 @@ func (ms *Server) InodeNotify(node uint64, off int64, length int64) Status { ...@@ -454,9 +454,9 @@ func (ms *Server) InodeNotify(node uint64, off int64, length int64) Status {
req := request{ req := request{
inHeader: &InHeader{ inHeader: &InHeader{
Opcode: _OP_NOTIFY_INODE, Opcode: _OP_NOTIFY_INVAL_INODE,
}, },
handler: operationHandlers[_OP_NOTIFY_INODE], handler: operationHandlers[_OP_NOTIFY_INVAL_INODE],
status: NOTIFY_INVAL_INODE, status: NOTIFY_INVAL_INODE,
} }
...@@ -481,7 +481,7 @@ func (ms *Server) InodeNotify(node uint64, off int64, length int64) Status { ...@@ -481,7 +481,7 @@ func (ms *Server) InodeNotify(node uint64, off int64, length int64) Status {
// This call is similar to InodeNotify, but instead of only invalidating a data // This call is similar to InodeNotify, but instead of only invalidating a data
// region, it gives updated data directly to the kernel. // region, it gives updated data directly to the kernel.
func (ms *Server) InodeNotifyStoreCache(node uint64, offset int64, data []byte) Status { func (ms *Server) InodeNotifyStoreCache(node uint64, offset int64, data []byte) Status {
if !ms.kernelSettings.SupportsNotify(NOTIFY_STORE) { if !ms.kernelSettings.SupportsNotify(NOTIFY_STORE_CACHE) {
return ENOSYS return ENOSYS
} }
...@@ -511,10 +511,10 @@ func (ms *Server) InodeNotifyStoreCache(node uint64, offset int64, data []byte) ...@@ -511,10 +511,10 @@ func (ms *Server) InodeNotifyStoreCache(node uint64, offset int64, data []byte)
func (ms *Server) inodeNotifyStoreCache32(node uint64, offset int64, data []byte) Status { func (ms *Server) inodeNotifyStoreCache32(node uint64, offset int64, data []byte) Status {
req := request{ req := request{
inHeader: &InHeader{ inHeader: &InHeader{
Opcode: _OP_NOTIFY_STORE, Opcode: _OP_NOTIFY_STORE_CACHE,
}, },
handler: operationHandlers[_OP_NOTIFY_STORE], handler: operationHandlers[_OP_NOTIFY_STORE_CACHE],
status: NOTIFY_STORE, status: NOTIFY_STORE_CACHE,
} }
store := (*NotifyStoreOut)(req.outData()) store := (*NotifyStoreOut)(req.outData())
...@@ -550,7 +550,7 @@ func (ms *Server) DeleteNotify(parent uint64, child uint64, name string) Status ...@@ -550,7 +550,7 @@ func (ms *Server) DeleteNotify(parent uint64, child uint64, name string) Status
Opcode: _OP_NOTIFY_DELETE, Opcode: _OP_NOTIFY_DELETE,
}, },
handler: operationHandlers[_OP_NOTIFY_DELETE], handler: operationHandlers[_OP_NOTIFY_DELETE],
status: NOTIFY_INVAL_DELETE, status: NOTIFY_DELETE,
} }
entry := (*NotifyInvalDeleteOut)(req.outData()) entry := (*NotifyInvalDeleteOut)(req.outData())
...@@ -585,9 +585,9 @@ func (ms *Server) EntryNotify(parent uint64, name string) Status { ...@@ -585,9 +585,9 @@ func (ms *Server) EntryNotify(parent uint64, name string) Status {
} }
req := request{ req := request{
inHeader: &InHeader{ inHeader: &InHeader{
Opcode: _OP_NOTIFY_ENTRY, Opcode: _OP_NOTIFY_INVAL_ENTRY,
}, },
handler: operationHandlers[_OP_NOTIFY_ENTRY], handler: operationHandlers[_OP_NOTIFY_INVAL_ENTRY],
status: NOTIFY_INVAL_ENTRY, status: NOTIFY_INVAL_ENTRY,
} }
entry := (*NotifyInvalEntryOut)(req.outData()) entry := (*NotifyInvalEntryOut)(req.outData())
...@@ -619,16 +619,16 @@ func (in *InitIn) SupportsVersion(maj, min uint32) bool { ...@@ -619,16 +619,16 @@ func (in *InitIn) SupportsVersion(maj, min uint32) bool {
} }
// SupportsNotify returns whether a certain notification type is // SupportsNotify returns whether a certain notification type is
// supported. Pass any of the NOTIFY_INVAL_* types as argument. // supported. Pass any of the NOTIFY_* types as argument.
func (in *InitIn) SupportsNotify(notifyType int) bool { func (in *InitIn) SupportsNotify(notifyType int) bool {
switch notifyType { switch notifyType {
case NOTIFY_INVAL_ENTRY: case NOTIFY_INVAL_ENTRY:
return in.SupportsVersion(7, 12) return in.SupportsVersion(7, 12)
case NOTIFY_INVAL_INODE: case NOTIFY_INVAL_INODE:
return in.SupportsVersion(7, 12) return in.SupportsVersion(7, 12)
case NOTIFY_STORE: case NOTIFY_STORE_CACHE:
return in.SupportsVersion(7, 15) return in.SupportsVersion(7, 15)
case NOTIFY_INVAL_DELETE: case NOTIFY_DELETE:
return in.SupportsVersion(7, 18) return in.SupportsVersion(7, 18)
} }
return false return false
......
...@@ -384,12 +384,12 @@ type NotifyStoreOut struct { ...@@ -384,12 +384,12 @@ type NotifyStoreOut struct {
} }
const ( const (
// NOTIFY_POLL = -1 // NOTIFY_POLL = -1 // notify kernel that a poll waiting for IO on a file handle should wake up
NOTIFY_INVAL_INODE = -2 NOTIFY_INVAL_INODE = -2 // notify kernel that an inode should be invalidated
NOTIFY_INVAL_ENTRY = -3 NOTIFY_INVAL_ENTRY = -3 // notify kernel that a directory entry should be invalidated
NOTIFY_STORE = -4 NOTIFY_STORE_CACHE = -4 // store data into kernel cache of an inode
// NOTIFY_RETRIEVE = -5 // NOTIFY_RETRIEVE_CACHE = -5 // retrieve data from kernel cache of an inode
NOTIFY_INVAL_DELETE = -6 NOTIFY_DELETE = -6 // notify kernel that a directory entry has been deleted
// NOTIFY_CODE_MAX = -6 // NOTIFY_CODE_MAX = -6
) )
......
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