Skip to content

Commit

Permalink
Merge pull request #20982 from Microsoft/jstarks/fix_tp5_commit
Browse files Browse the repository at this point in the history
Windows: Revendor github.com/Microsoft/hcsshim
  • Loading branch information
cpuguy83 committed Mar 7, 2016
2 parents 64a4a7a + 53b8b8f commit bc730f3
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 13 deletions.
2 changes: 1 addition & 1 deletion hack/vendor.sh
Expand Up @@ -7,7 +7,7 @@ source 'hack/.vendor-helpers.sh'

# the following lines are in sorted order, FYI
clone git github.com/Azure/go-ansiterm 70b2c90b260171e829f1ebd7c17f600c11858dbe
clone git github.com/Microsoft/hcsshim 9488dda5ab5d3c1af26e17d3d9fc2e9f29009a7b
clone git github.com/Microsoft/hcsshim 116e0e9f5ced0cec94ae46d0aa1b3002a325f532
clone git github.com/Microsoft/go-winio c40bf24f405ab3cc8e1383542d474e813332de6d
clone git github.com/Sirupsen/logrus v0.9.0 # logrus is a common dependency among multiple deps
clone git github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
Expand Down
2 changes: 2 additions & 0 deletions vendor/src/github.com/Microsoft/hcsshim/hcsshim.go
Expand Up @@ -27,6 +27,8 @@ import (
//sys nameToGuid(name string, guid *GUID) (hr error) = vmcompute.NameToGuid?
//sys prepareLayer(info *driverInfo, id string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) = vmcompute.PrepareLayer?
//sys unprepareLayer(info *driverInfo, id string) (hr error) = vmcompute.UnprepareLayer?
//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?
Expand Down
20 changes: 14 additions & 6 deletions vendor/src/github.com/Microsoft/hcsshim/hnsfuncs.go
Expand Up @@ -36,12 +36,16 @@ type MacPool struct {

// HNSNetwork represents a network in HNS
type HNSNetwork struct {
Id string `json:",omitempty"`
Name string `json:",omitempty"`
Type string `json:",omitempty"`
Policies []json.RawMessage `json:",omitempty"`
MacPools []MacPool `json:",omitempty"`
Subnets []Subnet `json:",omitempty"`
Id string `json:",omitempty"`
Name string `json:",omitempty"`
Type string `json:",omitempty"`
NetworkAdapterName string `json:",omitempty"`
SourceMac string `json:",omitempty"`
Policies []json.RawMessage `json:",omitempty"`
MacPools []MacPool `json:",omitempty"`
Subnets []Subnet `json:",omitempty"`
DNSSuffix string `json:",omitempty"`
DNSServerList string `json:",omitempty"`
}

// HNSEndpoint represents a network endpoint in HNS
Expand All @@ -53,6 +57,10 @@ type HNSEndpoint struct {
Policies []json.RawMessage `json:",omitempty"`
MacAddress string `json:",omitempty"`
IPAddress net.IP `json:",omitempty"`
DNSSuffix string `json:",omitempty"`
DNSServerList string `json:",omitempty"`
GatewayAddress string `json:",omitempty"`
PrefixLength uint8 `json:",omitempty"`
}

type hnsNetworkResponse struct {
Expand Down
8 changes: 2 additions & 6 deletions vendor/src/github.com/Microsoft/hcsshim/legacy.go
Expand Up @@ -319,11 +319,7 @@ func (w *LegacyLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo) erro
if err != nil {
return err
}
if strings.HasPrefix(name, `Files\`) {
path += ".$wcidirs$"
} else {
createDisposition = syscall.OPEN_EXISTING
}
path += ".$wcidirs$"
}

f, err := openFileOrDir(path, syscall.GENERIC_READ|syscall.GENERIC_WRITE, createDisposition)
Expand All @@ -344,7 +340,7 @@ func (w *LegacyLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo) erro
return err
}

if !strings.HasPrefix(name, `Files\`) {
if strings.HasPrefix(name, `Hives\`) {
w.backupWriter = winio.NewBackupFileWriter(f, false)
} else {
if !w.isTP4Format {
Expand Down
23 changes: 23 additions & 0 deletions vendor/src/github.com/Microsoft/hcsshim/processimage.go
@@ -0,0 +1,23 @@
package hcsshim

import "os"

// ProcessBaseLayer post-processes a base layer that has had its files extracted.
// The files should have been extracted to <path>\Files.
func ProcessBaseLayer(path string) error {
err := processBaseImage(path)
if err != nil {
return &os.PathError{Op: "ProcessBaseLayer", Path: path, Err: err}
}
return nil
}

// ProcessUtilityVMImage post-processes a utility VM image that has had its files extracted.
// The files should have been extracted to <path>\Files.
func ProcessUtilityVMImage(path string) error {
err := processUtilityImage(path)
if err != nil {
return &os.PathError{Op: "ProcessUtilityVMImage", Path: path, Err: err}
}
return nil
}
42 changes: 42 additions & 0 deletions vendor/src/github.com/Microsoft/hcsshim/zhcsshim.go
Expand Up @@ -30,6 +30,8 @@ var (
procNameToGuid = modvmcompute.NewProc("NameToGuid")
procPrepareLayer = modvmcompute.NewProc("PrepareLayer")
procUnprepareLayer = modvmcompute.NewProc("UnprepareLayer")
procProcessBaseImage = modvmcompute.NewProc("ProcessBaseImage")
procProcessUtilityImage = modvmcompute.NewProc("ProcessUtilityImage")
procImportLayerBegin = modvmcompute.NewProc("ImportLayerBegin")
procImportLayerNext = modvmcompute.NewProc("ImportLayerNext")
procImportLayerWrite = modvmcompute.NewProc("ImportLayerWrite")
Expand Down Expand Up @@ -370,6 +372,46 @@ func _unprepareLayer(info *driverInfo, id *uint16) (hr error) {
return
}

func processBaseImage(path string) (hr error) {
var _p0 *uint16
_p0, hr = syscall.UTF16PtrFromString(path)
if hr != nil {
return
}
return _processBaseImage(_p0)
}

func _processBaseImage(path *uint16) (hr error) {
if hr = procProcessBaseImage.Find(); hr != nil {
return
}
r0, _, _ := syscall.Syscall(procProcessBaseImage.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
if int32(r0) < 0 {
hr = syscall.Errno(win32FromHresult(r0))
}
return
}

func processUtilityImage(path string) (hr error) {
var _p0 *uint16
_p0, hr = syscall.UTF16PtrFromString(path)
if hr != nil {
return
}
return _processUtilityImage(_p0)
}

func _processUtilityImage(path *uint16) (hr error) {
if hr = procProcessUtilityImage.Find(); hr != nil {
return
}
r0, _, _ := syscall.Syscall(procProcessUtilityImage.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
if int32(r0) < 0 {
hr = syscall.Errno(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)
Expand Down

0 comments on commit bc730f3

Please sign in to comment.