From 518771e4e247762f60c5594de427a8c86f19bd57 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 3 May 2020 15:22:10 +0200 Subject: fusefrontend_reverse: use inomap for inode number translation Gets rid of static inode number value limitations. Fixes https://github.com/rfjakob/gocryptfs/issues/457 --- tests/reverse/inomap_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/reverse/inomap_test.go b/tests/reverse/inomap_test.go index e3bd207..5f7fb45 100644 --- a/tests/reverse/inomap_test.go +++ b/tests/reverse/inomap_test.go @@ -128,8 +128,10 @@ func TestVirtualFileIno(t *testing.T) { if origInos.parent == cipherInos.diriv { t.Errorf("diriv ino collision: %d == %d", origInos.parent, cipherInos.diriv) } - if origInos.parent != cipherInos.diriv-1000000000000000000 { - t.Errorf("diriv ino mismatch: %d != %d", origInos.parent, cipherInos.diriv) + // Lower 48 bits should come from the backing file + const mask = 0xffffffffffff + if origInos.parent&mask != cipherInos.diriv&mask { + t.Errorf("diriv ino mismatch: %#x vs %#x", origInos.parent, cipherInos.diriv) } if origInos.child != cipherInos.child { t.Errorf("child ino mismatch: %d vs %d", origInos.child, cipherInos.child) @@ -137,7 +139,7 @@ func TestVirtualFileIno(t *testing.T) { if origInos.child == cipherInos.name { t.Errorf("name ino collision: %d == %d", origInos.child, cipherInos.name) } - if origInos.child != cipherInos.name-2000000000000000000 { - t.Errorf("name ino mismatch: %d vs %d", origInos.child, cipherInos.name) + if origInos.child&mask != cipherInos.name&mask { + t.Errorf("name ino mismatch: %#x vs %#x", origInos.child, cipherInos.name) } } -- cgit v1.2.3