package cimfs

import "github.com/Microsoft/hcsshim/pkg/cimfs"

This package provides simple go wrappers on top of the win32 CIMFS mount APIs. The mounting/unmount of cim layers is done by the cim mount functions the internal/wclayer/cim package.

Index

Functions

func DestroyCim

func DestroyCim(ctx context.Context, cimPath string) (retErr error)

DestroyCim finds out the region files, object files of this cim and then delete the region files, object files and the <layer-id>.cim file itself.

func GetCimUsage

func GetCimUsage(ctx context.Context, cimPath string) (uint64, error)

GetCimUsage returns the total disk usage in bytes by the cim at path `cimPath`.

func IsCimFSSupported

func IsCimFSSupported() bool

func Mount

func Mount(cimPath string, volumeGUID guid.GUID, mountFlags uint32) (string, error)

Mount mounts the given cim at a volume with given GUID. Returns the full volume path if mount is successful.

func Unmount

func Unmount(volumePath string) error

Unmount unmounts the cim at mounted at path `volumePath`.

Types

type CimFsWriter

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

CimFsWriter represents a writer to a single CimFS filesystem instance. On disk, the image is composed of a filesystem file and several object ID and region files. Note: The CimFsWriter isn't thread safe!

func Create

func Create(imagePath string, oldFSName string, newFSName string) (_ *CimFsWriter, err error)

Create creates a new cim image. The CimFsWriter returned can then be used to do operations on this cim.

func (*CimFsWriter) AddFile

func (c *CimFsWriter) AddFile(path string, info *winio.FileBasicInfo, fileSize int64, securityDescriptor []byte, extendedAttributes []byte, reparseData []byte) error

AddFile adds a new file to the image. The file is added at the specified path. After calling this function, the file is set as the active stream for the image, so data can be written by calling `Write`.

func (c *CimFsWriter) AddLink(oldPath string, newPath string) error

AddLink adds a hard link from `oldPath` to `newPath` in the image.

func (*CimFsWriter) Close

func (c *CimFsWriter) Close() error

Close closes the CimFS filesystem.

func (*CimFsWriter) CreateAlternateStream

func (c *CimFsWriter) CreateAlternateStream(path string, size uint64) (err error)

CreateAlternateStream creates alternate stream of given size at the given path inside the cim. This will replace the current active stream. Always, finish writing current active stream and then create an alternate stream.

func (c *CimFsWriter) Unlink(path string) error

Unlink deletes the file at `path` from the image.

func (*CimFsWriter) Write

func (c *CimFsWriter) Write(p []byte) (int, error)

Write writes bytes to the active stream.

type LinkError

type LinkError struct {
	Cim string
	Op  string
	Old string
	New string
	Err error
}

func (*LinkError) Error

func (e *LinkError) Error() string

type MountError

type MountError struct {
	Cim        string
	Op         string
	VolumeGUID guid.GUID
	Err        error
}

func (*MountError) Error

func (e *MountError) Error() string

type OpError

type OpError struct {
	Cim string
	Op  string
	Err error
}

func (*OpError) Error

func (e *OpError) Error() string

type PathError

type PathError struct {
	Cim  string
	Op   string
	Path string
	Err  error
}

PathError is the error type returned by most functions in this package.

func (*PathError) Error

func (e *PathError) Error() string

Source Files

cim_writer_windows.go cimfs.go common.go doc.go mount_cim.go

Directories

PathSynopsis
pkg/cimfs/formatformat package maintains some basic structures to allows us to read header of a cim file.
Version
v0.12.1
Published
Mar 22, 2024
Platform
windows/amd64
Imports
17 packages
Last checked
46 minutes ago

Tools for package owners.