| 1 | package btrfsscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/ |
| 2 | |
| 3 | import ( |
| 4 | "encoding/binaryscip-go gomod github.com/golang/go/src go1.12 `encoding/binary`/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.12 fmt/" |
| 6 | "osscip-go gomod github.com/golang/go/src go1.12 os/" |
| 7 | ) |
| 8 | |
| 9 | func lookupUUIDSubvolItemscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/lookupUUIDSubvolItem().(f *osscip-go gomod github.com/golang/go/src go1.12 os/.Filescip-go gomod github.com/golang/go/src go1.12 os/File#, uuid UUIDscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/UUID#) (objectIDscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/objectID#, error) { |
| 10 | return uuidTreeLookupAnyscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/uuidTreeLookupAny().(f, uuid, uuidKeySubvolscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/uuidKeySubvol.) |
| 11 | } |
| 12 | |
| 13 | func lookupUUIDReceivedSubvolItemscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/lookupUUIDReceivedSubvolItem().(f *osscip-go gomod github.com/golang/go/src go1.12 os/.Filescip-go gomod github.com/golang/go/src go1.12 os/File#, uuid UUIDscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/UUID#) (objectIDscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/objectID#, error) { |
| 14 | return uuidTreeLookupAnyscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/uuidTreeLookupAny().(f, uuid, uuidKeyReceivedSubvolscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/uuidKeyReceivedSubvol.) |
| 15 | } |
| 16 | |
| 17 | func (id UUIDscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/UUID#) toKeyscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/UUID#toKey().() (objID objectIDscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/objectID#, off uint64) { |
| 18 | objID = objectIDscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/objectID#(binaryscip-go gomod github.com/golang/go/src go1.12 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.12 `encoding/binary`/LittleEndian..Uint64scip-go gomod github.com/golang/go/src go1.12 `encoding/binary`/littleEndian#Uint64().(id[:8])) |
| 19 | off = binaryscip-go gomod github.com/golang/go/src go1.12 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.12 `encoding/binary`/LittleEndian..Uint64scip-go gomod github.com/golang/go/src go1.12 `encoding/binary`/littleEndian#Uint64().(id[8:16]) |
| 20 | return |
| 21 | } |
| 22 | |
| 23 | // uuidTreeLookupAny searches uuid tree for a given uuid in specified field. |
| 24 | // It returns ErrNotFound if object was not found. |
| 25 | func uuidTreeLookupAnyscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/uuidTreeLookupAny().(f *osscip-go gomod github.com/golang/go/src go1.12 os/.Filescip-go gomod github.com/golang/go/src go1.12 os/File#, uuid UUIDscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/UUID#, typ treeKeyTypescip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/treeKeyType#) (objectIDscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/objectID#, error) { |
| 26 | objId, off := uuid.toKeyscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/UUID#toKey().() |
| 27 | args := btrfs_ioctl_search_keyscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/btrfs_ioctl_search_key#{ |
| 28 | tree_idscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/btrfs_ioctl_search_key#tree_id.: uuidTreeObjectidscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/uuidTreeObjectid., |
| 29 | min_objectidscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/btrfs_ioctl_search_key#min_objectid.: objId, |
| 30 | max_objectidscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/btrfs_ioctl_search_key#max_objectid.: objId, |
| 31 | min_typescip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/btrfs_ioctl_search_key#min_type.: typ, |
| 32 | max_typescip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/btrfs_ioctl_search_key#max_type.: typ, |
| 33 | min_offsetscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/btrfs_ioctl_search_key#min_offset.: off, |
| 34 | max_offsetscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/btrfs_ioctl_search_key#max_offset.: off, |
| 35 | max_transidscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/btrfs_ioctl_search_key#max_transid.: maxUint64scip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/maxUint64., |
| 36 | nr_itemsscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/btrfs_ioctl_search_key#nr_items.: 1, |
| 37 | } |
| 38 | res, err := treeSearchRawscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/treeSearchRaw().(f, args) |
| 39 | if err != nil { |
| 40 | return 0, err |
| 41 | } else if len(res) < 1 { |
| 42 | return 0, ErrNotFoundscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/ErrNotFound. |
| 43 | } |
| 44 | out := res[0] |
| 45 | if len(out.Datascip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/searchResult#Data.) != 8 { |
| 46 | return 0, fmtscip-go gomod github.com/golang/go/src go1.12 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.12 fmt/Errorf().("btrfs: uuid item with illegal size %d", len(out.Datascip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/searchResult#Data.)) |
| 47 | } |
| 48 | return objectIDscip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/objectID#(binaryscip-go gomod github.com/golang/go/src go1.12 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.12 `encoding/binary`/LittleEndian..Uint64scip-go gomod github.com/golang/go/src go1.12 `encoding/binary`/littleEndian#Uint64().(out.Datascip-go gomod github.com/dennwc/btrfs . `github.com/dennwc/btrfs`/searchResult#Data.)), nil |
| 49 | } |