Commit 64f48274 authored by Aaron Jacobs's avatar Aaron Jacobs

Fixed some build errors.

parent 3b9092ac
...@@ -50,7 +50,7 @@ func Convert( ...@@ -50,7 +50,7 @@ func Convert(
var io internalOp var io internalOp
switch m.Header().Opcode { switch m.Header().Opcode {
case fusekernel.OpLookup: case fusekernel.OpLookup:
buf := m.Bytes() buf := m.ConsumeBytes(m.Len())
n := len(buf) n := len(buf)
if n == 0 || buf[n-1] != '\x00' { if n == 0 || buf[n-1] != '\x00' {
err = errors.New("Corrupt OpLookup") err = errors.New("Corrupt OpLookup")
...@@ -74,8 +74,9 @@ func Convert( ...@@ -74,8 +74,9 @@ func Convert(
co = &to.commonOp co = &to.commonOp
case fusekernel.OpSetattr: case fusekernel.OpSetattr:
in := (*fusekernel.SetattrIn)(m.Data()) type input fusekernel.SetattrIn
if m.Len() < unsafe.Sizeof(*in) { in := (*input)(m.Consume(unsafe.Sizeof(input{})))
if in == nil {
err = errors.New("Corrupt OpSetattr") err = errors.New("Corrupt OpSetattr")
return return
} }
...@@ -109,8 +110,9 @@ func Convert( ...@@ -109,8 +110,9 @@ func Convert(
co = &to.commonOp co = &to.commonOp
case fusekernel.OpForget: case fusekernel.OpForget:
in := (*fusekernel.ForgetIn)(m.Data()) type input fusekernel.ForgetIn
if m.Len() < unsafe.Sizeof(*in) { in := (*input)(m.Consume(unsafe.Sizeof(input{})))
if in == nil {
err = errors.New("Corrupt OpForget") err = errors.New("Corrupt OpForget")
return return
} }
......
...@@ -41,6 +41,11 @@ func (m *InMessage) Header() (h *fusekernel.InHeader) { ...@@ -41,6 +41,11 @@ func (m *InMessage) Header() (h *fusekernel.InHeader) {
panic("TODO") panic("TODO")
} }
// Return the number of bytes left to consume.
func (m *InMessage) Len() uintptr {
panic("TODO")
}
// Consume the next n bytes from the message, returning a nil pointer if there // Consume the next n bytes from the message, returning a nil pointer if there
// are fewer than n bytes available. // are fewer than n bytes available.
func (m *InMessage) Consume(n uintptr) (p unsafe.Pointer) { func (m *InMessage) Consume(n uintptr) (p unsafe.Pointer) {
......
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