aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse/ino_map.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-09-21 21:25:55 +0200
committerJakob Unterwurzacher2016-09-25 16:43:17 +0200
commitd76e7aadb48e5efd6af6ad42e9146f65f8e89fb8 (patch)
treea3ac9bbd25c01988ecd4170beddb268c3837a737 /internal/fusefrontend_reverse/ino_map.go
parent5f726aaa9d95be30ecfcb61637df3ccc133bf2ea (diff)
reverse: use dynamic inode numbers
...with stable mappings for hard-linked files.
Diffstat (limited to 'internal/fusefrontend_reverse/ino_map.go')
-rw-r--r--internal/fusefrontend_reverse/ino_map.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/fusefrontend_reverse/ino_map.go b/internal/fusefrontend_reverse/ino_map.go
new file mode 100644
index 0000000..5217732
--- /dev/null
+++ b/internal/fusefrontend_reverse/ino_map.go
@@ -0,0 +1,24 @@
+package fusefrontend_reverse
+
+import (
+ "sync/atomic"
+)
+
+func NewInoGen() *inoGenT {
+ var ino uint64 = 1
+ return &inoGenT{&ino}
+}
+
+type inoGenT struct {
+ ino *uint64
+}
+
+// Get the next inode counter value
+func (i *inoGenT) next() uint64 {
+ return atomic.AddUint64(i.ino, 1)
+}
+
+type devIno struct {
+ dev uint64
+ ino uint64
+}