Documentation ¶
Index ¶
- Constants
- func LogLevel() int
- func SetLogLevel(newLevel int)
- type Hook
- type HookContext
- type HookFs
- func (h *HookFs) Access(name string, mode uint32, context *fuse.Context) fuse.Status
- func (h *HookFs) Chmod(name string, mode uint32, context *fuse.Context) fuse.Status
- func (h *HookFs) Chown(name string, uid uint32, gid uint32, context *fuse.Context) fuse.Status
- func (h *HookFs) Create(name string, flags uint32, mode uint32, context *fuse.Context) (nodefs.File, fuse.Status)
- func (h *HookFs) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Status)
- func (h *HookFs) GetXAttr(name string, attribute string, context *fuse.Context) ([]byte, fuse.Status)
- func (h *HookFs) Link(oldName string, newName string, context *fuse.Context) fuse.Status
- func (h *HookFs) ListXAttr(name string, context *fuse.Context) ([]string, fuse.Status)
- func (h *HookFs) Mkdir(name string, mode uint32, context *fuse.Context) fuse.Status
- func (h *HookFs) Mknod(name string, mode uint32, dev uint32, context *fuse.Context) fuse.Status
- func (h *HookFs) OnMount(nodeFs *pathfs.PathNodeFs)
- func (h *HookFs) OnUnmount()
- func (h *HookFs) Open(name string, flags uint32, context *fuse.Context) (nodefs.File, fuse.Status)
- func (h *HookFs) OpenDir(name string, context *fuse.Context) ([]fuse.DirEntry, fuse.Status)
- func (h *HookFs) Readlink(name string, context *fuse.Context) (string, fuse.Status)
- func (h *HookFs) RemoveXAttr(name string, attr string, context *fuse.Context) fuse.Status
- func (h *HookFs) Rename(oldName string, newName string, context *fuse.Context) fuse.Status
- func (h *HookFs) Rmdir(name string, context *fuse.Context) fuse.Status
- func (h *HookFs) Serve() error
- func (h *HookFs) SetDebug(debug bool)
- func (h *HookFs) SetXAttr(name string, attr string, data []byte, flags int, context *fuse.Context) fuse.Status
- func (h *HookFs) StatFs(name string) *fuse.StatfsOut
- func (h *HookFs) String() string
- func (h *HookFs) Symlink(value string, linkName string, context *fuse.Context) fuse.Status
- func (h *HookFs) Truncate(name string, size uint64, context *fuse.Context) fuse.Status
- func (h *HookFs) Unlink(name string, context *fuse.Context) fuse.Status
- func (h *HookFs) Utimens(name string, Atime *time.Time, Mtime *time.Time, context *fuse.Context) fuse.Status
- type HookOnAccess
- type HookOnAllocate
- type HookOnChmod
- type HookOnChown
- type HookOnCreate
- type HookOnFlush
- type HookOnFsync
- type HookOnGetAttr
- type HookOnGetLk
- type HookOnGetXAttr
- type HookOnLink
- type HookOnListXAttr
- type HookOnMkdir
- type HookOnMknod
- type HookOnOpen
- type HookOnOpenDir
- type HookOnRead
- type HookOnReadlink
- type HookOnRelease
- type HookOnRemoveXAttr
- type HookOnRename
- type HookOnRmdir
- type HookOnSetLk
- type HookOnSetLkw
- type HookOnSetXAttr
- type HookOnStatFs
- type HookOnSymlink
- type HookOnTruncate
- type HookOnUnlink
- type HookOnUtimens
- type HookOnWrite
- type HookWithInit
Constants ¶
const LogLevelMax = 2
LogLevelMax is the maximum log level
const LogLevelMin = 0
LogLevelMin is the minimum log level
Variables ¶
This section is empty.
Functions ¶
func SetLogLevel ¶
func SetLogLevel(newLevel int)
SetLogLevel sets the log level. newLevel must be >= LogLevelMin, and <= LogLevelMax.
Types ¶
type Hook ¶
type Hook interface{}
Hook is the base interface for user-written hooks.
You have to implement HookXXX (e.g. HookOnOpen, HookOnRead, HookOnWrite, ..) interfaces.
type HookContext ¶
type HookContext interface{}
HookContext is the context objects for interaction between prehooks and posthooks.
type HookFs ¶
type HookFs struct { Original string Mountpoint string FsName string // contains filtered or unexported fields }
HookFs is the object hooking the fs.
func (*HookFs) Access ¶
Access implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) Chmod ¶
Chmod implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) Chown ¶
Chown implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) Create ¶
func (h *HookFs) Create(name string, flags uint32, mode uint32, context *fuse.Context) (nodefs.File, fuse.Status)
Create implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) GetAttr ¶
GetAttr implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) GetXAttr ¶
func (h *HookFs) GetXAttr(name string, attribute string, context *fuse.Context) ([]byte, fuse.Status)
GetXAttr implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) Link ¶
Link implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) ListXAttr ¶
ListXAttr implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) Mkdir ¶
Mkdir implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) Mknod ¶
Mknod implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) OnMount ¶
func (h *HookFs) OnMount(nodeFs *pathfs.PathNodeFs)
OnMount implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) OnUnmount ¶
func (h *HookFs) OnUnmount()
OnUnmount implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) Open ¶
Open implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) OpenDir ¶
OpenDir implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) Readlink ¶
Readlink implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) RemoveXAttr ¶
RemoveXAttr implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) Rename ¶
Rename implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) Rmdir ¶
Rmdir implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) SetDebug ¶
SetDebug implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) SetXAttr ¶
func (h *HookFs) SetXAttr(name string, attr string, data []byte, flags int, context *fuse.Context) fuse.Status
SetXAttr implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) StatFs ¶
StatFs implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) String ¶
String implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) Symlink ¶
Symlink implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
func (*HookFs) Truncate ¶
Truncate implements hanwen/go-fuse/fuse/pathfs.FileSystem. You are not expected to call h manually.
type HookOnAccess ¶ added in v0.3.0
type HookOnAccess interface { // if hooked is true, the real access() would not be called PreAccess(name string, mode uint32) (hooked bool, ctx HookContext, err error) PostAccess(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on access. This also implements Hook.
type HookOnAllocate ¶ added in v0.2.0
type HookOnAllocate interface { // if hooked is true, the real allocate() would not be called PreAllocate(path string, off uint64, size uint64, mode uint32) (hooked bool, ctx HookContext, err error) PostAllocate(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on allocate. This also implements Hook.
type HookOnChmod ¶ added in v0.2.0
type HookOnChmod interface { // if hooked is true, the real chmod() would not be called PreChmod(path string, perms uint32) (hooked bool, ctx HookContext, err error) PostChmod(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on chmod. This also implements Hook.
type HookOnChown ¶ added in v0.2.0
type HookOnChown interface { // if hooked is true, the real chown() would not be called PreChown(path string, uid uint32, gid uint32) (hooked bool, ctx HookContext, err error) PostChown(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on chown. This also implements Hook.
type HookOnCreate ¶ added in v0.3.0
type HookOnCreate interface { // if hooked is true, the real create() would not be called PreCreate(name string, flags uint32, mode uint32) (hooked bool, ctx HookContext, err error) PostCreate(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on create. This also implements Hook.
type HookOnFlush ¶ added in v0.2.0
type HookOnFlush interface { // if hooked is true, the real flush() would not be called PreFlush(path string) (hooked bool, ctx HookContext, err error) PostFlush(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOnFlush is called on flush. This also implements Hook.
type HookOnFsync ¶
type HookOnFsync interface { // if hooked is true, the real fsync() would not be called PreFsync(path string, flags uint32) (hooked bool, ctx HookContext, err error) PostFsync(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOnFsync is called on fsync. This also implements Hook.
type HookOnGetAttr ¶ added in v0.2.0
type HookOnGetAttr interface { // if hooked is true, the real getattr() would not be called PreGetAttr(path string) (hooked bool, ctx HookContext, err error) PostGetAttr(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on getattr. This also implements Hook.
type HookOnGetLk ¶ added in v0.2.0
type HookOnGetLk interface { // if hooked is true, the real getlk() would not be called PreGetLk(path string, owner uint64, lk *fuse.FileLock, flags uint32, out *fuse.FileLock) (hooked bool, ctx HookContext, err error) PostGetLk(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on getlk. This also implements Hook.
type HookOnGetXAttr ¶ added in v0.3.0
type HookOnGetXAttr interface { // if hooked is true, the real getxattr() would not be called PreGetXAttr(name string, attribute string) (hooked bool, ctx HookContext, err error) PostGetXAttr(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on getxattr. This also implements Hook.
type HookOnLink ¶ added in v0.3.0
type HookOnLink interface { // if hooked is true, the real link() would not be called PreLink(oldName string, newName string) (hooked bool, ctx HookContext, err error) PostLink(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on link. This also implements Hook.
type HookOnListXAttr ¶ added in v0.3.0
type HookOnListXAttr interface { // if hooked is true, the real listxattr() would not be called PreListXAttr(name string) (hooked bool, ctx HookContext, err error) PostListXAttr(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on listxattr. This also implements Hook.
type HookOnMkdir ¶
type HookOnMkdir interface { // if hooked is true, the real mkdir() would not be called PreMkdir(path string, mode uint32) (hooked bool, ctx HookContext, err error) PostMkdir(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOnMkdir is called on mkdir. This also implements Hook.
type HookOnMknod ¶ added in v0.3.0
type HookOnMknod interface { // if hooked is true, the real mknod() would not be called PreMknod(name string, mode uint32, dev uint32) (hooked bool, ctx HookContext, err error) PostMknod(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on mknod. This also implements Hook.
type HookOnOpen ¶
type HookOnOpen interface { // if hooked is true, the real open() would not be called PreOpen(path string, flags uint32) (hooked bool, ctx HookContext, err error) PostOpen(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOnOpen is called on open. This also implements Hook.
type HookOnOpenDir ¶
type HookOnOpenDir interface { // if hooked is true, the real opendir() would not be called PreOpenDir(path string) (hooked bool, ctx HookContext, err error) PostOpenDir(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOnOpenDir is called on opendir. This also implements Hook.
type HookOnRead ¶
type HookOnRead interface { // if hooked is true, the real read() would not be called PreRead(path string, length int64, offset int64) (buf []byte, hooked bool, ctx HookContext, err error) PostRead(realRetCode int32, realBuf []byte, prehookCtx HookContext) (buf []byte, hooked bool, err error) }
HookOnRead is called on read. This also implements Hook.
type HookOnReadlink ¶ added in v0.3.0
type HookOnReadlink interface { // if hooked is true, the real readlink() would not be called PreReadlink(name string) (hooked bool, ctx HookContext, err error) PostReadlink(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on readlink. This also implements Hook.
type HookOnRelease ¶ added in v0.2.0
type HookOnRelease interface { // if hooked is true, the real release() would not be called PreRelease(path string) (hooked bool, ctx HookContext) PostRelease(prehookCtx HookContext) (hooked bool) }
HookOnRelease is called on release. This also implements Hook.
type HookOnRemoveXAttr ¶ added in v0.3.0
type HookOnRemoveXAttr interface { // if hooked is true, the real removexattr() would not be called PreRemoveXAttr(name string, attr string) (hooked bool, ctx HookContext, err error) PostRemoveXAttr(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on removeattr. This also implements Hook.
type HookOnRename ¶ added in v0.3.0
type HookOnRename interface { // if hooked is true, the real rename() would not be called PreRename(oldName string, newName string) (hooked bool, ctx HookContext, err error) PostRename(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on rename. This also implements Hook.
type HookOnRmdir ¶
type HookOnRmdir interface { // if hooked is true, the real rmdir() would not be called PreRmdir(path string) (hooked bool, ctx HookContext, err error) PostRmdir(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOnRmdir is called on rmdir. This also implements Hook.
type HookOnSetLk ¶ added in v0.2.0
type HookOnSetLk interface { // if hooked is true, the real setlk() would not be called PreSetLk(path string, owner uint64, lk *fuse.FileLock, flags uint32) (hooked bool, ctx HookContext, err error) PostSetLk(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on setlk. This also implements Hook.
type HookOnSetLkw ¶ added in v0.2.0
type HookOnSetLkw interface { // if hooked is true, the real setlkw() would not be called PreSetLkw(path string, owner uint64, lk *fuse.FileLock, flags uint32) (hooked bool, ctx HookContext, err error) PostSetLkw(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on setlkm. This also implements Hook.
type HookOnSetXAttr ¶ added in v0.3.0
type HookOnSetXAttr interface { // if hooked is true, the real setxattr() would not be called PreSetXAttr(name string, attr string, data []byte, flags int) (hooked bool, ctx HookContext, err error) PostSetXAttr(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on setxattr. This also implements Hook.
type HookOnStatFs ¶ added in v0.3.0
type HookOnStatFs interface { // if hooked is true, the real statfs) would not be called PreStatFs(path string) (hooked bool, ctx HookContext, err error) PostStatFs(prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on statfs. This also implements Hook.
type HookOnSymlink ¶ added in v0.3.0
type HookOnSymlink interface { // if hooked is true, the real symlink() would not be called PreSymlink(value string, linkName string) (hooked bool, ctx HookContext, err error) PostSymlink(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on symink. This also implements Hook.
type HookOnTruncate ¶ added in v0.2.0
type HookOnTruncate interface { // if hooked is true, the real release() would not be called PreTruncate(path string, size uint64) (hooked bool, ctx HookContext, err error) PostTruncate(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on release. This also implements Hook.
type HookOnUnlink ¶ added in v0.3.0
type HookOnUnlink interface { // if hooked is true, the real rename() would not be called PreUnlink(name string) (hooked bool, ctx HookContext, err error) PostUnlink(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on unlink. This also implements Hook.
type HookOnUtimens ¶ added in v0.2.0
type HookOnUtimens interface { // if hooked is true, the real utimens() would not be called PreUtimens(path string, atime *time.Time, mtime *time.Time) (hooked bool, ctx HookContext, err error) PostUtimens(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOn is called on chmod. This also implements Hook.
type HookOnWrite ¶
type HookOnWrite interface { // if hooked is true, the real write() would not be called PreWrite(path string, buf []byte, offset int64) (hooked bool, ctx HookContext, err error) PostWrite(realRetCode int32, prehookCtx HookContext) (hooked bool, err error) }
HookOnWrite is called on write. This also implements Hook.
type HookWithInit ¶
type HookWithInit interface {
Init() (err error)
}
HookWithInit is called on mount. This also implements Hook.