Fixed more build errors.
parent
bd41a4e788
commit
b14b41f3f5
|
@ -397,7 +397,7 @@ type entryOut struct {
|
|||
Attr Attr
|
||||
}
|
||||
|
||||
func entryOutSize(p Protocol) uintptr {
|
||||
func EntryOutSize(p Protocol) uintptr {
|
||||
switch {
|
||||
case p.LT(Protocol{7, 9}):
|
||||
return unsafe.Offsetof(entryOut{}.Attr) + unsafe.Offsetof(entryOut{}.Attr.Blksize)
|
||||
|
@ -406,11 +406,11 @@ func entryOutSize(p Protocol) uintptr {
|
|||
}
|
||||
}
|
||||
|
||||
type forgetIn struct {
|
||||
type ForgetIn struct {
|
||||
Nlookup uint64
|
||||
}
|
||||
|
||||
type getattrIn struct {
|
||||
type GetattrIn struct {
|
||||
GetattrFlags uint32
|
||||
dummy uint32
|
||||
Fh uint64
|
||||
|
@ -423,7 +423,7 @@ type attrOut struct {
|
|||
Attr Attr
|
||||
}
|
||||
|
||||
func attrOutSize(p Protocol) uintptr {
|
||||
func AttrOutSize(p Protocol) uintptr {
|
||||
switch {
|
||||
case p.LT(Protocol{7, 9}):
|
||||
return unsafe.Offsetof(attrOut{}.Attr) + unsafe.Offsetof(attrOut{}.Attr.Blksize)
|
||||
|
@ -440,7 +440,7 @@ type getxtimesOut struct {
|
|||
CrtimeNsec uint32
|
||||
}
|
||||
|
||||
type mknodIn struct {
|
||||
type MknodIn struct {
|
||||
Mode uint32
|
||||
Rdev uint32
|
||||
Umask uint32
|
||||
|
@ -448,43 +448,43 @@ type mknodIn struct {
|
|||
// "filename\x00" follows.
|
||||
}
|
||||
|
||||
func mknodInSize(p Protocol) uintptr {
|
||||
func MknodInSize(p Protocol) uintptr {
|
||||
switch {
|
||||
case p.LT(Protocol{7, 12}):
|
||||
return unsafe.Offsetof(mknodIn{}.Umask)
|
||||
return unsafe.Offsetof(MknodIn{}.Umask)
|
||||
default:
|
||||
return unsafe.Sizeof(mknodIn{})
|
||||
return unsafe.Sizeof(MknodIn{})
|
||||
}
|
||||
}
|
||||
|
||||
type mkdirIn struct {
|
||||
type MkdirIn struct {
|
||||
Mode uint32
|
||||
Umask uint32
|
||||
// filename follows
|
||||
}
|
||||
|
||||
func mkdirInSize(p Protocol) uintptr {
|
||||
func MkdirInSize(p Protocol) uintptr {
|
||||
switch {
|
||||
case p.LT(Protocol{7, 12}):
|
||||
return unsafe.Offsetof(mkdirIn{}.Umask) + 4
|
||||
return unsafe.Offsetof(MkdirIn{}.Umask) + 4
|
||||
default:
|
||||
return unsafe.Sizeof(mkdirIn{})
|
||||
return unsafe.Sizeof(MkdirIn{})
|
||||
}
|
||||
}
|
||||
|
||||
type renameIn struct {
|
||||
type RenameIn struct {
|
||||
Newdir uint64
|
||||
// "oldname\x00newname\x00" follows
|
||||
}
|
||||
|
||||
// OS X
|
||||
type exchangeIn struct {
|
||||
type ExchangeIn struct {
|
||||
Olddir uint64
|
||||
Newdir uint64
|
||||
Options uint64
|
||||
}
|
||||
|
||||
type linkIn struct {
|
||||
type LinkIn struct {
|
||||
Oldnodeid uint64
|
||||
}
|
||||
|
||||
|
@ -507,7 +507,7 @@ type setattrInCommon struct {
|
|||
Unused5 uint32
|
||||
}
|
||||
|
||||
type openIn struct {
|
||||
type OpenIn struct {
|
||||
Flags uint32
|
||||
Unused uint32
|
||||
}
|
||||
|
@ -518,37 +518,37 @@ type openOut struct {
|
|||
Padding uint32
|
||||
}
|
||||
|
||||
type createIn struct {
|
||||
type CreateIn struct {
|
||||
Flags uint32
|
||||
Mode uint32
|
||||
Umask uint32
|
||||
padding uint32
|
||||
}
|
||||
|
||||
func createInSize(p Protocol) uintptr {
|
||||
func CreateInSize(p Protocol) uintptr {
|
||||
switch {
|
||||
case p.LT(Protocol{7, 12}):
|
||||
return unsafe.Offsetof(createIn{}.Umask)
|
||||
return unsafe.Offsetof(CreateIn{}.Umask)
|
||||
default:
|
||||
return unsafe.Sizeof(createIn{})
|
||||
return unsafe.Sizeof(CreateIn{})
|
||||
}
|
||||
}
|
||||
|
||||
type releaseIn struct {
|
||||
type ReleaseIn struct {
|
||||
Fh uint64
|
||||
Flags uint32
|
||||
ReleaseFlags uint32
|
||||
LockOwner uint32
|
||||
}
|
||||
|
||||
type flushIn struct {
|
||||
type FlushIn struct {
|
||||
Fh uint64
|
||||
FlushFlags uint32
|
||||
Padding uint32
|
||||
LockOwner uint64
|
||||
}
|
||||
|
||||
type readIn struct {
|
||||
type ReadIn struct {
|
||||
Fh uint64
|
||||
Offset uint64
|
||||
Size uint32
|
||||
|
@ -558,12 +558,12 @@ type readIn struct {
|
|||
padding uint32
|
||||
}
|
||||
|
||||
func readInSize(p Protocol) uintptr {
|
||||
func ReadInSize(p Protocol) uintptr {
|
||||
switch {
|
||||
case p.LT(Protocol{7, 9}):
|
||||
return unsafe.Offsetof(readIn{}.ReadFlags) + 4
|
||||
return unsafe.Offsetof(ReadIn{}.ReadFlags) + 4
|
||||
default:
|
||||
return unsafe.Sizeof(readIn{})
|
||||
return unsafe.Sizeof(ReadIn{})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -583,7 +583,7 @@ func (fl ReadFlags) String() string {
|
|||
return flagString(uint32(fl), readFlagNames)
|
||||
}
|
||||
|
||||
type writeIn struct {
|
||||
type WriteIn struct {
|
||||
Fh uint64
|
||||
Offset uint64
|
||||
Size uint32
|
||||
|
@ -593,12 +593,12 @@ type writeIn struct {
|
|||
padding uint32
|
||||
}
|
||||
|
||||
func writeInSize(p Protocol) uintptr {
|
||||
func WriteInSize(p Protocol) uintptr {
|
||||
switch {
|
||||
case p.LT(Protocol{7, 9}):
|
||||
return unsafe.Offsetof(writeIn{}.LockOwner)
|
||||
return unsafe.Offsetof(WriteIn{}.LockOwner)
|
||||
default:
|
||||
return unsafe.Sizeof(writeIn{})
|
||||
return unsafe.Sizeof(WriteIn{})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -631,7 +631,7 @@ type statfsOut struct {
|
|||
St kstatfs
|
||||
}
|
||||
|
||||
type fsyncIn struct {
|
||||
type FsyncIn struct {
|
||||
Fh uint64
|
||||
FsyncFlags uint32
|
||||
Padding uint32
|
||||
|
@ -660,7 +660,7 @@ type getxattrOut struct {
|
|||
Padding uint32
|
||||
}
|
||||
|
||||
type lkIn struct {
|
||||
type LkIn struct {
|
||||
Fh uint64
|
||||
Owner uint64
|
||||
Lk fileLock
|
||||
|
@ -668,12 +668,12 @@ type lkIn struct {
|
|||
padding uint32
|
||||
}
|
||||
|
||||
func lkInSize(p Protocol) uintptr {
|
||||
func LkInSize(p Protocol) uintptr {
|
||||
switch {
|
||||
case p.LT(Protocol{7, 9}):
|
||||
return unsafe.Offsetof(lkIn{}.LkFlags)
|
||||
return unsafe.Offsetof(LkIn{}.LkFlags)
|
||||
default:
|
||||
return unsafe.Sizeof(lkIn{})
|
||||
return unsafe.Sizeof(LkIn{})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -681,19 +681,19 @@ type lkOut struct {
|
|||
Lk fileLock
|
||||
}
|
||||
|
||||
type accessIn struct {
|
||||
type AccessIn struct {
|
||||
Mask uint32
|
||||
Padding uint32
|
||||
}
|
||||
|
||||
type initIn struct {
|
||||
type InitIn struct {
|
||||
Major uint32
|
||||
Minor uint32
|
||||
MaxReadahead uint32
|
||||
Flags uint32
|
||||
}
|
||||
|
||||
const InitInSize = int(unsafe.Sizeof(initIn{}))
|
||||
const InitInSize = int(unsafe.Sizeof(InitIn{}))
|
||||
|
||||
type initOut struct {
|
||||
Major uint32
|
||||
|
@ -704,11 +704,11 @@ type initOut struct {
|
|||
MaxWrite uint32
|
||||
}
|
||||
|
||||
type interruptIn struct {
|
||||
type InterruptIn struct {
|
||||
Unique uint64
|
||||
}
|
||||
|
||||
type bmapIn struct {
|
||||
type BmapIn struct {
|
||||
Block uint64
|
||||
BlockSize uint32
|
||||
Padding uint32
|
||||
|
@ -753,13 +753,13 @@ const (
|
|||
notifyCodeInvalEntry int32 = 3
|
||||
)
|
||||
|
||||
type notifyInvalInodeOut struct {
|
||||
type NotifyInvalInodeOut struct {
|
||||
Ino uint64
|
||||
Off int64
|
||||
Len int64
|
||||
}
|
||||
|
||||
type notifyInvalEntryOut struct {
|
||||
type NotifyInvalEntryOut struct {
|
||||
Parent uint64
|
||||
Namelen uint32
|
||||
padding uint32
|
||||
|
|
|
@ -34,7 +34,7 @@ func (a *Attr) SetFlags(f uint32) {
|
|||
a.Flags_ = f
|
||||
}
|
||||
|
||||
type setattrIn struct {
|
||||
type SetattrIn struct {
|
||||
setattrInCommon
|
||||
|
||||
// OS X only
|
||||
|
@ -47,15 +47,15 @@ type setattrIn struct {
|
|||
Flags_ uint32 // see chflags(2)
|
||||
}
|
||||
|
||||
func (in *setattrIn) BkupTime() time.Time {
|
||||
func (in *SetattrIn) BkupTime() time.Time {
|
||||
return time.Unix(int64(in.Bkuptime_), int64(in.BkuptimeNsec))
|
||||
}
|
||||
|
||||
func (in *setattrIn) Chgtime() time.Time {
|
||||
func (in *SetattrIn) Chgtime() time.Time {
|
||||
return time.Unix(int64(in.Chgtime_), int64(in.ChgtimeNsec))
|
||||
}
|
||||
|
||||
func (in *setattrIn) Flags() uint32 {
|
||||
func (in *SetattrIn) Flags() uint32 {
|
||||
return in.Flags_
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ func openFlags(flags uint32) OpenFlags {
|
|||
return OpenFlags(flags)
|
||||
}
|
||||
|
||||
type getxattrIn struct {
|
||||
type GetxattrIn struct {
|
||||
getxattrInCommon
|
||||
|
||||
// OS X only
|
||||
|
@ -71,18 +71,10 @@ type getxattrIn struct {
|
|||
Padding uint32
|
||||
}
|
||||
|
||||
func (g *getxattrIn) position() uint32 {
|
||||
return g.Position
|
||||
}
|
||||
|
||||
type setxattrIn struct {
|
||||
type SetxattrIn struct {
|
||||
setxattrInCommon
|
||||
|
||||
// OS X only
|
||||
Position uint32
|
||||
Padding uint32
|
||||
}
|
||||
|
||||
func (s *setxattrIn) position() uint32 {
|
||||
return s.Position
|
||||
}
|
||||
|
|
|
@ -561,7 +561,7 @@ loop:
|
|||
}
|
||||
|
||||
// OSXFUSE sometimes sends the wrong m.hdr.Len in a FUSE_WRITE message.
|
||||
if m.hdr.Len < uint32(n) && m.hdr.Len >= uint32(unsafe.Sizeof(writeIn{})) && m.hdr.Opcode == fusekernel.OpWrite {
|
||||
if m.hdr.Len < uint32(n) && m.hdr.Len >= uint32(unsafe.Sizeof(fusekernel.WriteIn{})) && m.hdr.Opcode == fusekernel.OpWrite {
|
||||
m.hdr.Len = uint32(n)
|
||||
}
|
||||
|
||||
|
@ -579,7 +579,6 @@ loop:
|
|||
var req Request
|
||||
switch m.hdr.Opcode {
|
||||
default:
|
||||
Debug(noOpcode{Opcode: m.hdr.Opcode})
|
||||
goto unrecognized
|
||||
|
||||
case fusekernel.OpLookup:
|
||||
|
@ -594,7 +593,7 @@ loop:
|
|||
}
|
||||
|
||||
case fusekernel.OpForget:
|
||||
in := (*forgetIn)(m.data())
|
||||
in := (*fusekernel.ForgetIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
|
@ -611,7 +610,7 @@ loop:
|
|||
}
|
||||
|
||||
default:
|
||||
in := (*getattrIn)(m.data())
|
||||
in := (*fusekernel.GetattrIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
|
@ -623,13 +622,13 @@ loop:
|
|||
}
|
||||
|
||||
case fusekernel.OpSetattr:
|
||||
in := (*setattrIn)(m.data())
|
||||
in := (*fusekernel.SetattrIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
req = &SetattrRequest{
|
||||
Header: m.Header(),
|
||||
Valid: SetattrValid(in.Valid),
|
||||
Valid: fusekernel.SetattrValid(in.Valid),
|
||||
Handle: HandleID(in.Fh),
|
||||
Size: in.Size,
|
||||
Atime: time.Unix(int64(in.Atime), int64(in.AtimeNsec)),
|
||||
|
@ -668,7 +667,7 @@ loop:
|
|||
}
|
||||
|
||||
case fusekernel.OpLink:
|
||||
in := (*linkIn)(m.data())
|
||||
in := (*fusekernel.LinkIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
|
@ -684,11 +683,11 @@ loop:
|
|||
}
|
||||
|
||||
case fusekernel.OpMknod:
|
||||
size := mknodInSize(c.proto)
|
||||
size := fusekernel.MknodInSize(c.proto)
|
||||
if m.len() < size {
|
||||
goto corrupt
|
||||
}
|
||||
in := (*mknodIn)(m.data())
|
||||
in := (*fusekernel.MknodIn)(m.data())
|
||||
name := m.bytes()[size:]
|
||||
if len(name) < 2 || name[len(name)-1] != '\x00' {
|
||||
goto corrupt
|
||||
|
@ -706,11 +705,11 @@ loop:
|
|||
req = r
|
||||
|
||||
case fusekernel.OpMkdir:
|
||||
size := mkdirInSize(c.proto)
|
||||
size := fusekernel.MkdirInSize(c.proto)
|
||||
if m.len() < size {
|
||||
goto corrupt
|
||||
}
|
||||
in := (*mkdirIn)(m.data())
|
||||
in := (*fusekernel.MkdirIn)(m.data())
|
||||
name := m.bytes()[size:]
|
||||
i := bytes.IndexByte(name, '\x00')
|
||||
if i < 0 {
|
||||
|
@ -742,7 +741,7 @@ loop:
|
|||
}
|
||||
|
||||
case fusekernel.OpRename:
|
||||
in := (*renameIn)(m.data())
|
||||
in := (*fusekernel.RenameIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
|
@ -768,19 +767,19 @@ loop:
|
|||
}
|
||||
|
||||
case fusekernel.OpOpendir, fusekernel.OpOpen:
|
||||
in := (*openIn)(m.data())
|
||||
in := (*fusekernel.OpenIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
req = &OpenRequest{
|
||||
Header: m.Header(),
|
||||
Dir: m.hdr.Opcode == fusekernel.OpOpendir,
|
||||
Flags: openFlags(in.Flags),
|
||||
Flags: fusekernel.OpenFlags(in.Flags),
|
||||
}
|
||||
|
||||
case fusekernel.OpRead, fusekernel.OpReaddir:
|
||||
in := (*readIn)(m.data())
|
||||
if m.len() < readInSize(c.proto) {
|
||||
in := (*fusekernel.ReadIn)(m.data())
|
||||
if m.len() < fusekernel.ReadInSize(c.proto) {
|
||||
goto corrupt
|
||||
}
|
||||
r := &ReadRequest{
|
||||
|
@ -791,28 +790,28 @@ loop:
|
|||
Size: int(in.Size),
|
||||
}
|
||||
if c.proto.GE(fusekernel.Protocol{7, 9}) {
|
||||
r.Flags = ReadFlags(in.ReadFlags)
|
||||
r.Flags = fusekernel.ReadFlags(in.ReadFlags)
|
||||
r.LockOwner = in.LockOwner
|
||||
r.FileFlags = openFlags(in.Flags)
|
||||
r.FileFlags = fusekernel.OpenFlags(in.Flags)
|
||||
}
|
||||
req = r
|
||||
|
||||
case fusekernel.OpWrite:
|
||||
in := (*writeIn)(m.data())
|
||||
if m.len() < writeInSize(c.proto) {
|
||||
in := (*fusekernel.WriteIn)(m.data())
|
||||
if m.len() < fusekernel.WriteInSize(c.proto) {
|
||||
goto corrupt
|
||||
}
|
||||
r := &WriteRequest{
|
||||
Header: m.Header(),
|
||||
Handle: HandleID(in.Fh),
|
||||
Offset: int64(in.Offset),
|
||||
Flags: WriteFlags(in.WriteFlags),
|
||||
Flags: fusekernel.WriteFlags(in.WriteFlags),
|
||||
}
|
||||
if c.proto.GE(fusekernel.Protocol{7, 9}) {
|
||||
r.LockOwner = in.LockOwner
|
||||
r.FileFlags = openFlags(in.Flags)
|
||||
r.FileFlags = fusekernel.OpenFlags(in.Flags)
|
||||
}
|
||||
buf := m.bytes()[writeInSize(c.proto):]
|
||||
buf := m.bytes()[fusekernel.WriteInSize(c.proto):]
|
||||
if uint32(len(buf)) < in.Size {
|
||||
goto corrupt
|
||||
}
|
||||
|
@ -825,7 +824,7 @@ loop:
|
|||
}
|
||||
|
||||
case fusekernel.OpRelease, fusekernel.OpReleasedir:
|
||||
in := (*releaseIn)(m.data())
|
||||
in := (*fusekernel.ReleaseIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
|
@ -833,13 +832,13 @@ loop:
|
|||
Header: m.Header(),
|
||||
Dir: m.hdr.Opcode == fusekernel.OpReleasedir,
|
||||
Handle: HandleID(in.Fh),
|
||||
Flags: openFlags(in.Flags),
|
||||
ReleaseFlags: ReleaseFlags(in.ReleaseFlags),
|
||||
Flags: fusekernel.OpenFlags(in.Flags),
|
||||
ReleaseFlags: fusekernel.ReleaseFlags(in.ReleaseFlags),
|
||||
LockOwner: in.LockOwner,
|
||||
}
|
||||
|
||||
case fusekernel.OpFsync, fusekernel.OpFsyncdir:
|
||||
in := (*fsyncIn)(m.data())
|
||||
in := (*fusekernel.FsyncIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
|
@ -851,7 +850,7 @@ loop:
|
|||
}
|
||||
|
||||
case fusekernel.OpSetxattr:
|
||||
in := (*setxattrIn)(m.data())
|
||||
in := (*fusekernel.SetxattrIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
|
@ -869,13 +868,13 @@ loop:
|
|||
req = &SetxattrRequest{
|
||||
Header: m.Header(),
|
||||
Flags: in.Flags,
|
||||
Position: in.position(),
|
||||
Position: in.Position(),
|
||||
Name: string(name[:i]),
|
||||
Xattr: xattr,
|
||||
}
|
||||
|
||||
case fusekernel.OpGetxattr:
|
||||
in := (*getxattrIn)(m.data())
|
||||
in := (*fusekernel.GetxattrIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
|
@ -888,18 +887,18 @@ loop:
|
|||
Header: m.Header(),
|
||||
Name: string(name[:i]),
|
||||
Size: in.Size,
|
||||
Position: in.position(),
|
||||
Position: in.Position,
|
||||
}
|
||||
|
||||
case fusekernel.OpListxattr:
|
||||
in := (*getxattrIn)(m.data())
|
||||
in := (*fusekernel.GetxattrIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
req = &ListxattrRequest{
|
||||
Header: m.Header(),
|
||||
Size: in.Size,
|
||||
Position: in.position(),
|
||||
Position: in.Position,
|
||||
}
|
||||
|
||||
case fusekernel.OpRemovexattr:
|
||||
|
@ -914,7 +913,7 @@ loop:
|
|||
}
|
||||
|
||||
case fusekernel.OpFlush:
|
||||
in := (*flushIn)(m.data())
|
||||
in := (*fusekernel.FlushIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
|
@ -926,7 +925,7 @@ loop:
|
|||
}
|
||||
|
||||
case fusekernel.OpInit:
|
||||
in := (*initIn)(m.data())
|
||||
in := (*fusekernel.InitIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
|
@ -945,7 +944,7 @@ loop:
|
|||
panic("fusekernel.OpSetlkw")
|
||||
|
||||
case fusekernel.OpAccess:
|
||||
in := (*accessIn)(m.data())
|
||||
in := (*fusekernel.AccessIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
|
@ -955,11 +954,11 @@ loop:
|
|||
}
|
||||
|
||||
case fusekernel.OpCreate:
|
||||
size := createInSize(c.proto)
|
||||
size := fusekernel.CreateInSize(c.proto)
|
||||
if m.len() < size {
|
||||
goto corrupt
|
||||
}
|
||||
in := (*createIn)(m.data())
|
||||
in := (*fusekernel.CreateIn)(m.data())
|
||||
name := m.bytes()[size:]
|
||||
i := bytes.IndexByte(name, '\x00')
|
||||
if i < 0 {
|
||||
|
@ -967,7 +966,7 @@ loop:
|
|||
}
|
||||
r := &CreateRequest{
|
||||
Header: m.Header(),
|
||||
Flags: openFlags(in.Flags),
|
||||
Flags: fusekernel.OpenFlags(in.Flags),
|
||||
Mode: fileMode(in.Mode),
|
||||
Name: string(name[:i]),
|
||||
}
|
||||
|
@ -977,7 +976,7 @@ loop:
|
|||
req = r
|
||||
|
||||
case fusekernel.OpInterrupt:
|
||||
in := (*interruptIn)(m.data())
|
||||
in := (*fusekernel.InterruptIn)(m.data())
|
||||
if m.len() < unsafe.Sizeof(*in) {
|
||||
goto corrupt
|
||||
}
|
||||
|
@ -1006,7 +1005,6 @@ loop:
|
|||
return req, nil
|
||||
|
||||
corrupt:
|
||||
Debug(malformedMessage{})
|
||||
putMessage(m)
|
||||
return nil, fmt.Errorf("fuse: malformed message")
|
||||
|
||||
|
@ -1052,24 +1050,11 @@ func (c *Conn) writeToKernel(msg []byte) error {
|
|||
c.wio.RLock()
|
||||
defer c.wio.RUnlock()
|
||||
nn, err := syscall.Write(c.fd(), msg)
|
||||
if err == nil && nn != len(msg) {
|
||||
Debug(bugShortKernelWrite{
|
||||
Written: int64(nn),
|
||||
Length: int64(len(msg)),
|
||||
Error: errorString(err),
|
||||
Stack: stack(),
|
||||
})
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *Conn) respond(msg []byte) {
|
||||
if err := c.writeToKernel(msg); err != nil {
|
||||
Debug(bugKernelWriteError{
|
||||
Error: errorString(err),
|
||||
Stack: stack(),
|
||||
})
|
||||
}
|
||||
c.writeToKernel(msg)
|
||||
}
|
||||
|
||||
type notCachedError struct{}
|
||||
|
@ -1349,7 +1334,7 @@ func (r *GetattrRequest) String() string {
|
|||
|
||||
// Respond replies to the request with the given response.
|
||||
func (r *GetattrRequest) Respond(resp *GetattrResponse) {
|
||||
size := attrOutSize(r.Header.Conn.proto)
|
||||
size := fusekernel.AttrOutSize(r.Header.Conn.proto)
|
||||
buf := newBuffer(size)
|
||||
out := (*attrOut)(buf.alloc(size))
|
||||
out.AttrValid = uint64(resp.Attr.Valid / time.Second)
|
||||
|
@ -1534,7 +1519,7 @@ func (r *LookupRequest) String() string {
|
|||
|
||||
// Respond replies to the request with the given response.
|
||||
func (r *LookupRequest) Respond(resp *LookupResponse) {
|
||||
size := entryOutSize(r.Header.Conn.proto)
|
||||
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
||||
buf := newBuffer(size)
|
||||
out := (*entryOut)(buf.alloc(size))
|
||||
out.Nodeid = uint64(resp.Node)
|
||||
|
@ -1608,7 +1593,7 @@ func (r *CreateRequest) String() string {
|
|||
|
||||
// Respond replies to the request with the given response.
|
||||
func (r *CreateRequest) Respond(resp *CreateResponse) {
|
||||
eSize := entryOutSize(r.Header.Conn.proto)
|
||||
eSize := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
||||
buf := newBuffer(eSize + unsafe.Sizeof(openOut{}))
|
||||
|
||||
e := (*entryOut)(buf.alloc(eSize))
|
||||
|
@ -1654,7 +1639,7 @@ func (r *MkdirRequest) String() string {
|
|||
|
||||
// Respond replies to the request with the given response.
|
||||
func (r *MkdirRequest) Respond(resp *MkdirResponse) {
|
||||
size := entryOutSize(r.Header.Conn.proto)
|
||||
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
||||
buf := newBuffer(size)
|
||||
out := (*entryOut)(buf.alloc(size))
|
||||
out.Nodeid = uint64(resp.Node)
|
||||
|
@ -1988,7 +1973,7 @@ func (r *SetattrRequest) String() string {
|
|||
// Respond replies to the request with the given response,
|
||||
// giving the updated attributes.
|
||||
func (r *SetattrRequest) Respond(resp *SetattrResponse) {
|
||||
size := attrOutSize(r.Header.Conn.proto)
|
||||
size := fusekernel.AttrOutSize(r.Header.Conn.proto)
|
||||
buf := newBuffer(size)
|
||||
out := (*attrOut)(buf.alloc(size))
|
||||
out.AttrValid = uint64(resp.Attr.Valid / time.Second)
|
||||
|
@ -2062,7 +2047,7 @@ func (r *SymlinkRequest) String() string {
|
|||
|
||||
// Respond replies to the request, indicating that the symlink was created.
|
||||
func (r *SymlinkRequest) Respond(resp *SymlinkResponse) {
|
||||
size := entryOutSize(r.Header.Conn.proto)
|
||||
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
||||
buf := newBuffer(size)
|
||||
out := (*entryOut)(buf.alloc(size))
|
||||
out.Nodeid = uint64(resp.Node)
|
||||
|
@ -2111,7 +2096,7 @@ func (r *LinkRequest) String() string {
|
|||
}
|
||||
|
||||
func (r *LinkRequest) Respond(resp *LookupResponse) {
|
||||
size := entryOutSize(r.Header.Conn.proto)
|
||||
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
||||
buf := newBuffer(size)
|
||||
out := (*entryOut)(buf.alloc(size))
|
||||
out.Nodeid = uint64(resp.Node)
|
||||
|
@ -2157,7 +2142,7 @@ func (r *MknodRequest) String() string {
|
|||
}
|
||||
|
||||
func (r *MknodRequest) Respond(resp *LookupResponse) {
|
||||
size := entryOutSize(r.Header.Conn.proto)
|
||||
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
||||
buf := newBuffer(size)
|
||||
out := (*entryOut)(buf.alloc(size))
|
||||
out.Nodeid = uint64(resp.Node)
|
||||
|
|
Loading…
Reference in New Issue