diff options
author | Jakob Unterwurzacher | 2018-09-22 20:10:34 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2018-09-23 12:17:26 +0200 |
commit | c270b21efc1d9ecbe5c913c733204f826e263747 (patch) | |
tree | f001342e38ab81eeea1292c7a405d30321624b6d /internal/nametransform/longnames.go | |
parent | 22fba4ac3ed09ba07d1defb60436fb7a17095d09 (diff) |
fusefrontend: get rid of os.File* wrapping
Directly use int file descriptors for the dirfd
and get rid of one level of indirection.
Diffstat (limited to 'internal/nametransform/longnames.go')
-rw-r--r-- | internal/nametransform/longnames.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/nametransform/longnames.go b/internal/nametransform/longnames.go index 614af47..01280a8 100644 --- a/internal/nametransform/longnames.go +++ b/internal/nametransform/longnames.go @@ -89,8 +89,8 @@ func ReadLongName(path string) (string, error) { } // DeleteLongName deletes "hashName.name". -func DeleteLongName(dirfd *os.File, hashName string) error { - err := syscallcompat.Unlinkat(int(dirfd.Fd()), hashName+LongNameSuffix, 0) +func DeleteLongName(dirfd int, hashName string) error { + err := syscallcompat.Unlinkat(dirfd, hashName+LongNameSuffix, 0) if err != nil { tlog.Warn.Printf("DeleteLongName: %v", err) } @@ -100,7 +100,7 @@ func DeleteLongName(dirfd *os.File, hashName string) error { // WriteLongName encrypts plainName and writes it into "hashName.name". // For the convenience of the caller, plainName may also be a path and will be // converted internally. -func (n *NameTransform) WriteLongName(dirfd *os.File, hashName string, plainName string) (err error) { +func (n *NameTransform) WriteLongName(dirfd int, hashName string, plainName string) (err error) { plainName = filepath.Base(plainName) // Encrypt the basename @@ -111,7 +111,7 @@ func (n *NameTransform) WriteLongName(dirfd *os.File, hashName string, plainName cName := n.EncryptName(plainName, dirIV) // Write the encrypted name into hashName.name - fdRaw, err := syscallcompat.Openat(int(dirfd.Fd()), hashName+LongNameSuffix, + fdRaw, err := syscallcompat.Openat(dirfd, hashName+LongNameSuffix, syscall.O_WRONLY|syscall.O_CREAT|syscall.O_EXCL, 0600) if err != nil { // Don't warn if the file already exists - this is allowed for renames |