Skip to content

Commit

Permalink
drivers: add new method SupportsShifting() to LayerIDMapUpdater
Browse files Browse the repository at this point in the history
Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Jul 26, 2018
1 parent 6480245 commit 9bb1031
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/aufs/aufs.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,3 +728,8 @@ func useDirperm() bool {
func (a *Driver) UpdateLayerIDMap(id string, toContainer, toHost *idtools.IDMappings, mountLabel string) error {
return fmt.Errorf("aufs doesn't support changing ID mappings")
}

// SupportsShifting tells whether the driver support shifting of the UIDs/GIDs in an userNS
func (a *Driver) SupportsShifting() bool {
return false
}
5 changes: 5 additions & 0 deletions drivers/chown.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,8 @@ func (n *naiveLayerIDMapUpdater) UpdateLayerIDMap(id string, toContainer, toHost

return ChownPathByMaps(layerFs, toContainer, toHost)
}

// SupportsShifting tells whether the driver support shifting of the UIDs/GIDs in an userNS
func (n *naiveLayerIDMapUpdater) SupportsShifting() bool {
return false
}
4 changes: 4 additions & 0 deletions drivers/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ type LayerIDMapUpdater interface {
// relative to a parent layer, but before this method is called, may be discarded
// by Diff().
UpdateLayerIDMap(id string, toContainer, toHost *idtools.IDMappings, mountLabel string) error

// SupportsShifting tells whether the driver support shifting of the UIDs/GIDs in a
// image and it is not required to Chown the files when running in an user namespace.
SupportsShifting() bool
}

// Driver is the interface for layered/snapshot file system drivers.
Expand Down
5 changes: 5 additions & 0 deletions drivers/windows/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,11 @@ func (d *Driver) UpdateLayerIDMap(id string, toContainer, toHost *idtools.IDMapp
return fmt.Errorf("windows doesn't support changing ID mappings")
}

// SupportsShifting tells whether the driver support shifting of the UIDs/GIDs in an userNS
func (d *Driver) SupportsShifting() bool {
return false
}

type storageOptions struct {
size uint64
}
Expand Down

0 comments on commit 9bb1031

Please sign in to comment.