From 6c84328107b950f774da1b2be3ef59371b68de45 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Thu, 27 Apr 2017 13:50:45 -0400 Subject: [PATCH] Bump github.com/containers/storage Signed-off-by: Nalin Dahyabhai Closes: #87 Approved by: nalind --- .../drivers/{overlay2 => overlay}/mount.go | 2 +- .../drivers/{overlay2 => overlay}/overlay.go | 45 ++++++++++++------- .../overlay_unsupported.go | 2 +- .../drivers/{overlay2 => overlay}/randomid.go | 2 +- .../drivers/register/register_overlay.go | 4 +- 5 files changed, 35 insertions(+), 20 deletions(-) rename vendor/github.com/containers/storage/drivers/{overlay2 => overlay}/mount.go (99%) rename vendor/github.com/containers/storage/drivers/{overlay2 => overlay}/overlay.go (90%) rename vendor/github.com/containers/storage/drivers/{overlay2 => overlay}/overlay_unsupported.go (51%) rename vendor/github.com/containers/storage/drivers/{overlay2 => overlay}/randomid.go (99%) diff --git a/vendor/github.com/containers/storage/drivers/overlay2/mount.go b/vendor/github.com/containers/storage/drivers/overlay/mount.go similarity index 99% rename from vendor/github.com/containers/storage/drivers/overlay2/mount.go rename to vendor/github.com/containers/storage/drivers/overlay/mount.go index e6723001..1b53f0c8 100644 --- a/vendor/github.com/containers/storage/drivers/overlay2/mount.go +++ b/vendor/github.com/containers/storage/drivers/overlay/mount.go @@ -1,6 +1,6 @@ // +build linux -package overlay2 +package overlay import ( "bytes" diff --git a/vendor/github.com/containers/storage/drivers/overlay2/overlay.go b/vendor/github.com/containers/storage/drivers/overlay/overlay.go similarity index 90% rename from vendor/github.com/containers/storage/drivers/overlay2/overlay.go rename to vendor/github.com/containers/storage/drivers/overlay/overlay.go index 493676d8..7b9cff56 100644 --- a/vendor/github.com/containers/storage/drivers/overlay2/overlay.go +++ b/vendor/github.com/containers/storage/drivers/overlay/overlay.go @@ -1,6 +1,6 @@ // +build linux -package overlay2 +package overlay import ( "bufio" @@ -61,10 +61,9 @@ var ( // that mounts do not fail due to length. const ( - driverName = "overlay2" - linkDir = "l" - lowerFile = "lower" - maxDepth = 128 + linkDir = "l" + lowerFile = "lower" + maxDepth = 128 // idLength represents the number of random characters // which can be used to create the unique link identifer @@ -78,6 +77,7 @@ const ( // Driver contains information about the home directory and the list of active mounts that are created using this driver. type Driver struct { + name string home string uidMaps []idtools.IDMap gidMaps []idtools.IDMap @@ -87,13 +87,13 @@ type Driver struct { var backingFs = "" func init() { - graphdriver.Register(driverName, Init) + graphdriver.Register("overlay", InitAsOverlay) + graphdriver.Register("overlay2", InitAsOverlay2) } -// Init returns the a native diff driver for overlay filesystem. -// If overlay filesystem is not supported on the host, graphdriver.ErrNotSupported is returned as error. -// If a overlay filesystem is not supported over a existing filesystem then error graphdriver.ErrIncompatibleFS is returned. -func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) { +// InitWithName returns the a naive diff driver for the overlay filesystem, +// which returns the passed-in name when asked which driver it is. +func InitWithName(name, home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) { opts, err := parseOptions(options) if err != nil { return nil, err @@ -112,7 +112,7 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap if !opts.overrideKernelCheck { return nil, graphdriver.ErrNotSupported } - logrus.Warnf("Using pre-4.0.0 kernel for overlay2, mount failures may require kernel update") + logrus.Warnf("Using pre-4.0.0 kernel for overlay, mount failures may require kernel update") } fsMagic, err := graphdriver.GetFSMagic(home) @@ -126,7 +126,7 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap // check if they are running over btrfs, aufs, zfs, overlay, or ecryptfs switch fsMagic { case graphdriver.FsMagicBtrfs, graphdriver.FsMagicAufs, graphdriver.FsMagicZfs, graphdriver.FsMagicOverlay, graphdriver.FsMagicEcryptfs: - logrus.Errorf("'overlay2' is not supported over %s", backingFs) + logrus.Errorf("'overlay' is not supported over %s", backingFs) return nil, graphdriver.ErrIncompatibleFS } @@ -144,6 +144,7 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap } d := &Driver{ + name: name, home: home, uidMaps: uidMaps, gidMaps: gidMaps, @@ -153,6 +154,20 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap return d, nil } +// InitAsOverlay returns the a naive diff driver for overlay filesystem. +// If overlay filesystem is not supported on the host, graphdriver.ErrNotSupported is returned as error. +// If a overlay filesystem is not supported over a existing filesystem then error graphdriver.ErrIncompatibleFS is returned. +func InitAsOverlay(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) { + return InitWithName("overlay", home, options, uidMaps, gidMaps) +} + +// InitAsOverlay2 returns the a naive diff driver for overlay filesystem. +// If overlay filesystem is not supported on the host, graphdriver.ErrNotSupported is returned as error. +// If a overlay filesystem is not supported over a existing filesystem then error graphdriver.ErrIncompatibleFS is returned. +func InitAsOverlay2(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) { + return InitWithName("overlay2", home, options, uidMaps, gidMaps) +} + type overlayOptions struct { overrideKernelCheck bool } @@ -166,13 +181,13 @@ func parseOptions(options []string) (*overlayOptions, error) { } key = strings.ToLower(key) switch key { - case "overlay2.override_kernel_check": + case "overlay.override_kernel_check", "overlay2.override_kernel_check": o.overrideKernelCheck, err = strconv.ParseBool(val) if err != nil { return nil, err } default: - return nil, fmt.Errorf("overlay2: Unknown option %s", key) + return nil, fmt.Errorf("overlay: Unknown option %s", key) } } return o, nil @@ -200,7 +215,7 @@ func supportsOverlay() error { } func (d *Driver) String() string { - return driverName + return d.name } // Status returns current driver information in a two dimensional string array. diff --git a/vendor/github.com/containers/storage/drivers/overlay2/overlay_unsupported.go b/vendor/github.com/containers/storage/drivers/overlay/overlay_unsupported.go similarity index 51% rename from vendor/github.com/containers/storage/drivers/overlay2/overlay_unsupported.go rename to vendor/github.com/containers/storage/drivers/overlay/overlay_unsupported.go index e5ac4ca8..3dbb4de4 100644 --- a/vendor/github.com/containers/storage/drivers/overlay2/overlay_unsupported.go +++ b/vendor/github.com/containers/storage/drivers/overlay/overlay_unsupported.go @@ -1,3 +1,3 @@ // +build !linux -package overlay2 +package overlay diff --git a/vendor/github.com/containers/storage/drivers/overlay2/randomid.go b/vendor/github.com/containers/storage/drivers/overlay/randomid.go similarity index 99% rename from vendor/github.com/containers/storage/drivers/overlay2/randomid.go rename to vendor/github.com/containers/storage/drivers/overlay/randomid.go index af5cb659..983ed76b 100644 --- a/vendor/github.com/containers/storage/drivers/overlay2/randomid.go +++ b/vendor/github.com/containers/storage/drivers/overlay/randomid.go @@ -1,6 +1,6 @@ // +build linux -package overlay2 +package overlay import ( "crypto/rand" diff --git a/vendor/github.com/containers/storage/drivers/register/register_overlay.go b/vendor/github.com/containers/storage/drivers/register/register_overlay.go index c0ce60e7..2d61219b 100644 --- a/vendor/github.com/containers/storage/drivers/register/register_overlay.go +++ b/vendor/github.com/containers/storage/drivers/register/register_overlay.go @@ -3,6 +3,6 @@ package register import ( - // register the overlay2 graphdriver - _ "github.com/containers/storage/drivers/overlay2" + // register the overlay graphdriver + _ "github.com/containers/storage/drivers/overlay" )