mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 10:03:42 +08:00 
			
		
		
		
	commitc41b006be1updated the version of docker/docker in go.mod, but possibly overlooked that there was still a replace rule present. As a result the version was not actually updated. This patch removes the replace rule, updating docker/docker to 9f28837c1d93 full diff:4634ce647c...9f28837c1dSigned-off-by: Sebastiaan van Stijn <github@gone.nl>
		
			
				
	
	
		
			74 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			74 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package mount
 | 
						|
 | 
						|
import "github.com/moby/sys/mountinfo"
 | 
						|
 | 
						|
// MakeShared ensures a mounted filesystem has the SHARED mount option enabled.
 | 
						|
// See the supported options in flags.go for further reference.
 | 
						|
func MakeShared(mountPoint string) error {
 | 
						|
	return ensureMountedAs(mountPoint, SHARED)
 | 
						|
}
 | 
						|
 | 
						|
// MakeRShared ensures a mounted filesystem has the RSHARED mount option enabled.
 | 
						|
// See the supported options in flags.go for further reference.
 | 
						|
func MakeRShared(mountPoint string) error {
 | 
						|
	return ensureMountedAs(mountPoint, RSHARED)
 | 
						|
}
 | 
						|
 | 
						|
// MakePrivate ensures a mounted filesystem has the PRIVATE mount option enabled.
 | 
						|
// See the supported options in flags.go for further reference.
 | 
						|
func MakePrivate(mountPoint string) error {
 | 
						|
	return ensureMountedAs(mountPoint, PRIVATE)
 | 
						|
}
 | 
						|
 | 
						|
// MakeRPrivate ensures a mounted filesystem has the RPRIVATE mount option
 | 
						|
// enabled. See the supported options in flags.go for further reference.
 | 
						|
func MakeRPrivate(mountPoint string) error {
 | 
						|
	return ensureMountedAs(mountPoint, RPRIVATE)
 | 
						|
}
 | 
						|
 | 
						|
// MakeSlave ensures a mounted filesystem has the SLAVE mount option enabled.
 | 
						|
// See the supported options in flags.go for further reference.
 | 
						|
func MakeSlave(mountPoint string) error {
 | 
						|
	return ensureMountedAs(mountPoint, SLAVE)
 | 
						|
}
 | 
						|
 | 
						|
// MakeRSlave ensures a mounted filesystem has the RSLAVE mount option enabled.
 | 
						|
// See the supported options in flags.go for further reference.
 | 
						|
func MakeRSlave(mountPoint string) error {
 | 
						|
	return ensureMountedAs(mountPoint, RSLAVE)
 | 
						|
}
 | 
						|
 | 
						|
// MakeUnbindable ensures a mounted filesystem has the UNBINDABLE mount option
 | 
						|
// enabled. See the supported options in flags.go for further reference.
 | 
						|
func MakeUnbindable(mountPoint string) error {
 | 
						|
	return ensureMountedAs(mountPoint, UNBINDABLE)
 | 
						|
}
 | 
						|
 | 
						|
// MakeRUnbindable ensures a mounted filesystem has the RUNBINDABLE mount
 | 
						|
// option enabled. See the supported options in flags.go for further reference.
 | 
						|
func MakeRUnbindable(mountPoint string) error {
 | 
						|
	return ensureMountedAs(mountPoint, RUNBINDABLE)
 | 
						|
}
 | 
						|
 | 
						|
// MakeMount ensures that the file or directory given is a mount point,
 | 
						|
// bind mounting it to itself it case it is not.
 | 
						|
func MakeMount(mnt string) error {
 | 
						|
	mounted, err := mountinfo.Mounted(mnt)
 | 
						|
	if err != nil {
 | 
						|
		return err
 | 
						|
	}
 | 
						|
	if mounted {
 | 
						|
		return nil
 | 
						|
	}
 | 
						|
 | 
						|
	return mount(mnt, mnt, "none", uintptr(BIND), "")
 | 
						|
}
 | 
						|
 | 
						|
func ensureMountedAs(mnt string, flags int) error {
 | 
						|
	if err := MakeMount(mnt); err != nil {
 | 
						|
		return err
 | 
						|
	}
 | 
						|
 | 
						|
	return mount("", mnt, "none", uintptr(flags), "")
 | 
						|
}
 |