diff options
| author | Eric Biggers <ebiggers@google.com> | 2022-01-18 23:43:35 -0800 |
|---|---|---|
| committer | Eric Biggers <ebiggers@google.com> | 2022-01-19 11:12:37 -0800 |
| commit | bf17c3e80daa975ac15d6146964ca294327d8fd9 (patch) | |
| tree | df998573303e2f95c6c204e5d14cbfe5cedb69ea /filesystem/mountpoint_test.go | |
| parent | 8f619f9478ef5d3d616908bd2b30cb85d8034020 (diff) | |
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
Diffstat (limited to 'filesystem/mountpoint_test.go')
| -rw-r--r-- | filesystem/mountpoint_test.go | 6 |
1 files changed, 6 insertions, 0 deletions
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 |