udev

package
v2.42.5-go-mod+incompa... Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: GPL-3.0 Imports: 13 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

func ReloadRules

func ReloadRules(subsystemTriggers []string) error

ReloadRules runs three commands that reload udev rule database.

The commands are: udevadm control --reload-rules

udevadm trigger --subsystem-nomatch=input
udevadm settle --timeout=3

and optionally trigger other subsystems as defined in the interfaces. Eg:

udevadm trigger --subsystem-match=input
udevadm trigger --property-match=ID_INPUT_JOYSTICK=1

Types

type Backend

type Backend struct{}

Backend is responsible for maintaining udev rules.

func (*Backend) Initialize

func (b *Backend) Initialize() 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 confinment 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 marks a specification as needing to control it's 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 it's 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)

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