mirror of
https://github.com/golang/go
synced 2024-11-21 22:14:41 -07:00
syscall: adjust Mount to accomodate stricter FS implementations.
Notably, the "data" argument should be nil if no options are given, or (at least) the cgroup filesystem will refuse to mount. R=bradfitz, rsc CC=golang-dev https://golang.org/cl/5147047
This commit is contained in:
parent
8225f4d71f
commit
bb282baa93
@ -784,6 +784,16 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int,
|
||||
return origlen - len(buf), count, names
|
||||
}
|
||||
|
||||
//sys mount(source string, target string, fstype string, flags uint32, data *byte) (errno int)
|
||||
func Mount(source string, target string, fstype string, flags uint32, data string) (errno int) {
|
||||
// Certain file systems get rather angry and EINVAL if you give
|
||||
// them an empty string of data, rather than NULL.
|
||||
if data == "" {
|
||||
return mount(source, target, fstype, flags, nil)
|
||||
}
|
||||
return mount(source, target, fstype, flags, StringBytePtr(data))
|
||||
}
|
||||
|
||||
// Sendto
|
||||
// Recvfrom
|
||||
// Socketpair
|
||||
@ -834,7 +844,6 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int,
|
||||
//sys Mkdirat(dirfd int, path string, mode uint32) (errno int)
|
||||
//sys Mknod(path string, mode uint32, dev int) (errno int)
|
||||
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (errno int)
|
||||
//sys Mount(source string, target string, fstype string, flags int, data string) (errno int)
|
||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (errno int)
|
||||
//sys Pause() (errno int)
|
||||
//sys PivotRoot(newroot string, putold string) (errno int) = SYS_PIVOT_ROOT
|
||||
|
@ -89,6 +89,14 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (errno int) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func mount(source string, target string, fstype string, flags uint32, data *byte) (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(data)), 0)
|
||||
errno = int(e1)
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Access(path string, mode uint32) (errno int) {
|
||||
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
|
||||
errno = int(e1)
|
||||
@ -464,14 +472,6 @@ 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)
|
||||
|
@ -89,6 +89,14 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (errno int) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func mount(source string, target string, fstype string, flags uint32, data *byte) (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(data)), 0)
|
||||
errno = int(e1)
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Access(path string, mode uint32) (errno int) {
|
||||
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
|
||||
errno = int(e1)
|
||||
@ -464,14 +472,6 @@ 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)
|
||||
|
@ -89,6 +89,14 @@ func reboot(magic1 uint, magic2 uint, cmd int, arg string) (errno int) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func mount(source string, target string, fstype string, flags uint32, data *byte) (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(data)), 0)
|
||||
errno = int(e1)
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Access(path string, mode uint32) (errno int) {
|
||||
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
|
||||
errno = int(e1)
|
||||
@ -464,14 +472,6 @@ 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)
|
||||
|
Loading…
Reference in New Issue
Block a user