aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorJakob Unterwurzacher2022-12-29 15:00:24 +0100
committerJakob Unterwurzacher2022-12-29 15:00:37 +0100
commit856ccaac10579abda5620dfc86ad6031b1076a43 (patch)
tree91c3f90cf19123ff0cd6cd86d514afb7d38c4ed6 /internal
parent99cdaa0b69e884128e8f673f96bd4d3e32743d80 (diff)
make format
Run "make format" using go version go1.19.4 linux/amd64
Diffstat (limited to 'internal')
-rw-r--r--internal/ctlsocksrv/sanitize.go9
-rw-r--r--internal/ensurefds012/ensurefds012.go18
-rw-r--r--internal/fusefrontend/file_allocate_truncate.go4
-rw-r--r--internal/inomap/inomap.go4
-rw-r--r--internal/speed/cpuinfo.go12
-rw-r--r--internal/stupidgcm/doc.go36
-rw-r--r--internal/stupidgcm/prefer.go6
7 files changed, 45 insertions, 44 deletions
diff --git a/internal/ctlsocksrv/sanitize.go b/internal/ctlsocksrv/sanitize.go
index 4333872..2272943 100644
--- a/internal/ctlsocksrv/sanitize.go
+++ b/internal/ctlsocksrv/sanitize.go
@@ -6,10 +6,11 @@ import (
)
// SanitizePath adapts filepath.Clean for FUSE paths.
-// 1) Leading slash(es) are dropped
-// 2) It returns "" instead of "."
-// 3) If the cleaned path points above CWD (start with ".."), an empty string
-// is returned
+// 1. Leading slash(es) are dropped
+// 2. It returns "" instead of "."
+// 3. If the cleaned path points above CWD (start with ".."), an empty string
+// is returned
+//
// See the TestSanitizePath testcases for examples.
func SanitizePath(path string) string {
// (1)
diff --git a/internal/ensurefds012/ensurefds012.go b/internal/ensurefds012/ensurefds012.go
index 54a1ac1..6834b89 100644
--- a/internal/ensurefds012/ensurefds012.go
+++ b/internal/ensurefds012/ensurefds012.go
@@ -5,7 +5,7 @@
//
// Use like this:
//
-// import _ "github.com/rfjakob/gocryptfs/v2/internal/ensurefds012"
+// import _ "github.com/rfjakob/gocryptfs/v2/internal/ensurefds012"
//
// The import line MUST be in the alphabitcally first source code file of
// package main!
@@ -13,17 +13,17 @@
// You can test if it works as expected by inserting a long sleep into main,
// startings gocryptfs with all fds closed like this,
//
-// $ ./gocryptfs 0<&- 1>&- 2>&-
+// $ ./gocryptfs 0<&- 1>&- 2>&-
//
// and then checking the open fds. It should look like this:
//
-// $ ls -l /proc/$(pgrep gocryptfs)/fd
-// total 0
-// lrwx------. 1 jakob jakob 64 Jan 5 15:54 0 -> /dev/null
-// lrwx------. 1 jakob jakob 64 Jan 5 15:54 1 -> /dev/null
-// lrwx------. 1 jakob jakob 64 Jan 5 15:54 2 -> /dev/null
-// l-wx------. 1 jakob jakob 64 Jan 5 15:54 3 -> /dev/null
-// lrwx------. 1 jakob jakob 64 Jan 5 15:54 4 -> 'anon_inode:[eventpoll]'
+// $ ls -l /proc/$(pgrep gocryptfs)/fd
+// total 0
+// lrwx------. 1 jakob jakob 64 Jan 5 15:54 0 -> /dev/null
+// lrwx------. 1 jakob jakob 64 Jan 5 15:54 1 -> /dev/null
+// lrwx------. 1 jakob jakob 64 Jan 5 15:54 2 -> /dev/null
+// l-wx------. 1 jakob jakob 64 Jan 5 15:54 3 -> /dev/null
+// lrwx------. 1 jakob jakob 64 Jan 5 15:54 4 -> 'anon_inode:[eventpoll]'
//
// See https://github.com/rfjakob/gocryptfs/issues/320 for details.
package ensurefds012
diff --git a/internal/fusefrontend/file_allocate_truncate.go b/internal/fusefrontend/file_allocate_truncate.go
index fddcfe8..cae796e 100644
--- a/internal/fusefrontend/file_allocate_truncate.go
+++ b/internal/fusefrontend/file_allocate_truncate.go
@@ -30,8 +30,8 @@ var allocateWarnOnce sync.Once
//
// mode=FALLOC_DEFAULT is implemented as a two-step process:
//
-// (1) Allocate the space using FALLOC_FL_KEEP_SIZE
-// (2) Set the file size using ftruncate (via truncateGrowFile)
+// (1) Allocate the space using FALLOC_FL_KEEP_SIZE
+// (2) Set the file size using ftruncate (via truncateGrowFile)
//
// This allows us to reuse the file grow mechanics from Truncate as they are
// complicated and hard to get right.
diff --git a/internal/inomap/inomap.go b/internal/inomap/inomap.go
index 070fab4..0f7ade3 100644
--- a/internal/inomap/inomap.go
+++ b/internal/inomap/inomap.go
@@ -3,8 +3,8 @@
//
// Format of the returned inode numbers:
//
-// [spill bit = 0][15 bit namespace id][48 bit passthru inode number]
-// [spill bit = 1][63 bit spill inode number ]
+// [spill bit = 0][15 bit namespace id][48 bit passthru inode number]
+// [spill bit = 1][63 bit spill inode number ]
//
// Each (Dev, Tag) tuple gets a namespace id assigned. The original inode
// number is then passed through in the lower 48 bits.
diff --git a/internal/speed/cpuinfo.go b/internal/speed/cpuinfo.go
index 09e7a89..df3177d 100644
--- a/internal/speed/cpuinfo.go
+++ b/internal/speed/cpuinfo.go
@@ -12,17 +12,17 @@ import (
//
// Examples: On my desktop PC:
//
-// $ grep "model name" /proc/cpuinfo
-// model name : Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz
+// $ grep "model name" /proc/cpuinfo
+// model name : Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz
//
// --> Returns "Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz".
//
// On a Raspberry Pi 4:
//
-// $ grep "model name" /proc/cpuinfo
-// (empty)
-// $ grep Hardware /proc/cpuinfo
-// Hardware : BCM2835
+// $ grep "model name" /proc/cpuinfo
+// (empty)
+// $ grep Hardware /proc/cpuinfo
+// Hardware : BCM2835
//
// --> Returns "BCM2835"
func cpuModelName() string {
diff --git a/internal/stupidgcm/doc.go b/internal/stupidgcm/doc.go
index 36c189b..dce82ae 100644
--- a/internal/stupidgcm/doc.go
+++ b/internal/stupidgcm/doc.go
@@ -16,13 +16,13 @@
// However, OpenSSL has optimized assembly for almost all platforms, which Go
// does not. Example for a 32-bit ARM device (Odroid XU4):
//
-// $ gocrypts -speed
-// gocryptfs v2.1-68-gedf9d4c.stupidchacha; go-fuse v2.1.1-0.20210825171523-3ab5d95a30ae; 2021-09-04 go1.16.7 linux/arm
-// AES-GCM-256-OpenSSL 56.84 MB/s (selected in auto mode)
-// AES-GCM-256-Go 16.61 MB/s
-// AES-SIV-512-Go 16.49 MB/s
-// XChaCha20-Poly1305-Go 39.08 MB/s (use via -xchacha flag)
-// XChaCha20-Poly1305-OpenSSL 141.82 MB/s
+// $ gocrypts -speed
+// gocryptfs v2.1-68-gedf9d4c.stupidchacha; go-fuse v2.1.1-0.20210825171523-3ab5d95a30ae; 2021-09-04 go1.16.7 linux/arm
+// AES-GCM-256-OpenSSL 56.84 MB/s (selected in auto mode)
+// AES-GCM-256-Go 16.61 MB/s
+// AES-SIV-512-Go 16.49 MB/s
+// XChaCha20-Poly1305-Go 39.08 MB/s (use via -xchacha flag)
+// XChaCha20-Poly1305-OpenSSL 141.82 MB/s
//
// This package is "stupid" in the sense that it only supports a narrow set of
// key- and iv-lengths, and panics if it does not like what you pass it.
@@ -33,7 +33,7 @@
// Corrupt ciphertexts never cause a panic. Instead, ErrAuth is returned on
// decryption.
//
-// XChaCha20-Poly1305
+// # XChaCha20-Poly1305
//
// The XChaCha20-Poly1305 implementation is more complicated than the others,
// because OpenSSL does not support XChaCha20-Poly1305 directly. Follow
@@ -43,16 +43,16 @@
// Fortunately, XChaCha20-Poly1305 is just ChaCha20-Poly1305 with some key+iv
// mixing using HChaCha20 in front:
//
-// key (32 bytes), iv (24 bytes)
-// |
-// v
-// HChaCha20 (provided by golang.org/x/crypto/chacha20)
-// |
-// v
-// key2 (32 bytes), iv2 (16 bytes)
-// |
-// v
-// ChaCha20-Poly1305 (OpenSSL EVP_chacha20_poly1305)
+// key (32 bytes), iv (24 bytes)
+// |
+// v
+// HChaCha20 (provided by golang.org/x/crypto/chacha20)
+// |
+// v
+// key2 (32 bytes), iv2 (16 bytes)
+// |
+// v
+// ChaCha20-Poly1305 (OpenSSL EVP_chacha20_poly1305)
//
// As HChaCha20 is very fast, XChaCha20-Poly1305 gets almost the same throughput
// as ChaCha20-Poly1305 (for 4kiB blocks).
diff --git a/internal/stupidgcm/prefer.go b/internal/stupidgcm/prefer.go
index fe8c613..e3f52d4 100644
--- a/internal/stupidgcm/prefer.go
+++ b/internal/stupidgcm/prefer.go
@@ -11,9 +11,9 @@ import (
//
// Go GCM is only faster if the CPU either:
//
-// 1) Is X86_64 && has AES instructions && Go is v1.6 or higher
-// 2) Is ARM64 && has AES instructions && Go is v1.11 or higher
-// (commit https://github.com/golang/go/commit/4f1f503373cda7160392be94e3849b0c9b9ebbda)
+// 1. Is X86_64 && has AES instructions && Go is v1.6 or higher
+// 2. Is ARM64 && has AES instructions && Go is v1.11 or higher
+// (commit https://github.com/golang/go/commit/4f1f503373cda7160392be94e3849b0c9b9ebbda)
//
// See https://github.com/rfjakob/gocryptfs/wiki/CPU-Benchmarks
// for benchmarks.