udev

package
v0.0.0-...-2f584b8 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package udev implements integration between snapd, udev and snap-confine around tagging character and block devices so that they can be accessed by applications.

TODO: Document this better

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

Backend is responsible for maintaining udev rules.

func (*Backend) Initialize

func (b *Backend) Initialize(opts *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.Specification

func (*Backend) Remove

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

Remove removes udev rules specific to a given snap. If any of the rules are removed then udev database is reloaded.

This method should be called after removing a snap.

If the method fails it should be re-tried (with a sensible strategy) by the caller.

func (*Backend) SandboxFeatures

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

SandboxFeatures returns the list of features supported by snapd for mediating access to kernel devices.

func (*Backend) Setup

Setup creates udev rules specific to a given snap. If any of the rules are changed or removed then udev database is reloaded.

UDev has no concept of a complain mode so confinement options are ignored.

If the method fails it should be re-tried (with a sensible strategy) by the caller.

type Specification

type Specification struct {
	// contains filtered or unexported fields
}

Specification assists in collecting udev snippets associated with an interface.

func (*Specification) AddConnectedPlug

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

AddConnectedPlug records udev-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) 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) AddSnippet

func (spec *Specification) AddSnippet(snippet string)

AddSnippet adds a new udev snippet.

func (*Specification) ControlsDeviceCgroup

func (spec *Specification) ControlsDeviceCgroup() bool

ControlsDeviceCgroup returns whether a specification was marked as needing to control its own device cgroup which prevents generation of any udev tagging rules for this snap name.

func (*Specification) SetControlsDeviceCgroup

func (spec *Specification) SetControlsDeviceCgroup()

SetControlsDeviceCgroup marks a specification as needing to control its own device cgroup which prevents generation of any udev tagging rules for this snap name

func (*Specification) Snippets

func (spec *Specification) Snippets() (result []string)

Snippets returns a copy of all the snippets added so far.

func (*Specification) TagDevice

func (spec *Specification) TagDevice(snippet string)

TagDevice adds an app/hook specific udev tag to devices described by the snippet and adds an app/hook-specific RUN rule for hotplugging.

func (*Specification) TriggerSubsystem

func (spec *Specification) TriggerSubsystem(subsystem string)

TriggerSubsystem informs ReloadRules() to also do 'udevadm trigger <subsystem specific>'. IMPORTANT: because there is currently no way to call TriggerSubsystem during interface disconnect, TriggerSubsystem() should typically only by used in UDevPermanentSlot since the rules are permanent until the snap is removed.

func (*Specification) TriggeredSubsystems

func (spec *Specification) TriggeredSubsystems() []string

Jump to

Keyboard shortcuts

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