diff options
author | Jose M Perez | 2021-08-12 22:48:34 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2021-08-19 18:05:54 +0200 |
commit | 8f94083a2114c3aef4bc0320065e0374c420ea4a (patch) | |
tree | d6b56a31e58a99e8a46b4663d6d63b0c3be425b8 /internal/fusefrontend | |
parent | 02c91d73ce2c63f999f2c29cf61d55caef19c67b (diff) |
Flag -zerodiriv to create all diriv as all zero byte files
Diffstat (limited to 'internal/fusefrontend')
-rw-r--r-- | internal/fusefrontend/args.go | 2 | ||||
-rw-r--r-- | internal/fusefrontend/node_dir_ops.go | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/internal/fusefrontend/args.go b/internal/fusefrontend/args.go index d92c3ff..02ffddb 100644 --- a/internal/fusefrontend/args.go +++ b/internal/fusefrontend/args.go @@ -53,4 +53,6 @@ type Args struct { // like rsync's `--one-file-system` does. // Only applicable to reverse mode. OneFileSystem bool + // ZeroDirIV creates diriv files as all-zero files + ZeroDirIV bool } diff --git a/internal/fusefrontend/node_dir_ops.go b/internal/fusefrontend/node_dir_ops.go index 6d03544..b43a4e4 100644 --- a/internal/fusefrontend/node_dir_ops.go +++ b/internal/fusefrontend/node_dir_ops.go @@ -35,6 +35,7 @@ func haveDsstore(entries []fuse.DirEntry) bool { // should be a handle to the parent directory, cName is the name of the new // directory and mode specifies the access permissions to use. func (n *Node) mkdirWithIv(dirfd int, cName string, mode uint32, context *fuse.Context) error { + rn := n.rootNode() // Between the creation of the directory and the creation of gocryptfs.diriv // the directory is inconsistent. Take the lock to prevent other readers @@ -48,7 +49,7 @@ func (n *Node) mkdirWithIv(dirfd int, cName string, mode uint32, context *fuse.C dirfd2, err := syscallcompat.Openat(dirfd, cName, syscall.O_DIRECTORY|syscall.O_NOFOLLOW|syscallcompat.O_PATH, 0) if err == nil { // Create gocryptfs.diriv - err = nametransform.WriteDirIVAt(dirfd2) + err = nametransform.WriteDirIVAt(dirfd2, !rn.args.ZeroDirIV) syscall.Close(dirfd2) } if err != nil { |