rootfs

package
v0.0.0-...-8073689 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package rootfs encapsulates the container's root filesystem.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorId

type ErrorId int

ErrorId is used for error ids relating to the RootFS interface.

const (
	ErrCreateTempDir ErrorId = iota // a temporary directory for the read-write layer could not be created
	ErrCreateMountDir
	ErrBindMountRoot
	ErrBindMountSubdir
	ErrRootSubdirMissing
	ErrUnmountSubdir
	ErrOverlayTempDir
	ErrOverlayDir
	ErrRemoveMountDir
	ErrUnmountRoot
)

type ImplErrorId

type ImplErrorId int

ImplErrorId is used for error ids relating to the implementation of this package.

const (
	ErrNilSyscallFS     ImplErrorId = iota // the SyscallFS value was nil
	ErrRwBaseDirMissing                    // the read-write base directory was not found
	ErrRwBaseDirIsFile                     // a file was found instead of the read-write base directory
	ErrRwBaseDirNotRw                      // the read-write base directory does not have read and write permissions
)

type RootFS

type RootFS interface {
	/*
		Generate produces a usable root filesystem instance from a
		"prototype" root filesystem.

		The input parameter `prototype` is the path of the prototype,
		which may be any filesystem directory. Generate does not modify
		the prototype.

		The resultant filesystem is a collection of read-write
		directories overlaid on the prototype. If an overlay filesystem,
		such as `aufs` or `overlayfs`, is available, it will be used to
		create the result. Otherwise, the result is a mounted filesystem
		consisting of a patchwork quilt of read-write temporary directories
		and the prototype. TODO: decide which of these to support.

		If Generate fails, it has no side-effects other than possibly
		creating some directories in the read-write base directory.

		The return values are the path of the generated root filesystem
		and an error. The error is `nil` if and only if Generate was
		successful.

		Generate is a replacement for garden's `hook-parent-before-clone.sh`
		script, except that Generate does not copy `wshd` into the
		generated filesystem.
	*/
	Generate(prototype string) (string, gerror.Gerror)

	/*
		Remove a previously generated root filesystem.
	*/
	Remove(root string) gerror.Gerror
}

func NewRootFS

func NewRootFS(sc syscall.SyscallFS, f fileutils.Fileutils, rwBaseDir string) (RootFS, gerror.Gerror)

Creates a new RootFS instance which uses the given SyscallFS interface and the given read-write directory as a base for the writable portion of generated root filesystems. The SyscallFS interface value must not be nil to ensure that the caller has sufficient privileges to perform mounts, etc.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL