Skip to content
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

squashfs: passthrough squashfs compressed layers #1408

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/compression/compression.go
Expand Up @@ -35,13 +35,17 @@ var (
// Zstd:chunked compression.
ZstdChunked = internal.NewAlgorithm(types.ZstdChunkedAlgorithmName, types.ZstdAlgorithmName, /* Note: InternalUnstableUndocumentedMIMEQuestionMark is not ZstdChunkedAlgorithmName */
nil, ZstdDecompressor, compressor.ZstdCompressor)
// Squashfs compression.
Squashfs = internal.NewAlgorithm(types.SquashfsAlgorithmName, types.SquashfsAlgorithmName,
[]byte{0x68, 0x73, 0x71, 0x73}, SquashfsDecompressor, nil)

compressionAlgorithms = map[string]Algorithm{
Gzip.Name(): Gzip,
Bzip2.Name(): Bzip2,
Xz.Name(): Xz,
Zstd.Name(): Zstd,
ZstdChunked.Name(): ZstdChunked,
Squashfs.Name(): Squashfs,
}
)

Expand Down Expand Up @@ -77,6 +81,11 @@ func XzDecompressor(r io.Reader) (io.ReadCloser, error) {
return ioutil.NopCloser(r), nil
}

// SquashfsDecompressor is a DecompressorFunc for the squashfs compression algorithm.
func SquashfsDecompressor(r io.Reader) (io.ReadCloser, error) {
return ioutil.NopCloser(r), nil
}

// gzipCompressor is a CompressorFunc for the gzip compression algorithm.
func gzipCompressor(r io.Writer, metadata map[string]string, level *int) (io.WriteCloser, error) {
if level != nil {
Expand Down
5 changes: 5 additions & 0 deletions pkg/compression/types/types.go
Expand Up @@ -38,4 +38,9 @@ const (
// will actually be available. (In fact it is intended for this types package not to depend
// on any of the implementations.)
ZstdChunkedAlgorithmName = "zstd:chunked"
// SquashfsAlgorithName is the name used by pkg/compression.Squashfs
// NOTE: Importing only this /types package does not inherently guarantee a Squashfs algorithm
// will actually be available. (In fact it is intended for this types package not to depend
// on any of the implementations.)
SquashfsAlgorithmName = "squashfs"
)