summaryrefslogtreecommitdiff
path: root/internal/inomap/qino.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-04-12 17:15:03 +0200
committerJakob Unterwurzacher2020-04-13 14:54:04 +0200
commit488111ce390218806fca933b89279b766f7ff49c (patch)
treed75a8aac95f95767410027da14cd0231c17110a3 /internal/inomap/qino.go
parent194030f18ae623fbf5b0bb805b780f81fe9ec7a7 (diff)
inomap: split into separate package
inomap will also be used by fusefrontend_reverse in the future. Split if off openfiletable to make it independent.
Diffstat (limited to 'internal/inomap/qino.go')
-rw-r--r--internal/inomap/qino.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/inomap/qino.go b/internal/inomap/qino.go
new file mode 100644
index 0000000..8f99004
--- /dev/null
+++ b/internal/inomap/qino.go
@@ -0,0 +1,25 @@
+package inomap
+
+import (
+ "syscall"
+)
+
+// QIno = Qualified Inode number.
+// Uniquely identifies a backing file through the device number,
+// inode number pair.
+type QIno struct {
+ // Stat_t.{Dev,Ino} is uint64 on 32- and 64-bit Linux
+ Dev uint64
+ Ino uint64
+}
+
+// QInoFromStat fills a new QIno struct with the passed Stat_t info.
+func QInoFromStat(st *syscall.Stat_t) QIno {
+ return QIno{
+ // There are some architectures that use 32-bit values here
+ // (darwin, freebsd-32, maybe others). Add and explicit cast to make
+ // this function work everywhere.
+ Dev: uint64(st.Dev),
+ Ino: uint64(st.Ino),
+ }
+}