1eacf78858
To support the detection and creation of sparse files, add two new methods: func Header.DetectSparseHoles(*os.File) error func Header.PunchSparseHoles(*os.File) error DetectSparseHoles is intended to be used after FileInfoHeader prior to serializing the Header with WriteHeader. For each OS, it uses specialized logic to detect the location of sparse holes. On most Unix systems, it uses SEEK_HOLE and SEEK_DATA to query for the holes. On Windows, it uses a specialized the FSCTL_QUERY_ALLOCATED_RANGES syscall to query for all the holes. PunchSparseHoles is intended to be used after Reader.Next prior to populating the file with Reader.WriteTo. On Windows, this uses the FSCTL_SET_ZERO_DATA syscall. On other operating systems it simply truncates the file to the end-offset of SparseHoles. DetectSparseHoles and PunchSparseHoles are added as methods on Header because they are heavily tied to the operating system, for which there is already an existing precedence for (since FileInfoHeader makes uses of OS-specific details). Fixes #13548 Change-Id: I98a321dd1ce0165f3d143d4edadfda5e7db67746 Reviewed-on: https://go-review.googlesource.com/60871 Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> |
||
---|---|---|
.github | ||
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
AUTHORS | ||
CONTRIBUTING.md | ||
CONTRIBUTORS | ||
favicon.ico | ||
LICENSE | ||
PATENTS | ||
README.md | ||
robots.txt |
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Download and Install
Binary Distributions
Official binary distributions are available at https://golang.org/dl/.
After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.
Contributing
Go is the work of hundreds of contributors. We appreciate your help!
To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html
Note that the Go project does not use GitHub pull requests, and that we use the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.