aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Rabson <dfr@rabson.org>2022-09-20 11:26:58 +0100
committerDoug Rabson <dfr@rabson.org>2022-09-27 16:31:40 +0100
commit359e397443093f038ae7a8c4d0d0e5f07b5c6506 (patch)
treed6c47fc54f8529bc667663ae35c8ab53792fa00f
parentabe8dad3449b38dee845358d0da5ababa8d8c157 (diff)
downloadpodman-359e397443093f038ae7a8c4d0d0e5f07b5c6506.tar.gz
podman-359e397443093f038ae7a8c4d0d0e5f07b5c6506.tar.bz2
podman-359e397443093f038ae7a8c4d0d0e5f07b5c6506.zip
libpod: Add volume support for FreeBSD
[NO NEW TESTS NEEDED] Signed-off-by: Doug Rabson <dfr@rabson.org>
-rw-r--r--libpod/runtime_volume_common.go4
-rw-r--r--libpod/runtime_volume_unsupported.go4
-rw-r--r--libpod/util_freebsd.go36
-rw-r--r--libpod/util_unsupported.go4
-rw-r--r--libpod/volume_internal_common.go4
-rw-r--r--libpod/volume_internal_freebsd.go9
-rw-r--r--libpod/volume_internal_unsupported.go4
7 files changed, 55 insertions, 10 deletions
diff --git a/libpod/runtime_volume_common.go b/libpod/runtime_volume_common.go
index c59417979..b1de2be86 100644
--- a/libpod/runtime_volume_common.go
+++ b/libpod/runtime_volume_common.go
@@ -1,5 +1,5 @@
-//go:build linux
-// +build linux
+//go:build linux || freebsd
+// +build linux freebsd
package libpod
diff --git a/libpod/runtime_volume_unsupported.go b/libpod/runtime_volume_unsupported.go
index c2816b817..7b7758894 100644
--- a/libpod/runtime_volume_unsupported.go
+++ b/libpod/runtime_volume_unsupported.go
@@ -1,5 +1,5 @@
-//go:build !linux
-// +build !linux
+//go:build !linux && !freebsd
+// +build !linux,!freebsd
package libpod
diff --git a/libpod/util_freebsd.go b/libpod/util_freebsd.go
new file mode 100644
index 000000000..72019743c
--- /dev/null
+++ b/libpod/util_freebsd.go
@@ -0,0 +1,36 @@
+//go:build freebsd
+// +build freebsd
+
+package libpod
+
+import (
+ "errors"
+ "syscall"
+
+ spec "github.com/opencontainers/runtime-spec/specs-go"
+ "github.com/sirupsen/logrus"
+ "golang.org/x/sys/unix"
+)
+
+// systemdSliceFromPath makes a new systemd slice under the given parent with
+// the given name.
+// The parent must be a slice. The name must NOT include ".slice"
+func systemdSliceFromPath(parent, name string, resources *spec.LinuxResources) (string, error) {
+ return "", errors.New("not implemented systemdSliceFromPath")
+}
+
+// No equivalent on FreeBSD?
+func LabelVolumePath(path string) error {
+ return nil
+}
+
+// Unmount umounts a target directory
+func Unmount(mount string) {
+ if err := unix.Unmount(mount, unix.MNT_FORCE); err != nil {
+ if err != syscall.EINVAL {
+ logrus.Warnf("Failed to unmount %s : %v", mount, err)
+ } else {
+ logrus.Debugf("failed to unmount %s : %v", mount, err)
+ }
+ }
+}
diff --git a/libpod/util_unsupported.go b/libpod/util_unsupported.go
index d2ec3ae7b..fc3d00274 100644
--- a/libpod/util_unsupported.go
+++ b/libpod/util_unsupported.go
@@ -1,5 +1,5 @@
-//go:build !linux
-// +build !linux
+//go:build !linux && !freebsd
+// +build !linux,!freebsd
package libpod
diff --git a/libpod/volume_internal_common.go b/libpod/volume_internal_common.go
index c85782e4b..4ff7ac790 100644
--- a/libpod/volume_internal_common.go
+++ b/libpod/volume_internal_common.go
@@ -1,5 +1,5 @@
-//go:build linux
-// +build linux
+//go:build linux || freebsd
+// +build linux freebsd
package libpod
diff --git a/libpod/volume_internal_freebsd.go b/libpod/volume_internal_freebsd.go
new file mode 100644
index 000000000..cf71f1e32
--- /dev/null
+++ b/libpod/volume_internal_freebsd.go
@@ -0,0 +1,9 @@
+package libpod
+
+import (
+ "golang.org/x/sys/unix"
+)
+
+func detachUnmount(mountPoint string) error {
+ return unix.Unmount(mountPoint, unix.MNT_FORCE)
+}
diff --git a/libpod/volume_internal_unsupported.go b/libpod/volume_internal_unsupported.go
index 50515e692..d138c15fb 100644
--- a/libpod/volume_internal_unsupported.go
+++ b/libpod/volume_internal_unsupported.go
@@ -1,5 +1,5 @@
-//go:build !linux
-// +build !linux
+//go:build !linux && !freebsd
+// +build !linux,!freebsd
package libpod