-
Notifications
You must be signed in to change notification settings - Fork 184
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
Implement winio.GetFileStandardInfo
#185
Conversation
The discussion about bools reminded me to that I hadn't written any tests; It turns out the Update: Yeah, |
a560866
to
8e16071
Compare
I was able to add tests for everything but the As far as I can tell, the only way to trigger |
8e16071
to
b35a191
Compare
Flicking over to take advantage of I wasn't sure if it's actually desirable to move from (Windows-specific) I did also convert the entire rest of the package, and if this is something that we actually want, rather than just a learning exercise for me, the branch is TBBle/go-winio@GetFileStandardInfo...TBBle:use-x_sys_windows-instead-of-syscall, and I can make it a PR after this lands.
The rest of the conversion should be ready now. I've only put it through the unit tests locally, but I did manually inspect every substitution except sometimes when I was replacing one generated function with another, and they had the same parameters. On the other hand, if this PR just got too complex, it's easy enough to roll back to the last version and apply the |
b35a191
to
91aeaa6
Compare
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.
LGTM. Just a minor nit.
d174434
to
373de8a
Compare
This pulls in microsoft/go-winio#185, which is based on current go-winio master, to support more-efficient hardlink detection when exporting base layers. This ends up pulling a newer version of golang.org/x/sys too. Although not strictly necessary, this allows exercising this code when I pull this into containerd, since until microsoft#901 is merged, I need to pull _something_ for containerd anyway.
Poke: I think this one's ready to go, and I'd like to land it so I can update microsoft/hcsshim#901 to take advantage of it, as well as flush it through so I can rebase my "Kill |
This pulls in microsoft/go-winio#185, which is based on current go-winio master, to support more-efficient hardlink detection when exporting base layers. This ends up pulling a newer version of golang.org/x/sys too. Although not strictly necessary, this allows exercising this code when I pull this into containerd, since until microsoft#901 is merged, I need to pull _something_ for containerd anyway.
@kevpar ptal 🤗 |
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.
LGTM, could you rebase?
This moves all the current users of $GOROOT/src/syscall/mksyscall_windows.go to instead use golang.org/x/sys/windows/mkwinsyscall, as directed by the version of the former in Go 1.15. It also syncs the local forks of mksyscall_windows.go with the latest version of golang.org/x/sys/windows/mkwinsyscall/mkwinsyscall.go, so that the local patches can be easily seen in a side-by-side comparison. Significant changes compared to the in-tree forked versions: * *bool parameters are read back through a temp-var, not directly like other pointer parameters. * ?-suffixed function names support testing for function presence before calling. This replaces a local implementation of this in pkg/security, which was not actually used anyway. The upstream version correctly supports functions that don't already have an error return. * `errnoErr(0)` is now useful, so each call of `errnoErr` doesn't need to be protected with a check for 0 first. * The generated functions are now sorted. This of course produced a *lot* of churn in the generated files. vhd\vhd.go was changed to generate syscalls into zvhd_windows.go, since regeneration removes the build tag added by hand in 9d82773. After all that, I also ran ``` go generate . .\pkg\etw\ .\pkg\process\ .\pkg\security\ .\vhd\ ``` to update all the existing generated code. Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
At this point points of difference between the three local mksyscall_windows.go implementations and golang.org/x/sys/windows/mkwinsyscall v0.0.0-20210104204734-6f8348627aad are: - pkg/etw: Deduplicates imported functions due to multiple calling APIs - pkg/security and vhd: Forced UTF-16 mode, not checking A/W suffix. I also removed cosmetic differences between these two implementations. `go generate` reports no changes with these updates. Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
We also get pre-defined constants instead of carrying our own copies. However, this changes the public API winio.FileBasicInfo from using syscall.Filetime to using windows.Filetime, as visible in backuptar/tar.go. Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
373de8a
to
ef753e6
Compare
Rebased. Helpfully someone pulled in an even-newer Edit: 🚀🚀🚀 |
This pulls in microsoft/go-winio#185, which is based on current go-winio master, to support more-efficient hardlink detection when exporting base layers. This ends up pulling a newer version of golang.org/x/sys too. Although not strictly necessary, this allows exercising this code when I pull this into containerd, since until microsoft#901 is merged, I need to pull _something_ for containerd anyway.
This pulls in an updated Microsoft/go-winio in order to use GetFileStandardInfo to recognise hard-linked files, added in microsoft/go-winio#185 Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
This pulls in an updated Microsoft/go-winio in order to use GetFileStandardInfo to recognise hard-linked files, added in microsoft/go-winio#185 Consequently, this pulls in containerd v1.5.0-beta1, as v1.4.0 and earlier have fork of go-winio's backuptar which has a different API in go-winio now. Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
This pulls in an updated Microsoft/go-winio in order to use GetFileStandardInfo to recognise hard-linked files, added in microsoft/go-winio#185 Consequently, this pulls in containerd v1.5.0-beta1, as v1.4.0 and earlier have fork of go-winio's backuptar which has a different API in go-winio now. Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
This pulls in an updated Microsoft/go-winio in order to use GetFileStandardInfo to recognise hard-linked files, added in microsoft/go-winio#185 Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
This pulls in an updated Microsoft/go-winio in order to use GetFileStandardInfo to recognise hard-linked files, added in microsoft/go-winio#185 Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
This pulls in an updated Microsoft/go-winio in order to use GetFileStandardInfo to recognise hard-linked files, added in microsoft/go-winio#185 Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
See microsoft/go-winio#185; this also pulls in a newer golang.org/x/sys release and some generated syscall cleanups. Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
This get-only API will be useful for detecting when a file has multiple links to it.
Specifically, I plan to use this to provide an optimisation for microsoft/hcsshim#901 (or afterwards, it's not a blocker...) by only attempting to recognise hard-links for files which have multiple links.
See TBBle/hcsshim@base-layer-manipulation...TBBle:hack-base-layer-manipulation-with-branched-go-winio for the example use-case.