Skip to content

Commit

Permalink
Change CreateNTFSVHD to use computestorage call
Browse files Browse the repository at this point in the history
* Previously CreateNTFSVHD would call a local (/internal/hcs) binding of hcsFormatWritableLayerVhd.
As the computestorage calls are all present now, just use the exported calls from the
computestorage package instead.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
dcantah committed Nov 9, 2020
1 parent 1432f9c commit 36c772f
Showing 3 changed files with 3 additions and 61 deletions.
5 changes: 0 additions & 5 deletions internal/hcs/syscall.go

This file was deleted.

5 changes: 3 additions & 2 deletions internal/hcs/utils.go
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import (

"github.com/Microsoft/go-winio"
diskutil "github.com/Microsoft/go-winio/vhd"
"github.com/Microsoft/hcsshim/computestorage"
"github.com/pkg/errors"
"golang.org/x/sys/windows"
)
@@ -36,7 +37,7 @@ func makeOpenFiles(hs []syscall.Handle) (_ []io.ReadWriteCloser, err error) {
return fs, nil
}

// creates a VHD formatted with NTFS of size `sizeGB` at the given `vhdPath`.
// CreateNTFSVHD creates a VHD formatted with NTFS of size `sizeGB` at the given `vhdPath`.
func CreateNTFSVHD(ctx context.Context, vhdPath string, sizeGB uint32) (err error) {
if err := diskutil.CreateVhdx(vhdPath, sizeGB, 1); err != nil {
return errors.Wrap(err, "failed to create VHD")
@@ -53,7 +54,7 @@ func CreateNTFSVHD(ctx context.Context, vhdPath string, sizeGB uint32) (err erro
}
}()

if err := hcsFormatWritableLayerVhd(uintptr(vhd)); err != nil {
if err := computestorage.FormatWritableLayerVhd(ctx, windows.Handle(vhd)); err != nil {
return errors.Wrap(err, "failed to format VHD")
}

54 changes: 0 additions & 54 deletions internal/hcs/zsyscall_windows.go

This file was deleted.

0 comments on commit 36c772f

Please sign in to comment.