2014-01-31 05:16:42 -05:00
|
|
|
// +build linux,amd64
|
2013-11-27 22:12:51 -05:00
|
|
|
|
2013-11-20 15:05:10 -05:00
|
|
|
package devmapper
|
|
|
|
|
|
|
|
import (
|
2013-11-20 15:49:01 -05:00
|
|
|
"os"
|
2013-11-20 21:16:26 -05:00
|
|
|
"os/exec"
|
2013-11-20 15:05:10 -05:00
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
2013-11-20 15:49:01 -05:00
|
|
|
type (
|
|
|
|
sysStatT syscall.Stat_t
|
|
|
|
sysErrno syscall.Errno
|
2013-11-20 16:05:17 -05:00
|
|
|
|
|
|
|
osFile struct{ *os.File }
|
2013-11-20 15:49:01 -05:00
|
|
|
)
|
2013-11-20 15:05:10 -05:00
|
|
|
|
|
|
|
var (
|
2013-11-20 15:49:01 -05:00
|
|
|
sysMount = syscall.Mount
|
|
|
|
sysUnmount = syscall.Unmount
|
|
|
|
sysCloseOnExec = syscall.CloseOnExec
|
|
|
|
sysSyscall = syscall.Syscall
|
2013-11-20 16:05:17 -05:00
|
|
|
|
2013-11-27 02:16:34 -05:00
|
|
|
osOpenFile = func(name string, flag int, perm os.FileMode) (*osFile, error) {
|
|
|
|
f, err := os.OpenFile(name, flag, perm)
|
|
|
|
return &osFile{File: f}, err
|
|
|
|
}
|
|
|
|
osOpen = func(name string) (*osFile, error) { f, err := os.Open(name); return &osFile{File: f}, err }
|
2013-11-20 16:05:17 -05:00
|
|
|
osNewFile = os.NewFile
|
|
|
|
osCreate = os.Create
|
|
|
|
osStat = os.Stat
|
|
|
|
osIsNotExist = os.IsNotExist
|
|
|
|
osIsExist = os.IsExist
|
|
|
|
osMkdirAll = os.MkdirAll
|
|
|
|
osRemoveAll = os.RemoveAll
|
|
|
|
osRename = os.Rename
|
|
|
|
osReadlink = os.Readlink
|
2013-11-20 21:16:26 -05:00
|
|
|
|
2013-11-28 14:02:53 -05:00
|
|
|
execRun = func(name string, args ...string) error { return exec.Command(name, args...).Run() }
|
2013-11-20 15:05:10 -05:00
|
|
|
)
|
2013-11-20 15:49:01 -05:00
|
|
|
|
|
|
|
const (
|
|
|
|
sysMsMgcVal = syscall.MS_MGC_VAL
|
|
|
|
sysMsRdOnly = syscall.MS_RDONLY
|
|
|
|
sysEInval = syscall.EINVAL
|
|
|
|
sysSysIoctl = syscall.SYS_IOCTL
|
2013-11-27 02:16:34 -05:00
|
|
|
sysEBusy = syscall.EBUSY
|
2013-11-20 16:05:17 -05:00
|
|
|
|
2013-11-27 21:21:17 -05:00
|
|
|
osORdOnly = os.O_RDONLY
|
|
|
|
osORdWr = os.O_RDWR
|
|
|
|
osOCreate = os.O_CREATE
|
|
|
|
osModeDevice = os.ModeDevice
|
2013-11-20 15:49:01 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func toSysStatT(i interface{}) *sysStatT {
|
|
|
|
return (*sysStatT)(i.(*syscall.Stat_t))
|
|
|
|
}
|