summaryrefslogtreecommitdiff
path: root/internal/nametransform
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-06-15 23:30:44 +0200
committerJakob Unterwurzacher2016-06-15 23:30:44 +0200
commit6c3f97399a01a2d8480b39978209099335efbf7d (patch)
tree097b34a37b5f62ebcfd7294d096b16f436c180f9 /internal/nametransform
parent09e88f31d1b4308bf82c7f4eb0dd83855ad67ffc (diff)
Rename internal "toggledlog" package to "tlog"
tlog is used heavily everywhere and deserves a shorter name. Renamed using sed magic, without any manual rework: find * -type f -exec sed -i 's/toggledlog/tlog/g' {} +
Diffstat (limited to 'internal/nametransform')
-rw-r--r--internal/nametransform/longnames.go10
-rw-r--r--internal/nametransform/names_diriv.go12
2 files changed, 11 insertions, 11 deletions
diff --git a/internal/nametransform/longnames.go b/internal/nametransform/longnames.go
index 0746cd6..13bedb3 100644
--- a/internal/nametransform/longnames.go
+++ b/internal/nametransform/longnames.go
@@ -9,7 +9,7 @@ import (
"strings"
"syscall"
- "github.com/rfjakob/gocryptfs/internal/toggledlog"
+ "github.com/rfjakob/gocryptfs/internal/tlog"
)
const (
@@ -58,7 +58,7 @@ func IsLongContent(cName string) bool {
func ReadLongName(path string) (string, error) {
content, err := ioutil.ReadFile(path + LongNameSuffix)
if err != nil {
- toggledlog.Warn.Printf("ReadLongName: %v", err)
+ tlog.Warn.Printf("ReadLongName: %v", err)
}
return string(content), err
}
@@ -67,7 +67,7 @@ func ReadLongName(path string) (string, error) {
func DeleteLongName(dirfd *os.File, hashName string) error {
err := syscall.Unlinkat(int(dirfd.Fd()), hashName+LongNameSuffix)
if err != nil {
- toggledlog.Warn.Printf("DeleteLongName: %v", err)
+ tlog.Warn.Printf("DeleteLongName: %v", err)
}
return err
}
@@ -89,14 +89,14 @@ func (n *NameTransform) WriteLongName(dirfd *os.File, hashName string, plainName
fdRaw, err := syscall.Openat(int(dirfd.Fd()), hashName+LongNameSuffix,
syscall.O_WRONLY|syscall.O_CREAT|syscall.O_EXCL, 0600)
if err != nil {
- toggledlog.Warn.Printf("WriteLongName: Openat: %v", err)
+ tlog.Warn.Printf("WriteLongName: Openat: %v", err)
return err
}
fd := os.NewFile(uintptr(fdRaw), hashName+LongNameSuffix)
defer fd.Close()
_, err = fd.Write([]byte(cName))
if err != nil {
- toggledlog.Warn.Printf("WriteLongName: Write: %v", err)
+ tlog.Warn.Printf("WriteLongName: Write: %v", err)
}
return err
}
diff --git a/internal/nametransform/names_diriv.go b/internal/nametransform/names_diriv.go
index f5aa88d..b9473aa 100644
--- a/internal/nametransform/names_diriv.go
+++ b/internal/nametransform/names_diriv.go
@@ -9,7 +9,7 @@ import (
"syscall"
"github.com/rfjakob/gocryptfs/internal/cryptocore"
- "github.com/rfjakob/gocryptfs/internal/toggledlog"
+ "github.com/rfjakob/gocryptfs/internal/tlog"
)
const (
@@ -37,7 +37,7 @@ func ReadDirIV(dir string) (iv []byte, err error) {
func ReadDirIVAt(dirfd *os.File) (iv []byte, err error) {
fdRaw, err := syscall.Openat(int(dirfd.Fd()), DirIVFilename, syscall.O_RDONLY, 0)
if err != nil {
- toggledlog.Warn.Printf("ReadDirIVAt: opening %q in dir %q failed: %v",
+ tlog.Warn.Printf("ReadDirIVAt: opening %q in dir %q failed: %v",
DirIVFilename, dirfd.Name(), err)
return nil, err
}
@@ -47,12 +47,12 @@ func ReadDirIVAt(dirfd *os.File) (iv []byte, err error) {
iv = make([]byte, dirIVLen+1)
n, err := fd.Read(iv)
if err != nil {
- toggledlog.Warn.Printf("ReadDirIVAt: Read failed: %v", err)
+ tlog.Warn.Printf("ReadDirIVAt: Read failed: %v", err)
return nil, err
}
iv = iv[0:n]
if len(iv) != dirIVLen {
- toggledlog.Warn.Printf("ReadDirIVAt: wanted %d bytes, got %d", dirIVLen, len(iv))
+ tlog.Warn.Printf("ReadDirIVAt: wanted %d bytes, got %d", dirIVLen, len(iv))
return nil, errors.New("invalid iv length")
}
return iv, nil
@@ -66,7 +66,7 @@ func WriteDirIV(dir string) error {
file := filepath.Join(dir, DirIVFilename)
err := ioutil.WriteFile(file, iv, 0400)
if err != nil {
- toggledlog.Warn.Printf("WriteDirIV: %v", err)
+ tlog.Warn.Printf("WriteDirIV: %v", err)
}
return err
}
@@ -126,7 +126,7 @@ func (be *NameTransform) DecryptPathDirIV(encryptedPath string, rootDir string)
var wd = rootDir
var plainNames []string
encryptedNames := strings.Split(encryptedPath, "/")
- toggledlog.Debug.Printf("DecryptPathDirIV: decrypting %v\n", encryptedNames)
+ tlog.Debug.Printf("DecryptPathDirIV: decrypting %v\n", encryptedNames)
for _, encryptedName := range encryptedNames {
iv, err := ReadDirIV(wd)
if err != nil {