From 47c3958c49caee4c8f4ee4d224d93ae4052f2eb0 Mon Sep 17 00:00:00 2001 From: Ben McClelland Date: Wed, 16 Jan 2019 15:51:53 -0800 Subject: [PATCH] simplify code by reusing other functions --- scoutfs.go | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/scoutfs.go b/scoutfs.go index 20fddc5..67bf70e 100644 --- a/scoutfs.go +++ b/scoutfs.go @@ -206,13 +206,7 @@ func ReleaseFile(path string, version uint64) error { } defer f.Close() - r := IocRelease{ - Count: math.MaxUint64, - DataVersion: version, - } - - _, err = scoutfsctl(f.Fd(), IOCRELEASE, uintptr(unsafe.Pointer(&r))) - return err + return FReleaseFile(f, version) } // FReleaseFile marks file offline and frees associated extents @@ -234,15 +228,7 @@ func StageFile(path string, version, offset uint64, b []byte) error { } defer f.Close() - r := IocStage{ - DataVersion: version, - BufPtr: uint64(uintptr(unsafe.Pointer(&b))), - Offset: offset, - count: int32(len(b)), - } - - _, err = scoutfsctl(f.Fd(), IOCSTAGE, uintptr(unsafe.Pointer(&r))) - return err + return FStageFile(f, version, offset, b) } // FStageFile rehydrates offline file