mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 17:49:10 +00:00
Remove dead code
Signed-off-by: David Gageot <david.gageot@docker.com>
This commit is contained in:
parent
07adfa2bb8
commit
d7ec2209b1
22
src/cmd/linuxkit/cache/nopcloserwriter.go
vendored
22
src/cmd/linuxkit/cache/nopcloserwriter.go
vendored
@ -1,22 +0,0 @@
|
|||||||
package cache
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
)
|
|
||||||
|
|
||||||
type nopCloserWriter struct {
|
|
||||||
writer io.Writer
|
|
||||||
}
|
|
||||||
|
|
||||||
func (n nopCloserWriter) Write(b []byte) (int, error) {
|
|
||||||
return n.writer.Write(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (n nopCloserWriter) Close() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// NopCloserWriter wrap an io.Writer with a no-op Closer
|
|
||||||
func NopCloserWriter(writer io.Writer) io.WriteCloser {
|
|
||||||
return nopCloserWriter{writer}
|
|
||||||
}
|
|
@ -94,24 +94,6 @@ func copyTarEntry(w *Writer, thdr *tar.Header, r io.Reader) (written int64, err
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// CopyTar copies a tar stream into an initrd
|
|
||||||
func CopyTar(w *Writer, r *tar.Reader) (written int64, err error) {
|
|
||||||
for {
|
|
||||||
var thdr *tar.Header
|
|
||||||
thdr, err = r.Next()
|
|
||||||
if err == io.EOF {
|
|
||||||
return written, nil
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
written, err = copyTarEntry(w, thdr, r)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopySplitTar copies a tar stream into an initrd, but splits out kernel, cmdline, and ucode
|
// CopySplitTar copies a tar stream into an initrd, but splits out kernel, cmdline, and ucode
|
||||||
func CopySplitTar(w *Writer, r *tar.Reader) (kernel []byte, cmdline string, ucode []byte, err error) {
|
func CopySplitTar(w *Writer, r *tar.Reader) (kernel []byte, cmdline string, ucode []byte, err error) {
|
||||||
for {
|
for {
|
||||||
@ -188,10 +170,3 @@ func (w *Writer) Close() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy reads a tarball in a stream and outputs a compressed init ram disk
|
|
||||||
func Copy(w *Writer, r io.Reader) (int64, error) {
|
|
||||||
tr := tar.NewReader(r)
|
|
||||||
|
|
||||||
return CopyTar(w, tr)
|
|
||||||
}
|
|
||||||
|
@ -24,18 +24,6 @@ import (
|
|||||||
var imagesBytes []byte
|
var imagesBytes []byte
|
||||||
var outputImages map[string]string
|
var outputImages map[string]string
|
||||||
|
|
||||||
// UpdateOutputImages overwrite the docker images used to build the outputs
|
|
||||||
// 'update' is a map where the key is the output format and the value is a LinuxKit 'mkimage' image.
|
|
||||||
func UpdateOutputImages(update map[string]string) error {
|
|
||||||
for k, img := range update {
|
|
||||||
if _, ok := outputImages[k]; !ok {
|
|
||||||
return fmt.Errorf("Image format %s is not known", k)
|
|
||||||
}
|
|
||||||
outputImages[k] = img
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var outFuns = map[string]func(string, io.Reader, int) error{
|
var outFuns = map[string]func(string, io.Reader, int) error{
|
||||||
"kernel+initrd": func(base string, image io.Reader, size int) error {
|
"kernel+initrd": func(base string, image io.Reader, size int) error {
|
||||||
kernel, initrd, cmdline, ucode, err := tarToInitrd(image)
|
kernel, initrd, cmdline, ucode, err := tarToInitrd(image)
|
||||||
|
Loading…
Reference in New Issue
Block a user