package os
import "github.com/containerd/cri/pkg/os"
Index ¶
- func Unmount(target string) error
- type OS
- type RealOS
- func (RealOS) CopyFile(src, dest string, perm os.FileMode) error
- func (RealOS) FollowSymlinkInScope(path, scope string) (string, error)
- func (RealOS) LookupMount(path string) (mount.Info, error)
- func (RealOS) MkdirAll(path string, perm os.FileMode) error
- func (RealOS) Mount(source string, target string, fstype string, flags uintptr, data string) error
- func (RealOS) OpenFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (io.ReadWriteCloser, error)
- func (RealOS) RemoveAll(path string) error
- func (RealOS) ResolveSymbolicLink(path string) (string, error)
- func (RealOS) Stat(name string) (os.FileInfo, error)
- func (RealOS) Unmount(target string) error
- func (RealOS) WriteFile(filename string, data []byte, perm os.FileMode) error
Functions ¶
func Unmount ¶
Unmount unmounts the target. It does not return an error in case the target is not mounted. In case the target does not exist, the appropriate error is returned.
Types ¶
type OS ¶
type OS interface { MkdirAll(path string, perm os.FileMode) error RemoveAll(path string) error OpenFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (io.ReadWriteCloser, error) Stat(name string) (os.FileInfo, error) ResolveSymbolicLink(name string) (string, error) FollowSymlinkInScope(path, scope string) (string, error) CopyFile(src, dest string, perm os.FileMode) error WriteFile(filename string, data []byte, perm os.FileMode) error Mount(source string, target string, fstype string, flags uintptr, data string) error Unmount(target string) error LookupMount(path string) (mount.Info, error) }
OS collects system level operations that need to be mocked out during tests.
type RealOS ¶
type RealOS struct{}
RealOS is used to dispatch the real system level operations.
func (RealOS) CopyFile ¶
CopyFile will copy src file to dest file
func (RealOS) FollowSymlinkInScope ¶
FollowSymlinkInScope will call symlink.FollowSymlinkInScope.
func (RealOS) LookupMount ¶
LookupMount gets mount info of a given path.
func (RealOS) MkdirAll ¶
MkdirAll will call os.MkdirAll to create a directory.
func (RealOS) Mount ¶
Mount will call unix.Mount to mount the file.
func (RealOS) OpenFifo ¶
func (RealOS) OpenFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (io.ReadWriteCloser, error)
OpenFifo will call fifo.OpenFifo to open a fifo.
func (RealOS) RemoveAll ¶
RemoveAll will call os.RemoveAll to remove the path and its children.
func (RealOS) ResolveSymbolicLink ¶
ResolveSymbolicLink will follow any symbolic links
func (RealOS) Stat ¶
Stat will call os.Stat to get the status of the given file.
func (RealOS) Unmount ¶
Unmount will call Unmount to unmount the file.
func (RealOS) WriteFile ¶
WriteFile will call ioutil.WriteFile to write data into a file.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
pkg/os/testing |
- Version
- v1.11.1
- Published
- Aug 9, 2018
- Platform
- js/wasm
- Imports
- 9 packages
- Last checked
- 4 hours ago –
Tools for package owners.