"Fossies" - the Fresh Open Source Software Archive

Member "buildah-1.23.1/vendor/github.com/Microsoft/hcsshim/internal/wclayer/activatelayer.go" (28 Sep 2021, 891 Bytes) of package /linux/misc/buildah-1.23.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Go source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 package wclayer
    2 
    3 import (
    4     "context"
    5 
    6     "github.com/Microsoft/hcsshim/internal/hcserror"
    7     "github.com/Microsoft/hcsshim/internal/oc"
    8     "go.opencensus.io/trace"
    9 )
   10 
   11 // ActivateLayer will find the layer with the given id and mount it's filesystem.
   12 // For a read/write layer, the mounted filesystem will appear as a volume on the
   13 // host, while a read-only layer is generally expected to be a no-op.
   14 // An activated layer must later be deactivated via DeactivateLayer.
   15 func ActivateLayer(ctx context.Context, path string) (err error) {
   16     title := "hcsshim::ActivateLayer"
   17     ctx, span := trace.StartSpan(ctx, title) //nolint:ineffassign,staticcheck
   18     defer span.End()
   19     defer func() { oc.SetSpanStatus(span, err) }()
   20     span.AddAttributes(trace.StringAttribute("path", path))
   21 
   22     err = activateLayer(&stdDriverInfo, path)
   23     if err != nil {
   24         return hcserror.New(err, title+" - failed", "")
   25     }
   26     return nil
   27 }