Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mountinfo: fix not showing package doc, typos #37

Merged
merged 2 commits into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions mountinfo/doc.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -8,7 +9,7 @@
// see different mounts. A per-process mountinfo table is available from /proc/<PID>/mountinfo,
// where <PID> 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
Expand All @@ -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
Expand All @@ -43,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
2 changes: 1 addition & 1 deletion mountinfo/mountinfo_filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions mountinfo/mountinfo_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we enable misspell in golang-ci-lint? https://golangci-lint.run/usage/linters/

// and everything else is passed through as is.
buf := make([]byte, len(path))
bufLen := 0
Expand Down