summaryrefslogtreecommitdiff
path: root/lib/btrfs/internal/misc.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-08-28 17:55:36 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-08-28 18:09:10 -0600
commite2cdb05eac6726c59fe1831876fddd8037156d67 (patch)
tree157e86b1088710e4f7b93ea8dc8c08c32eeb70ef /lib/btrfs/internal/misc.go
parenta2743121bad8a390dd248e3ec5c8d6844876832a (diff)
btrfs: Split off btrfstree and btrfsprim sub-packages
Diffstat (limited to 'lib/btrfs/internal/misc.go')
-rw-r--r--lib/btrfs/internal/misc.go48
1 files changed, 0 insertions, 48 deletions
diff --git a/lib/btrfs/internal/misc.go b/lib/btrfs/internal/misc.go
deleted file mode 100644
index 3bc5402..0000000
--- a/lib/btrfs/internal/misc.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com>
-//
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-package internal
-
-import (
- "fmt"
- "time"
-
- "git.lukeshu.com/btrfs-progs-ng/lib/binstruct"
- "git.lukeshu.com/btrfs-progs-ng/lib/containers"
-)
-
-type Generation uint64
-
-type Key struct {
- ObjectID ObjID `bin:"off=0x0, siz=0x8"` // Each tree has its own set of Object IDs.
- ItemType ItemType `bin:"off=0x8, siz=0x1"`
- Offset uint64 `bin:"off=0x9, siz=0x8"` // The meaning depends on the item type.
- binstruct.End `bin:"off=0x11"`
-}
-
-func (k Key) String() string {
- return fmt.Sprintf("{%v %v %v}", k.ObjectID, k.ItemType, k.Offset)
-}
-
-func (a Key) Cmp(b Key) int {
- if d := containers.NativeCmp(a.ObjectID, b.ObjectID); d != 0 {
- return d
- }
- if d := containers.NativeCmp(a.ItemType, b.ItemType); d != 0 {
- return d
- }
- return containers.NativeCmp(a.Offset, b.Offset)
-}
-
-var _ containers.Ordered[Key] = Key{}
-
-type Time struct {
- Sec int64 `bin:"off=0x0, siz=0x8"` // Number of seconds since 1970-01-01T00:00:00Z.
- NSec uint32 `bin:"off=0x8, siz=0x4"` // Number of nanoseconds since the beginning of the second.
- binstruct.End `bin:"off=0xc"`
-}
-
-func (t Time) ToStd() time.Time {
- return time.Unix(t.Sec, int64(t.NSec))
-}