summaryrefslogtreecommitdiff
path: root/lib/btrfs/btrfsprim/key.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/btrfs/btrfsprim/key.go')
-rw-r--r--lib/btrfs/btrfsprim/key.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/btrfs/btrfsprim/key.go b/lib/btrfs/btrfsprim/key.go
index 7a3cc5c..b07cc8c 100644
--- a/lib/btrfs/btrfsprim/key.go
+++ b/lib/btrfs/btrfsprim/key.go
@@ -64,8 +64,26 @@ func (key Key) Mm() Key {
key.Offset--
case key.ItemType > 0:
key.ItemType--
+ key.Offset = MaxOffset
case key.ObjectID > 0:
key.ObjectID--
+ key.ItemType = MAX_KEY
+ key.Offset = MaxOffset
+ }
+ return key
+}
+
+func (key Key) Pp() Key {
+ switch {
+ case key.Offset < MaxOffset:
+ key.Offset++
+ case key.ItemType < MAX_KEY:
+ key.ItemType++
+ key.Offset = 0
+ case key.ObjectID < MAX_OBJECTID:
+ key.ObjectID++
+ key.ItemType = 0
+ key.Offset = 0
}
return key
}