summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Rabson <dfr@rabson.org>2022-08-25 08:24:20 +0100
committerDoug Rabson <dfr@rabson.org>2022-09-20 08:36:23 +0100
commitbb160be12be137116c2ee2b5e448ec8756f2ed64 (patch)
tree551db7e0bd612ce987a406aed9a4a3cac4890982
parent88f82ceab2b14b0523a56cd8c6b3a9cec8a323e2 (diff)
downloadpodman-bb160be12be137116c2ee2b5e448ec8756f2ed64.tar.gz
podman-bb160be12be137116c2ee2b5e448ec8756f2ed64.tar.bz2
podman-bb160be12be137116c2ee2b5e448ec8756f2ed64.zip
libpod: Implement 'podman cp' for FreeBSD
[NO NEW TESTS NEEDED] Signed-off-by: Doug Rabson <dfr@rabson.org>
-rw-r--r--libpod/container_copy_common.go4
-rw-r--r--libpod/container_copy_freebsd.go13
-rw-r--r--libpod/container_copy_unsupported.go4
-rw-r--r--libpod/container_stat_common.go4
-rw-r--r--libpod/container_stat_freebsd.go13
-rw-r--r--libpod/container_stat_unsupported.go4
6 files changed, 34 insertions, 8 deletions
diff --git a/libpod/container_copy_common.go b/libpod/container_copy_common.go
index d09a8b17d..d07b4c692 100644
--- a/libpod/container_copy_common.go
+++ b/libpod/container_copy_common.go
@@ -1,5 +1,5 @@
-//go:build linux
-// +build linux
+//go:build linux || freebsd
+// +build linux freebsd
package libpod
diff --git a/libpod/container_copy_freebsd.go b/libpod/container_copy_freebsd.go
new file mode 100644
index 000000000..218f3917f
--- /dev/null
+++ b/libpod/container_copy_freebsd.go
@@ -0,0 +1,13 @@
+package libpod
+
+// On FreeBSD, the container's mounts are in the global mount
+// namespace so we can just execute the function directly.
+func (c *Container) joinMountAndExec(f func() error) error {
+ return f()
+}
+
+// Similarly, we can just use resolvePath for both running and stopped
+// containers.
+func (c *Container) resolveCopyTarget(mountPoint string, containerPath string) (string, string, error) {
+ return c.resolvePath(mountPoint, containerPath)
+}
diff --git a/libpod/container_copy_unsupported.go b/libpod/container_copy_unsupported.go
index 62937279a..703b0a74e 100644
--- a/libpod/container_copy_unsupported.go
+++ b/libpod/container_copy_unsupported.go
@@ -1,5 +1,5 @@
-//go:build !linux
-// +build !linux
+//go:build !linux && !freebsd
+// +build !linux,!freebsd
package libpod
diff --git a/libpod/container_stat_common.go b/libpod/container_stat_common.go
index 4d6726946..e59a52ede 100644
--- a/libpod/container_stat_common.go
+++ b/libpod/container_stat_common.go
@@ -1,5 +1,5 @@
-//go:build linux
-// +build linux
+//go:build linux || freebsd
+// +build linux freebsd
package libpod
diff --git a/libpod/container_stat_freebsd.go b/libpod/container_stat_freebsd.go
new file mode 100644
index 000000000..d1e0db348
--- /dev/null
+++ b/libpod/container_stat_freebsd.go
@@ -0,0 +1,13 @@
+package libpod
+
+import (
+ "github.com/containers/buildah/copier"
+)
+
+// On FreeBSD, jails use the global mount namespace, filtered to only
+// the mounts the jail should see. This means that we can use
+// statOnHost whether the container is running or not.
+// container is running
+func (c *Container) statInContainer(mountPoint string, containerPath string) (*copier.StatForItem, string, string, error) {
+ return c.statOnHost(mountPoint, containerPath)
+}
diff --git a/libpod/container_stat_unsupported.go b/libpod/container_stat_unsupported.go
index 2f1acd44d..e88b88bb1 100644
--- a/libpod/container_stat_unsupported.go
+++ b/libpod/container_stat_unsupported.go
@@ -1,5 +1,5 @@
-//go:build !linux
-// +build !linux
+//go:build !linux && !freebsd
+// +build !linux,!freebsd
package libpod