mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	mount: move the MakePrivate to pkg/mount
The logic is unrelated to graphdriver. Signed-off-by: Vincent Batts <vbatts@redhat.com>
This commit is contained in:
		
							parent
							
								
									b63a254522
								
							
						
					
					
						commit
						930a756ad5
					
				
					 5 changed files with 21 additions and 19 deletions
				
			
		| 
						 | 
				
			
			@ -98,7 +98,7 @@ func Init(root string, options []string) (graphdriver.Driver, error) {
 | 
			
		|||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := graphdriver.MakePrivate(root); err != nil {
 | 
			
		||||
	if err := mountpk.MakePrivate(root); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,7 +40,7 @@ func Init(home string, options []string) (graphdriver.Driver, error) {
 | 
			
		|||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := graphdriver.MakePrivate(home); err != nil {
 | 
			
		||||
	if err := mount.MakePrivate(home); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ func Init(home string, options []string) (graphdriver.Driver, error) {
 | 
			
		|||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := graphdriver.MakePrivate(home); err != nil {
 | 
			
		||||
	if err := mount.MakePrivate(home); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,6 @@ import (
 | 
			
		|||
	"path"
 | 
			
		||||
 | 
			
		||||
	"github.com/docker/docker/pkg/archive"
 | 
			
		||||
	"github.com/docker/docker/pkg/mount"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type FsMagic uint64
 | 
			
		||||
| 
						 | 
				
			
			@ -139,18 +138,3 @@ func New(root string, options []string) (driver Driver, err error) {
 | 
			
		|||
	}
 | 
			
		||||
	return nil, fmt.Errorf("No supported storage backend found")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func MakePrivate(mountPoint string) error {
 | 
			
		||||
	mounted, err := mount.Mounted(mountPoint)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if !mounted {
 | 
			
		||||
		if err := mount.Mount(mountPoint, mountPoint, "none", "bind,rw"); err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return mount.ForceMount("", mountPoint, "none", "private")
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										18
									
								
								pkg/mount/sharedsubtree_linux.go
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								pkg/mount/sharedsubtree_linux.go
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
// +build linux
 | 
			
		||||
 | 
			
		||||
package mount
 | 
			
		||||
 | 
			
		||||
func MakePrivate(mountPoint string) error {
 | 
			
		||||
	mounted, err := Mounted(mountPoint)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if !mounted {
 | 
			
		||||
		if err := Mount(mountPoint, mountPoint, "none", "bind,rw"); err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ForceMount("", mountPoint, "none", "private")
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue