devutil

package
v0.0.0-...-8516598 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0, MIT Imports: 8 Imported by: 5

Documentation

Overview

Package devutil provides device specific utilities.

Index

Constants

View Source
const (
	// CtxDevGoferClient is a Context.Value key for a /dev gofer client.
	CtxDevGoferClient contextID = iota

	// CtxDevGoferClientProvider is a Context.Value key for GoferClientProvider.
	CtxDevGoferClientProvider
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GoferClient

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

GoferClient is the lisafs client for the /dev gofer connection.

func GoferClientFromContext

func GoferClientFromContext(ctx context.Context) *GoferClient

GoferClientFromContext returns the device gofer client used by ctx.

func NewGoferClient

func NewGoferClient(ctx context.Context, contName string, fd int) (*GoferClient, error)

NewGoferClient establishes the LISAFS connection to the dev gofer server. It takes ownership of fd. contName is the owning container name.

func (*GoferClient) Close

func (g *GoferClient) Close()

Close closes the LISAFS connection.

func (*GoferClient) ContainerName

func (g *GoferClient) ContainerName() string

ContainerName returns the name of the container that owns this gofer.

func (*GoferClient) DirentNames

func (g *GoferClient) DirentNames(ctx context.Context) ([]string, error)

DirentNames returns names of all the dirents for /dev on the gofer.

func (*GoferClient) OpenAt

func (g *GoferClient) OpenAt(ctx context.Context, name string, flags uint32) (int, error)

OpenAt opens the device file at /dev/{name} on the gofer.

type GoferClientProvider

type GoferClientProvider interface {
	GetDevGoferClient(contName string) *GoferClient
}

GoferClientProvider provides a GoferClient for a given container.

func GoferClientProviderFromContext

func GoferClientProviderFromContext(ctx context.Context) GoferClientProvider

GoferClientProviderFromContext returns the GoferClientProvider used by ctx.

Jump to

Keyboard shortcuts

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