Made package fuseshim build.
parent
b14b41f3f5
commit
8c94df5ce9
|
@ -53,7 +53,7 @@ const (
|
||||||
RootID = 1
|
RootID = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
type kstatfs struct {
|
type Kstatfs struct {
|
||||||
Blocks uint64
|
Blocks uint64
|
||||||
Bfree uint64
|
Bfree uint64
|
||||||
Bavail uint64
|
Bavail uint64
|
||||||
|
@ -387,7 +387,7 @@ const (
|
||||||
OpExchange = 63
|
OpExchange = 63
|
||||||
)
|
)
|
||||||
|
|
||||||
type entryOut struct {
|
type EntryOut struct {
|
||||||
Nodeid uint64 // Inode ID
|
Nodeid uint64 // Inode ID
|
||||||
Generation uint64 // Inode generation
|
Generation uint64 // Inode generation
|
||||||
EntryValid uint64 // Cache timeout for the name
|
EntryValid uint64 // Cache timeout for the name
|
||||||
|
@ -400,9 +400,9 @@ type entryOut struct {
|
||||||
func EntryOutSize(p Protocol) uintptr {
|
func EntryOutSize(p Protocol) uintptr {
|
||||||
switch {
|
switch {
|
||||||
case p.LT(Protocol{7, 9}):
|
case p.LT(Protocol{7, 9}):
|
||||||
return unsafe.Offsetof(entryOut{}.Attr) + unsafe.Offsetof(entryOut{}.Attr.Blksize)
|
return unsafe.Offsetof(EntryOut{}.Attr) + unsafe.Offsetof(EntryOut{}.Attr.Blksize)
|
||||||
default:
|
default:
|
||||||
return unsafe.Sizeof(entryOut{})
|
return unsafe.Sizeof(EntryOut{})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ type GetattrIn struct {
|
||||||
Fh uint64
|
Fh uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
type attrOut struct {
|
type AttrOut struct {
|
||||||
AttrValid uint64 // Cache timeout for the attributes
|
AttrValid uint64 // Cache timeout for the attributes
|
||||||
AttrValidNsec uint32
|
AttrValidNsec uint32
|
||||||
Dummy uint32
|
Dummy uint32
|
||||||
|
@ -426,14 +426,14 @@ type attrOut struct {
|
||||||
func AttrOutSize(p Protocol) uintptr {
|
func AttrOutSize(p Protocol) uintptr {
|
||||||
switch {
|
switch {
|
||||||
case p.LT(Protocol{7, 9}):
|
case p.LT(Protocol{7, 9}):
|
||||||
return unsafe.Offsetof(attrOut{}.Attr) + unsafe.Offsetof(attrOut{}.Attr.Blksize)
|
return unsafe.Offsetof(AttrOut{}.Attr) + unsafe.Offsetof(AttrOut{}.Attr.Blksize)
|
||||||
default:
|
default:
|
||||||
return unsafe.Sizeof(attrOut{})
|
return unsafe.Sizeof(AttrOut{})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// OS X
|
// OS X
|
||||||
type getxtimesOut struct {
|
type GetxtimesOut struct {
|
||||||
Bkuptime uint64
|
Bkuptime uint64
|
||||||
Crtime uint64
|
Crtime uint64
|
||||||
BkuptimeNsec uint32
|
BkuptimeNsec uint32
|
||||||
|
@ -512,7 +512,7 @@ type OpenIn struct {
|
||||||
Unused uint32
|
Unused uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
type openOut struct {
|
type OpenOut struct {
|
||||||
Fh uint64
|
Fh uint64
|
||||||
OpenFlags uint32
|
OpenFlags uint32
|
||||||
Padding uint32
|
Padding uint32
|
||||||
|
@ -602,7 +602,7 @@ func WriteInSize(p Protocol) uintptr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type writeOut struct {
|
type WriteOut struct {
|
||||||
Size uint32
|
Size uint32
|
||||||
Padding uint32
|
Padding uint32
|
||||||
}
|
}
|
||||||
|
@ -627,8 +627,8 @@ func (fl WriteFlags) String() string {
|
||||||
|
|
||||||
const compatStatfsSize = 48
|
const compatStatfsSize = 48
|
||||||
|
|
||||||
type statfsOut struct {
|
type StatfsOut struct {
|
||||||
St kstatfs
|
St Kstatfs
|
||||||
}
|
}
|
||||||
|
|
||||||
type FsyncIn struct {
|
type FsyncIn struct {
|
||||||
|
@ -642,7 +642,7 @@ type setxattrInCommon struct {
|
||||||
Flags uint32
|
Flags uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (setxattrInCommon) position() uint32 {
|
func (setxattrInCommon) GetPosition() uint32 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,11 +651,11 @@ type getxattrInCommon struct {
|
||||||
Padding uint32
|
Padding uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (getxattrInCommon) position() uint32 {
|
func (getxattrInCommon) GetPosition() uint32 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
type getxattrOut struct {
|
type GetxattrOut struct {
|
||||||
Size uint32
|
Size uint32
|
||||||
Padding uint32
|
Padding uint32
|
||||||
}
|
}
|
||||||
|
@ -677,7 +677,7 @@ func LkInSize(p Protocol) uintptr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type lkOut struct {
|
type LkOut struct {
|
||||||
Lk fileLock
|
Lk fileLock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,7 +695,7 @@ type InitIn struct {
|
||||||
|
|
||||||
const InitInSize = int(unsafe.Sizeof(InitIn{}))
|
const InitInSize = int(unsafe.Sizeof(InitIn{}))
|
||||||
|
|
||||||
type initOut struct {
|
type InitOut struct {
|
||||||
Major uint32
|
Major uint32
|
||||||
Minor uint32
|
Minor uint32
|
||||||
MaxReadahead uint32
|
MaxReadahead uint32
|
||||||
|
@ -714,7 +714,7 @@ type BmapIn struct {
|
||||||
Padding uint32
|
Padding uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
type bmapOut struct {
|
type BmapOut struct {
|
||||||
Block uint64
|
Block uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,7 +737,7 @@ type OutHeader struct {
|
||||||
Unique uint64
|
Unique uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
type dirent struct {
|
type Dirent struct {
|
||||||
Ino uint64
|
Ino uint64
|
||||||
Off uint64
|
Off uint64
|
||||||
Namelen uint32
|
Namelen uint32
|
||||||
|
@ -745,12 +745,12 @@ type dirent struct {
|
||||||
Name [0]byte
|
Name [0]byte
|
||||||
}
|
}
|
||||||
|
|
||||||
const direntSize = 8 + 8 + 4 + 4
|
const DirentSize = 8 + 8 + 4 + 4
|
||||||
|
|
||||||
const (
|
const (
|
||||||
notifyCodePoll int32 = 1
|
NotifyCodePoll int32 = 1
|
||||||
notifyCodeInvalInode int32 = 2
|
NotifyCodeInvalInode int32 = 2
|
||||||
notifyCodeInvalEntry int32 = 3
|
NotifyCodeInvalEntry int32 = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
type NotifyInvalInodeOut struct {
|
type NotifyInvalInodeOut struct {
|
||||||
|
|
|
@ -71,6 +71,10 @@ type GetxattrIn struct {
|
||||||
Padding uint32
|
Padding uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *GetxattrIn) GetPosition() uint32 {
|
||||||
|
return g.Position
|
||||||
|
}
|
||||||
|
|
||||||
type SetxattrIn struct {
|
type SetxattrIn struct {
|
||||||
setxattrInCommon
|
setxattrInCommon
|
||||||
|
|
||||||
|
@ -78,3 +82,7 @@ type SetxattrIn struct {
|
||||||
Position uint32
|
Position uint32
|
||||||
Padding uint32
|
Padding uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *SetxattrIn) GetPosition() uint32 {
|
||||||
|
return s.Position
|
||||||
|
}
|
||||||
|
|
|
@ -868,7 +868,7 @@ loop:
|
||||||
req = &SetxattrRequest{
|
req = &SetxattrRequest{
|
||||||
Header: m.Header(),
|
Header: m.Header(),
|
||||||
Flags: in.Flags,
|
Flags: in.Flags,
|
||||||
Position: in.Position(),
|
Position: in.GetPosition(),
|
||||||
Name: string(name[:i]),
|
Name: string(name[:i]),
|
||||||
Xattr: xattr,
|
Xattr: xattr,
|
||||||
}
|
}
|
||||||
|
@ -887,7 +887,7 @@ loop:
|
||||||
Header: m.Header(),
|
Header: m.Header(),
|
||||||
Name: string(name[:i]),
|
Name: string(name[:i]),
|
||||||
Size: in.Size,
|
Size: in.Size,
|
||||||
Position: in.Position,
|
Position: in.GetPosition(),
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpListxattr:
|
case fusekernel.OpListxattr:
|
||||||
|
@ -898,7 +898,7 @@ loop:
|
||||||
req = &ListxattrRequest{
|
req = &ListxattrRequest{
|
||||||
Header: m.Header(),
|
Header: m.Header(),
|
||||||
Size: in.Size,
|
Size: in.Size,
|
||||||
Position: in.Position,
|
Position: in.GetPosition(),
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpRemovexattr:
|
case fusekernel.OpRemovexattr:
|
||||||
|
@ -1049,7 +1049,7 @@ func (c *Conn) writeToKernel(msg []byte) error {
|
||||||
|
|
||||||
c.wio.RLock()
|
c.wio.RLock()
|
||||||
defer c.wio.RUnlock()
|
defer c.wio.RUnlock()
|
||||||
nn, err := syscall.Write(c.fd(), msg)
|
_, err := syscall.Write(c.fd(), msg)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1096,11 +1096,11 @@ func (c *Conn) sendInvalidate(msg []byte) error {
|
||||||
// Returns ErrNotCached if the kernel is not currently caching the
|
// Returns ErrNotCached if the kernel is not currently caching the
|
||||||
// node.
|
// node.
|
||||||
func (c *Conn) InvalidateNode(nodeID NodeID, off int64, size int64) error {
|
func (c *Conn) InvalidateNode(nodeID NodeID, off int64, size int64) error {
|
||||||
buf := newBuffer(unsafe.Sizeof(notifyInvalInodeOut{}))
|
buf := newBuffer(unsafe.Sizeof(fusekernel.NotifyInvalInodeOut{}))
|
||||||
h := (*fusekernel.OutHeader)(unsafe.Pointer(&buf[0]))
|
h := (*fusekernel.OutHeader)(unsafe.Pointer(&buf[0]))
|
||||||
// h.Unique is 0
|
// h.Unique is 0
|
||||||
h.Error = notifyCodeInvalInode
|
h.Error = fusekernel.NotifyCodeInvalInode
|
||||||
out := (*notifyInvalInodeOut)(buf.alloc(unsafe.Sizeof(notifyInvalInodeOut{})))
|
out := (*fusekernel.NotifyInvalInodeOut)(buf.alloc(unsafe.Sizeof(fusekernel.NotifyInvalInodeOut{})))
|
||||||
out.Ino = uint64(nodeID)
|
out.Ino = uint64(nodeID)
|
||||||
out.Off = off
|
out.Off = off
|
||||||
out.Len = size
|
out.Len = size
|
||||||
|
@ -1123,11 +1123,11 @@ func (c *Conn) InvalidateEntry(parent NodeID, name string) error {
|
||||||
// very unlikely, but we don't want to silently truncate
|
// very unlikely, but we don't want to silently truncate
|
||||||
return syscall.ENAMETOOLONG
|
return syscall.ENAMETOOLONG
|
||||||
}
|
}
|
||||||
buf := newBuffer(unsafe.Sizeof(notifyInvalEntryOut{}) + uintptr(len(name)) + 1)
|
buf := newBuffer(unsafe.Sizeof(fusekernel.NotifyInvalEntryOut{}) + uintptr(len(name)) + 1)
|
||||||
h := (*fusekernel.OutHeader)(unsafe.Pointer(&buf[0]))
|
h := (*fusekernel.OutHeader)(unsafe.Pointer(&buf[0]))
|
||||||
// h.Unique is 0
|
// h.Unique is 0
|
||||||
h.Error = notifyCodeInvalEntry
|
h.Error = fusekernel.NotifyCodeInvalEntry
|
||||||
out := (*notifyInvalEntryOut)(buf.alloc(unsafe.Sizeof(notifyInvalEntryOut{})))
|
out := (*fusekernel.NotifyInvalEntryOut)(buf.alloc(unsafe.Sizeof(fusekernel.NotifyInvalEntryOut{})))
|
||||||
out.Parent = uint64(parent)
|
out.Parent = uint64(parent)
|
||||||
out.Namelen = uint32(len(name))
|
out.Namelen = uint32(len(name))
|
||||||
buf = append(buf, name...)
|
buf = append(buf, name...)
|
||||||
|
@ -1168,8 +1168,8 @@ func (r *InitResponse) String() string {
|
||||||
|
|
||||||
// Respond replies to the request with the given response.
|
// Respond replies to the request with the given response.
|
||||||
func (r *InitRequest) Respond(resp *InitResponse) {
|
func (r *InitRequest) Respond(resp *InitResponse) {
|
||||||
buf := newBuffer(unsafe.Sizeof(initOut{}))
|
buf := newBuffer(unsafe.Sizeof(fusekernel.InitOut{}))
|
||||||
out := (*initOut)(buf.alloc(unsafe.Sizeof(initOut{})))
|
out := (*fusekernel.InitOut)(buf.alloc(unsafe.Sizeof(fusekernel.InitOut{})))
|
||||||
out.Major = resp.Library.Major
|
out.Major = resp.Library.Major
|
||||||
out.Minor = resp.Library.Minor
|
out.Minor = resp.Library.Minor
|
||||||
out.MaxReadahead = resp.MaxReadahead
|
out.MaxReadahead = resp.MaxReadahead
|
||||||
|
@ -1197,9 +1197,9 @@ func (r *StatfsRequest) String() string {
|
||||||
|
|
||||||
// Respond replies to the request with the given response.
|
// Respond replies to the request with the given response.
|
||||||
func (r *StatfsRequest) Respond(resp *StatfsResponse) {
|
func (r *StatfsRequest) Respond(resp *StatfsResponse) {
|
||||||
buf := newBuffer(unsafe.Sizeof(statfsOut{}))
|
buf := newBuffer(unsafe.Sizeof(fusekernel.StatfsOut{}))
|
||||||
out := (*statfsOut)(buf.alloc(unsafe.Sizeof(statfsOut{})))
|
out := (*fusekernel.StatfsOut)(buf.alloc(unsafe.Sizeof(fusekernel.StatfsOut{})))
|
||||||
out.St = kstatfs{
|
out.St = fusekernel.Kstatfs{
|
||||||
Blocks: resp.Blocks,
|
Blocks: resp.Blocks,
|
||||||
Bfree: resp.Bfree,
|
Bfree: resp.Bfree,
|
||||||
Bavail: resp.Bavail,
|
Bavail: resp.Bavail,
|
||||||
|
@ -1336,7 +1336,7 @@ func (r *GetattrRequest) String() string {
|
||||||
func (r *GetattrRequest) Respond(resp *GetattrResponse) {
|
func (r *GetattrRequest) Respond(resp *GetattrResponse) {
|
||||||
size := fusekernel.AttrOutSize(r.Header.Conn.proto)
|
size := fusekernel.AttrOutSize(r.Header.Conn.proto)
|
||||||
buf := newBuffer(size)
|
buf := newBuffer(size)
|
||||||
out := (*attrOut)(buf.alloc(size))
|
out := (*fusekernel.AttrOut)(buf.alloc(size))
|
||||||
out.AttrValid = uint64(resp.Attr.Valid / time.Second)
|
out.AttrValid = uint64(resp.Attr.Valid / time.Second)
|
||||||
out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond)
|
out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond)
|
||||||
resp.Attr.attr(&out.Attr, r.Header.Conn.proto)
|
resp.Attr.attr(&out.Attr, r.Header.Conn.proto)
|
||||||
|
@ -1378,8 +1378,8 @@ func (r *GetxattrRequest) String() string {
|
||||||
// Respond replies to the request with the given response.
|
// Respond replies to the request with the given response.
|
||||||
func (r *GetxattrRequest) Respond(resp *GetxattrResponse) {
|
func (r *GetxattrRequest) Respond(resp *GetxattrResponse) {
|
||||||
if r.Size == 0 {
|
if r.Size == 0 {
|
||||||
buf := newBuffer(unsafe.Sizeof(getxattrOut{}))
|
buf := newBuffer(unsafe.Sizeof(fusekernel.GetxattrOut{}))
|
||||||
out := (*getxattrOut)(buf.alloc(unsafe.Sizeof(getxattrOut{})))
|
out := (*fusekernel.GetxattrOut)(buf.alloc(unsafe.Sizeof(fusekernel.GetxattrOut{})))
|
||||||
out.Size = uint32(len(resp.Xattr))
|
out.Size = uint32(len(resp.Xattr))
|
||||||
r.respond(buf)
|
r.respond(buf)
|
||||||
} else {
|
} else {
|
||||||
|
@ -1414,8 +1414,8 @@ func (r *ListxattrRequest) String() string {
|
||||||
// Respond replies to the request with the given response.
|
// Respond replies to the request with the given response.
|
||||||
func (r *ListxattrRequest) Respond(resp *ListxattrResponse) {
|
func (r *ListxattrRequest) Respond(resp *ListxattrResponse) {
|
||||||
if r.Size == 0 {
|
if r.Size == 0 {
|
||||||
buf := newBuffer(unsafe.Sizeof(getxattrOut{}))
|
buf := newBuffer(unsafe.Sizeof(fusekernel.GetxattrOut{}))
|
||||||
out := (*getxattrOut)(buf.alloc(unsafe.Sizeof(getxattrOut{})))
|
out := (*fusekernel.GetxattrOut)(buf.alloc(unsafe.Sizeof(fusekernel.GetxattrOut{})))
|
||||||
out.Size = uint32(len(resp.Xattr))
|
out.Size = uint32(len(resp.Xattr))
|
||||||
r.respond(buf)
|
r.respond(buf)
|
||||||
} else {
|
} else {
|
||||||
|
@ -1521,7 +1521,7 @@ func (r *LookupRequest) String() string {
|
||||||
func (r *LookupRequest) Respond(resp *LookupResponse) {
|
func (r *LookupRequest) Respond(resp *LookupResponse) {
|
||||||
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
||||||
buf := newBuffer(size)
|
buf := newBuffer(size)
|
||||||
out := (*entryOut)(buf.alloc(size))
|
out := (*fusekernel.EntryOut)(buf.alloc(size))
|
||||||
out.Nodeid = uint64(resp.Node)
|
out.Nodeid = uint64(resp.Node)
|
||||||
out.Generation = resp.Generation
|
out.Generation = resp.Generation
|
||||||
out.EntryValid = uint64(resp.EntryValid / time.Second)
|
out.EntryValid = uint64(resp.EntryValid / time.Second)
|
||||||
|
@ -1559,8 +1559,8 @@ func (r *OpenRequest) String() string {
|
||||||
|
|
||||||
// Respond replies to the request with the given response.
|
// Respond replies to the request with the given response.
|
||||||
func (r *OpenRequest) Respond(resp *OpenResponse) {
|
func (r *OpenRequest) Respond(resp *OpenResponse) {
|
||||||
buf := newBuffer(unsafe.Sizeof(openOut{}))
|
buf := newBuffer(unsafe.Sizeof(fusekernel.OpenOut{}))
|
||||||
out := (*openOut)(buf.alloc(unsafe.Sizeof(openOut{})))
|
out := (*fusekernel.OpenOut)(buf.alloc(unsafe.Sizeof(fusekernel.OpenOut{})))
|
||||||
out.Fh = uint64(resp.Handle)
|
out.Fh = uint64(resp.Handle)
|
||||||
out.OpenFlags = uint32(resp.Flags)
|
out.OpenFlags = uint32(resp.Flags)
|
||||||
r.respond(buf)
|
r.respond(buf)
|
||||||
|
@ -1594,9 +1594,9 @@ func (r *CreateRequest) String() string {
|
||||||
// Respond replies to the request with the given response.
|
// Respond replies to the request with the given response.
|
||||||
func (r *CreateRequest) Respond(resp *CreateResponse) {
|
func (r *CreateRequest) Respond(resp *CreateResponse) {
|
||||||
eSize := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
eSize := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
||||||
buf := newBuffer(eSize + unsafe.Sizeof(openOut{}))
|
buf := newBuffer(eSize + unsafe.Sizeof(fusekernel.OpenOut{}))
|
||||||
|
|
||||||
e := (*entryOut)(buf.alloc(eSize))
|
e := (*fusekernel.EntryOut)(buf.alloc(eSize))
|
||||||
e.Nodeid = uint64(resp.Node)
|
e.Nodeid = uint64(resp.Node)
|
||||||
e.Generation = resp.Generation
|
e.Generation = resp.Generation
|
||||||
e.EntryValid = uint64(resp.EntryValid / time.Second)
|
e.EntryValid = uint64(resp.EntryValid / time.Second)
|
||||||
|
@ -1605,7 +1605,7 @@ func (r *CreateRequest) Respond(resp *CreateResponse) {
|
||||||
e.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond)
|
e.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond)
|
||||||
resp.Attr.attr(&e.Attr, r.Header.Conn.proto)
|
resp.Attr.attr(&e.Attr, r.Header.Conn.proto)
|
||||||
|
|
||||||
o := (*openOut)(buf.alloc(unsafe.Sizeof(openOut{})))
|
o := (*fusekernel.OpenOut)(buf.alloc(unsafe.Sizeof(fusekernel.OpenOut{})))
|
||||||
o.Fh = uint64(resp.Handle)
|
o.Fh = uint64(resp.Handle)
|
||||||
o.OpenFlags = uint32(resp.Flags)
|
o.OpenFlags = uint32(resp.Flags)
|
||||||
|
|
||||||
|
@ -1641,7 +1641,7 @@ func (r *MkdirRequest) String() string {
|
||||||
func (r *MkdirRequest) Respond(resp *MkdirResponse) {
|
func (r *MkdirRequest) Respond(resp *MkdirResponse) {
|
||||||
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
||||||
buf := newBuffer(size)
|
buf := newBuffer(size)
|
||||||
out := (*entryOut)(buf.alloc(size))
|
out := (*fusekernel.EntryOut)(buf.alloc(size))
|
||||||
out.Nodeid = uint64(resp.Node)
|
out.Nodeid = uint64(resp.Node)
|
||||||
out.Generation = resp.Generation
|
out.Generation = resp.Generation
|
||||||
out.EntryValid = uint64(resp.EntryValid / time.Second)
|
out.EntryValid = uint64(resp.EntryValid / time.Second)
|
||||||
|
@ -1831,15 +1831,15 @@ func (t DirentType) String() string {
|
||||||
// AppendDirent appends the encoded form of a directory entry to data
|
// AppendDirent appends the encoded form of a directory entry to data
|
||||||
// and returns the resulting slice.
|
// and returns the resulting slice.
|
||||||
func AppendDirent(data []byte, dir Dirent) []byte {
|
func AppendDirent(data []byte, dir Dirent) []byte {
|
||||||
de := dirent{
|
de := fusekernel.Dirent{
|
||||||
Ino: dir.Inode,
|
Ino: dir.Inode,
|
||||||
Namelen: uint32(len(dir.Name)),
|
Namelen: uint32(len(dir.Name)),
|
||||||
Type: uint32(dir.Type),
|
Type: uint32(dir.Type),
|
||||||
}
|
}
|
||||||
de.Off = uint64(len(data) + direntSize + (len(dir.Name)+7)&^7)
|
de.Off = uint64(len(data) + fusekernel.DirentSize + (len(dir.Name)+7)&^7)
|
||||||
data = append(data, (*[direntSize]byte)(unsafe.Pointer(&de))[:]...)
|
data = append(data, (*[fusekernel.DirentSize]byte)(unsafe.Pointer(&de))[:]...)
|
||||||
data = append(data, dir.Name...)
|
data = append(data, dir.Name...)
|
||||||
n := direntSize + uintptr(len(dir.Name))
|
n := fusekernel.DirentSize + uintptr(len(dir.Name))
|
||||||
if n%8 != 0 {
|
if n%8 != 0 {
|
||||||
var pad [8]byte
|
var pad [8]byte
|
||||||
data = append(data, pad[:8-n%8]...)
|
data = append(data, pad[:8-n%8]...)
|
||||||
|
@ -1883,8 +1883,8 @@ func (r *WriteRequest) MarshalJSON() ([]byte, error) {
|
||||||
|
|
||||||
// Respond replies to the request with the given response.
|
// Respond replies to the request with the given response.
|
||||||
func (r *WriteRequest) Respond(resp *WriteResponse) {
|
func (r *WriteRequest) Respond(resp *WriteResponse) {
|
||||||
buf := newBuffer(unsafe.Sizeof(writeOut{}))
|
buf := newBuffer(unsafe.Sizeof(fusekernel.WriteOut{}))
|
||||||
out := (*writeOut)(buf.alloc(unsafe.Sizeof(writeOut{})))
|
out := (*fusekernel.WriteOut)(buf.alloc(unsafe.Sizeof(fusekernel.WriteOut{})))
|
||||||
out.Size = uint32(resp.Size)
|
out.Size = uint32(resp.Size)
|
||||||
r.respond(buf)
|
r.respond(buf)
|
||||||
}
|
}
|
||||||
|
@ -1975,7 +1975,7 @@ func (r *SetattrRequest) String() string {
|
||||||
func (r *SetattrRequest) Respond(resp *SetattrResponse) {
|
func (r *SetattrRequest) Respond(resp *SetattrResponse) {
|
||||||
size := fusekernel.AttrOutSize(r.Header.Conn.proto)
|
size := fusekernel.AttrOutSize(r.Header.Conn.proto)
|
||||||
buf := newBuffer(size)
|
buf := newBuffer(size)
|
||||||
out := (*attrOut)(buf.alloc(size))
|
out := (*fusekernel.AttrOut)(buf.alloc(size))
|
||||||
out.AttrValid = uint64(resp.Attr.Valid / time.Second)
|
out.AttrValid = uint64(resp.Attr.Valid / time.Second)
|
||||||
out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond)
|
out.AttrValidNsec = uint32(resp.Attr.Valid % time.Second / time.Nanosecond)
|
||||||
resp.Attr.attr(&out.Attr, r.Header.Conn.proto)
|
resp.Attr.attr(&out.Attr, r.Header.Conn.proto)
|
||||||
|
@ -2049,7 +2049,7 @@ func (r *SymlinkRequest) String() string {
|
||||||
func (r *SymlinkRequest) Respond(resp *SymlinkResponse) {
|
func (r *SymlinkRequest) Respond(resp *SymlinkResponse) {
|
||||||
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
||||||
buf := newBuffer(size)
|
buf := newBuffer(size)
|
||||||
out := (*entryOut)(buf.alloc(size))
|
out := (*fusekernel.EntryOut)(buf.alloc(size))
|
||||||
out.Nodeid = uint64(resp.Node)
|
out.Nodeid = uint64(resp.Node)
|
||||||
out.Generation = resp.Generation
|
out.Generation = resp.Generation
|
||||||
out.EntryValid = uint64(resp.EntryValid / time.Second)
|
out.EntryValid = uint64(resp.EntryValid / time.Second)
|
||||||
|
@ -2098,7 +2098,7 @@ func (r *LinkRequest) String() string {
|
||||||
func (r *LinkRequest) Respond(resp *LookupResponse) {
|
func (r *LinkRequest) Respond(resp *LookupResponse) {
|
||||||
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
||||||
buf := newBuffer(size)
|
buf := newBuffer(size)
|
||||||
out := (*entryOut)(buf.alloc(size))
|
out := (*fusekernel.EntryOut)(buf.alloc(size))
|
||||||
out.Nodeid = uint64(resp.Node)
|
out.Nodeid = uint64(resp.Node)
|
||||||
out.Generation = resp.Generation
|
out.Generation = resp.Generation
|
||||||
out.EntryValid = uint64(resp.EntryValid / time.Second)
|
out.EntryValid = uint64(resp.EntryValid / time.Second)
|
||||||
|
@ -2144,7 +2144,7 @@ func (r *MknodRequest) String() string {
|
||||||
func (r *MknodRequest) Respond(resp *LookupResponse) {
|
func (r *MknodRequest) Respond(resp *LookupResponse) {
|
||||||
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
size := fusekernel.EntryOutSize(r.Header.Conn.proto)
|
||||||
buf := newBuffer(size)
|
buf := newBuffer(size)
|
||||||
out := (*entryOut)(buf.alloc(size))
|
out := (*fusekernel.EntryOut)(buf.alloc(size))
|
||||||
out.Nodeid = uint64(resp.Node)
|
out.Nodeid = uint64(resp.Node)
|
||||||
out.Generation = resp.Generation
|
out.Generation = resp.Generation
|
||||||
out.EntryValid = uint64(resp.EntryValid / time.Second)
|
out.EntryValid = uint64(resp.EntryValid / time.Second)
|
||||||
|
|
|
@ -166,7 +166,7 @@ func MaxReadahead(n uint32) MountOption {
|
||||||
// time.
|
// time.
|
||||||
func AsyncRead() MountOption {
|
func AsyncRead() MountOption {
|
||||||
return func(conf *mountConfig) error {
|
return func(conf *mountConfig) error {
|
||||||
conf.initFlags |= InitAsyncRead
|
conf.initFlags |= fusekernel.InitAsyncRead
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ func AsyncRead() MountOption {
|
||||||
// used.
|
// used.
|
||||||
func WritebackCache() MountOption {
|
func WritebackCache() MountOption {
|
||||||
return func(conf *mountConfig) error {
|
return func(conf *mountConfig) error {
|
||||||
conf.initFlags |= InitWritebackCache
|
conf.initFlags |= fusekernel.InitWritebackCache
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue