From 1e373c7efab79dcb8bda9f97986510a651f3f744 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 23 Sep 2020 12:58:51 -0700 Subject: [PATCH 1/2] mountinfo: fix typos and words Signed-off-by: Kir Kolyshkin --- mountinfo/doc.go | 5 +++-- mountinfo/mountinfo_filters.go | 2 +- mountinfo/mountinfo_linux.go | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mountinfo/doc.go b/mountinfo/doc.go index 21aa8dd5..4a73a9a6 100644 --- a/mountinfo/doc.go +++ b/mountinfo/doc.go @@ -1,4 +1,5 @@ // Package mountinfo provides a set of functions to retrieve information about OS mounts. +// // Currently it supports Linux. For historical reasons, there is also some support for FreeBSD, // and a shallow implementation for Windows, but in general this is Linux-only package, so // the rest of the document only applies to Linux, unless explicitly specified otherwise. @@ -8,7 +9,7 @@ // see different mounts. A per-process mountinfo table is available from /proc//mountinfo, // where is a numerical process identifier. // -// In general, /proc is not a very effective interface, and mountinfo is not an exception. +// In general, /proc is not a very efficient interface, and mountinfo is not an exception. // For example, there is no way to get information about a specific mount point (i.e. it // is all-or-nothing). This package tries to hide the /proc ineffectiveness by using // parse filters while reading mountinfo. A filter can skip some entries, or stop @@ -27,7 +28,7 @@ // of the cases where mountinfo should not be parsed: // // 1. Before performing a mount. Usually, this is not needed, but if required (say to -// prevent overmounts), to check whether a directory is mounted, call os.Lstat +// prevent over-mounts), to check whether a directory is mounted, call os.Lstat // on it and its parent directory, and compare their st.Sys().(*syscall.Stat_t).Dev // fields -- if they differ, then the directory is the mount point. NOTE this does // not work for bind mounts. Optionally, the filesystem type can also be checked diff --git a/mountinfo/mountinfo_filters.go b/mountinfo/mountinfo_filters.go index 8aebe1ad..5ced02b5 100644 --- a/mountinfo/mountinfo_filters.go +++ b/mountinfo/mountinfo_filters.go @@ -50,7 +50,7 @@ func FstypeFilter(fstype ...string) FilterFunc { return func(m *Info) (bool, bool) { for _, t := range fstype { if m.Fstype == t { - return false, false // don't skeep, keep going + return false, false // don't skip, keep going } } return true, false // skip, keep going diff --git a/mountinfo/mountinfo_linux.go b/mountinfo/mountinfo_linux.go index cdfd37da..a78799cd 100644 --- a/mountinfo/mountinfo_linux.go +++ b/mountinfo/mountinfo_linux.go @@ -85,7 +85,7 @@ func parseInfoFile(r io.Reader, filter FilterFunc) ([]*Info, error) { } p.VfsOpts = fields[sepIdx+3] - // Run a filter soon so we can skip parsing/adding entries + // Run a filter early so we can skip parsing/adding entries // the caller is not interested in var skip, stop bool if filter != nil { @@ -173,7 +173,7 @@ func unescape(path string) (string, error) { } // The following code is UTF-8 transparent as it only looks for some - // specific characters (backslach and 0..7) with values < utf8.RuneSelf, + // specific characters (backslash and 0..7) with values < utf8.RuneSelf, // and everything else is passed through as is. buf := make([]byte, len(path)) bufLen := 0 From a720826ee61d5cdbee93153a420d10d8b97de9a1 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 23 Sep 2020 12:59:17 -0700 Subject: [PATCH 2/2] mountinfo: fix go doc Nothing from the doc.go was shown by godoc -- this is because the comment about the package as a whole should precede the "package $NAME", and this was broken here because of an empty line. Signed-off-by: Kir Kolyshkin --- mountinfo/doc.go | 1 - 1 file changed, 1 deletion(-) diff --git a/mountinfo/doc.go b/mountinfo/doc.go index 4a73a9a6..ffac661f 100644 --- a/mountinfo/doc.go +++ b/mountinfo/doc.go @@ -44,5 +44,4 @@ // // 5. To find the mount point root of a specific directory. You can perform os.Stat() // on the directory and traverse up until the Dev field of a parent directory differs. - package mountinfo