зеркало из https://github.com/golang/sys.git
unix: add mount(2) for macOS
The 'data' argument of this method needs to point to a file system type
specific data structure. In the case of NFS (which I'm interested in
using), this needs to point to an XDR encoded message. The schema for
this message can be found here:
https://github.com/apple-oss-distributions/NFS/blob/main/mount_nfs/nfs_sys_prot.x
Change-Id: Ia49562ba6e8ab5d4c00eb961db6862fb1310b74e
GitHub-Last-Rev: 62c32df776
GitHub-Pull-Request: golang/sys#125
Reviewed-on: https://go-review.googlesource.com/c/sys/+/405494
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
Родитель
988cb79eb6
Коммит
45d2b4557a
|
@ -90,6 +90,7 @@ var darwinTests = [...]darwinTest{
|
|||
{"mlock", libc_mlock_trampoline_addr},
|
||||
{"mlockall", libc_mlockall_trampoline_addr},
|
||||
{"mmap", libc_mmap_trampoline_addr},
|
||||
{"mount", libc_mount_trampoline_addr},
|
||||
{"mprotect", libc_mprotect_trampoline_addr},
|
||||
{"msync", libc_msync_trampoline_addr},
|
||||
{"munlock", libc_munlock_trampoline_addr},
|
||||
|
|
|
@ -90,6 +90,7 @@ var darwinTests = [...]darwinTest{
|
|||
{"mlock", libc_mlock_trampoline_addr},
|
||||
{"mlockall", libc_mlockall_trampoline_addr},
|
||||
{"mmap", libc_mmap_trampoline_addr},
|
||||
{"mount", libc_mount_trampoline_addr},
|
||||
{"mprotect", libc_mprotect_trampoline_addr},
|
||||
{"msync", libc_msync_trampoline_addr},
|
||||
{"munlock", libc_munlock_trampoline_addr},
|
||||
|
|
|
@ -504,6 +504,7 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
|||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mkfifo(path string, mode uint32) (err error)
|
||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||
//sys Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error)
|
||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Pathconf(path string, name int) (val int, err error)
|
||||
|
@ -572,7 +573,6 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
|||
// Nfssvc
|
||||
// Getfh
|
||||
// Quotactl
|
||||
// Mount
|
||||
// Csops
|
||||
// Waitid
|
||||
// Add_profil
|
||||
|
|
|
@ -1643,6 +1643,30 @@ var libc_mknod_trampoline_addr uintptr
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(fsType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(dir)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_mount_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_mount mount "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Open(path string, mode int, perm uint32) (fd int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
|
|
|
@ -600,6 +600,12 @@ TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0
|
|||
GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_mount(SB)
|
||||
|
||||
GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB)
|
||||
|
||||
TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_open(SB)
|
||||
|
||||
|
|
|
@ -1643,6 +1643,30 @@ var libc_mknod_trampoline_addr uintptr
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(fsType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(dir)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_mount_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_mount mount "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Open(path string, mode int, perm uint32) (fd int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
|
|
|
@ -600,6 +600,12 @@ TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0
|
|||
GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_mount(SB)
|
||||
|
||||
GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB)
|
||||
|
||||
TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_open(SB)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче