diff options
| author | Eric Biggers <ebiggers@google.com> | 2020-04-16 20:43:48 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-16 20:43:48 -0700 |
| commit | fe860934c793276100b7a60ebbb9325a2cfd910d (patch) | |
| tree | d4599e6a345c4df735e27944ca902cad19c698ca /filesystem/filesystem.go | |
| parent | 2b160aeb4dccac642bfeca3a0598fcfdc4238842 (diff) | |
Allow fscrypt to work in containers (#213)
Update the /proc/self/mountinfo parsing code to allow selecting a Mount
with Subtree != "/", i.e. a Mount not of the full filesystem. This is
needed to allow fscrypt to work in containers, where the root of the
filesystem may not be mounted.
See findMainMount() for details about the algorithm used.
Resolves https://github.com/google/fscrypt/issues/211
Diffstat (limited to 'filesystem/filesystem.go')
| -rw-r--r-- | filesystem/filesystem.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index e0ef110..ecdeae1 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -70,8 +70,9 @@ var ( // DeviceNumber - Device number of the filesystem. This is set even if // Device isn't, since all filesystems have a device // number assigned by the kernel, even pseudo-filesystems. -// BindMnt - True if this mount is not for the full filesystem but -// rather is only for a subtree. +// Subtree - The mounted subtree of the filesystem. This is usually +// "/", meaning that the entire filesystem is mounted, but +// it can differ for bind mounts. // ReadOnly - True if this is a read-only mount // // In order to use a Mount to store fscrypt metadata, some directories must be @@ -99,7 +100,7 @@ type Mount struct { FilesystemType string Device string DeviceNumber DeviceNumber - BindMnt bool + Subtree string ReadOnly bool } |