72 lines
1.5 KiB
Go
72 lines
1.5 KiB
Go
package kubelwagen
|
|
|
|
import "github.com/hanwen/go-fuse/fuse"
|
|
|
|
type Method int
|
|
|
|
const (
|
|
MethodInvalid Method = iota
|
|
MethodOpenDir
|
|
MethodGetAttr
|
|
MethodStatFs
|
|
MethodChmod
|
|
MethodChown
|
|
MethodTruncate
|
|
MethodMknod
|
|
MethodMkdir
|
|
MethodUnlink
|
|
MethodRmdir
|
|
MethodSymlink
|
|
MethodRename
|
|
MethodLink
|
|
MethodReadLink
|
|
MethodAccess
|
|
MethodOpen
|
|
MethodCreate
|
|
|
|
MethodFileRead
|
|
MethodFileWrite
|
|
MethodFileFlock
|
|
MethodFileRelease
|
|
MethodFileGetAttr
|
|
MethodFileFsync
|
|
MethodFileTruncate
|
|
MethodFileChown
|
|
MethodFileChmod
|
|
MethodFileAllocate
|
|
)
|
|
|
|
type Request struct {
|
|
ID int `json:"id"`
|
|
Method Method `json:"method"`
|
|
Path string `json:"path"`
|
|
Mode uint32
|
|
UID uint32
|
|
GID uint32
|
|
Size uint32
|
|
Dev int32
|
|
Flags uint32
|
|
Offset int64
|
|
NewPath string `json:"newpath,omitempty"`
|
|
Attr string `json:"attr,omitempty"`
|
|
Data []byte `json:"data,omitempty"`
|
|
FileHandle int `json:"handle,omitempty"`
|
|
}
|
|
|
|
type RequestCallback struct {
|
|
message Request
|
|
response chan Response
|
|
}
|
|
|
|
type Response struct {
|
|
ID int `json:"id"`
|
|
Code fuse.Status `json:"status"`
|
|
Data []byte `json:"data,omitempty"`
|
|
Stat *fuse.Attr `json:"stat,omitempty"`
|
|
Attrs []string `json:"attrs,omitempty"`
|
|
Dirents []fuse.DirEntry `json:"dirents,omitempty"`
|
|
LinkStr string `json:"linkstr,omitempty"`
|
|
Statfs *fuse.StatfsOut `json:"statfs,omitempty"`
|
|
FileHandle int `json:"filehandle,omitempty"`
|
|
WriteSize int `json:"wsize,omitempty"`
|
|
}
|