From 4259c8f7ebc9f5d167556ed142e82e8232706de6 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 24 Jan 2016 19:43:21 +0100 Subject: Only warn once for unsupported fallocate(2) and truncate(2) Also, print the inode number in Ftruncate warnings. --- pathfs_frontend/fs.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pathfs_frontend/fs.go') diff --git a/pathfs_frontend/fs.go b/pathfs_frontend/fs.go index c7dfc82..2b26f6f 100644 --- a/pathfs_frontend/fs.go +++ b/pathfs_frontend/fs.go @@ -198,8 +198,14 @@ func (fs *FS) Mknod(path string, mode uint32, dev uint32, context *fuse.Context) return fs.FileSystem.Mknod(cPath, mode, dev, context) } +var truncateWarned bool + func (fs *FS) Truncate(path string, offset uint64, context *fuse.Context) (code fuse.Status) { - cryptfs.Warn.Printf("Truncate of a closed file is not supported, returning ENOSYS") + // Only warn once + if !truncateWarned { + cryptfs.Warn.Printf("truncate(2) is not supported, returning ENOSYS - use ftruncate(2)") + truncateWarned = true + } return fuse.ENOSYS } -- cgit v1.2.3