Skip to content
This repository was archived by the owner on Dec 13, 2021. It is now read-only.

inspectors/fs: implement Fsync #160

Merged
merged 1 commit into from
Jul 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions nmz/inspector/fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,25 @@ func (this *FilesystemInspector) PostRmdir(realRetCode int32, ctx hookfs.HookCon
log.Debugf("PostRmdir %s", ctx)
return nil, false
}

// implements hookfs.HookOnFsync
func (this *FilesystemInspector) PreFsync(path string, flags uint32) (error, bool, hookfs.HookContext) {
ctx := EQFSHookContext{Path: path}
log.Debugf("PreFsync %s", ctx)
err, hooked := this.commonHook(PreFsync, path, map[string]interface{}{})
if hooked {
return err, true, ctx
} else {
if err != nil {
log.Error(err)
}
return nil, false, ctx
}
// NOTREACHED
}

// implements hookfs.HookOnFsync
func (this *FilesystemInspector) PostFsync(realRetCode int32, ctx hookfs.HookContext) (error, bool) {
log.Debugf("PostFsync %s", ctx)
return nil, false
}
1 change: 1 addition & 0 deletions nmz/inspector/fs/fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func TestFilesystemInspectorInterfaceImpl(t *testing.T) {
func(x hookfs.HookOnMkdir) {}(h)
func(x hookfs.HookOnRmdir) {}(h)
func(x hookfs.HookOnOpenDir) {}(h)
func(x hookfs.HookOnFsync) {}(h)
}

func newFUSEServer(t *testing.T, fs *hookfs.HookFs) *fuse.Server {
Expand Down
1 change: 1 addition & 0 deletions nmz/signal/event_filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (
PreWrite = "pre-write"
PreMkdir = "pre-mkdir"
PreRmdir = "pre-rmdir"
PreFsync = "pre-fsync"
)

func NewFilesystemEvent(entityID string, op FilesystemOp, path string, m map[string]interface{}) (Event, error) {
Expand Down