aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-07-23 22:34:41 +0200
committerJakob Unterwurzacher2018-07-23 22:34:41 +0200
commitd620054caf011982dce2eef5fde0ad11738c4cea (patch)
treec30fb8871bfdf78248c0947aea594fdbc727781d
parentf4a972ddf1f8002095b1e57bd93bb8894ae745f2 (diff)
fsck: print inode number on file read error
This makes it possible to find the file without mounting the fs.
-rw-r--r--fsck.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/fsck.go b/fsck.go
index 0f061ac..e6a695a 100644
--- a/fsck.go
+++ b/fsck.go
@@ -11,6 +11,7 @@ import (
"syscall"
"github.com/hanwen/go-fuse/fuse"
+ "github.com/hanwen/go-fuse/fuse/nodefs"
"github.com/rfjakob/gocryptfs/internal/exitcodes"
"github.com/rfjakob/gocryptfs/internal/fusefrontend"
@@ -127,7 +128,7 @@ func (ck *fsckObj) file(path string) {
result, status := f.Read(buf, off)
if !status.Ok() {
ck.markCorrupt(path)
- fmt.Printf("fsck: error reading file %q at offset %d: %v\n", path, off, status)
+ fmt.Printf("fsck: error reading file %q (inum %d) at offset %d: %v\n", path, inum(f), off, status)
return
}
// EOF
@@ -218,3 +219,9 @@ func (s sortableDirEntries) Swap(i, j int) {
func (s sortableDirEntries) Less(i, j int) bool {
return strings.Compare(s[i].Name, s[j].Name) < 0
}
+
+func inum(f nodefs.File) uint64 {
+ var a fuse.Attr
+ f.GetAttr(&a)
+ return a.Ino
+}