libpod: Implement 'podman cp' for FreeBSD

[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
This commit is contained in:
Doug Rabson
2022-08-25 08:24:20 +01:00
parent 88f82ceab2
commit bb160be12b
6 changed files with 34 additions and 8 deletions

View File

@ -1,5 +1,5 @@
//go:build linux
// +build linux
//go:build linux || freebsd
// +build linux freebsd
package libpod

View File

@ -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)
}

View File

@ -1,5 +1,5 @@
//go:build !linux
// +build !linux
//go:build !linux && !freebsd
// +build !linux,!freebsd
package libpod

View File

@ -1,5 +1,5 @@
//go:build linux
// +build linux
//go:build linux || freebsd
// +build linux freebsd
package libpod

View File

@ -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)
}

View File

@ -1,5 +1,5 @@
//go:build !linux
// +build !linux
//go:build !linux && !freebsd
// +build !linux,!freebsd
package libpod