Documentation ¶
Index ¶
- Constants
- func AnonymousFile(dir string) (*os.File, error)
- func Bind(source, target string) error
- func CopyRegularFile(src, dest string) (err error)
- func FullHostname() string
- func InstallRegularFile(src, dest string) error
- func IsOpNotSupported(err error) bool
- func IsSymlink(path string) bool
- func LinkFile(file *os.File, name string) error
- func Mount(source, target, fstype, options string) error
- func MountPrivate(target string) error
- func MountShared(target string) error
- func MountSlave(target string) error
- func Move(source, target string) error
- func PortageArch() string
- func PrivateFile(dir string) (*os.File, error)
- func ReadOnlyBind(source, target string) error
- func RecursiveBind(source, target string) error
- func RecursivePrivate(target string) error
- func RecursiveShared(target string) error
- func RecursiveSlave(target string) error
- type MountError
Constants ¶
const ( // MS_PROPAGATION flags are special operations and cannot be combined // with each other or any flags other than MS_REC. MS_PROPAGATION = syscall.MS_SHARED | syscall.MS_SLAVE | syscall.MS_UNBINDABLE | syscall.MS_PRIVATE // MS_OPERATION flags can be mapped to high level operation names. MS_OPERATION = MS_PROPAGATION | syscall.MS_BIND | syscall.MS_MOVE | syscall.MS_REC )
Variables ¶
This section is empty.
Functions ¶
func AnonymousFile ¶ added in v0.2.0
AnonymousFile creates an unlinked temporary file in the given directory or the default temporary directory if unspecified. Since the file has no name, the file's Name method does not return a real path. The file may be later linked into the filesystem for safe keeping using LinkFile.
func CopyRegularFile ¶
CopyRegularFile copies a file in place, updates are not atomic. If the destination doesn't exist it will be created with the same permissions as the original but umask is respected. If the destination already exists the permissions will remain as-is.
func FullHostname ¶
func FullHostname() string
FullHostname is a best effort attempt to resolve the canonical FQDN of the host. On failure it will fall back to a reasonable looking default such as 'localhost.' or 'hostname.invalid.'
func InstallRegularFile ¶
InstallRegularFile copies a file, creating any parent directories.
func IsOpNotSupported ¶ added in v0.2.0
IsOpNotSupported reports true if the underlying error was EOPNOTSUPP. Useful for checking if the host or filesystem lacks O_TMPFILE support.
func LinkFile ¶ added in v0.2.0
LinkFile creates a new link to an open File instead of an existing name as os.Link and friends do. Particularly useful for making a file created by AnonymousFile accessible in the filesystem. As with Link the caller should ensure the new name is on the same filesystem.
func Mount ¶
Mount wraps mount(2) in a similar way to mount(8), accepting both flags and filesystem options as a string. Any option not recognized as a flag will be passed as a filesystem option. Note that option parsing here is simpler than mount(8) and quotes are not considered.
func MountPrivate ¶
MountPrivate changes a mount point's propagation type to "private"
func MountShared ¶
MountShared changes a mount point's propagation type to "shared"
func MountSlave ¶
MountSlave changes a mount point's propagation type to "slave"
func PortageArch ¶
func PortageArch() string
func PrivateFile ¶ added in v0.2.0
PrivateFile creates an unlinked temporary file in the given directory or the default temporary directory if unspecified. Unlike AnonymousFile, the opened file cannot be linked into the filesystem later.
func ReadOnlyBind ¶
ReadOnlyBind creates a read-only bind mount. Note that this must be performed in two operations so it is possible for a read-write bind to be left behind if the second operation fails.
func RecursiveBind ¶
RecursiveBind bind mounts an entire tree under source to target.
func RecursivePrivate ¶
RecursivePrivate changes an entire tree's propagation type to "private"
func RecursiveShared ¶
RecursiveShared changes an entire tree's propagation type to "shared"
func RecursiveSlave ¶
RecursiveSlave changes an entire tree's propagation type to "slave"