From 778c955eea1fdc16666f51f6f0a2fab0f580dbf0 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 1 Apr 2017 17:19:15 +0200 Subject: fusefrontend_reverse: switch to stable inode numbers The volatile inode numbers that we used before cause "find" to complain and error out. Virtual inode numbers are derived from their parent file inode number by adding 10^19, which is hopefully large enough no never cause problems in practice. If the backing directory contains inode numbers higher than that, stat() on these files will return EOVERFLOW. Example directory lising after this change: $ ls -i 926473 gocryptfs.conf 1000000000000926466 gocryptfs.diriv 944878 gocryptfs.longname.hmZojMqC6ns47eyVxLlH2ailKjN9bxfosi3C-FR8mjA 1000000000000944878 gocryptfs.longname.hmZojMqC6ns47eyVxLlH2ailKjN9bxfosi3C-FR8mjA.name 934408 Tdfbf02CKsTaGVYnAsSypA --- internal/fusefrontend_reverse/rpath.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'internal/fusefrontend_reverse/rpath.go') diff --git a/internal/fusefrontend_reverse/rpath.go b/internal/fusefrontend_reverse/rpath.go index 02f4e9a..5082d11 100644 --- a/internal/fusefrontend_reverse/rpath.go +++ b/internal/fusefrontend_reverse/rpath.go @@ -37,6 +37,11 @@ func derivePathIV(path string, purpose ivPurposeType) []byte { return hash[:nametransform.DirIVLen] } +// abs basically returns storage dir + "/" + relPath. +// It takes an error parameter so it can directly wrap decryptPath like this: +// a, err := rfs.abs(rfs.decryptPath(relPath)) +// abs never generates an error on its own. In other words, abs(p, nil) never +// fails. func (rfs *ReverseFS) abs(relPath string, err error) (string, error) { if err != nil { return "", err -- cgit v1.2.3