Version: v0.0.0-...-c7fba9c Latest Latest

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

Go to latest
Published: Aug 25, 2021 License: GPL-3.0 Imports: 15 Imported by: 0



Package mount implements mounts that get mapped into the snap

Snappy creates fstab like configuration files that describe what directories from the system or from other snaps should get mapped into the snap.

Each fstab like file looks like a regular fstab entry:

/src/dir /dst/dir none bind 0 0
/src/dir /dst/dir none bind,rw 0 0

but only bind mounts are supported



This section is empty.


This section is empty.


func DiscardSnapNamespace

func DiscardSnapNamespace(snapName string) error

Discard the mount namespace of a given snap.

func UpdateSnapNamespace

func UpdateSnapNamespace(snapName string) error

Update the mount namespace of a given snap.


type Backend

type Backend struct{}

Backend is responsible for maintaining mount files for snap-confine

func (*Backend) Initialize

Initialize does nothing.

func (*Backend) Name

func (b *Backend) Name() interfaces.SecuritySystem

Name returns the name of the backend.

func (*Backend) NewSpecification

func (b *Backend) NewSpecification() interfaces.Specification

NewSpecification returns a new mount specification.

func (*Backend) Remove

func (b *Backend) Remove(snapName string) error

Remove removes mount configuration files of a given snap.

This method should be called after removing a snap.

func (*Backend) SandboxFeatures

func (b *Backend) SandboxFeatures() []string

SandboxFeatures returns the list of features supported by snapd for composing mount namespaces.

func (*Backend) Setup

func (b *Backend) Setup(snapInfo *snap.Info, confinement interfaces.ConfinementOptions, repo *interfaces.Repository, tm timings.Measurer) error

Setup creates mount mount profile files specific to a given snap.

type Specification

type Specification struct {
	// contains filtered or unexported fields

Specification assists in collecting mount entries associated with an interface.

Unlike the Backend itself (which is stateless and non-persistent) this type holds internal state that is used by the mount backend during the interface setup process.

func (*Specification) AddConnectedPlug

func (spec *Specification) AddConnectedPlug(iface interfaces.Interface, plug *interfaces.ConnectedPlug, slot *interfaces.ConnectedSlot) error

AddConnectedPlug records mount-specific side-effects of having a connected plug.

func (*Specification) AddConnectedSlot

func (spec *Specification) AddConnectedSlot(iface interfaces.Interface, plug *interfaces.ConnectedPlug, slot *interfaces.ConnectedSlot) error

AddConnectedSlot records mount-specific side-effects of having a connected slot.

func (*Specification) AddLayout

func (spec *Specification) AddLayout(si *snap.Info)

AddLayout adds mount entries based on the layout of the snap.

func (*Specification) AddMountEntry

func (spec *Specification) AddMountEntry(e osutil.MountEntry) error

AddMountEntry adds a new mount entry.

func (*Specification) AddOvername

func (spec *Specification) AddOvername(info *snap.Info)

AddOvername records mappings of snap directories.

When the snap is installed with an instance key, set up its mount namespace such that it appears as a non-instance key snap. This ensures compatibility with code making assumptions about $SNAP{,_DATA,_COMMON} locations. That is, given a snap foo_bar, the mappings added are:

- /snap/foo_bar -> /snap/foo - /var/snap/foo_bar -> /var/snap/foo

func (*Specification) AddOvernameMountEntry

func (spec *Specification) AddOvernameMountEntry(e osutil.MountEntry) error

AddOvernameMountEntry adds a new overname mount entry.

func (*Specification) AddPermanentPlug

func (spec *Specification) AddPermanentPlug(iface interfaces.Interface, plug *snap.PlugInfo) error

AddPermanentPlug records mount-specific side-effects of having a plug.

func (*Specification) AddPermanentSlot

func (spec *Specification) AddPermanentSlot(iface interfaces.Interface, slot *snap.SlotInfo) error

AddPermanentSlot records mount-specific side-effects of having a slot.

func (*Specification) AddUserMountEntry

func (spec *Specification) AddUserMountEntry(e osutil.MountEntry) error

AddUserMountEntry adds a new user mount entry.

func (*Specification) MountEntries

func (spec *Specification) MountEntries() []osutil.MountEntry

MountEntries returns a copy of the added mount entries.

func (*Specification) UserMountEntries

func (spec *Specification) UserMountEntries() []osutil.MountEntry

UserMountEntries returns a copy of the added user mount entries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL