aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend/file_allocate_truncate.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-07-01 19:10:57 +0200
committerJakob Unterwurzacher2018-07-01 20:56:22 +0200
commita2af1fb5da90ec12d05e1c3ece9c44507a5b44c8 (patch)
tree6d3dab34ea12ca3e716b40a204ce1336ca31b6f8 /internal/fusefrontend/file_allocate_truncate.go
parent4a736377829f9b72a538d9f1e75ccc4defddc69a (diff)
fusefrontend: export "File" type
"gocryptfs -fsck" will need access to helper functions, and to get that, it will need to cast a gofuse.File to a fusefrontend.File. Make fusefrontend.File exported to make this work.
Diffstat (limited to 'internal/fusefrontend/file_allocate_truncate.go')
-rw-r--r--internal/fusefrontend/file_allocate_truncate.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/fusefrontend/file_allocate_truncate.go b/internal/fusefrontend/file_allocate_truncate.go
index 67254dc..e02fc06 100644
--- a/internal/fusefrontend/file_allocate_truncate.go
+++ b/internal/fusefrontend/file_allocate_truncate.go
@@ -36,7 +36,7 @@ var allocateWarnOnce sync.Once
// complicated and hard to get right.
//
// Other modes (hole punching, zeroing) are not supported.
-func (f *file) Allocate(off uint64, sz uint64, mode uint32) fuse.Status {
+func (f *File) Allocate(off uint64, sz uint64, mode uint32) fuse.Status {
if mode != FALLOC_DEFAULT && mode != FALLOC_FL_KEEP_SIZE {
f := func() {
tlog.Warn.Printf("fallocate: only mode 0 (default) and 1 (keep size) are supported")
@@ -92,7 +92,7 @@ func (f *file) Allocate(off uint64, sz uint64, mode uint32) fuse.Status {
}
// Truncate - FUSE call
-func (f *file) Truncate(newSize uint64) fuse.Status {
+func (f *File) Truncate(newSize uint64) fuse.Status {
f.fdLock.RLock()
defer f.fdLock.RUnlock()
if f.released {
@@ -165,7 +165,7 @@ func (f *file) Truncate(newSize uint64) fuse.Status {
}
// statPlainSize stats the file and returns the plaintext size
-func (f *file) statPlainSize() (uint64, error) {
+func (f *File) statPlainSize() (uint64, error) {
fi, err := f.fd.Stat()
if err != nil {
tlog.Warn.Printf("ino%d fh%d: statPlainSize: %v", f.qIno.Ino, f.intFd(), err)
@@ -179,7 +179,7 @@ func (f *file) statPlainSize() (uint64, error) {
// truncateGrowFile extends a file using seeking or ftruncate performing RMW on
// the first and last block as necessary. New blocks in the middle become
// file holes unless they have been fallocate()'d beforehand.
-func (f *file) truncateGrowFile(oldPlainSz uint64, newPlainSz uint64) fuse.Status {
+func (f *File) truncateGrowFile(oldPlainSz uint64, newPlainSz uint64) fuse.Status {
if newPlainSz <= oldPlainSz {
log.Panicf("BUG: newSize=%d <= oldSize=%d", newPlainSz, oldPlainSz)
}