Skip to content

Commit

Permalink
Add support for OpenBSD in addition to FreeBSD
Browse files Browse the repository at this point in the history
I am looking at using these modules in containerd, so that we can
reduce the effort of maintaining "mountinfo" implementations.

The containerd variant of this module currently supports OpenBSD in
addition to FreeBSD.

This patch bring in changes similar to the ones made in containerd in:

containerd/containerd@0828b7a

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Sep 22, 2020
1 parent bbb236c commit 91a75ff
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mount/flags_freebsd.go → mount/flags_bsd.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build freebsd,cgo
// +build freebsd,cgo openbsd,cgo

package mount

Expand Down
2 changes: 1 addition & 1 deletion mount/flags_unsupported.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !linux,!freebsd freebsd,!cgo
// +build !linux,!freebsd,!openbsd freebsd,!cgo openbsd,!cgo

package mount

Expand Down
2 changes: 2 additions & 0 deletions mount/mounter_freebsd.go → mount/mounter_bsd.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build freebsd openbsd

package mount

/*
Expand Down
2 changes: 1 addition & 1 deletion mount/mounter_unsupported.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !linux,!freebsd freebsd,!cgo
// +build !linux,!freebsd,!openbsd freebsd,!cgo openbsd,!cgo

package mount

Expand Down
2 changes: 1 addition & 1 deletion mountinfo/doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +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,
// Currently it supports Linux. For historical reasons, there is also some support for FreeBSD and OpenBSD,
// 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 Down
2 changes: 1 addition & 1 deletion mountinfo/mounted_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build linux freebsd,cgo
// +build linux freebsd,cgo openbsd,cgo

package mountinfo

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build freebsd openbsd

package mountinfo

/*
Expand Down Expand Up @@ -54,7 +56,7 @@ func parseMountTable(filter FilterFunc) ([]*Info, error) {

func mounted(path string) (bool, error) {
// Fast path: compare st.st_dev fields.
// This should always work for FreeBSD.
// This should always work for FreeBSD and OpenBSD.
mounted, err := mountedByStat(path)
if err == nil {
return mounted, nil
Expand Down
2 changes: 1 addition & 1 deletion mountinfo/mountinfo_unsupported.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !windows,!linux,!freebsd freebsd,!cgo
// +build !windows,!linux,!freebsd,!openbsd freebsd,!cgo openbsd,!cgo

package mountinfo

Expand Down

0 comments on commit 91a75ff

Please sign in to comment.