syscall: implement Mount and Unmount for linux.

Note that, while the final argument of mount(2) is a void*, in
practice all filesystem implementations treat it as a string
of comma-separated mount options.

R=bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4247070
This commit is contained in:
David Anderson 2011-03-09 05:58:47 -08:00 committed by Brad Fitzpatrick
parent 05660b79ea
commit ad102e143c
8 changed files with 118 additions and 0 deletions

View file

@ -456,6 +456,14 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (errno int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mount(source string, target string, fstype string, flags int, data string) (errno int) {
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(StringBytePtr(source))), uintptr(unsafe.Pointer(StringBytePtr(target))), uintptr(unsafe.Pointer(StringBytePtr(fstype))), uintptr(flags), uintptr(unsafe.Pointer(StringBytePtr(data))), 0)
errno = int(e1)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Nanosleep(time *Timespec, leftover *Timespec) (errno int) {
_, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0)
errno = int(e1)
@ -684,6 +692,14 @@ func Unlinkat(dirfd int, path string) (errno int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unmount(target string, flags int) (errno int) {
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(StringBytePtr(target))), uintptr(flags), 0)
errno = int(e1)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unshare(flags int) (errno int) {
_, _, e1 := Syscall(SYS_UNSHARE, uintptr(flags), 0, 0)
errno = int(e1)