Commit b36e1a46 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse: hide internal type _BatchForgetIn.

parent 8eccfcb4
......@@ -230,8 +230,8 @@ func doForget(server *Server, req *request) {
}
func doBatchForget(server *Server, req *request) {
in := (*BatchForgetIn)(req.inData)
wantBytes := uintptr(in.Count) * (unsafe.Sizeof(ForgetIn{}) - unsafe.Sizeof(InHeader{}))
in := (*_BatchForgetIn)(req.inData)
wantBytes := uintptr(in.Count) * unsafe.Sizeof(_ForgetOne{})
if uintptr(len(req.arg)) < wantBytes {
// We have no return value to complain, so log an error.
log.Printf("Too few bytes for batch forget. Got %d bytes, want %d (%d entries)",
......@@ -240,7 +240,7 @@ func doBatchForget(server *Server, req *request) {
h := &reflect.SliceHeader{uintptr(unsafe.Pointer(&req.arg[0])), int(in.Count), int(in.Count)}
forgets := *(*[]ForgetOne)(unsafe.Pointer(h))
forgets := *(*[]_ForgetOne)(unsafe.Pointer(h))
for _, f := range forgets {
server.fileSystem.Forget(f.NodeId, f.Nlookup)
}
......@@ -399,7 +399,7 @@ func init() {
for op, sz := range map[int32]uintptr{
_OP_FORGET: unsafe.Sizeof(ForgetIn{}),
_OP_BATCH_FORGET: unsafe.Sizeof(BatchForgetIn{}),
_OP_BATCH_FORGET: unsafe.Sizeof(_BatchForgetIn{}),
_OP_GETATTR: unsafe.Sizeof(GetAttrIn{}),
_OP_SETATTR: unsafe.Sizeof(SetAttrIn{}),
_OP_MKNOD: unsafe.Sizeof(MknodIn{}),
......@@ -582,7 +582,7 @@ func init() {
_OP_READDIR: func(ptr unsafe.Pointer) interface{} { return (*ReadIn)(ptr) },
_OP_ACCESS: func(ptr unsafe.Pointer) interface{} { return (*AccessIn)(ptr) },
_OP_FORGET: func(ptr unsafe.Pointer) interface{} { return (*ForgetIn)(ptr) },
_OP_BATCH_FORGET: func(ptr unsafe.Pointer) interface{} { return (*BatchForgetIn)(ptr) },
_OP_BATCH_FORGET: func(ptr unsafe.Pointer) interface{} { return (*_BatchForgetIn)(ptr) },
_OP_LINK: func(ptr unsafe.Pointer) interface{} { return (*LinkIn)(ptr) },
_OP_MKDIR: func(ptr unsafe.Pointer) interface{} { return (*MkdirIn)(ptr) },
_OP_RELEASE: func(ptr unsafe.Pointer) interface{} { return (*ReleaseIn)(ptr) },
......
......@@ -93,7 +93,7 @@ func (me *ForgetIn) string() string {
return fmt.Sprintf("{%d}", me.Nlookup)
}
func (me *BatchForgetIn) string() string {
func (me *_BatchForgetIn) string() string {
return fmt.Sprintf("{%d}", me.Count)
}
......
......@@ -37,12 +37,14 @@ type ForgetIn struct {
Nlookup uint64
}
type ForgetOne struct {
// batch forget is handled internally.
type _ForgetOne struct {
NodeId uint64
Nlookup uint64
}
type BatchForgetIn struct {
// batch forget is handled internally.
type _BatchForgetIn struct {
InHeader
Count uint32
Dummy uint32
......
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