]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: adjust Mount to accomodate stricter FS implementations.
authorDavid Anderson <danderson@google.com>
Fri, 14 Oct 2011 16:19:45 +0000 (09:19 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 14 Oct 2011 16:19:45 +0000 (09:19 -0700)
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

src/pkg/syscall/syscall_linux.go
src/pkg/syscall/zsyscall_linux_386.go
src/pkg/syscall/zsyscall_linux_amd64.go
src/pkg/syscall/zsyscall_linux_arm.go

index 715561fd7a1c375cea428a606f8da93a0fde9d5a..50d6fa9837580aa754cc49141b85f4650833a922 100644 (file)
@@ -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
index 4eb522ad922842860485bf1b63c36f78e554a22b..35c54327d7e852435010d1a569074bd28d6cbb38 100644 (file)
@@ -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)
index 999ed64a1815eb032057cea52c1b1e2a7f1e5060..0d4ce43007b8eaeab1e6686a880d280b61a9c73f 100644 (file)
@@ -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)
index cd49dabed6ec8493b17316e00464976e0d821a42..a01b16ef162136690d14d2c6688dbee30b1715a8 100644 (file)
@@ -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)