aboutsummaryrefslogtreecommitdiff
path: root/internal/inomap/qino.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-05-03 15:22:10 +0200
committerJakob Unterwurzacher2020-05-03 15:22:10 +0200
commit518771e4e247762f60c5594de427a8c86f19bd57 (patch)
tree625aed59393508f8f3b61787963012a684b37d8e /internal/inomap/qino.go
parentdb93a6c54cfd615561207f1bbcf7e665ebc296b6 (diff)
fusefrontend_reverse: use inomap for inode number translation
Gets rid of static inode number value limitations. Fixes https://github.com/rfjakob/gocryptfs/issues/457
Diffstat (limited to 'internal/inomap/qino.go')
-rw-r--r--internal/inomap/qino.go26
1 files changed, 17 insertions, 9 deletions
diff --git a/internal/inomap/qino.go b/internal/inomap/qino.go
index a74a96d..ed514e8 100644
--- a/internal/inomap/qino.go
+++ b/internal/inomap/qino.go
@@ -7,9 +7,11 @@ import (
type namespaceData struct {
// Stat_t.Dev is uint64 on 32- and 64-bit Linux
Dev uint64
- // Flags acts like an extension of the Dev field.
+ // Tag acts like an extension of the Dev field.
// It is used by reverse mode for virtual files.
- Flags uint8
+ // Normal (forward) mode does not use it and it
+ // stays always zero there.
+ Tag uint8
}
// QIno = Qualified Inode number.
@@ -21,15 +23,21 @@ type QIno struct {
Ino uint64
}
-// QInoFromStat fills a new QIno struct with the passed Stat_t info.
-func QInoFromStat(st *syscall.Stat_t) QIno {
+// NewQIno returns a filled QIno struct
+func NewQIno(dev uint64, tag uint8, ino uint64) QIno {
return QIno{
namespaceData: namespaceData{
- // There are some architectures that use 32-bit values here
- // (darwin, freebsd-32, maybe others). Add an explicit cast to make
- // this function work everywhere.
- Dev: uint64(st.Dev),
+ Dev: dev,
+ Tag: tag,
},
- Ino: uint64(st.Ino),
+ Ino: ino,
}
}
+
+// QInoFromStat fills a new QIno struct with the passed Stat_t info.
+func QInoFromStat(st *syscall.Stat_t) QIno {
+ // There are some architectures that use 32-bit values here
+ // (darwin, freebsd-32, maybe others). Add an explicit cast to make
+ // this function work everywhere.
+ return NewQIno(uint64(st.Dev), 0, uint64(st.Ino))
+}