From d3d630281c3ad706a2bc401a0289a6f0916fa4a2 Mon Sep 17 00:00:00 2001 From: Travis Rhoden Date: Tue, 27 Aug 2019 11:23:11 -0600 Subject: [PATCH] Additional mount comments Add extra comments to clarify behavior. --- pkg/util/mount/mount.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/util/mount/mount.go b/pkg/util/mount/mount.go index 7d94a48f4b0..364e6a9acf3 100644 --- a/pkg/util/mount/mount.go +++ b/pkg/util/mount/mount.go @@ -45,11 +45,18 @@ type Interface interface { // is not a mountpoint. // It should return ErrNotExist when the directory does not exist. // IsLikelyNotMountPoint does NOT properly detect all mountpoint types - // most notably linux bind mounts and symbolic link. + // most notably linux bind mounts and symbolic link. For callers that do not + // care about such situations, this is a faster alternative to calling List() + // and scanning that output. IsLikelyNotMountPoint(file string) (bool, error) - // GetMountRefs finds all mount references to the path, returns a - // list of paths. Path could be a mountpoint or a normal - // directory (for bind mount). + // GetMountRefs finds all mount references to pathname, returning a slice of + // paths. Pathname can be a mountpoint path or a normal directory + // (for bind mount). On Linux, pathname is excluded from the slice. + // For example, if /dev/sdc was mounted at /path/a and /path/b, + // GetMountRefs("/path/a") would return ["/path/b"] + // GetMountRefs("/path/b") would return ["/path/a"] + // On Windows there is no way to query all mount points; as long as pathname is + // a valid mount, it will be returned. GetMountRefs(pathname string) ([]string, error) }