Documentation ¶
Overview ¶
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
Index ¶
- func DiscardSnapNamespace(snapName string) error
- func UpdateSnapNamespace(snapName string) error
- type Backend
- func (b *Backend) Initialize(*interfaces.SecurityBackendOptions) error
- func (b *Backend) Name() interfaces.SecuritySystem
- func (b *Backend) NewSpecification(*interfaces.SnapAppSet, interfaces.ConfinementOptions) interfaces.Specification
- func (b *Backend) Remove(snapName string) error
- func (b *Backend) SandboxFeatures() []string
- func (b *Backend) Setup(appSet *interfaces.SnapAppSet, opts interfaces.ConfinementOptions, ...) error
- type Specification
- func (spec *Specification) AddConnectedPlug(iface interfaces.Interface, plug *interfaces.ConnectedPlug, ...) error
- func (spec *Specification) AddConnectedSlot(iface interfaces.Interface, plug *interfaces.ConnectedPlug, ...) error
- func (spec *Specification) AddExtraLayouts(layouts []snap.Layout)
- func (spec *Specification) AddLayout(si *snap.Info)
- func (spec *Specification) AddMountEntry(e osutil.MountEntry) error
- func (spec *Specification) AddOvername(info *snap.Info)
- func (spec *Specification) AddOvernameMountEntry(e osutil.MountEntry) error
- func (spec *Specification) AddPermanentPlug(iface interfaces.Interface, plug *snap.PlugInfo) error
- func (spec *Specification) AddPermanentSlot(iface interfaces.Interface, slot *snap.SlotInfo) error
- func (spec *Specification) AddUserEnsureDirs(ensureDirSpecs []*interfaces.EnsureDirSpec) error
- func (spec *Specification) AddUserMountEntry(e osutil.MountEntry) error
- func (spec *Specification) MountEntries() []osutil.MountEntry
- func (spec *Specification) UserMountEntries() []osutil.MountEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscardSnapNamespace ¶
Discard the mount namespace of a given snap.
func UpdateSnapNamespace ¶
Update the mount namespace of a given snap.
Types ¶
type Backend ¶
type Backend struct{}
Backend is responsible for maintaining mount files for snap-confine
func (*Backend) Initialize ¶
func (b *Backend) Initialize(*interfaces.SecurityBackendOptions) error
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.SnapAppSet, interfaces.ConfinementOptions) interfaces.Specification
NewSpecification returns a new mount specification.
func (*Backend) Remove ¶
Remove removes mount configuration files of a given snap.
This method should be called after removing a snap.
func (*Backend) SandboxFeatures ¶
SandboxFeatures returns the list of features supported by snapd for composing mount namespaces.
func (*Backend) Setup ¶
func (b *Backend) Setup(appSet *interfaces.SnapAppSet, opts 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) AddExtraLayouts ¶
func (spec *Specification) AddExtraLayouts(layouts []snap.Layout)
AddExtraLayouts adds mount entries based on additional layouts that are provided for the snap.
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) AddUserEnsureDirs ¶
func (spec *Specification) AddUserEnsureDirs(ensureDirSpecs []*interfaces.EnsureDirSpec) error
AddUserEnsureDirs adds user mount entries to ensure the existence of directories according to the given ensure directory specs.
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.