2121
2222import drgn
2323import sdb
24- from sdb .commands .zfs .internal import (BP_GET_TYPE , BP_GET_CHECKSUM ,
25- BP_GET_COMPRESS , BP_GET_LEVEL ,
26- BP_GET_LSIZE , BP_GET_BIRTH ,
27- BP_GET_PSIZE , BP_LOGICAL_BIRTH ,
28- BP_IS_HOLE , BP_GET_NDVAS ,
29- BP_IS_ENCRYPTED , BP_IS_GANG ,
30- BP_GET_LAYER , BP_IS_AUTHENTICATED ,
31- BP_HAS_INDIRECT_MAC_CKSUM ,
32- BP_GET_BYTEORDER , BP_GET_DEDUP ,
33- BP_IS_EMBEDDED , BP_IS_REDACTED ,
34- BP_GET_FILL , BP_GET_IV2 ,
35- DVA_IS_VALID , DVA_GET_VDEV ,
36- DVA_GET_OFFSET , DVA_GET_ASIZE ,
37- BPE_GET_ETYPE )
38-
39-
24+ from sdb .commands .zfs .internal import (
25+ BP_GET_TYPE , BP_GET_CHECKSUM , BP_GET_COMPRESS , BP_GET_LEVEL , BP_GET_LSIZE ,
26+ BP_GET_BIRTH , BP_GET_PSIZE , BP_LOGICAL_BIRTH , BP_IS_HOLE , BP_GET_NDVAS ,
27+ BP_IS_ENCRYPTED , BP_IS_GANG , BP_GET_LAYER , BP_IS_AUTHENTICATED ,
28+ BP_HAS_INDIRECT_MAC_CKSUM , BP_GET_BYTEORDER , BP_GET_DEDUP , BP_IS_EMBEDDED ,
29+ BP_IS_REDACTED , BP_GET_FILL , BP_GET_IV2 , DVA_IS_VALID , DVA_GET_VDEV ,
30+ DVA_GET_OFFSET , DVA_GET_ASIZE , BPE_GET_ETYPE )
4031
4132
4233class Blkptr (sdb .PrettyPrinter ):
@@ -61,61 +52,52 @@ class Blkptr(sdb.PrettyPrinter):
6152 names = ["blkptr" ]
6253 input_type = "blkptr_t *"
6354
64-
6555 def get_ot_name (self , bp : drgn .Object ) -> str :
66- return str (sdb . get_object (
67- "dmu_ot" )[BP_GET_TYPE (bp )].ot_name .string_ ().decode ("utf-8" ))
68-
56+ return str (
57+ sdb . get_object ( "dmu_ot" )[BP_GET_TYPE (bp )].ot_name .string_ ().decode (
58+ "utf-8" ))
6959
7060 def get_checksum (self , bp : drgn .Object ) -> str :
71- checksum = sdb .get_object (
72- "zio_checksum_table" )[ BP_GET_CHECKSUM ( bp )].ci_name
61+ checksum = sdb .get_object ("zio_checksum_table" )[ BP_GET_CHECKSUM (
62+ bp )].ci_name
7363 return str (checksum .string_ ().decode ("utf-8" ))
7464
75-
7665 def get_compress (self , bp : drgn .Object ) -> str :
77- compress = sdb .get_object (
78- "zio_compress_table" )[ BP_GET_COMPRESS ( bp )].ci_name
66+ compress = sdb .get_object ("zio_compress_table" )[ BP_GET_COMPRESS (
67+ bp )].ci_name
7968 return str (compress .string_ ().decode ("utf-8" ))
8069
81-
8270 def print_hole (self , bp : drgn .Object ) -> None :
8371 print (f"HOLE [L{ BP_GET_LEVEL (bp )} { self .get_ot_name (bp )} ]" , end = ' ' )
8472 print (f"size={ BP_GET_LSIZE (bp ):#x} L birth={ BP_GET_BIRTH (bp ):#x} L" )
8573
86-
8774 def print_embedded (self , bp : drgn .Object ) -> None :
8875 print (f"EMBEDDED [L{ BP_GET_LEVEL (bp )} " , end = ' ' )
8976 print (f"{ self .get_ot_name (bp )} ]" , end = ' ' )
9077 print (f"et={ BPE_GET_ETYPE (bp )} { BP_GET_COMPRESS (bp )} " , end = ' ' )
9178 print (f"size={ BP_GET_LSIZE (bp ):#x} L/{ BP_GET_PSIZE (bp ):#x} P " , end = ' ' )
9279 print (f"birth={ BP_LOGICAL_BIRTH (bp )} L" )
9380
94-
9581 def print_redacted (self , bp : drgn .Object ) -> None :
9682 print (f"REDACTED [L{ BP_GET_LEVEL (bp )} " , end = ' ' )
9783 print (f"{ self .get_ot_name (bp )} ] size={ BP_GET_LSIZE (bp ):#x} " , end = ' ' )
9884 print (f"birth={ BP_LOGICAL_BIRTH (bp ):#x} " )
9985
100-
10186 def get_byteorder (self , bp : drgn .Object ) -> str :
10287 if BP_GET_BYTEORDER (bp ) == 0 :
10388 return "BE"
10489 return "LE"
10590
106-
10791 def get_gang (self , bp : drgn .Object ) -> str :
10892 if BP_IS_GANG (bp ):
10993 return "gang"
11094 return "contiguous"
11195
112-
11396 def get_dedup (self , bp : drgn .Object ) -> str :
11497 if BP_GET_DEDUP (bp ):
11598 return "dedup"
11699 return "unique"
117100
118-
119101 def get_crypt (self , bp : drgn .Object ) -> str :
120102 if BP_IS_ENCRYPTED (bp ):
121103 return "encrypted"
@@ -125,7 +107,6 @@ def get_crypt(self, bp: drgn.Object) -> str:
125107 return "indirect-MAC"
126108 return "unencrypted"
127109
128-
129110 def pretty_print (self , objs : Iterable [drgn .Object ]) -> None :
130111 copyname = ['zero' , 'single' , 'double' , 'triple' ]
131112 copies = 0
0 commit comments