Windows: Updates Windows Vendoring
Updates windows dependent libraries for vendoing.
This commit is contained in:
27
vendor/github.com/Microsoft/hcsshim/internal/wclayer/activatelayer.go
generated
vendored
27
vendor/github.com/Microsoft/hcsshim/internal/wclayer/activatelayer.go
generated
vendored
@ -9,17 +9,24 @@ import (
|
||||
// For a read/write layer, the mounted filesystem will appear as a volume on the
|
||||
// host, while a read-only layer is generally expected to be a no-op.
|
||||
// An activated layer must later be deactivated via DeactivateLayer.
|
||||
func ActivateLayer(path string) error {
|
||||
title := "hcsshim::ActivateLayer "
|
||||
logrus.Debugf(title+"path %s", path)
|
||||
|
||||
err := activateLayer(&stdDriverInfo, path)
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "path=%s", path)
|
||||
logrus.Error(err)
|
||||
return err
|
||||
func ActivateLayer(path string) (err error) {
|
||||
title := "hcsshim::ActivateLayer"
|
||||
fields := logrus.Fields{
|
||||
"path": path,
|
||||
}
|
||||
logrus.WithFields(fields).Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
fields[logrus.ErrorKey] = err
|
||||
logrus.WithFields(fields).Error(err)
|
||||
} else {
|
||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
logrus.Debugf(title+" - succeeded path=%s", path)
|
||||
err = activateLayer(&stdDriverInfo, path)
|
||||
if err != nil {
|
||||
return hcserror.New(err, title+" - failed", "")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
28
vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go
generated
vendored
28
vendor/github.com/Microsoft/hcsshim/internal/wclayer/createlayer.go
generated
vendored
@ -7,17 +7,25 @@ import (
|
||||
|
||||
// CreateLayer creates a new, empty, read-only layer on the filesystem based on
|
||||
// the parent layer provided.
|
||||
func CreateLayer(path, parent string) error {
|
||||
title := "hcsshim::CreateLayer "
|
||||
logrus.Debugf(title+"ID %s parent %s", path, parent)
|
||||
|
||||
err := createLayer(&stdDriverInfo, path, parent)
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "path=%s parent=%s", path, parent)
|
||||
logrus.Error(err)
|
||||
return err
|
||||
func CreateLayer(path, parent string) (err error) {
|
||||
title := "hcsshim::CreateLayer"
|
||||
fields := logrus.Fields{
|
||||
"parent": parent,
|
||||
"path": path,
|
||||
}
|
||||
logrus.WithFields(fields).Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
fields[logrus.ErrorKey] = err
|
||||
logrus.WithFields(fields).Error(err)
|
||||
} else {
|
||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
logrus.Debugf(title+"- succeeded path=%s parent=%s", path, parent)
|
||||
err = createLayer(&stdDriverInfo, path, parent)
|
||||
if err != nil {
|
||||
return hcserror.New(err, title+" - failed", "")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
23
vendor/github.com/Microsoft/hcsshim/internal/wclayer/createscratchlayer.go
generated
vendored
23
vendor/github.com/Microsoft/hcsshim/internal/wclayer/createscratchlayer.go
generated
vendored
@ -9,9 +9,20 @@ import (
|
||||
// This requires both the id of the direct parent layer, as well as the full list
|
||||
// of paths to all parent layers up to the base (and including the direct parent
|
||||
// whose id was provided).
|
||||
func CreateScratchLayer(path string, parentLayerPaths []string) error {
|
||||
title := "hcsshim::CreateScratchLayer "
|
||||
logrus.Debugf(title+"path %s", path)
|
||||
func CreateScratchLayer(path string, parentLayerPaths []string) (err error) {
|
||||
title := "hcsshim::CreateScratchLayer"
|
||||
fields := logrus.Fields{
|
||||
"path": path,
|
||||
}
|
||||
logrus.WithFields(fields).Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
fields[logrus.ErrorKey] = err
|
||||
logrus.WithFields(fields).Error(err)
|
||||
} else {
|
||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
// Generate layer descriptors
|
||||
layers, err := layerPathsToDescriptors(parentLayerPaths)
|
||||
@ -21,11 +32,7 @@ func CreateScratchLayer(path string, parentLayerPaths []string) error {
|
||||
|
||||
err = createSandboxLayer(&stdDriverInfo, path, 0, layers)
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "path=%s", path)
|
||||
logrus.Error(err)
|
||||
return err
|
||||
return hcserror.New(err, title+" - failed", "")
|
||||
}
|
||||
|
||||
logrus.Debugf(title+"- succeeded path=%s", path)
|
||||
return nil
|
||||
}
|
||||
|
27
vendor/github.com/Microsoft/hcsshim/internal/wclayer/deactivatelayer.go
generated
vendored
27
vendor/github.com/Microsoft/hcsshim/internal/wclayer/deactivatelayer.go
generated
vendored
@ -6,17 +6,24 @@ import (
|
||||
)
|
||||
|
||||
// DeactivateLayer will dismount a layer that was mounted via ActivateLayer.
|
||||
func DeactivateLayer(path string) error {
|
||||
title := "hcsshim::DeactivateLayer "
|
||||
logrus.Debugf(title+"path %s", path)
|
||||
|
||||
err := deactivateLayer(&stdDriverInfo, path)
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "path=%s", path)
|
||||
logrus.Error(err)
|
||||
return err
|
||||
func DeactivateLayer(path string) (err error) {
|
||||
title := "hcsshim::DeactivateLayer"
|
||||
fields := logrus.Fields{
|
||||
"path": path,
|
||||
}
|
||||
logrus.WithFields(fields).Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
fields[logrus.ErrorKey] = err
|
||||
logrus.WithFields(fields).Error(err)
|
||||
} else {
|
||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
logrus.Debugf(title+"succeeded path=%s", path)
|
||||
err = deactivateLayer(&stdDriverInfo, path)
|
||||
if err != nil {
|
||||
return hcserror.New(err, title+"- failed", "")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
27
vendor/github.com/Microsoft/hcsshim/internal/wclayer/destroylayer.go
generated
vendored
27
vendor/github.com/Microsoft/hcsshim/internal/wclayer/destroylayer.go
generated
vendored
@ -7,17 +7,24 @@ import (
|
||||
|
||||
// DestroyLayer will remove the on-disk files representing the layer with the given
|
||||
// path, including that layer's containing folder, if any.
|
||||
func DestroyLayer(path string) error {
|
||||
title := "hcsshim::DestroyLayer "
|
||||
logrus.Debugf(title+"path %s", path)
|
||||
|
||||
err := destroyLayer(&stdDriverInfo, path)
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "path=%s", path)
|
||||
logrus.Error(err)
|
||||
return err
|
||||
func DestroyLayer(path string) (err error) {
|
||||
title := "hcsshim::DestroyLayer"
|
||||
fields := logrus.Fields{
|
||||
"path": path,
|
||||
}
|
||||
logrus.WithFields(fields).Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
fields[logrus.ErrorKey] = err
|
||||
logrus.WithFields(fields).Error(err)
|
||||
} else {
|
||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
logrus.Debugf(title+"succeeded path=%s", path)
|
||||
err = destroyLayer(&stdDriverInfo, path)
|
||||
if err != nil {
|
||||
return hcserror.New(err, title+" - failed", "")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
28
vendor/github.com/Microsoft/hcsshim/internal/wclayer/expandscratchsize.go
generated
vendored
28
vendor/github.com/Microsoft/hcsshim/internal/wclayer/expandscratchsize.go
generated
vendored
@ -6,17 +6,25 @@ import (
|
||||
)
|
||||
|
||||
// ExpandScratchSize expands the size of a layer to at least size bytes.
|
||||
func ExpandScratchSize(path string, size uint64) error {
|
||||
title := "hcsshim::ExpandScratchSize "
|
||||
logrus.Debugf(title+"path=%s size=%d", path, size)
|
||||
|
||||
err := expandSandboxSize(&stdDriverInfo, path, size)
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "path=%s size=%d", path, size)
|
||||
logrus.Error(err)
|
||||
return err
|
||||
func ExpandScratchSize(path string, size uint64) (err error) {
|
||||
title := "hcsshim::ExpandScratchSize"
|
||||
fields := logrus.Fields{
|
||||
"path": path,
|
||||
"size": size,
|
||||
}
|
||||
logrus.WithFields(fields).Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
fields[logrus.ErrorKey] = err
|
||||
logrus.WithFields(fields).Error(err)
|
||||
} else {
|
||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
logrus.Debugf(title+"- succeeded path=%s size=%d", path, size)
|
||||
err = expandSandboxSize(&stdDriverInfo, path, size)
|
||||
if err != nil {
|
||||
return hcserror.New(err, title+" - failed", "")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
113
vendor/github.com/Microsoft/hcsshim/internal/wclayer/exportlayer.go
generated
vendored
113
vendor/github.com/Microsoft/hcsshim/internal/wclayer/exportlayer.go
generated
vendored
@ -1,14 +1,11 @@
|
||||
package wclayer
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
"github.com/Microsoft/go-winio"
|
||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||
"github.com/Microsoft/hcsshim/internal/interop"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@ -17,9 +14,21 @@ import (
|
||||
// format includes any metadata required for later importing the layer (using
|
||||
// ImportLayer), and requires the full list of parent layer paths in order to
|
||||
// perform the export.
|
||||
func ExportLayer(path string, exportFolderPath string, parentLayerPaths []string) error {
|
||||
title := "hcsshim::ExportLayer "
|
||||
logrus.Debugf(title+"path %s folder %s", path, exportFolderPath)
|
||||
func ExportLayer(path string, exportFolderPath string, parentLayerPaths []string) (err error) {
|
||||
title := "hcsshim::ExportLayer"
|
||||
fields := logrus.Fields{
|
||||
"path": path,
|
||||
"exportFolderPath": exportFolderPath,
|
||||
}
|
||||
logrus.WithFields(fields).Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
fields[logrus.ErrorKey] = err
|
||||
logrus.WithFields(fields).Error(err)
|
||||
} else {
|
||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
// Generate layer descriptors
|
||||
layers, err := layerPathsToDescriptors(parentLayerPaths)
|
||||
@ -29,12 +38,8 @@ func ExportLayer(path string, exportFolderPath string, parentLayerPaths []string
|
||||
|
||||
err = exportLayer(&stdDriverInfo, path, exportFolderPath, layers)
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "path=%s folder=%s", path, exportFolderPath)
|
||||
logrus.Error(err)
|
||||
return err
|
||||
return hcserror.New(err, title+" - failed", "")
|
||||
}
|
||||
|
||||
logrus.Debugf(title+"succeeded path=%s folder=%s", path, exportFolderPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -44,96 +49,20 @@ type LayerReader interface {
|
||||
Close() error
|
||||
}
|
||||
|
||||
// FilterLayerReader provides an interface for extracting the contents of an on-disk layer.
|
||||
type FilterLayerReader struct {
|
||||
context uintptr
|
||||
}
|
||||
|
||||
// Next reads the next available file from a layer, ensuring that parent directories are always read
|
||||
// before child files and directories.
|
||||
//
|
||||
// Next returns the file's relative path, size, and basic file metadata. Read() should be used to
|
||||
// extract a Win32 backup stream with the remainder of the metadata and the data.
|
||||
func (r *FilterLayerReader) Next() (string, int64, *winio.FileBasicInfo, error) {
|
||||
var fileNamep *uint16
|
||||
fileInfo := &winio.FileBasicInfo{}
|
||||
var deleted uint32
|
||||
var fileSize int64
|
||||
err := exportLayerNext(r.context, &fileNamep, fileInfo, &fileSize, &deleted)
|
||||
if err != nil {
|
||||
if err == syscall.ERROR_NO_MORE_FILES {
|
||||
err = io.EOF
|
||||
} else {
|
||||
err = hcserror.New(err, "ExportLayerNext", "")
|
||||
}
|
||||
return "", 0, nil, err
|
||||
}
|
||||
fileName := interop.ConvertAndFreeCoTaskMemString(fileNamep)
|
||||
if deleted != 0 {
|
||||
fileInfo = nil
|
||||
}
|
||||
if fileName[0] == '\\' {
|
||||
fileName = fileName[1:]
|
||||
}
|
||||
return fileName, fileSize, fileInfo, nil
|
||||
}
|
||||
|
||||
// Read reads from the current file's Win32 backup stream.
|
||||
func (r *FilterLayerReader) Read(b []byte) (int, error) {
|
||||
var bytesRead uint32
|
||||
err := exportLayerRead(r.context, b, &bytesRead)
|
||||
if err != nil {
|
||||
return 0, hcserror.New(err, "ExportLayerRead", "")
|
||||
}
|
||||
if bytesRead == 0 {
|
||||
return 0, io.EOF
|
||||
}
|
||||
return int(bytesRead), nil
|
||||
}
|
||||
|
||||
// Close frees resources associated with the layer reader. It will return an
|
||||
// error if there was an error while reading the layer or of the layer was not
|
||||
// completely read.
|
||||
func (r *FilterLayerReader) Close() (err error) {
|
||||
if r.context != 0 {
|
||||
err = exportLayerEnd(r.context)
|
||||
if err != nil {
|
||||
err = hcserror.New(err, "ExportLayerEnd", "")
|
||||
}
|
||||
r.context = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// NewLayerReader returns a new layer reader for reading the contents of an on-disk layer.
|
||||
// The caller must have taken the SeBackupPrivilege privilege
|
||||
// to call this and any methods on the resulting LayerReader.
|
||||
func NewLayerReader(path string, parentLayerPaths []string) (LayerReader, error) {
|
||||
if procExportLayerBegin.Find() != nil {
|
||||
// The new layer reader is not available on this Windows build. Fall back to the
|
||||
// legacy export code path.
|
||||
exportPath, err := ioutil.TempDir("", "hcs")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = ExportLayer(path, exportPath, parentLayerPaths)
|
||||
if err != nil {
|
||||
os.RemoveAll(exportPath)
|
||||
return nil, err
|
||||
}
|
||||
return &legacyLayerReaderWrapper{newLegacyLayerReader(exportPath)}, nil
|
||||
}
|
||||
|
||||
layers, err := layerPathsToDescriptors(parentLayerPaths)
|
||||
exportPath, err := ioutil.TempDir("", "hcs")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
r := &FilterLayerReader{}
|
||||
err = exportLayerBegin(&stdDriverInfo, path, layers, &r.context)
|
||||
err = ExportLayer(path, exportPath, parentLayerPaths)
|
||||
if err != nil {
|
||||
return nil, hcserror.New(err, "ExportLayerBegin", "")
|
||||
os.RemoveAll(exportPath)
|
||||
return nil, err
|
||||
}
|
||||
return r, err
|
||||
return &legacyLayerReaderWrapper{newLegacyLayerReader(exportPath)}, nil
|
||||
}
|
||||
|
||||
type legacyLayerReaderWrapper struct {
|
||||
|
33
vendor/github.com/Microsoft/hcsshim/internal/wclayer/getlayermountpath.go
generated
vendored
33
vendor/github.com/Microsoft/hcsshim/internal/wclayer/getlayermountpath.go
generated
vendored
@ -11,20 +11,29 @@ import (
|
||||
// the path at which that layer can be accessed. This path may be a volume path
|
||||
// if the layer is a mounted read-write layer, otherwise it is expected to be the
|
||||
// folder path at which the layer is stored.
|
||||
func GetLayerMountPath(path string) (string, error) {
|
||||
title := "hcsshim::GetLayerMountPath "
|
||||
logrus.Debugf(title+"path %s", path)
|
||||
func GetLayerMountPath(path string) (_ string, err error) {
|
||||
title := "hcsshim::GetLayerMountPath"
|
||||
fields := logrus.Fields{
|
||||
"path": path,
|
||||
}
|
||||
logrus.WithFields(fields).Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
fields[logrus.ErrorKey] = err
|
||||
logrus.WithFields(fields).Error(err)
|
||||
} else {
|
||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
var mountPathLength uintptr
|
||||
mountPathLength = 0
|
||||
|
||||
// Call the procedure itself.
|
||||
logrus.Debugf("Calling proc (1)")
|
||||
err := getLayerMountPath(&stdDriverInfo, path, &mountPathLength, nil)
|
||||
logrus.WithFields(fields).Debug("Calling proc (1)")
|
||||
err = getLayerMountPath(&stdDriverInfo, path, &mountPathLength, nil)
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "(first call) path=%s", path)
|
||||
logrus.Error(err)
|
||||
return "", err
|
||||
return "", hcserror.New(err, title+" - failed", "(first call)")
|
||||
}
|
||||
|
||||
// Allocate a mount path of the returned length.
|
||||
@ -35,15 +44,13 @@ func GetLayerMountPath(path string) (string, error) {
|
||||
mountPathp[0] = 0
|
||||
|
||||
// Call the procedure again
|
||||
logrus.Debugf("Calling proc (2)")
|
||||
logrus.WithFields(fields).Debug("Calling proc (2)")
|
||||
err = getLayerMountPath(&stdDriverInfo, path, &mountPathLength, &mountPathp[0])
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "(second call) path=%s", path)
|
||||
logrus.Error(err)
|
||||
return "", err
|
||||
return "", hcserror.New(err, title+" - failed", "(second call)")
|
||||
}
|
||||
|
||||
mountPath := syscall.UTF16ToString(mountPathp[0:])
|
||||
logrus.Debugf(title+"succeeded path=%s mountPath=%s", path, mountPath)
|
||||
fields["mountPath"] = mountPath
|
||||
return mountPath, nil
|
||||
}
|
||||
|
19
vendor/github.com/Microsoft/hcsshim/internal/wclayer/getsharedbaseimages.go
generated
vendored
19
vendor/github.com/Microsoft/hcsshim/internal/wclayer/getsharedbaseimages.go
generated
vendored
@ -10,17 +10,20 @@ import (
|
||||
// image store and return descriptive info about those images for the purpose
|
||||
// of registering them with the graphdriver, graph, and tagstore.
|
||||
func GetSharedBaseImages() (imageData string, err error) {
|
||||
title := "hcsshim::GetSharedBaseImages "
|
||||
title := "hcsshim::GetSharedBaseImages"
|
||||
logrus.Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
logrus.WithError(err).Error(err)
|
||||
} else {
|
||||
logrus.WithField("imageData", imageData).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
logrus.Debugf("Calling proc")
|
||||
var buffer *uint16
|
||||
err = getBaseImages(&buffer)
|
||||
if err != nil {
|
||||
err = hcserror.New(err, title, "")
|
||||
logrus.Error(err)
|
||||
return
|
||||
return "", hcserror.New(err, title+" - failed", "")
|
||||
}
|
||||
imageData = interop.ConvertAndFreeCoTaskMemString(buffer)
|
||||
logrus.Debugf(title+" - succeeded output=%s", imageData)
|
||||
return
|
||||
return interop.ConvertAndFreeCoTaskMemString(buffer), nil
|
||||
}
|
||||
|
30
vendor/github.com/Microsoft/hcsshim/internal/wclayer/grantvmaccess.go
generated
vendored
30
vendor/github.com/Microsoft/hcsshim/internal/wclayer/grantvmaccess.go
generated
vendored
@ -1,24 +1,30 @@
|
||||
package wclayer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/Microsoft/hcsshim/internal/hcserror"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// GrantVmAccess adds access to a file for a given VM
|
||||
func GrantVmAccess(vmid string, filepath string) error {
|
||||
title := fmt.Sprintf("hcsshim::GrantVmAccess id:%s path:%s ", vmid, filepath)
|
||||
logrus.Debugf(title)
|
||||
|
||||
err := grantVmAccess(vmid, filepath)
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "path=%s", filepath)
|
||||
logrus.Error(err)
|
||||
return err
|
||||
func GrantVmAccess(vmid string, filepath string) (err error) {
|
||||
title := "hcsshim::GrantVmAccess"
|
||||
fields := logrus.Fields{
|
||||
"vm-id": vmid,
|
||||
"path": filepath,
|
||||
}
|
||||
logrus.WithFields(fields).Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
fields[logrus.ErrorKey] = err
|
||||
logrus.WithFields(fields).Error(err)
|
||||
} else {
|
||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
logrus.Debugf(title + " - succeeded")
|
||||
err = grantVmAccess(vmid, filepath)
|
||||
if err != nil {
|
||||
return hcserror.New(err, title+" - failed", "")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
119
vendor/github.com/Microsoft/hcsshim/internal/wclayer/importlayer.go
generated
vendored
119
vendor/github.com/Microsoft/hcsshim/internal/wclayer/importlayer.go
generated
vendored
@ -1,7 +1,6 @@
|
||||
package wclayer
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -16,9 +15,21 @@ import (
|
||||
// that into a layer with the id layerId. Note that in order to correctly populate
|
||||
// the layer and interperet the transport format, all parent layers must already
|
||||
// be present on the system at the paths provided in parentLayerPaths.
|
||||
func ImportLayer(path string, importFolderPath string, parentLayerPaths []string) error {
|
||||
title := "hcsshim::ImportLayer "
|
||||
logrus.Debugf(title+"path %s folder %s", path, importFolderPath)
|
||||
func ImportLayer(path string, importFolderPath string, parentLayerPaths []string) (err error) {
|
||||
title := "hcsshim::ImportLayer"
|
||||
fields := logrus.Fields{
|
||||
"path": path,
|
||||
"importFolderPath": importFolderPath,
|
||||
}
|
||||
logrus.WithFields(fields).Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
fields[logrus.ErrorKey] = err
|
||||
logrus.WithFields(fields).Error(err)
|
||||
} else {
|
||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
// Generate layer descriptors
|
||||
layers, err := layerPathsToDescriptors(parentLayerPaths)
|
||||
@ -28,12 +39,8 @@ func ImportLayer(path string, importFolderPath string, parentLayerPaths []string
|
||||
|
||||
err = importLayer(&stdDriverInfo, path, importFolderPath, layers)
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "path=%s folder=%s", path, importFolderPath)
|
||||
logrus.Error(err)
|
||||
return err
|
||||
return hcserror.New(err, title+" - failed", "")
|
||||
}
|
||||
|
||||
logrus.Debugf(title+"succeeded path=%s folder=%s", path, importFolderPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -52,69 +59,6 @@ type LayerWriter interface {
|
||||
Close() error
|
||||
}
|
||||
|
||||
// FilterLayerWriter provides an interface to write the contents of a layer to the file system.
|
||||
type FilterLayerWriter struct {
|
||||
context uintptr
|
||||
}
|
||||
|
||||
// Add adds a file or directory to the layer. The file's parent directory must have already been added.
|
||||
//
|
||||
// name contains the file's relative path. fileInfo contains file times and file attributes; the rest
|
||||
// of the file metadata and the file data must be written as a Win32 backup stream to the Write() method.
|
||||
// winio.BackupStreamWriter can be used to facilitate this.
|
||||
func (w *FilterLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo) error {
|
||||
if name[0] != '\\' {
|
||||
name = `\` + name
|
||||
}
|
||||
err := importLayerNext(w.context, name, fileInfo)
|
||||
if err != nil {
|
||||
return hcserror.New(err, "ImportLayerNext", "")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddLink adds a hard link to the layer. The target of the link must have already been added.
|
||||
func (w *FilterLayerWriter) AddLink(name string, target string) error {
|
||||
return errors.New("hard links not yet supported")
|
||||
}
|
||||
|
||||
// Remove removes a file from the layer. The file must have been present in the parent layer.
|
||||
//
|
||||
// name contains the file's relative path.
|
||||
func (w *FilterLayerWriter) Remove(name string) error {
|
||||
if name[0] != '\\' {
|
||||
name = `\` + name
|
||||
}
|
||||
err := importLayerNext(w.context, name, nil)
|
||||
if err != nil {
|
||||
return hcserror.New(err, "ImportLayerNext", "")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Write writes more backup stream data to the current file.
|
||||
func (w *FilterLayerWriter) Write(b []byte) (int, error) {
|
||||
err := importLayerWrite(w.context, b)
|
||||
if err != nil {
|
||||
err = hcserror.New(err, "ImportLayerWrite", "")
|
||||
return 0, err
|
||||
}
|
||||
return len(b), err
|
||||
}
|
||||
|
||||
// Close completes the layer write operation. The error must be checked to ensure that the
|
||||
// operation was successful.
|
||||
func (w *FilterLayerWriter) Close() (err error) {
|
||||
if w.context != 0 {
|
||||
err = importLayerEnd(w.context)
|
||||
if err != nil {
|
||||
err = hcserror.New(err, "ImportLayerEnd", "")
|
||||
}
|
||||
w.context = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type legacyLayerWriterWrapper struct {
|
||||
*legacyLayerWriter
|
||||
path string
|
||||
@ -175,32 +119,17 @@ func NewLayerWriter(path string, parentLayerPaths []string) (LayerWriter, error)
|
||||
}, nil
|
||||
}
|
||||
|
||||
if procImportLayerBegin.Find() != nil {
|
||||
// The new layer reader is not available on this Windows build. Fall back to the
|
||||
// legacy export code path.
|
||||
importPath, err := ioutil.TempDir("", "hcs")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
w, err := newLegacyLayerWriter(importPath, parentLayerPaths, path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &legacyLayerWriterWrapper{
|
||||
legacyLayerWriter: w,
|
||||
path: importPath,
|
||||
parentLayerPaths: parentLayerPaths,
|
||||
}, nil
|
||||
}
|
||||
layers, err := layerPathsToDescriptors(parentLayerPaths)
|
||||
importPath, err := ioutil.TempDir("", "hcs")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
w := &FilterLayerWriter{}
|
||||
err = importLayerBegin(&stdDriverInfo, path, layers, &w.context)
|
||||
w, err := newLegacyLayerWriter(importPath, parentLayerPaths, path)
|
||||
if err != nil {
|
||||
return nil, hcserror.New(err, "ImportLayerStart", "")
|
||||
return nil, err
|
||||
}
|
||||
return w, nil
|
||||
return &legacyLayerWriterWrapper{
|
||||
legacyLayerWriter: w,
|
||||
path: importPath,
|
||||
parentLayerPaths: parentLayerPaths,
|
||||
}, nil
|
||||
}
|
||||
|
26
vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerexists.go
generated
vendored
26
vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerexists.go
generated
vendored
@ -7,19 +7,27 @@ import (
|
||||
|
||||
// LayerExists will return true if a layer with the given id exists and is known
|
||||
// to the system.
|
||||
func LayerExists(path string) (bool, error) {
|
||||
title := "hcsshim::LayerExists "
|
||||
logrus.Debugf(title+"path %s", path)
|
||||
func LayerExists(path string) (_ bool, err error) {
|
||||
title := "hcsshim::LayerExists"
|
||||
fields := logrus.Fields{
|
||||
"path": path,
|
||||
}
|
||||
logrus.WithFields(fields).Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
fields[logrus.ErrorKey] = err
|
||||
logrus.WithFields(fields).Error(err)
|
||||
} else {
|
||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
// Call the procedure itself.
|
||||
var exists uint32
|
||||
err := layerExists(&stdDriverInfo, path, &exists)
|
||||
err = layerExists(&stdDriverInfo, path, &exists)
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "path=%s", path)
|
||||
logrus.Error(err)
|
||||
return false, err
|
||||
return false, hcserror.New(err, title+" - failed", "")
|
||||
}
|
||||
|
||||
logrus.Debugf(title+"succeeded path=%s exists=%d", path, exists)
|
||||
fields["layer-exists"] = exists != 0
|
||||
return exists != 0, nil
|
||||
}
|
||||
|
4
vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerutils.go
generated
vendored
4
vendor/github.com/Microsoft/hcsshim/internal/wclayer/layerutils.go
generated
vendored
@ -75,13 +75,13 @@ func layerPathsToDescriptors(parentLayerPaths []string) ([]WC_LAYER_DESCRIPTOR,
|
||||
for i := 0; i < len(parentLayerPaths); i++ {
|
||||
g, err := LayerID(parentLayerPaths[i])
|
||||
if err != nil {
|
||||
logrus.Debugf("Failed to convert name to guid %s", err)
|
||||
logrus.WithError(err).Debug("Failed to convert name to guid")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
p, err := syscall.UTF16PtrFromString(parentLayerPaths[i])
|
||||
if err != nil {
|
||||
logrus.Debugf("Failed conversion of parentLayerPath to pointer %s", err)
|
||||
logrus.WithError(err).Debug("Failed conversion of parentLayerPath to pointer")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
20
vendor/github.com/Microsoft/hcsshim/internal/wclayer/nametoguid.go
generated
vendored
20
vendor/github.com/Microsoft/hcsshim/internal/wclayer/nametoguid.go
generated
vendored
@ -10,15 +10,25 @@ import (
|
||||
// Host Compute Service, ensuring GUIDs generated with the same string are common
|
||||
// across all clients.
|
||||
func NameToGuid(name string) (id guid.GUID, err error) {
|
||||
title := "hcsshim::NameToGuid "
|
||||
title := "hcsshim::NameToGuid"
|
||||
fields := logrus.Fields{
|
||||
"name": name,
|
||||
}
|
||||
logrus.WithFields(fields).Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
fields[logrus.ErrorKey] = err
|
||||
logrus.WithFields(fields).Error(err)
|
||||
} else {
|
||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
err = nameToGuid(name, &id)
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "name=%s", name)
|
||||
logrus.Error(err)
|
||||
err = hcserror.New(err, title+" - failed", "")
|
||||
return
|
||||
}
|
||||
|
||||
logrus.Debugf(title+"name:%s guid:%s", name, id.String())
|
||||
fields["guid"] = id.String()
|
||||
return
|
||||
}
|
||||
|
23
vendor/github.com/Microsoft/hcsshim/internal/wclayer/preparelayer.go
generated
vendored
23
vendor/github.com/Microsoft/hcsshim/internal/wclayer/preparelayer.go
generated
vendored
@ -14,9 +14,20 @@ var prepareLayerLock sync.Mutex
|
||||
// parent layers, and is necessary in order to view or interact with the layer
|
||||
// as an actual filesystem (reading and writing files, creating directories, etc).
|
||||
// Disabling the filter must be done via UnprepareLayer.
|
||||
func PrepareLayer(path string, parentLayerPaths []string) error {
|
||||
title := "hcsshim::PrepareLayer "
|
||||
logrus.Debugf(title+"path %s", path)
|
||||
func PrepareLayer(path string, parentLayerPaths []string) (err error) {
|
||||
title := "hcsshim::PrepareLayer"
|
||||
fields := logrus.Fields{
|
||||
"path": path,
|
||||
}
|
||||
logrus.WithFields(fields).Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
fields[logrus.ErrorKey] = err
|
||||
logrus.WithFields(fields).Error(err)
|
||||
} else {
|
||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
// Generate layer descriptors
|
||||
layers, err := layerPathsToDescriptors(parentLayerPaths)
|
||||
@ -30,11 +41,7 @@ func PrepareLayer(path string, parentLayerPaths []string) error {
|
||||
defer prepareLayerLock.Unlock()
|
||||
err = prepareLayer(&stdDriverInfo, path, layers)
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "path=%s", path)
|
||||
logrus.Error(err)
|
||||
return err
|
||||
return hcserror.New(err, title+" - failed", "")
|
||||
}
|
||||
|
||||
logrus.Debugf(title+"succeeded path=%s", path)
|
||||
return nil
|
||||
}
|
||||
|
27
vendor/github.com/Microsoft/hcsshim/internal/wclayer/unpreparelayer.go
generated
vendored
27
vendor/github.com/Microsoft/hcsshim/internal/wclayer/unpreparelayer.go
generated
vendored
@ -7,17 +7,24 @@ import (
|
||||
|
||||
// UnprepareLayer disables the filesystem filter for the read-write layer with
|
||||
// the given id.
|
||||
func UnprepareLayer(path string) error {
|
||||
title := "hcsshim::UnprepareLayer "
|
||||
logrus.Debugf(title+"path %s", path)
|
||||
|
||||
err := unprepareLayer(&stdDriverInfo, path)
|
||||
if err != nil {
|
||||
err = hcserror.Errorf(err, title, "path=%s", path)
|
||||
logrus.Error(err)
|
||||
return err
|
||||
func UnprepareLayer(path string) (err error) {
|
||||
title := "hcsshim::UnprepareLayer"
|
||||
fields := logrus.Fields{
|
||||
"path": path,
|
||||
}
|
||||
logrus.WithFields(fields).Debug(title)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
fields[logrus.ErrorKey] = err
|
||||
logrus.WithFields(fields).Error(err)
|
||||
} else {
|
||||
logrus.WithFields(fields).Debug(title + " - succeeded")
|
||||
}
|
||||
}()
|
||||
|
||||
logrus.Debugf(title+"succeeded path=%s", path)
|
||||
err = unprepareLayer(&stdDriverInfo, path)
|
||||
if err != nil {
|
||||
return hcserror.New(err, title+" - failed", "")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
12
vendor/github.com/Microsoft/hcsshim/internal/wclayer/wclayer.go
generated
vendored
12
vendor/github.com/Microsoft/hcsshim/internal/wclayer/wclayer.go
generated
vendored
@ -2,7 +2,7 @@ package wclayer
|
||||
|
||||
import "github.com/Microsoft/hcsshim/internal/guid"
|
||||
|
||||
//go:generate go run ../../mksyscall_windows.go -output zsyscall_windows.go -winio wclayer.go
|
||||
//go:generate go run ../../mksyscall_windows.go -output zsyscall_windows.go wclayer.go
|
||||
|
||||
//sys activateLayer(info *driverInfo, id string) (hr error) = vmcompute.ActivateLayer?
|
||||
//sys copyLayer(info *driverInfo, srcId string, dstId string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) = vmcompute.CopyLayer?
|
||||
@ -22,16 +22,6 @@ import "github.com/Microsoft/hcsshim/internal/guid"
|
||||
//sys processBaseImage(path string) (hr error) = vmcompute.ProcessBaseImage?
|
||||
//sys processUtilityImage(path string) (hr error) = vmcompute.ProcessUtilityImage?
|
||||
|
||||
//sys importLayerBegin(info *driverInfo, id string, descriptors []WC_LAYER_DESCRIPTOR, context *uintptr) (hr error) = vmcompute.ImportLayerBegin?
|
||||
//sys importLayerNext(context uintptr, fileName string, fileInfo *winio.FileBasicInfo) (hr error) = vmcompute.ImportLayerNext?
|
||||
//sys importLayerWrite(context uintptr, buffer []byte) (hr error) = vmcompute.ImportLayerWrite?
|
||||
//sys importLayerEnd(context uintptr) (hr error) = vmcompute.ImportLayerEnd?
|
||||
|
||||
//sys exportLayerBegin(info *driverInfo, id string, descriptors []WC_LAYER_DESCRIPTOR, context *uintptr) (hr error) = vmcompute.ExportLayerBegin?
|
||||
//sys exportLayerNext(context uintptr, fileName **uint16, fileInfo *winio.FileBasicInfo, fileSize *int64, deleted *uint32) (hr error) = vmcompute.ExportLayerNext?
|
||||
//sys exportLayerRead(context uintptr, buffer []byte, bytesRead *uint32) (hr error) = vmcompute.ExportLayerRead?
|
||||
//sys exportLayerEnd(context uintptr) (hr error) = vmcompute.ExportLayerEnd?
|
||||
|
||||
//sys grantVmAccess(vmid string, filepath string) (hr error) = vmcompute.GrantVmAccess?
|
||||
|
||||
type _guid = guid.GUID
|
||||
|
233
vendor/github.com/Microsoft/hcsshim/internal/wclayer/zsyscall_windows.go
generated
vendored
233
vendor/github.com/Microsoft/hcsshim/internal/wclayer/zsyscall_windows.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT
|
||||
// Code generated mksyscall_windows.exe DO NOT EDIT
|
||||
|
||||
package wclayer
|
||||
|
||||
@ -6,8 +6,6 @@ import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/Microsoft/go-winio"
|
||||
"github.com/Microsoft/hcsshim/internal/interop"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
@ -58,14 +56,6 @@ var (
|
||||
procUnprepareLayer = modvmcompute.NewProc("UnprepareLayer")
|
||||
procProcessBaseImage = modvmcompute.NewProc("ProcessBaseImage")
|
||||
procProcessUtilityImage = modvmcompute.NewProc("ProcessUtilityImage")
|
||||
procImportLayerBegin = modvmcompute.NewProc("ImportLayerBegin")
|
||||
procImportLayerNext = modvmcompute.NewProc("ImportLayerNext")
|
||||
procImportLayerWrite = modvmcompute.NewProc("ImportLayerWrite")
|
||||
procImportLayerEnd = modvmcompute.NewProc("ImportLayerEnd")
|
||||
procExportLayerBegin = modvmcompute.NewProc("ExportLayerBegin")
|
||||
procExportLayerNext = modvmcompute.NewProc("ExportLayerNext")
|
||||
procExportLayerRead = modvmcompute.NewProc("ExportLayerRead")
|
||||
procExportLayerEnd = modvmcompute.NewProc("ExportLayerEnd")
|
||||
procGrantVmAccess = modvmcompute.NewProc("GrantVmAccess")
|
||||
)
|
||||
|
||||
@ -84,7 +74,10 @@ func _activateLayer(info *driverInfo, id *uint16) (hr error) {
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procActivateLayer.Addr(), 2, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -113,7 +106,10 @@ func _copyLayer(info *driverInfo, srcId *uint16, dstId *uint16, descriptors []WC
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procCopyLayer.Addr(), 5, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(srcId)), uintptr(unsafe.Pointer(dstId)), uintptr(unsafe.Pointer(_p2)), uintptr(len(descriptors)), 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -138,7 +134,10 @@ func _createLayer(info *driverInfo, id *uint16, parent *uint16) (hr error) {
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procCreateLayer.Addr(), 3, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(parent)))
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -162,7 +161,10 @@ func _createSandboxLayer(info *driverInfo, id *uint16, parent uintptr, descripto
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procCreateSandboxLayer.Addr(), 5, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(parent), uintptr(unsafe.Pointer(_p1)), uintptr(len(descriptors)), 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -182,7 +184,10 @@ func _expandSandboxSize(info *driverInfo, id *uint16, size uint64) (hr error) {
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procExpandSandboxSize.Addr(), 3, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(size))
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -202,7 +207,10 @@ func _deactivateLayer(info *driverInfo, id *uint16) (hr error) {
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procDeactivateLayer.Addr(), 2, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -222,7 +230,10 @@ func _destroyLayer(info *driverInfo, id *uint16) (hr error) {
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procDestroyLayer.Addr(), 2, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -251,7 +262,10 @@ func _exportLayer(info *driverInfo, id *uint16, path *uint16, descriptors []WC_L
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procExportLayer.Addr(), 5, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(_p2)), uintptr(len(descriptors)), 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -271,7 +285,10 @@ func _getLayerMountPath(info *driverInfo, id *uint16, length *uintptr, buffer *u
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procGetLayerMountPath.Addr(), 4, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(length)), uintptr(unsafe.Pointer(buffer)), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -282,7 +299,10 @@ func getBaseImages(buffer **uint16) (hr error) {
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procGetBaseImages.Addr(), 1, uintptr(unsafe.Pointer(buffer)), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -311,7 +331,10 @@ func _importLayer(info *driverInfo, id *uint16, path *uint16, descriptors []WC_L
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procImportLayer.Addr(), 5, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(_p2)), uintptr(len(descriptors)), 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -331,7 +354,10 @@ func _layerExists(info *driverInfo, id *uint16, exists *uint32) (hr error) {
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procLayerExists.Addr(), 3, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(exists)))
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -351,7 +377,10 @@ func _nameToGuid(name *uint16, guid *_guid) (hr error) {
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procNameToGuid.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(guid)), 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -375,7 +404,10 @@ func _prepareLayer(info *driverInfo, id *uint16, descriptors []WC_LAYER_DESCRIPT
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procPrepareLayer.Addr(), 4, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(_p1)), uintptr(len(descriptors)), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -395,7 +427,10 @@ func _unprepareLayer(info *driverInfo, id *uint16) (hr error) {
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procUnprepareLayer.Addr(), 2, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -415,7 +450,10 @@ func _processBaseImage(path *uint16) (hr error) {
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procProcessBaseImage.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -435,138 +473,10 @@ func _processUtilityImage(path *uint16) (hr error) {
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procProcessUtilityImage.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func importLayerBegin(info *driverInfo, id string, descriptors []WC_LAYER_DESCRIPTOR, context *uintptr) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(id)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _importLayerBegin(info, _p0, descriptors, context)
|
||||
}
|
||||
|
||||
func _importLayerBegin(info *driverInfo, id *uint16, descriptors []WC_LAYER_DESCRIPTOR, context *uintptr) (hr error) {
|
||||
var _p1 *WC_LAYER_DESCRIPTOR
|
||||
if len(descriptors) > 0 {
|
||||
_p1 = &descriptors[0]
|
||||
}
|
||||
if hr = procImportLayerBegin.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procImportLayerBegin.Addr(), 5, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(_p1)), uintptr(len(descriptors)), uintptr(unsafe.Pointer(context)), 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func importLayerNext(context uintptr, fileName string, fileInfo *winio.FileBasicInfo) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(fileName)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _importLayerNext(context, _p0, fileInfo)
|
||||
}
|
||||
|
||||
func _importLayerNext(context uintptr, fileName *uint16, fileInfo *winio.FileBasicInfo) (hr error) {
|
||||
if hr = procImportLayerNext.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procImportLayerNext.Addr(), 3, uintptr(context), uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(fileInfo)))
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func importLayerWrite(context uintptr, buffer []byte) (hr error) {
|
||||
var _p0 *byte
|
||||
if len(buffer) > 0 {
|
||||
_p0 = &buffer[0]
|
||||
}
|
||||
if hr = procImportLayerWrite.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procImportLayerWrite.Addr(), 3, uintptr(context), uintptr(unsafe.Pointer(_p0)), uintptr(len(buffer)))
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func importLayerEnd(context uintptr) (hr error) {
|
||||
if hr = procImportLayerEnd.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procImportLayerEnd.Addr(), 1, uintptr(context), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func exportLayerBegin(info *driverInfo, id string, descriptors []WC_LAYER_DESCRIPTOR, context *uintptr) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(id)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _exportLayerBegin(info, _p0, descriptors, context)
|
||||
}
|
||||
|
||||
func _exportLayerBegin(info *driverInfo, id *uint16, descriptors []WC_LAYER_DESCRIPTOR, context *uintptr) (hr error) {
|
||||
var _p1 *WC_LAYER_DESCRIPTOR
|
||||
if len(descriptors) > 0 {
|
||||
_p1 = &descriptors[0]
|
||||
}
|
||||
if hr = procExportLayerBegin.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procExportLayerBegin.Addr(), 5, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(_p1)), uintptr(len(descriptors)), uintptr(unsafe.Pointer(context)), 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func exportLayerNext(context uintptr, fileName **uint16, fileInfo *winio.FileBasicInfo, fileSize *int64, deleted *uint32) (hr error) {
|
||||
if hr = procExportLayerNext.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procExportLayerNext.Addr(), 5, uintptr(context), uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(fileInfo)), uintptr(unsafe.Pointer(fileSize)), uintptr(unsafe.Pointer(deleted)), 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func exportLayerRead(context uintptr, buffer []byte, bytesRead *uint32) (hr error) {
|
||||
var _p0 *byte
|
||||
if len(buffer) > 0 {
|
||||
_p0 = &buffer[0]
|
||||
}
|
||||
if hr = procExportLayerRead.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procExportLayerRead.Addr(), 4, uintptr(context), uintptr(unsafe.Pointer(_p0)), uintptr(len(buffer)), uintptr(unsafe.Pointer(bytesRead)), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func exportLayerEnd(context uintptr) (hr error) {
|
||||
if hr = procExportLayerEnd.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procExportLayerEnd.Addr(), 1, uintptr(context), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -591,7 +501,10 @@ func _grantVmAccess(vmid *uint16, filepath *uint16) (hr error) {
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procGrantVmAccess.Addr(), 2, uintptr(unsafe.Pointer(vmid)), uintptr(unsafe.Pointer(filepath)), 0)
|
||||
if int32(r0) < 0 {
|
||||
hr = interop.Win32FromHresult(r0)
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user