-
Notifications
You must be signed in to change notification settings - Fork 275
support both cimfs and cimwriter dlls #2587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,45 @@ | ||||||
| //go:build windows | ||||||
|
|
||||||
| package cimfs | ||||||
|
|
||||||
| import ( | ||||||
| "github.com/Microsoft/go-winio/pkg/guid" | ||||||
|
|
||||||
| "github.com/Microsoft/hcsshim/internal/winapi/types" | ||||||
| ) | ||||||
|
|
||||||
| // Type aliases | ||||||
| type g = guid.GUID | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know its already called
Suggested change
|
||||||
| type FsHandle = types.FsHandle | ||||||
| type StreamHandle = types.StreamHandle | ||||||
| type FileMetadata = types.CimFsFileMetadata | ||||||
| type ImagePath = types.CimFsImagePath | ||||||
|
|
||||||
| //sys CimMountImage(imagePath string, fsName string, flags uint32, volumeID *g) (hr error) = cimfs.CimMountImage? | ||||||
| //sys CimDismountImage(volumeID *g) (hr error) = cimfs.CimDismountImage? | ||||||
|
|
||||||
| //sys CimCreateImage(imagePath string, oldFSName *uint16, newFSName *uint16, cimFSHandle *FsHandle) (hr error) = cimfs.CimCreateImage? | ||||||
| //sys CimCreateImage2(imagePath string, flags uint32, oldFSName *uint16, newFSName *uint16, cimFSHandle *FsHandle) (hr error) = cimfs.CimCreateImage2? | ||||||
| //sys CimCloseImage(cimFSHandle FsHandle) = cimfs.CimCloseImage? | ||||||
| //sys CimCommitImage(cimFSHandle FsHandle) (hr error) = cimfs.CimCommitImage? | ||||||
|
|
||||||
| //sys CimCreateFile(cimFSHandle FsHandle, path string, file *FileMetadata, cimStreamHandle *StreamHandle) (hr error) = cimfs.CimCreateFile? | ||||||
| //sys CimCloseStream(cimStreamHandle StreamHandle) (hr error) = cimfs.CimCloseStream? | ||||||
| //sys CimWriteStream(cimStreamHandle StreamHandle, buffer uintptr, bufferSize uint32) (hr error) = cimfs.CimWriteStream? | ||||||
| //sys CimDeletePath(cimFSHandle FsHandle, path string) (hr error) = cimfs.CimDeletePath? | ||||||
| //sys CimCreateHardLink(cimFSHandle FsHandle, newPath string, oldPath string) (hr error) = cimfs.CimCreateHardLink? | ||||||
| //sys CimCreateAlternateStream(cimFSHandle FsHandle, path string, size uint64, cimStreamHandle *StreamHandle) (hr error) = cimfs.CimCreateAlternateStream? | ||||||
| //sys CimAddFsToMergedImage(cimFSHandle FsHandle, path string) (hr error) = cimfs.CimAddFsToMergedImage? | ||||||
| //sys CimAddFsToMergedImage2(cimFSHandle FsHandle, path string, flags uint32) (hr error) = cimfs.CimAddFsToMergedImage2? | ||||||
| //sys CimMergeMountImage(numCimPaths uint32, backingImagePaths *ImagePath, flags uint32, volumeID *g) (hr error) = cimfs.CimMergeMountImage? | ||||||
| //sys CimTombstoneFile(cimFSHandle FsHandle, path string) (hr error) = cimfs.CimTombstoneFile? | ||||||
| //sys CimCreateMergeLink(cimFSHandle FsHandle, newPath string, oldPath string) (hr error) = cimfs.CimCreateMergeLink? | ||||||
| //sys CimSealImage(blockCimPath string, hashSize *uint64, fixedHeaderSize *uint64, hash *byte) (hr error) = cimfs.CimSealImage? | ||||||
| //sys CimGetVerificationInformation(blockCimPath string, isSealed *uint32, hashSize *uint64, signatureSize *uint64, fixedHeaderSize *uint64, hash *byte, signature *byte) (hr error) = cimfs.CimGetVerificationInformation? | ||||||
| //sys CimMountVerifiedImage(imagePath string, fsName string, flags uint32, volumeID *g, hashSize uint16, hash *byte) (hr error) = cimfs.CimMountVerifiedImage? | ||||||
| //sys CimMergeMountVerifiedImage(numCimPaths uint32, backingImagePaths *ImagePath, flags uint32, volumeID *g, hashSize uint16, hash *byte) (hr error) = cimfs.CimMergeMountVerifiedImage | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. carried over from
Suggested change
|
||||||
|
|
||||||
| // CimFsSupported checks if cimfs.dll is present on the system. | ||||||
| func CimFsSupported() bool { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: avoid stutter here (
Suggested change
|
||||||
| return modcimfs.Load() == nil | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| package cimfs | ||
|
|
||
| //go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go ./*.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could probably do something like the below to simplify a lot the boilerplate for picking between the
cimfsandcimwriter(playground):