From 2fa84b5907e0d855e812e5f5dfd4e2a5ff71e804 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 23 Sep 2020 15:29:07 +0200 Subject: [PATCH] mount: use MNT_* flags from golang.org/x/sys/unix on freebsd Bump golang.org/x/sys/unix to the latest version and use the MNT_* constants defined there instead of getting them from sys/mount.h using cgo. Signed-off-by: Tobias Klauser --- mount/flags_freebsd.go | 17 +++++++---------- mount/flags_unsupported.go | 2 +- mount/go.mod | 2 +- mount/go.sum | 4 ++-- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/mount/flags_freebsd.go b/mount/flags_freebsd.go index 69c50680..a8840d4c 100644 --- a/mount/flags_freebsd.go +++ b/mount/flags_freebsd.go @@ -1,28 +1,25 @@ -// +build freebsd,cgo +// +build freebsd package mount -/* -#include -*/ -import "C" +import "golang.org/x/sys/unix" const ( // RDONLY will mount the filesystem as read-only. - RDONLY = C.MNT_RDONLY + RDONLY = unix.MNT_RDONLY // NOSUID will not allow set-user-identifier or set-group-identifier bits to // take effect. - NOSUID = C.MNT_NOSUID + NOSUID = unix.MNT_NOSUID // NOEXEC will not allow execution of any binaries on the mounted file system. - NOEXEC = C.MNT_NOEXEC + NOEXEC = unix.MNT_NOEXEC // SYNCHRONOUS will allow any I/O to the file system to be done synchronously. - SYNCHRONOUS = C.MNT_SYNCHRONOUS + SYNCHRONOUS = unix.MNT_SYNCHRONOUS // NOATIME will not update the file access time when reading from a file. - NOATIME = C.MNT_NOATIME + NOATIME = unix.MNT_NOATIME ) // These flags are unsupported. diff --git a/mount/flags_unsupported.go b/mount/flags_unsupported.go index e1d64f6b..3ec4a11e 100644 --- a/mount/flags_unsupported.go +++ b/mount/flags_unsupported.go @@ -1,4 +1,4 @@ -// +build !linux,!freebsd freebsd,!cgo +// +build !linux,!freebsd package mount diff --git a/mount/go.mod b/mount/go.mod index 21cef0a9..f0f46448 100644 --- a/mount/go.mod +++ b/mount/go.mod @@ -4,5 +4,5 @@ go 1.14 require ( github.com/moby/sys/mountinfo v0.1.0 - golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae + golang.org/x/sys v0.0.0-20200922070232-aee5d888a860 ) diff --git a/mount/go.sum b/mount/go.sum index ae99f859..729e4354 100644 --- a/mount/go.sum +++ b/mount/go.sum @@ -1,4 +1,4 @@ github.com/moby/sys/mountinfo v0.1.0 h1:r8vMRbMAFEAfiNptYVokP+nfxPJzvRuia5e2vzXtENo= github.com/moby/sys/mountinfo v0.1.0/go.mod h1:w2t2Avltqx8vE7gX5l+QiBKxODu2TX0+Syr3h52Tw4o= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200922070232-aee5d888a860 h1:YEu4SMq7D0cmT7CBbXfcH0NZeuChAXwsHe/9XueUO6o= +golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=