gvisorgvisor.dev/gvisor/pkg/devutil Index | Files

package devutil

import "gvisor.dev/gvisor/pkg/devutil"

Package devutil provides device specific utilities.

Index

Constants

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

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

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.

Source Files

context.go devutil.go

Version
v0.0.0-20250605235530-a6711d1e1dc6 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
4 hours ago

Tools for package owners.