...

Source file src/github.com/Microsoft/hcsshim/computestorage/mount.go

Documentation: github.com/Microsoft/hcsshim/computestorage

     1  //go:build windows
     2  
     3  package computestorage
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/Microsoft/hcsshim/internal/interop"
     9  	"github.com/Microsoft/hcsshim/internal/oc"
    10  	"github.com/pkg/errors"
    11  	"golang.org/x/sys/windows"
    12  )
    13  
    14  // GetLayerVhdMountPath returns the volume path for a virtual disk of a writable container layer.
    15  func GetLayerVhdMountPath(ctx context.Context, vhdHandle windows.Handle) (path string, err error) {
    16  	title := "hcsshim::GetLayerVhdMountPath"
    17  	ctx, span := oc.StartSpan(ctx, title) //nolint:ineffassign,staticcheck
    18  	defer span.End()
    19  	defer func() { oc.SetSpanStatus(span, err) }()
    20  
    21  	var mountPath *uint16
    22  	err = hcsGetLayerVhdMountPath(vhdHandle, &mountPath)
    23  	if err != nil {
    24  		return "", errors.Wrap(err, "failed to get vhd mount path")
    25  	}
    26  	path = interop.ConvertAndFreeCoTaskMemString(mountPath)
    27  	return path, nil
    28  }
    29  

View as plain text