summaryrefslogtreecommitdiff
path: root/internal/inomap/qino.go
diff options
context:
space:
mode:
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))
+}