aboutsummaryrefslogtreecommitdiff
path: root/pathfs_frontend/file_holes.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-02-06 19:27:59 +0100
committerJakob Unterwurzacher2016-02-06 19:27:59 +0100
commit9078a77850dd680bfa938d9ed7c83600a60c0e7b (patch)
tree03ee83879c398307d450002e1f07e928cb743672 /pathfs_frontend/file_holes.go
parent2b8cbd944149afe51fadddbd67ee4499d1d86250 (diff)
Move pathfs_frontend to internal/fusefrontend
"git status" for reference: renamed: pathfs_frontend/args.go -> internal/fusefrontend/args.go renamed: pathfs_frontend/compat_darwin.go -> internal/fusefrontend/compat_darwin.go renamed: pathfs_frontend/compat_linux.go -> internal/fusefrontend/compat_linux.go renamed: pathfs_frontend/file.go -> internal/fusefrontend/file.go renamed: pathfs_frontend/file_holes.go -> internal/fusefrontend/file_holes.go renamed: pathfs_frontend/fs.go -> internal/fusefrontend/fs.go renamed: pathfs_frontend/fs_dir.go -> internal/fusefrontend/fs_dir.go renamed: pathfs_frontend/names.go -> internal/fusefrontend/names.go renamed: pathfs_frontend/write_lock.go -> internal/fusefrontend/write_lock.go modified: main.go
Diffstat (limited to 'pathfs_frontend/file_holes.go')
-rw-r--r--pathfs_frontend/file_holes.go29
1 files changed, 0 insertions, 29 deletions
diff --git a/pathfs_frontend/file_holes.go b/pathfs_frontend/file_holes.go
deleted file mode 100644
index a147deb..0000000
--- a/pathfs_frontend/file_holes.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package pathfs_frontend
-
-// Helper functions for sparse files (files with holes)
-
-import (
- "github.com/hanwen/go-fuse/fuse"
-
- "github.com/rfjakob/gocryptfs/internal/toggledlog"
-)
-
-// Will a write to offset "off" create a file hole?
-func (f *file) createsHole(plainSize uint64, off int64) bool {
- nextBlock := f.contentEnc.PlainOffToBlockNo(plainSize)
- targetBlock := f.contentEnc.PlainOffToBlockNo(uint64(off))
- if targetBlock > nextBlock {
- return true
- }
- return false
-}
-
-// Zero-pad the file of size plainSize to the next block boundary
-func (f *file) zeroPad(plainSize uint64) fuse.Status {
- lastBlockLen := plainSize % f.contentEnc.PlainBS()
- missing := f.contentEnc.PlainBS() - lastBlockLen
- pad := make([]byte, missing)
- toggledlog.Debug.Printf("zeroPad: Writing %d bytes\n", missing)
- _, status := f.doWrite(pad, int64(plainSize))
- return status
-}