From bf17c3e80daa975ac15d6146964ca294327d8fd9 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 18 Jan 2022 23:43:35 -0800 Subject: filesystem: add back the mountsByPath map Add back the mountsByPath map, which indexes all Mounts by mountpoint. This is needed again. To avoid confusion, also rename two local variables named mountsByPath. mountsByPath won't contain nil entries, so also make AllFilesystems() use it instead of mountsByDevice. This shouldn't change its behavior. Update https://github.com/google/fscrypt/issues/339 --- filesystem/mountpoint_test.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'filesystem/mountpoint_test.go') diff --git a/filesystem/mountpoint_test.go b/filesystem/mountpoint_test.go index 6600d87..a4688ed 100644 --- a/filesystem/mountpoint_test.go +++ b/filesystem/mountpoint_test.go @@ -90,6 +90,12 @@ func TestLoadMountInfoBasic(t *testing.T) { if mnt.ReadOnly { t.Error("Wrong readonly flag") } + if len(mountsByPath) != 1 { + t.Error("mountsByPath doesn't contain exactly one entry") + } + if mountsByPath[mnt.Path] != mnt { + t.Error("mountsByPath doesn't contain the correct entry") + } } // Test that Mount.Device is set to the mountpoint's source device if -- cgit v1.3