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 ¶
- func DestroyCim(ctx context.Context, cimPath string) (retErr error)
- func GetCimUsage(ctx context.Context, cimPath string) (uint64, error)
- func IsCimFSSupported() bool
- func Mount(cimPath string, volumeGUID guid.GUID, mountFlags uint32) (string, error)
- func Unmount(volumePath string) error
- type CimFsWriter
- func Create(imagePath string, oldFSName string, newFSName string) (_ *CimFsWriter, err error)
- func (c *CimFsWriter) AddFile(path string, info *winio.FileBasicInfo, fileSize int64, securityDescriptor []byte, extendedAttributes []byte, reparseData []byte) error
- func (c *CimFsWriter) AddLink(oldPath string, newPath string) error
- func (c *CimFsWriter) Close() error
- func (c *CimFsWriter) CreateAlternateStream(path string, size uint64) (err error)
- func (c *CimFsWriter) Unlink(path string) error
- func (c *CimFsWriter) Write(p []byte) (int, error)
- type LinkError
- type MountError
- type OpError
- type PathError
Functions ¶
func DestroyCim ¶
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 ¶
GetCimUsage returns the total disk usage in bytes by the cim at path `cimPath`.
func IsCimFSSupported ¶
func IsCimFSSupported() bool
func Mount ¶
Mount mounts the given cim at a volume with given GUID. Returns the full volume path if mount is successful.
func Unmount ¶
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 (*CimFsWriter) AddLink ¶
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 (*CimFsWriter) Unlink ¶
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 ¶
func (*LinkError) Error ¶
type MountError ¶
func (*MountError) Error ¶
func (e *MountError) Error() string
type OpError ¶
func (*OpError) Error ¶
type PathError ¶
PathError is the error type returned by most functions in this package.
func (*PathError) Error ¶
Source Files ¶
cim_writer_windows.go cimfs.go common.go doc.go mount_cim.go
Directories ¶
Path | Synopsis |
---|---|
pkg/cimfs/format | format package maintains some basic structures to allows us to read header of a cim file. |
- Version
- v0.12.8
- Published
- Oct 21, 2024
- Platform
- windows/amd64
- Imports
- 17 packages
- Last checked
- 14 minutes ago –
Tools for package owners.