File: overlay_freebsd.go

package info (click to toggle)
golang-github-containers-buildah 1.39.3%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,724 kB
  • sloc: sh: 2,398; makefile: 236; perl: 187; asm: 16; awk: 12; ansic: 1
file content (34 lines) | stat: -rw-r--r-- 889 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package overlay

import (
	//"fmt"
	//"os"
	//"path/filepath"
	//"strings"
	//"syscall"
	"errors"

	//"github.com/containers/storage/pkg/unshare"
	"github.com/opencontainers/runtime-spec/specs-go"
)

// MountWithOptions returns a specs.Mount which makes the contents of ${source}
// visible at ${dest} in the container.
// Options allows the caller to configure whether or not the mount should be
// read-only.
// This API is used by podman.
func MountWithOptions(contentDir, source, dest string, opts *Options) (mount specs.Mount, Err error) {
	if opts == nil {
		opts = &Options{}
	}
	if opts.ReadOnly {
		// Read-only overlay mounts can be simulated with nullfs
		mount.Source = source
		mount.Destination = dest
		mount.Type = "nullfs"
		mount.Options = []string{"ro"}
		return mount, nil
	} else {
		return mount, errors.New("read/write overlay mounts not supported on freebsd")
	}
}