Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion guid.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ func NewGUID(source string) *GUID {
}

func (g *GUID) ToString() string {
return fmt.Sprintf("%x-%x-%x-%x-%x", g[0:4], g[4:6], g[6:8], g[8:10], g[10:])
return fmt.Sprintf("%x%x%x%x-%x%x-%x%x-%x-%x", g[3], g[2], g[1], g[0], g[5], g[4], g[7], g[6], g[8:10], g[10:])
}
12 changes: 9 additions & 3 deletions layerutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package hcsshim
// functionality.

import (
"path/filepath"
"syscall"

"github.com/Sirupsen/logrus"
Expand Down Expand Up @@ -84,9 +85,14 @@ func layerPathsToDescriptors(parentLayerPaths []string) ([]WC_LAYER_DESCRIPTOR,
var layers []WC_LAYER_DESCRIPTOR

for i := 0; i < len(parentLayerPaths); i++ {
// Create a layer descriptor, using the folder path
// Create a layer descriptor, using the folder name
// as the source for a GUID LayerId
g := NewGUID(parentLayerPaths[i])
_, folderName := filepath.Split(parentLayerPaths[i])
g, err := NameToGuid(folderName)
if err != nil {
logrus.Debugf("Failed to convert name to guid %s", err)
return nil, err
}

p, err := syscall.UTF16PtrFromString(parentLayerPaths[i])
if err != nil {
Expand All @@ -95,7 +101,7 @@ func layerPathsToDescriptors(parentLayerPaths []string) ([]WC_LAYER_DESCRIPTOR,
}

layers = append(layers, WC_LAYER_DESCRIPTOR{
LayerId: *g,
LayerId: g,
Flags: 0,
Pathp: p,
})
Expand Down
2 changes: 1 addition & 1 deletion nametoguid.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NameToGuid(name string) (id GUID, err error) {
}

// Call the procedure itself.
logrus.Debugf("Calling proc (1)")
logrus.Debugf("Calling proc")
r1, _, _ := proc.Call(
uintptr(unsafe.Pointer(namep)),
uintptr(unsafe.Pointer(&id)))
Expand Down