aboutsummaryrefslogtreecommitdiff
path: root/src/os/file_plan9.go
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-10-28 09:12:20 -0400
committerCherry Zhang <cherryyz@google.com>2020-10-28 09:12:20 -0400
commita16e30d162c1c7408db7821e7b9513cefa09c6ca (patch)
treeaf752ba9ba44c547df39bb0af9bff79f610ba9d5 /src/os/file_plan9.go
parent91e4d2d57bc341dd82c98247117114c851380aef (diff)
parentcf6cfba4d5358404dd890f6025e573a4b2156543 (diff)
downloadgo-a16e30d162c1c7408db7821e7b9513cefa09c6ca.tar.gz
go-a16e30d162c1c7408db7821e7b9513cefa09c6ca.zip
[dev.link] all: merge branch 'master' into dev.linkdev.link
Clean merge. Change-Id: Ia7b2808bc649790198d34c226a61d9e569084dc5
Diffstat (limited to 'src/os/file_plan9.go')
-rw-r--r--src/os/file_plan9.go50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/os/file_plan9.go b/src/os/file_plan9.go
index a1a51a1c06..bbc732838a 100644
--- a/src/os/file_plan9.go
+++ b/src/os/file_plan9.go
@@ -119,18 +119,18 @@ func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
if IsNotExist(e) && create {
fd, e = syscall.Create(name, flag, syscallMode(perm))
if e != nil {
- return nil, &PathError{"create", name, e}
+ return nil, &PathError{Op: "create", Path: name, Err: e}
}
}
}
if e != nil {
- return nil, &PathError{"open", name, e}
+ return nil, &PathError{Op: "open", Path: name, Err: e}
}
if append {
if _, e = syscall.Seek(fd, 0, io.SeekEnd); e != nil {
- return nil, &PathError{"seek", name, e}
+ return nil, &PathError{Op: "seek", Path: name, Err: e}
}
}
@@ -154,7 +154,7 @@ func (file *file) close() error {
}
var err error
if e := syscall.Close(file.fd); e != nil {
- err = &PathError{"close", file.name, e}
+ err = &PathError{Op: "close", Path: file.name, Err: e}
}
file.fd = badFd // so it can't be closed again
@@ -191,10 +191,10 @@ func (f *File) Truncate(size int64) error {
var buf [syscall.STATFIXLEN]byte
n, err := d.Marshal(buf[:])
if err != nil {
- return &PathError{"truncate", f.name, err}
+ return &PathError{Op: "truncate", Path: f.name, Err: err}
}
if err = syscall.Fwstat(f.fd, buf[:n]); err != nil {
- return &PathError{"truncate", f.name, err}
+ return &PathError{Op: "truncate", Path: f.name, Err: err}
}
return nil
}
@@ -209,7 +209,7 @@ func (f *File) chmod(mode FileMode) error {
odir, e := dirstat(f)
if e != nil {
- return &PathError{"chmod", f.name, e}
+ return &PathError{Op: "chmod", Path: f.name, Err: e}
}
d.Null()
d.Mode = odir.Mode&^chmodMask | syscallMode(mode)&chmodMask
@@ -217,10 +217,10 @@ func (f *File) chmod(mode FileMode) error {
var buf [syscall.STATFIXLEN]byte
n, err := d.Marshal(buf[:])
if err != nil {
- return &PathError{"chmod", f.name, err}
+ return &PathError{Op: "chmod", Path: f.name, Err: err}
}
if err = syscall.Fwstat(f.fd, buf[:n]); err != nil {
- return &PathError{"chmod", f.name, err}
+ return &PathError{Op: "chmod", Path: f.name, Err: err}
}
return nil
}
@@ -238,10 +238,10 @@ func (f *File) Sync() error {
var buf [syscall.STATFIXLEN]byte
n, err := d.Marshal(buf[:])
if err != nil {
- return &PathError{"sync", f.name, err}
+ return &PathError{Op: "sync", Path: f.name, Err: err}
}
if err = syscall.Fwstat(f.fd, buf[:n]); err != nil {
- return &PathError{"sync", f.name, err}
+ return &PathError{Op: "sync", Path: f.name, Err: err}
}
return nil
}
@@ -314,10 +314,10 @@ func Truncate(name string, size int64) error {
var buf [syscall.STATFIXLEN]byte
n, err := d.Marshal(buf[:])
if err != nil {
- return &PathError{"truncate", name, err}
+ return &PathError{Op: "truncate", Path: name, Err: err}
}
if err = syscall.Wstat(name, buf[:n]); err != nil {
- return &PathError{"truncate", name, err}
+ return &PathError{Op: "truncate", Path: name, Err: err}
}
return nil
}
@@ -326,7 +326,7 @@ func Truncate(name string, size int64) error {
// If there is an error, it will be of type *PathError.
func Remove(name string) error {
if e := syscall.Remove(name); e != nil {
- return &PathError{"remove", name, e}
+ return &PathError{Op: "remove", Path: name, Err: e}
}
return nil
}
@@ -389,7 +389,7 @@ func chmod(name string, mode FileMode) error {
odir, e := dirstat(name)
if e != nil {
- return &PathError{"chmod", name, e}
+ return &PathError{Op: "chmod", Path: name, Err: e}
}
d.Null()
d.Mode = odir.Mode&^chmodMask | syscallMode(mode)&chmodMask
@@ -397,10 +397,10 @@ func chmod(name string, mode FileMode) error {
var buf [syscall.STATFIXLEN]byte
n, err := d.Marshal(buf[:])
if err != nil {
- return &PathError{"chmod", name, err}
+ return &PathError{Op: "chmod", Path: name, Err: err}
}
if err = syscall.Wstat(name, buf[:n]); err != nil {
- return &PathError{"chmod", name, err}
+ return &PathError{Op: "chmod", Path: name, Err: err}
}
return nil
}
@@ -421,10 +421,10 @@ func Chtimes(name string, atime time.Time, mtime time.Time) error {
var buf [syscall.STATFIXLEN]byte
n, err := d.Marshal(buf[:])
if err != nil {
- return &PathError{"chtimes", name, err}
+ return &PathError{Op: "chtimes", Path: name, Err: err}
}
if err = syscall.Wstat(name, buf[:n]); err != nil {
- return &PathError{"chtimes", name, err}
+ return &PathError{Op: "chtimes", Path: name, Err: err}
}
return nil
}
@@ -458,7 +458,7 @@ func Symlink(oldname, newname string) error {
// Readlink returns the destination of the named symbolic link.
// If there is an error, it will be of type *PathError.
func Readlink(name string) (string, error) {
- return "", &PathError{"readlink", name, syscall.EPLAN9}
+ return "", &PathError{Op: "readlink", Path: name, Err: syscall.EPLAN9}
}
// Chown changes the numeric uid and gid of the named file.
@@ -469,14 +469,14 @@ func Readlink(name string) (string, error) {
// On Windows or Plan 9, Chown always returns the syscall.EWINDOWS or
// EPLAN9 error, wrapped in *PathError.
func Chown(name string, uid, gid int) error {
- return &PathError{"chown", name, syscall.EPLAN9}
+ return &PathError{Op: "chown", Path: name, Err: syscall.EPLAN9}
}
// Lchown changes the numeric uid and gid of the named file.
// If the file is a symbolic link, it changes the uid and gid of the link itself.
// If there is an error, it will be of type *PathError.
func Lchown(name string, uid, gid int) error {
- return &PathError{"lchown", name, syscall.EPLAN9}
+ return &PathError{Op: "lchown", Path: name, Err: syscall.EPLAN9}
}
// Chown changes the numeric uid and gid of the named file.
@@ -485,7 +485,7 @@ func (f *File) Chown(uid, gid int) error {
if f == nil {
return ErrInvalid
}
- return &PathError{"chown", f.name, syscall.EPLAN9}
+ return &PathError{Op: "chown", Path: f.name, Err: syscall.EPLAN9}
}
func tempDir() string {
@@ -505,7 +505,7 @@ func (f *File) Chdir() error {
return err
}
if e := syscall.Fchdir(f.fd); e != nil {
- return &PathError{"chdir", f.name, e}
+ return &PathError{Op: "chdir", Path: f.name, Err: e}
}
return nil
}
@@ -541,7 +541,7 @@ func (f *File) checkValid(op string) error {
return ErrInvalid
}
if f.fd == badFd {
- return &PathError{op, f.name, ErrClosed}
+ return &PathError{Op: op, Path: f.name, Err: ErrClosed}
}
return nil
}