mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	devicemapper: remove unused code
This commit is contained in:
		
							parent
							
								
									1711de4b09
								
							
						
					
					
						commit
						153248b60f
					
				
					 5 changed files with 4 additions and 89 deletions
				
			
		
							
								
								
									
										14
									
								
								deviceset.go
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								deviceset.go
									
										
									
									
									
								
							|  | @ -1,14 +0,0 @@ | ||||||
| package docker |  | ||||||
| 
 |  | ||||||
| type DeviceSet interface { |  | ||||||
| 	AddDevice(hash, baseHash string) error |  | ||||||
| 	SetInitialized(hash string) error |  | ||||||
| 	DeactivateDevice(hash string) error |  | ||||||
| 	RemoveDevice(hash string) error |  | ||||||
| 	MountDevice(hash, path string) error |  | ||||||
| 	UnmountDevice(hash, path string, deactivate bool) error |  | ||||||
| 	HasDevice(hash string) bool |  | ||||||
| 	HasInitializedDevice(hash string) bool |  | ||||||
| 	HasActivatedDevice(hash string) bool |  | ||||||
| 	Shutdown() error |  | ||||||
| } |  | ||||||
|  | @ -573,19 +573,6 @@ func (devices *DeviceSetDM) waitClose(hash string) error { | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (devices *DeviceSetDM) DeactivateDevice(hash string) error { |  | ||||||
| 	devices.Lock() |  | ||||||
| 	defer devices.Unlock() |  | ||||||
| 
 |  | ||||||
| 	if err := devices.ensureInit(); err != nil { |  | ||||||
| 		utils.Debugf("\n--->Err: %s\n", err) |  | ||||||
| 		return err |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	utils.Debugf("DeactivateDevice %s", hash) |  | ||||||
| 	return devices.deactivateDevice(hash) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (devices *DeviceSetDM) Shutdown() error { | func (devices *DeviceSetDM) Shutdown() error { | ||||||
| 	devices.Lock() | 	devices.Lock() | ||||||
| 	utils.Debugf("[devmapper] Shutting down DeviceSet: %s", devices.root) | 	utils.Debugf("[devmapper] Shutting down DeviceSet: %s", devices.root) | ||||||
|  |  | ||||||
							
								
								
									
										3
									
								
								image.go
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								image.go
									
										
									
									
									
								
							|  | @ -6,6 +6,7 @@ import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"github.com/dotcloud/docker/utils" | 	"github.com/dotcloud/docker/utils" | ||||||
|  | 	"github.com/dotcloud/docker/devmapper" | ||||||
| 	"io" | 	"io" | ||||||
| 	"io/ioutil" | 	"io/ioutil" | ||||||
| 	"os" | 	"os" | ||||||
|  | @ -334,7 +335,7 @@ func (image *Image) applyLayer(layer, target string) error { | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (image *Image) ensureImageDevice(devices DeviceSet) error { | func (image *Image) ensureImageDevice(devices *devmapper.DeviceSetDM) error { | ||||||
| 	if devices.HasInitializedDevice(image.ID) { | 	if devices.HasInitializedDevice(image.ID) { | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -43,7 +43,7 @@ type Runtime struct { | ||||||
| 	volumes        *Graph | 	volumes        *Graph | ||||||
| 	srv            *Server | 	srv            *Server | ||||||
| 	Dns            []string | 	Dns            []string | ||||||
| 	deviceSet      DeviceSet | 	deviceSet      *devmapper.DeviceSetDM | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| var sysInitPath string | var sysInitPath string | ||||||
|  | @ -86,7 +86,7 @@ func (runtime *Runtime) getContainerElement(id string) *list.Element { | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (runtime *Runtime) GetDeviceSet() (DeviceSet, error) { | func (runtime *Runtime) GetDeviceSet() (*devmapper.DeviceSetDM, error) { | ||||||
| 	if runtime.deviceSet == nil { | 	if runtime.deviceSet == nil { | ||||||
| 		return nil, fmt.Errorf("No device set available") | 		return nil, fmt.Errorf("No device set available") | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -324,62 +324,3 @@ func TestParseLxcConfOpt(t *testing.T) { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 |  | ||||||
| type DeviceSetWrapper struct { |  | ||||||
| 	wrapped DeviceSet |  | ||||||
| 	prefix  string |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (wrapper *DeviceSetWrapper) wrap(hash string) string { |  | ||||||
| 	if hash != "" { |  | ||||||
| 		hash = wrapper.prefix + "-" + hash |  | ||||||
| 	} |  | ||||||
| 	return hash |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (wrapper *DeviceSetWrapper) AddDevice(hash, baseHash string) error { |  | ||||||
| 	return wrapper.wrapped.AddDevice(wrapper.wrap(hash), wrapper.wrap(baseHash)) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (wrapper *DeviceSetWrapper) SetInitialized(hash string) error { |  | ||||||
| 	return wrapper.wrapped.SetInitialized(wrapper.wrap(hash)) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (wrapper *DeviceSetWrapper) DeactivateDevice(hash string) error { |  | ||||||
| 	return wrapper.wrapped.DeactivateDevice(wrapper.wrap(hash)) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (wrapper *DeviceSetWrapper) Shutdown() error { |  | ||||||
| 	return nil |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (wrapper *DeviceSetWrapper) RemoveDevice(hash string) error { |  | ||||||
| 	return wrapper.wrapped.RemoveDevice(wrapper.wrap(hash)) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (wrapper *DeviceSetWrapper) MountDevice(hash, path string) error { |  | ||||||
| 	return wrapper.wrapped.MountDevice(wrapper.wrap(hash), path) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (wrapper *DeviceSetWrapper) UnmountDevice(hash, path string, deactivate bool) error { |  | ||||||
| 	return wrapper.wrapped.UnmountDevice(wrapper.wrap(hash), path, deactivate) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (wrapper *DeviceSetWrapper) HasDevice(hash string) bool { |  | ||||||
| 	return wrapper.wrapped.HasDevice(wrapper.wrap(hash)) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (wrapper *DeviceSetWrapper) HasInitializedDevice(hash string) bool { |  | ||||||
| 	return wrapper.wrapped.HasInitializedDevice(wrapper.wrap(hash)) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (wrapper *DeviceSetWrapper) HasActivatedDevice(hash string) bool { |  | ||||||
| 	return wrapper.wrapped.HasActivatedDevice(wrapper.wrap(hash)) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func NewDeviceSetWrapper(wrapped DeviceSet, prefix string) DeviceSet { |  | ||||||
| 	return &DeviceSetWrapper{ |  | ||||||
| 		wrapped: wrapped, |  | ||||||
| 		prefix:  prefix, |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Solomon Hykes
						Solomon Hykes