# Generated by cstruct-stubgen
from typing import BinaryIO, Literal, TypeAlias, overload

import dissect.cstruct as __cs__

class _c_apfs(__cs__.cstruct):
    OID_NX_SUPERBLOCK: Literal[1] = ...
    OID_INVALID: Literal[0] = ...
    OID_RESERVED_COUNT: Literal[1024] = ...
    OBJECT_TYPE_MASK: Literal[65535] = ...
    OBJECT_TYPE_FLAGS_MASK: Literal[4294901760] = ...
    OBJ_STORAGETYPE_MASK: Literal[3221225472] = ...
    OBJECT_TYPE_FLAGS_DEFINED_MASK: Literal[4160749568] = ...
    OBJECT_TYPE_NX_SUPERBLOCK: Literal[1] = ...
    OBJECT_TYPE_BTREE: Literal[2] = ...
    OBJECT_TYPE_BTREE_NODE: Literal[3] = ...
    OBJECT_TYPE_SPACEMAN: Literal[5] = ...
    OBJECT_TYPE_SPACEMAN_CAB: Literal[6] = ...
    OBJECT_TYPE_SPACEMAN_CIB: Literal[7] = ...
    OBJECT_TYPE_SPACEMAN_BITMAP: Literal[8] = ...
    OBJECT_TYPE_SPACEMAN_FREE_QUEUE: Literal[9] = ...
    OBJECT_TYPE_EXTENT_LIST_TREE: Literal[10] = ...
    OBJECT_TYPE_OMAP: Literal[11] = ...
    OBJECT_TYPE_CHECKPOINT_MAP: Literal[12] = ...
    OBJECT_TYPE_FS: Literal[13] = ...
    OBJECT_TYPE_FSTREE: Literal[14] = ...
    OBJECT_TYPE_BLOCKREFTREE: Literal[15] = ...
    OBJECT_TYPE_SNAPMETATREE: Literal[16] = ...
    OBJECT_TYPE_NX_REAPER: Literal[17] = ...
    OBJECT_TYPE_NX_REAP_LIST: Literal[18] = ...
    OBJECT_TYPE_OMAP_SNAPSHOT: Literal[19] = ...
    OBJECT_TYPE_EFI_JUMPSTART: Literal[20] = ...
    OBJECT_TYPE_FUSION_MIDDLE_TREE: Literal[21] = ...
    OBJECT_TYPE_NX_FUSION_WBC: Literal[22] = ...
    OBJECT_TYPE_NX_FUSION_WBC_LIST: Literal[23] = ...
    OBJECT_TYPE_ER_STATE: Literal[24] = ...
    OBJECT_TYPE_GBITMAP: Literal[25] = ...
    OBJECT_TYPE_GBITMAP_TREE: Literal[26] = ...
    OBJECT_TYPE_GBITMAP_BLOCK: Literal[27] = ...
    OBJECT_TYPE_ER_RECOVERY_BLOCK: Literal[28] = ...
    OBJECT_TYPE_SNAP_META_EXT: Literal[29] = ...
    OBJECT_TYPE_INTEGRITY_META: Literal[30] = ...
    OBJECT_TYPE_FEXT_TREE: Literal[31] = ...
    OBJECT_TYPE_RESERVED_20: Literal[32] = ...
    OBJECT_TYPE_INVALID: Literal[0] = ...
    OBJECT_TYPE_TEST: Literal[255] = ...
    OBJECT_TYPE_CONTAINER_KEYBAG: Literal[1801812339] = ...
    OBJECT_TYPE_VOLUME_KEYBAG: Literal[1919247219] = ...
    OBJECT_TYPE_MEDIA_KEYBAG: Literal[1835754873] = ...
    OBJ_VIRTUAL: Literal[0] = ...
    OBJ_EPHEMERAL: Literal[2147483648] = ...
    OBJ_PHYSICAL: Literal[1073741824] = ...
    OBJ_NOHEADER: Literal[536870912] = ...
    OBJ_ENCRYPTED: Literal[268435456] = ...
    OBJ_NONPERSISTENT: Literal[134217728] = ...
    MAX_CKSUM_SIZE: Literal[8] = ...
    OMAP_VAL_DELETED: Literal[1] = ...
    OMAP_VAL_SAVED: Literal[2] = ...
    OMAP_VAL_ENCRYPTED: Literal[4] = ...
    OMAP_VAL_NOHEADER: Literal[8] = ...
    OMAP_VAL_CRYPTO_GENERATION: Literal[16] = ...
    OMAP_SNAPSHOT_DELETED: Literal[1] = ...
    OMAP_SNAPSHOT_REVERTED: Literal[2] = ...
    OMAP_MANUALLY_MANAGED: Literal[1] = ...
    OMAP_ENCRYPTING: Literal[2] = ...
    OMAP_DECRYPTING: Literal[4] = ...
    OMAP_KEYROLLING: Literal[8] = ...
    OMAP_CRYPTO_GENERATION: Literal[16] = ...
    OMAP_VALID_FLAGS: Literal[31] = ...
    OMAP_MAX_SNAP_COUNT: Literal[4294967295] = ...
    OMAP_REAP_PHASE_MAP_TREE: Literal[1] = ...
    OMAP_REAP_PHASE_SNAPSHOT_TREE: Literal[2] = ...
    BTREE_UINT64_KEYS: Literal[1] = ...
    BTREE_SEQUENTIAL_INSERT: Literal[2] = ...
    BTREE_ALLOW_GHOSTS: Literal[4] = ...
    BTREE_EPHEMERAL: Literal[8] = ...
    BTREE_PHYSICAL: Literal[16] = ...
    BTREE_NONPERSISTENT: Literal[32] = ...
    BTREE_KV_NONALIGNED: Literal[64] = ...
    BTREE_HASHED: Literal[128] = ...
    BTREE_NOHEADER: Literal[256] = ...
    BTREE_TOC_ENTRY_INCREMENT: Literal[8] = ...
    BTREE_TOC_ENTRY_MAX_UNUSED: Literal[16] = ...
    BTNODE_ROOT: Literal[1] = ...
    BTNODE_LEAF: Literal[2] = ...
    BTNODE_FIXED_KV_SIZE: Literal[4] = ...
    BTNODE_HASHED: Literal[8] = ...
    BTNODE_NOHEADER: Literal[16] = ...
    BTNODE_CHECK_KOFF_INVAL: Literal[32768] = ...
    BTREE_NODE_SIZE_DEFAULT: Literal[4096] = ...
    BTREE_NODE_MIN_ENTRY_COUNT: Literal[4] = ...
    BTREE_NODE_HASH_SIZE_MAX: Literal[64] = ...
    BTOFF_INVALID: Literal[65535] = ...
    OBJ_ID_MASK: Literal[1152921504606846975] = ...
    OBJ_TYPE_MASK: Literal[17293822569102704640] = ...
    OBJ_TYPE_SHIFT: Literal[60] = ...
    SYSTEM_OBJ_ID_MARK: Literal[1152921500311879680] = ...
    J_DREC_LEN_MASK: Literal[1023] = ...
    J_DREC_HASH_MASK: Literal[4294966272] = ...
    J_DREC_HASH_SHIFT: Literal[10] = ...
    APFS_INODE_PINNED_MASK: Literal["INODE.PINNED_TO_MAIN | INODE.PINNED_TO_TIER2"] = ...
    UF_NODUMP: Literal[1] = ...
    UF_IMMUTABLE: Literal[2] = ...
    UF_APPEND: Literal[4] = ...
    UF_OPAQUE: Literal[8] = ...
    UF_NOUNLINK: Literal[16] = ...
    UF_COMPRESSED: Literal[32] = ...
    UF_TRACKED: Literal[64] = ...
    UF_DATAVAULT: Literal[128] = ...
    UF_HIDDEN: Literal[32768] = ...
    SF_SUPPORTED: Literal[10420224] = ...
    SF_SETTABLE: Literal[1073676288] = ...
    SF_SYNTHETIC: Literal[3221225472] = ...
    SF_ARCHIVED: Literal[65536] = ...
    SF_IMMUTABLE: Literal[131072] = ...
    SF_APPEND: Literal[262144] = ...
    SF_RESTRICTED: Literal[524288] = ...
    SF_NOUNLINK: Literal[1048576] = ...
    SF_SNAPSHOT: Literal[2097152] = ...
    SF_FIRMLINK: Literal[8388608] = ...
    SF_DATALESS: Literal[1073741824] = ...
    DREC_TYPE_MASK: Literal[15] = ...
    INVALID_INO_NUM: Literal[0] = ...
    ROOT_DIR_PARENT: Literal[1] = ...
    ROOT_DIR_INO_NUM: Literal[2] = ...
    PRIV_DIR_INO_NUM: Literal[3] = ...
    SNAP_DIR_INO_NUM: Literal[6] = ...
    PURGEABLE_DIR_INO_NUM: Literal[7] = ...
    MIN_USER_INO_NUM: Literal[16] = ...
    UNIFIED_ID_SPACE_MARK: Literal[576460752303423488] = ...
    XATTR_MAX_EMBEDDED_SIZE: Literal[3804] = ...
    SYMLINK_EA_NAME: Literal["com.apple.fs.symlink"] = ...
    FIRMLINK_EA_NAME: Literal["com.apple.fs.firmlink"] = ...
    APFS_COW_EXEMPT_COUNT_NAME: Literal["com.apple.fs.cow-exempt-file-count"] = ...
    OWNING_OBJ_ID_INVALID: Literal[-1] = ...
    OWNING_OBJ_ID_UNKNOWN: Literal[-2] = ...
    JOBJ_MAX_KEY_SIZE: Literal[832] = ...
    JOBJ_MAX_VALUE_SIZE: Literal[3808] = ...
    MIN_DOC_ID: Literal[3] = ...
    FEXT_CRYPTO_ID_IS_TWEAK: Literal[1] = ...
    DECMPFS_MAGIC: Literal[b"cmpf"] = ...
    DECMPFS_BLOCK_SIZE: Literal[65536] = ...
    DECMPFS_ZLIB_ATTR: Literal[3] = ...
    DECMPFS_ZLIB_RSRC: Literal[4] = ...
    DECMPFS_LZVN_ATTR: Literal[7] = ...
    DECMPFS_LZVN_RSRC: Literal[8] = ...
    DECMPFS_PLAIN_ATTR: Literal[9] = ...
    DECMPFS_PLAIN_RSRC: Literal[10] = ...
    DECMPFS_LZFSE_ATTR: Literal[11] = ...
    DECMPFS_LZFSE_RSRC: Literal[12] = ...
    DECMPFS_LZBITMAP_ATTR: Literal[13] = ...
    DECMPFS_LZBITMAP_RSRC: Literal[14] = ...
    PEXT_LEN_MASK: Literal[1152921504606846975] = ...
    PEXT_KIND_MASK: Literal[17293822569102704640] = ...
    PEXT_KIND_SHIFT: Literal[60] = ...
    J_FILE_EXTENT_LEN_MASK: Literal[72057594037927935] = ...
    J_FILE_EXTENT_FLAG_MASK: Literal[18374686479671623680] = ...
    J_FILE_EXTENT_FLAG_SHIFT: Literal[56] = ...
    CRYPTO_SW_ID: Literal[4] = ...
    CRYPTO_RESERVED_5: Literal[5] = ...
    APFS_UNASSIGNED_CRYPTO_ID: Literal[-1] = ...
    APFS_VOL_KEYBAG_ENTRY_MAX_SIZE: Literal[512] = ...
    APFS_FV_PERSONAL_RECOVERY_KEY_UUID: Literal["EBC6C064-0000-11AA-AA11-00306543ECAC"] = ...
    APFS_KEYBAG_VERSION: Literal[2] = ...
    CP_EFFECTIVE_CLASSMASK: Literal[31] = ...
    ER_512B_BLOCKSIZE: Literal[0] = ...
    ER_2KiB_BLOCKSIZE: Literal[1] = ...
    ER_4KiB_BLOCKSIZE: Literal[2] = ...
    ER_8KiB_BLOCKSIZE: Literal[3] = ...
    ER_16KiB_BLOCKSIZE: Literal[4] = ...
    ER_32KiB_BLOCKSIZE: Literal[5] = ...
    ER_64KiB_BLOCKSIZE: Literal[6] = ...
    ERSB_FLAG_ENCRYPTING: Literal[1] = ...
    ERSB_FLAG_DECRYPTING: Literal[2] = ...
    ERSB_FLAG_KEYROLLING: Literal[4] = ...
    ERSB_FLAG_PAUSED: Literal[8] = ...
    ERSB_FLAG_FAILED: Literal[16] = ...
    ERSB_FLAG_CID_IS_TWEAK: Literal[32] = ...
    ERSB_FLAG_FREE_1: Literal[64] = ...
    ERSB_FLAG_FREE_2: Literal[128] = ...
    ERSB_FLAG_CM_BLOCK_SIZE_MASK: Literal[3840] = ...
    ERSB_FLAG_CM_BLOCK_SIZE_SHIFT: Literal[8] = ...
    ERSB_FLAG_ER_PHASE_MASK: Literal[12288] = ...
    ERSB_FLAG_ER_PHASE_SHIFT: Literal[12] = ...
    ERSB_FLAG_FROM_ONEKEY: Literal[16384] = ...
    ER_CHECKSUM_LENGTH: Literal[8] = ...
    ER_MAGIC: Literal[b"FLAB"] = ...
    ER_VERSION: Literal[1] = ...
    ER_MAX_CHECKSUM_COUNT_SHIFT: Literal[16] = ...
    ER_CUR_CHECKSUM_COUNT_MASK: Literal[65535] = ...
    NX_EFI_JUMPSTART_MAGIC: Literal[b"RDSJ"] = ...
    NX_EFI_JUMPSTART_VERSION: Literal[1] = ...
    NX_MAGIC: Literal[b"BSXN"] = ...
    NX_MAX_FILE_SYSTEMS: Literal[100] = ...
    NX_EPH_INFO_COUNT: Literal[4] = ...
    NX_EPH_MIN_BLOCK_COUNT: Literal[8] = ...
    NX_MAX_FILE_SYSTEM_EPH_STRUCTS: Literal[4] = ...
    NX_TX_MIN_CHECKPOINT_COUNT: Literal[4] = ...
    NX_EPH_INFO_VERSION_1: Literal[1] = ...
    NX_MINIMUM_BLOCK_SIZE: Literal[4096] = ...
    NX_DEFAULT_BLOCK_SIZE: Literal[4096] = ...
    NX_MAXIMUM_BLOCK_SIZE: Literal[65536] = ...
    NX_MINIMUM_CONTAINER_SIZE: Literal[1048576] = ...
    NX_RESERVED_1: Literal[1] = ...
    NX_RESERVED_2: Literal[2] = ...
    NX_CRYPTO_SW: Literal[4] = ...
    NX_CNTR_OBJ_CKSUM_SET: Literal[0] = ...
    NX_CNTR_OBJ_CKSUM_FAIL: Literal[1] = ...
    NX_NUM_COUNTERS: Literal[32] = ...
    CHECKPOINT_MAP_LAST: Literal[1] = ...
    APFS_MAGIC: Literal[b"BSPA"] = ...
    APFS_MAX_HIST: Literal[8] = ...
    APFS_VOLNAME_LEN: Literal[256] = ...
    APFS_MODIFIED_NAMELEN: Literal[32] = ...
    APFS_VOLUME_ENUM_SHIFT: Literal[6] = ...
    APFS_HASH_CCSHA256_SIZE: Literal[32] = ...
    APFS_HASH_CCSHA512_256_SIZE: Literal[32] = ...
    APFS_HASH_CCSHA384_SIZE: Literal[48] = ...
    APFS_HASH_CCSHA512_SIZE: Literal[64] = ...
    APFS_HASH_MAX_SIZE: Literal[64] = ...
    APFS_SEAL_BROKEN: Literal[1] = ...
    J_FILE_INFO_LBA_MASK: Literal[72057594037927935] = ...
    J_FILE_INFO_TYPE_MASK: Literal[18374686479671623680] = ...
    J_FILE_INFO_TYPE_SHIFT: Literal[56] = ...
    SM_ALLOCZONE_INVALID_END_BOUNDARY: Literal[0] = ...
    SM_ALLOCZONE_NUM_PREVIOUS_BOUNDARIES: Literal[7] = ...
    SM_DATAZONE_ALLOCZONE_COUNT: Literal[8] = ...
    SM_FLAG_VERSIONED: Literal[1] = ...
    SFQ_IP: Literal[0] = ...
    SFQ_MAIN: Literal[1] = ...
    SFQ_TIER2: Literal[2] = ...
    SFQ_COUNT: Literal[3] = ...
    SD_MAIN: Literal[0] = ...
    SD_TIER2: Literal[1] = ...
    SD_COUNT: Literal[2] = ...
    CI_COUNT_MASK: Literal[1048575] = ...
    CI_COUNT_RESERVED_MASK: Literal[4293918720] = ...
    SPACEMAN_IP_BM_TX_MULTIPLIER: Literal[16] = ...
    SPACEMAN_IP_BM_INDEX_INVALID: Literal[65535] = ...
    SPACEMAN_IP_BM_BLOCK_COUNT_MAX: Literal[65534] = ...
    NR_BHM_FLAG: Literal[1] = ...
    NR_CONTINUE: Literal[2] = ...
    NRLE_VALID: Literal[1] = ...
    NRLE_REAP_ID_RECORD: Literal[2] = ...
    NRLE_CALL: Literal[4] = ...
    NRLE_COMPLETION: Literal[8] = ...
    NRLE_CLEANUP: Literal[16] = ...
    NRL_INDEX_INVALID: Literal[4294967295] = ...
    FUSION_TIER2_DEVICE_BYTE_ADDR: Literal[4611686018427387904] = ...
    FUSION_MT_DIRTY: Literal[1] = ...
    FUSION_MT_TENANT: Literal[2] = ...
    FUSION_MT_ALLFLAGS: Literal[3] = ...
    mode_t: TypeAlias = _c_apfs.uint16
    uid_t: TypeAlias = _c_apfs.uint32
    gid_t: TypeAlias = _c_apfs.uint32
    cp_key_class_t: TypeAlias = _c_apfs.uint32
    cp_key_os_version_t: TypeAlias = _c_apfs.uint32
    cp_key_revision_t: TypeAlias = _c_apfs.uint16
    crypto_flags_t: TypeAlias = _c_apfs.uint32
    paddr_t: TypeAlias = _c_apfs.int64
    class prange(__cs__.Structure):
        pr_start_paddr: _c_apfs.int64
        pr_block_count: _c_apfs.uint64
        @overload
        def __init__(self, pr_start_paddr: _c_apfs.int64 | None = ..., pr_block_count: _c_apfs.uint64 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    prange_t: TypeAlias = prange
    oid_t: TypeAlias = _c_apfs.uint64
    xid_t: TypeAlias = _c_apfs.uint64
    class OBJECT_TYPE(__cs__.Enum):
        NX_SUPERBLOCK = ...
        BTREE = ...
        BTREE_NODE = ...
        SPACEMAN = ...
        SPACEMAN_CAB = ...
        SPACEMAN_CIB = ...
        SPACEMAN_BITMAP = ...
        SPACEMAN_FREE_QUEUE = ...
        EXTENT_LIST_TREE = ...
        OMAP = ...
        CHECKPOINT_MAP = ...
        FS = ...
        FSTREE = ...
        BLOCKREFTREE = ...
        SNAPMETATREE = ...
        NX_REAPER = ...
        NX_REAP_LIST = ...
        OMAP_SNAPSHOT = ...
        EFI_JUMPSTART = ...
        FUSION_MIDDLE_TREE = ...
        NX_FUSION_WBC = ...
        NX_FUSION_WBC_LIST = ...
        ER_STATE = ...
        GBITMAP = ...
        GBITMAP_TREE = ...
        GBITMAP_BLOCK = ...
        ER_RECOVERY_BLOCK = ...
        SNAP_META_EXT = ...
        INTEGRITY_META = ...
        FEXT_TREE = ...
        RESERVED_20 = ...
        INVALID = ...
        TEST = ...
        CONTAINER_KEYBAG = ...
        VOLUME_KEYBAG = ...
        MEDIA_KEYBAG = ...

    class OBJ(__cs__.Enum):
        VIRTUAL = ...
        EPHEMERAL = ...
        PHYSICAL = ...
        NOHEADER = ...
        ENCRYPTED = ...
        NONPERSISTENT = ...

    class obj_phys(__cs__.Structure):
        o_cksum: __cs__.CharArray
        o_oid: _c_apfs.uint64
        o_xid: _c_apfs.uint64
        o_type: _c_apfs.uint32
        o_subtype: _c_apfs.uint32
        @overload
        def __init__(
            self,
            o_cksum: __cs__.CharArray | None = ...,
            o_oid: _c_apfs.uint64 | None = ...,
            o_xid: _c_apfs.uint64 | None = ...,
            o_type: _c_apfs.uint32 | None = ...,
            o_subtype: _c_apfs.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    obj_phys_t: TypeAlias = obj_phys
    class omap_phys(__cs__.Structure):
        om_o: _c_apfs.obj_phys
        om_flags: _c_apfs.uint32
        om_snap_count: _c_apfs.uint32
        om_tree_type: _c_apfs.uint32
        om_snapshot_tree_type: _c_apfs.uint32
        om_tree_oid: _c_apfs.uint64
        om_snapshot_tree_oid: _c_apfs.uint64
        om_most_recent_snap: _c_apfs.uint64
        om_pending_revert_min: _c_apfs.uint64
        om_pending_revert_max: _c_apfs.uint64
        @overload
        def __init__(
            self,
            om_o: _c_apfs.obj_phys | None = ...,
            om_flags: _c_apfs.uint32 | None = ...,
            om_snap_count: _c_apfs.uint32 | None = ...,
            om_tree_type: _c_apfs.uint32 | None = ...,
            om_snapshot_tree_type: _c_apfs.uint32 | None = ...,
            om_tree_oid: _c_apfs.uint64 | None = ...,
            om_snapshot_tree_oid: _c_apfs.uint64 | None = ...,
            om_most_recent_snap: _c_apfs.uint64 | None = ...,
            om_pending_revert_min: _c_apfs.uint64 | None = ...,
            om_pending_revert_max: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    omap_phys_t: TypeAlias = omap_phys
    class omap_key(__cs__.Structure):
        ok_oid: _c_apfs.uint64
        ok_xid: _c_apfs.uint64
        @overload
        def __init__(self, ok_oid: _c_apfs.uint64 | None = ..., ok_xid: _c_apfs.uint64 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    omap_key_t: TypeAlias = omap_key
    class omap_val(__cs__.Structure):
        ov_flags: _c_apfs.uint32
        ov_size: _c_apfs.uint32
        ov_paddr: _c_apfs.int64
        @overload
        def __init__(
            self,
            ov_flags: _c_apfs.uint32 | None = ...,
            ov_size: _c_apfs.uint32 | None = ...,
            ov_paddr: _c_apfs.int64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    omap_val_t: TypeAlias = omap_val
    class omap_snapshot(__cs__.Structure):
        oms_flags: _c_apfs.uint32
        oms_pad: _c_apfs.uint32
        oms_oid: _c_apfs.uint64
        @overload
        def __init__(
            self,
            oms_flags: _c_apfs.uint32 | None = ...,
            oms_pad: _c_apfs.uint32 | None = ...,
            oms_oid: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    omap_snapshot_t: TypeAlias = omap_snapshot
    class BTREE(__cs__.Flag):
        UINT64_KEYS = ...
        SEQUENTIAL_INSERT = ...
        ALLOW_GHOSTS = ...
        EPHEMERAL = ...
        PHYSICAL = ...
        NONPERSISTENT = ...
        KV_NONALIGNED = ...
        HASHED = ...
        NOHEADER = ...

    class BTNODE(__cs__.Flag):
        ROOT = ...
        LEAF = ...
        FIXED_KV_SIZE = ...
        HASHED = ...
        NOHEADER = ...
        CHECK_KOFF_INVAL = ...

    class nloc(__cs__.Structure):
        off: _c_apfs.uint16
        len: _c_apfs.uint16
        @overload
        def __init__(self, off: _c_apfs.uint16 | None = ..., len: _c_apfs.uint16 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    nloc_t: TypeAlias = nloc
    class btree_node_phys(__cs__.Structure):
        btn_o: _c_apfs.obj_phys
        btn_flags: _c_apfs.uint16
        btn_level: _c_apfs.uint16
        btn_nkeys: _c_apfs.uint32
        btn_table_space: _c_apfs.nloc
        btn_free_space: _c_apfs.nloc
        btn_key_free_list: _c_apfs.nloc
        btn_val_free_list: _c_apfs.nloc
        @overload
        def __init__(
            self,
            btn_o: _c_apfs.obj_phys | None = ...,
            btn_flags: _c_apfs.uint16 | None = ...,
            btn_level: _c_apfs.uint16 | None = ...,
            btn_nkeys: _c_apfs.uint32 | None = ...,
            btn_table_space: _c_apfs.nloc | None = ...,
            btn_free_space: _c_apfs.nloc | None = ...,
            btn_key_free_list: _c_apfs.nloc | None = ...,
            btn_val_free_list: _c_apfs.nloc | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    btree_node_phys_t: TypeAlias = btree_node_phys
    class btree_info_fixed(__cs__.Structure):
        bt_flags: _c_apfs.uint32
        bt_node_size: _c_apfs.uint32
        bt_key_size: _c_apfs.uint32
        bt_val_size: _c_apfs.uint32
        @overload
        def __init__(
            self,
            bt_flags: _c_apfs.uint32 | None = ...,
            bt_node_size: _c_apfs.uint32 | None = ...,
            bt_key_size: _c_apfs.uint32 | None = ...,
            bt_val_size: _c_apfs.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    btree_info_fixed_t: TypeAlias = btree_info_fixed
    class btree_info(__cs__.Structure):
        bt_fixed: _c_apfs.btree_info_fixed
        bt_longest_key: _c_apfs.uint32
        bt_longest_val: _c_apfs.uint32
        bt_key_count: _c_apfs.uint64
        bt_node_count: _c_apfs.uint64
        @overload
        def __init__(
            self,
            bt_fixed: _c_apfs.btree_info_fixed | None = ...,
            bt_longest_key: _c_apfs.uint32 | None = ...,
            bt_longest_val: _c_apfs.uint32 | None = ...,
            bt_key_count: _c_apfs.uint64 | None = ...,
            bt_node_count: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    btree_info_t: TypeAlias = btree_info
    class btn_index_node_val(__cs__.Structure):
        binv_child_oid: _c_apfs.uint64
        binv_child_hash: __cs__.CharArray
        @overload
        def __init__(
            self, binv_child_oid: _c_apfs.uint64 | None = ..., binv_child_hash: __cs__.CharArray | None = ...
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    btn_index_node_val_t: TypeAlias = btn_index_node_val
    class kvloc(__cs__.Structure):
        k: _c_apfs.nloc
        v: _c_apfs.nloc
        @overload
        def __init__(self, k: _c_apfs.nloc | None = ..., v: _c_apfs.nloc | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    kvloc_t: TypeAlias = kvloc
    class kvoff(__cs__.Structure):
        k: _c_apfs.uint16
        v: _c_apfs.uint16
        @overload
        def __init__(self, k: _c_apfs.uint16 | None = ..., v: _c_apfs.uint16 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    kvoff_t: TypeAlias = kvoff
    class j_key(__cs__.Structure):
        obj_id_and_type: _c_apfs.uint64
        @overload
        def __init__(self, obj_id_and_type: _c_apfs.uint64 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_key_t: TypeAlias = j_key
    class j_inode_key(__cs__.Structure):
        hdr: _c_apfs.j_key
        @overload
        def __init__(self, hdr: _c_apfs.j_key | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_inode_key_t: TypeAlias = j_inode_key
    class j_inode_val(__cs__.Structure):
        parent_id: _c_apfs.uint64
        private_id: _c_apfs.uint64
        create_time: _c_apfs.uint64
        mod_time: _c_apfs.uint64
        change_time: _c_apfs.uint64
        access_time: _c_apfs.uint64
        internal_flags: _c_apfs.uint64
        nchildren: _c_apfs.int32
        nlink: _c_apfs.int32
        default_protection_class: _c_apfs.uint32
        write_generation_counter: _c_apfs.uint32
        bsd_flags: _c_apfs.uint32
        owner: _c_apfs.uint32
        group: _c_apfs.uint32
        mode: _c_apfs.uint16
        pad1: _c_apfs.uint16
        uncompressed_size: _c_apfs.uint64
        @overload
        def __init__(
            self,
            parent_id: _c_apfs.uint64 | None = ...,
            private_id: _c_apfs.uint64 | None = ...,
            create_time: _c_apfs.uint64 | None = ...,
            mod_time: _c_apfs.uint64 | None = ...,
            change_time: _c_apfs.uint64 | None = ...,
            access_time: _c_apfs.uint64 | None = ...,
            internal_flags: _c_apfs.uint64 | None = ...,
            nchildren: _c_apfs.int32 | None = ...,
            nlink: _c_apfs.int32 | None = ...,
            default_protection_class: _c_apfs.uint32 | None = ...,
            write_generation_counter: _c_apfs.uint32 | None = ...,
            bsd_flags: _c_apfs.uint32 | None = ...,
            owner: _c_apfs.uint32 | None = ...,
            group: _c_apfs.uint32 | None = ...,
            mode: _c_apfs.uint16 | None = ...,
            pad1: _c_apfs.uint16 | None = ...,
            uncompressed_size: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_inode_val_t: TypeAlias = j_inode_val
    class j_drec_key(__cs__.Structure):
        hdr: _c_apfs.j_key
        name_len: _c_apfs.uint16
        name: __cs__.CharArray
        @overload
        def __init__(
            self,
            hdr: _c_apfs.j_key | None = ...,
            name_len: _c_apfs.uint16 | None = ...,
            name: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_drec_key_t: TypeAlias = j_drec_key
    class j_drec_hashed_key(__cs__.Structure):
        hdr: _c_apfs.j_key
        name_len_and_hash: _c_apfs.uint32
        name: __cs__.CharArray
        @overload
        def __init__(
            self,
            hdr: _c_apfs.j_key | None = ...,
            name_len_and_hash: _c_apfs.uint32 | None = ...,
            name: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_drec_hashed_key_t: TypeAlias = j_drec_hashed_key
    class j_drec_val(__cs__.Structure):
        file_id: _c_apfs.uint64
        date_added: _c_apfs.uint64
        flags: _c_apfs.uint16
        @overload
        def __init__(
            self,
            file_id: _c_apfs.uint64 | None = ...,
            date_added: _c_apfs.uint64 | None = ...,
            flags: _c_apfs.uint16 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_drec_val_t: TypeAlias = j_drec_val
    class j_dir_stats_key(__cs__.Structure):
        hdr: _c_apfs.j_key
        @overload
        def __init__(self, hdr: _c_apfs.j_key | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_dir_stats_key_t: TypeAlias = j_dir_stats_key
    class j_dir_stats_val(__cs__.Structure):
        num_children: _c_apfs.uint64
        total_size: _c_apfs.uint64
        chained_key: _c_apfs.uint64
        gen_count: _c_apfs.uint64
        @overload
        def __init__(
            self,
            num_children: _c_apfs.uint64 | None = ...,
            total_size: _c_apfs.uint64 | None = ...,
            chained_key: _c_apfs.uint64 | None = ...,
            gen_count: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_dir_stats_val_t: TypeAlias = j_dir_stats_val
    class j_xattr_key(__cs__.Structure):
        hdr: _c_apfs.j_key
        name_len: _c_apfs.uint16
        name: __cs__.CharArray
        @overload
        def __init__(
            self,
            hdr: _c_apfs.j_key | None = ...,
            name_len: _c_apfs.uint16 | None = ...,
            name: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_xattr_key_t: TypeAlias = j_xattr_key
    class j_xattr_val(__cs__.Structure):
        flags: _c_apfs.uint16
        xdata_len: _c_apfs.uint16
        xdata: __cs__.CharArray
        @overload
        def __init__(
            self,
            flags: _c_apfs.uint16 | None = ...,
            xdata_len: _c_apfs.uint16 | None = ...,
            xdata: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_xattr_val_t: TypeAlias = j_xattr_val
    class APFS_TYPE(__cs__.Enum):
        ANY = ...
        SNAP_METADATA = ...
        EXTENT = ...
        INODE = ...
        XATTR = ...
        SIBLING_LINK = ...
        DSTREAM_ID = ...
        CRYPTO_STATE = ...
        FILE_EXTENT = ...
        DIR_REC = ...
        DIR_STATS = ...
        SNAP_NAME = ...
        SIBLING_MAP = ...
        FILE_INFO = ...
        MAX_VALID = ...
        MAX = ...
        INVALID = ...

    class APFS_KIND(__cs__.Enum):
        ANY = ...
        NEW = ...
        UPDATE = ...
        DEAD = ...
        UPDATE_REFCNT = ...
        INVALID = ...

    class INODE(__cs__.Flag):
        IS_APFS_PRIVATE = ...
        MAINTAIN_DIR_STATS = ...
        DIR_STATS_ORIGIN = ...
        PROT_CLASS_EXPLICIT = ...
        WAS_CLONED = ...
        FLAG_UNUSED = ...
        HAS_SECURITY_EA = ...
        BEING_TRUNCATED = ...
        HAS_FINDER_INFO = ...
        IS_SPARSE = ...
        WAS_EVER_CLONED = ...
        ACTIVE_FILE_TRIMMED = ...
        PINNED_TO_MAIN = ...
        PINNED_TO_TIER2 = ...
        HAS_RSRC_FORK = ...
        NO_RSRC_FORK = ...
        ALLOCATION_SPILLEDOVER = ...
        FAST_PROMOTE = ...
        HAS_UNCOMPRESSED_SIZE = ...
        IS_PURGEABLE = ...
        WANTS_TO_BE_PURGEABLE = ...
        IS_SYNC_ROOT = ...
        SNAPSHOT_COW_EXEMPTION = ...
        INHERITED_INTERNAL_FLAGS = ...
        CLONED_INTERNAL_FLAGS = ...

    class XATTR(__cs__.Flag):
        DATA_STREAM = ...
        DATA_EMBEDDED = ...
        FILE_SYSTEM_OWNED = ...
        RESERVED_8 = ...
        RESERVED_10 = ...

    class DT(__cs__.Enum):
        UNKNOWN = ...
        FIFO = ...
        CHR = ...
        DIR = ...
        BLK = ...
        REG = ...
        LNK = ...
        SOCK = ...
        WHT = ...

    class decmpfs_header(__cs__.Structure):
        magic: _c_apfs.uint32
        algorithm: _c_apfs.uint32
        uncompressed_size: _c_apfs.uint64
        @overload
        def __init__(
            self,
            magic: _c_apfs.uint32 | None = ...,
            algorithm: _c_apfs.uint32 | None = ...,
            uncompressed_size: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class j_phys_ext_key(__cs__.Structure):
        hdr: _c_apfs.j_key
        @overload
        def __init__(self, hdr: _c_apfs.j_key | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_phys_ext_key_t: TypeAlias = j_phys_ext_key
    class j_phys_ext_val(__cs__.Structure):
        len_and_kind: _c_apfs.uint64
        owning_obj_id: _c_apfs.uint64
        refcnt: _c_apfs.int32
        @overload
        def __init__(
            self,
            len_and_kind: _c_apfs.uint64 | None = ...,
            owning_obj_id: _c_apfs.uint64 | None = ...,
            refcnt: _c_apfs.int32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_phys_ext_val_t: TypeAlias = j_phys_ext_val
    class j_file_extent_key(__cs__.Structure):
        hdr: _c_apfs.j_key
        logical_addr: _c_apfs.uint64
        @overload
        def __init__(self, hdr: _c_apfs.j_key | None = ..., logical_addr: _c_apfs.uint64 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_file_extent_key_t: TypeAlias = j_file_extent_key
    class j_file_extent_val(__cs__.Structure):
        len_and_flags: _c_apfs.uint64
        phys_block_num: _c_apfs.uint64
        crypto_id: _c_apfs.uint64
        @overload
        def __init__(
            self,
            len_and_flags: _c_apfs.uint64 | None = ...,
            phys_block_num: _c_apfs.uint64 | None = ...,
            crypto_id: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_file_extent_val_t: TypeAlias = j_file_extent_val
    class j_dstream_id_key(__cs__.Structure):
        hdr: _c_apfs.j_key
        @overload
        def __init__(self, hdr: _c_apfs.j_key | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_dstream_id_key_t: TypeAlias = j_dstream_id_key
    class j_dstream_id_val(__cs__.Structure):
        refcnt: _c_apfs.uint32
        @overload
        def __init__(self, refcnt: _c_apfs.uint32 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_dstream_id_val_t: TypeAlias = j_dstream_id_val
    class j_dstream(__cs__.Structure):
        size: _c_apfs.uint64
        alloced_size: _c_apfs.uint64
        default_crypto_id: _c_apfs.uint64
        total_bytes_written: _c_apfs.uint64
        total_bytes_read: _c_apfs.uint64
        @overload
        def __init__(
            self,
            size: _c_apfs.uint64 | None = ...,
            alloced_size: _c_apfs.uint64 | None = ...,
            default_crypto_id: _c_apfs.uint64 | None = ...,
            total_bytes_written: _c_apfs.uint64 | None = ...,
            total_bytes_read: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_dstream_t: TypeAlias = j_dstream
    class j_xattr_dstream(__cs__.Structure):
        xattr_obj_id: _c_apfs.uint64
        dstream: _c_apfs.j_dstream
        @overload
        def __init__(self, xattr_obj_id: _c_apfs.uint64 | None = ..., dstream: _c_apfs.j_dstream | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_xattr_dstream_t: TypeAlias = j_xattr_dstream
    class x_field(__cs__.Structure):
        x_type: _c_apfs.uint8
        x_flags: _c_apfs.uint8
        x_size: _c_apfs.uint16
        @overload
        def __init__(
            self,
            x_type: _c_apfs.uint8 | None = ...,
            x_flags: _c_apfs.uint8 | None = ...,
            x_size: _c_apfs.uint16 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    x_field_t: TypeAlias = x_field
    class xf_blob(__cs__.Structure):
        xf_num_exts: _c_apfs.uint16
        xf_used_data: _c_apfs.uint16
        class x_field(__cs__.Structure):
            x_type: _c_apfs.uint8
            x_flags: _c_apfs.uint8
            x_size: _c_apfs.uint16
            @overload
            def __init__(
                self,
                x_type: _c_apfs.uint8 | None = ...,
                x_flags: _c_apfs.uint8 | None = ...,
                x_size: _c_apfs.uint16 | None = ...,
            ): ...
            @overload
            def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

        xf_exts: __cs__.Array[x_field]
        xf_data: __cs__.CharArray
        @overload
        def __init__(
            self,
            xf_num_exts: _c_apfs.uint16 | None = ...,
            xf_used_data: _c_apfs.uint16 | None = ...,
            xf_exts: __cs__.Array[x_field] | None = ...,
            xf_data: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    xf_blob_t: TypeAlias = xf_blob
    class DREC_EXT_TYPE(__cs__.Enum):
        SIBLING_ID = ...

    class INO_EXT_TYPE(__cs__.Enum):
        SNAP_XID = ...
        DELTA_TREE_OID = ...
        DOCUMENT_ID = ...
        NAME = ...
        PREV_FSIZE = ...
        RESERVED_6 = ...
        FINDER_INFO = ...
        DSTREAM = ...
        RESERVED_9 = ...
        DIR_STATS_KEY = ...
        FS_UUID = ...
        RESERVED_12 = ...
        SPARSE_BYTES = ...
        RDEV = ...
        PURGEABLE_FLAGS = ...
        ORIG_SYNC_ROOT_ID = ...

    class XF(__cs__.Flag):
        DATA_DEPENDENT = ...
        DO_NOT_COPY = ...
        RESERVED_4 = ...
        CHILDREN_INHERIT = ...
        USER_FIELD = ...
        SYSTEM_FIELD = ...
        RESERVED_40 = ...
        RESERVED_80 = ...

    class j_sibling_key(__cs__.Structure):
        hdr: _c_apfs.j_key
        sibling_id: _c_apfs.uint64
        @overload
        def __init__(self, hdr: _c_apfs.j_key | None = ..., sibling_id: _c_apfs.uint64 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_sibling_key_t: TypeAlias = j_sibling_key
    class j_sibling_val(__cs__.Structure):
        parent_id: _c_apfs.uint64
        name_len: _c_apfs.uint16
        name: __cs__.CharArray
        @overload
        def __init__(
            self,
            parent_id: _c_apfs.uint64 | None = ...,
            name_len: _c_apfs.uint16 | None = ...,
            name: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_sibling_val_t: TypeAlias = j_sibling_val
    class j_sibling_map_key(__cs__.Structure):
        hdr: _c_apfs.j_key
        @overload
        def __init__(self, hdr: _c_apfs.j_key | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_sibling_map_key_t: TypeAlias = j_sibling_map_key
    class j_sibling_map_val(__cs__.Structure):
        file_id: _c_apfs.uint64
        @overload
        def __init__(self, file_id: _c_apfs.uint64 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_sibling_map_val_t: TypeAlias = j_sibling_map_val
    class j_snap_metadata_key(__cs__.Structure):
        hdr: _c_apfs.j_key
        @overload
        def __init__(self, hdr: _c_apfs.j_key | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_snap_metadata_key_t: TypeAlias = j_snap_metadata_key
    class j_snap_metadata_val(__cs__.Structure):
        extentref_tree_oid: _c_apfs.uint64
        sblock_oid: _c_apfs.uint64
        create_time: _c_apfs.uint64
        change_time: _c_apfs.uint64
        inum: _c_apfs.uint64
        extentref_tree_type: _c_apfs.uint32
        flags: _c_apfs.uint32
        name_len: _c_apfs.uint16
        name: __cs__.CharArray
        @overload
        def __init__(
            self,
            extentref_tree_oid: _c_apfs.uint64 | None = ...,
            sblock_oid: _c_apfs.uint64 | None = ...,
            create_time: _c_apfs.uint64 | None = ...,
            change_time: _c_apfs.uint64 | None = ...,
            inum: _c_apfs.uint64 | None = ...,
            extentref_tree_type: _c_apfs.uint32 | None = ...,
            flags: _c_apfs.uint32 | None = ...,
            name_len: _c_apfs.uint16 | None = ...,
            name: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_snap_metadata_val_t: TypeAlias = j_snap_metadata_val
    class j_snap_name_key(__cs__.Structure):
        hdr: _c_apfs.j_key
        name_len: _c_apfs.uint16
        name: __cs__.CharArray
        @overload
        def __init__(
            self,
            hdr: _c_apfs.j_key | None = ...,
            name_len: _c_apfs.uint16 | None = ...,
            name: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_snap_name_key_t: TypeAlias = j_snap_name_key
    class j_snap_name_val(__cs__.Structure):
        snap_xid: _c_apfs.uint64
        @overload
        def __init__(self, snap_xid: _c_apfs.uint64 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_snap_name_val_t: TypeAlias = j_snap_name_val
    class SNAP_META(__cs__.Enum):
        PENDING_DATALESS = ...
        MERGE_IN_PROGRESS = ...

    class snap_meta_ext(__cs__.Structure):
        sme_version: _c_apfs.uint32
        sme_flags: _c_apfs.uint32
        sme_snap_xid: _c_apfs.uint64
        sme_uuid: __cs__.CharArray
        sme_token: _c_apfs.uint64
        @overload
        def __init__(
            self,
            sme_version: _c_apfs.uint32 | None = ...,
            sme_flags: _c_apfs.uint32 | None = ...,
            sme_snap_xid: _c_apfs.uint64 | None = ...,
            sme_uuid: __cs__.CharArray | None = ...,
            sme_token: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    snap_meta_ext_t: TypeAlias = snap_meta_ext
    class snap_meta_ext_obj_phys(__cs__.Structure):
        smeop_o: _c_apfs.obj_phys
        smeop_sme: _c_apfs.snap_meta_ext
        @overload
        def __init__(self, smeop_o: _c_apfs.obj_phys | None = ..., smeop_sme: _c_apfs.snap_meta_ext | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    snap_meta_ext_obj_phys_t: TypeAlias = snap_meta_ext_obj_phys
    class keybag_entry(__cs__.Structure):
        ke_uuid: __cs__.CharArray
        ke_tag: _c_apfs.uint16
        ke_keylen: _c_apfs.uint16
        padding: __cs__.Array[_c_apfs.uint8]
        ke_keydata: __cs__.CharArray
        @overload
        def __init__(
            self,
            ke_uuid: __cs__.CharArray | None = ...,
            ke_tag: _c_apfs.uint16 | None = ...,
            ke_keylen: _c_apfs.uint16 | None = ...,
            padding: __cs__.Array[_c_apfs.uint8] | None = ...,
            ke_keydata: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    keybag_entry_t: TypeAlias = keybag_entry
    class kb_locker(__cs__.Structure):
        kl_version: _c_apfs.uint16
        kl_nkeys: _c_apfs.uint16
        kl_nbytes: _c_apfs.uint32
        padding: __cs__.Array[_c_apfs.uint8]
        class keybag_entry(__cs__.Structure):
            ke_uuid: __cs__.CharArray
            ke_tag: _c_apfs.uint16
            ke_keylen: _c_apfs.uint16
            padding: __cs__.Array[_c_apfs.uint8]
            ke_keydata: __cs__.CharArray
            @overload
            def __init__(
                self,
                ke_uuid: __cs__.CharArray | None = ...,
                ke_tag: _c_apfs.uint16 | None = ...,
                ke_keylen: _c_apfs.uint16 | None = ...,
                padding: __cs__.Array[_c_apfs.uint8] | None = ...,
                ke_keydata: __cs__.CharArray | None = ...,
            ): ...
            @overload
            def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

        kl_entries: __cs__.Array[keybag_entry]
        @overload
        def __init__(
            self,
            kl_version: _c_apfs.uint16 | None = ...,
            kl_nkeys: _c_apfs.uint16 | None = ...,
            kl_nbytes: _c_apfs.uint32 | None = ...,
            padding: __cs__.Array[_c_apfs.uint8] | None = ...,
            kl_entries: __cs__.Array[keybag_entry] | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    kb_locker_t: TypeAlias = kb_locker
    class media_keybag(__cs__.Structure):
        mk_obj: _c_apfs.obj_phys
        mk_locker: _c_apfs.kb_locker
        @overload
        def __init__(self, mk_obj: _c_apfs.obj_phys | None = ..., mk_locker: _c_apfs.kb_locker | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    media_keybag_t: TypeAlias = media_keybag
    class KB_TAG(__cs__.Enum):
        UNKNOWN = ...
        RESERVED_1 = ...
        VOLUME_KEY = ...
        VOLUME_UNLOCK_RECORDS = ...
        VOLUME_PASSPHRASE_HINT = ...
        WRAPPING_M_KEY = ...
        KB_TAG_VOLUME_M_KEY = ...
        KB_TAG_RESERVED_F8 = ...

    class PROTECTION_CLASS(__cs__.Enum):
        DIR_NONE = ...
        A = ...
        B = ...
        C = ...
        D = ...
        F = ...
        M = ...

    class wrapped_meta_crypto_state(__cs__.Structure):
        major_version: _c_apfs.uint16
        minor_version: _c_apfs.uint16
        cpflags: _c_apfs.uint32
        persistent_class: _c_apfs.uint32
        key_os_version: _c_apfs.uint32
        key_revision: _c_apfs.uint16
        unused: _c_apfs.uint16
        @overload
        def __init__(
            self,
            major_version: _c_apfs.uint16 | None = ...,
            minor_version: _c_apfs.uint16 | None = ...,
            cpflags: _c_apfs.uint32 | None = ...,
            persistent_class: _c_apfs.uint32 | None = ...,
            key_os_version: _c_apfs.uint32 | None = ...,
            key_revision: _c_apfs.uint16 | None = ...,
            unused: _c_apfs.uint16 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    wrapped_meta_crypto_state_t: TypeAlias = wrapped_meta_crypto_state
    class wrapped_crypto_state(__cs__.Structure):
        major_version: _c_apfs.uint16
        minor_version: _c_apfs.uint16
        cpflags: _c_apfs.uint32
        persistent_class: _c_apfs.uint32
        key_os_version: _c_apfs.uint32
        key_revision: _c_apfs.uint16
        key_len: _c_apfs.uint16
        persistent_key: __cs__.CharArray
        @overload
        def __init__(
            self,
            major_version: _c_apfs.uint16 | None = ...,
            minor_version: _c_apfs.uint16 | None = ...,
            cpflags: _c_apfs.uint32 | None = ...,
            persistent_class: _c_apfs.uint32 | None = ...,
            key_os_version: _c_apfs.uint32 | None = ...,
            key_revision: _c_apfs.uint16 | None = ...,
            key_len: _c_apfs.uint16 | None = ...,
            persistent_key: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    wrapped_crypto_state_t: TypeAlias = wrapped_crypto_state
    class j_crypto_key(__cs__.Structure):
        hdr: _c_apfs.j_key
        @overload
        def __init__(self, hdr: _c_apfs.j_key | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_crypto_key_t: TypeAlias = j_crypto_key
    class j_crypto_val(__cs__.Structure):
        refcnt: _c_apfs.uint32
        state: _c_apfs.wrapped_crypto_state
        @overload
        def __init__(self, refcnt: _c_apfs.uint32 | None = ..., state: _c_apfs.wrapped_crypto_state | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_crypto_val_t: TypeAlias = j_crypto_val
    class ER_PHASE(__cs__.Enum):
        OMAP_ROLL = ...
        DATA_ROLL = ...
        SNAP_ROLL = ...

    class er_state_phys_header(__cs__.Structure):
        ersb_o: _c_apfs.obj_phys
        ersb_magic: _c_apfs.uint32
        ersb_version: _c_apfs.uint32
        @overload
        def __init__(
            self,
            ersb_o: _c_apfs.obj_phys | None = ...,
            ersb_magic: _c_apfs.uint32 | None = ...,
            ersb_version: _c_apfs.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    er_state_phys_header_t: TypeAlias = er_state_phys_header
    class er_state_phys(__cs__.Structure):
        ersb_header: _c_apfs.er_state_phys_header
        ersb_flags: _c_apfs.uint64
        ersb_snap_xid: _c_apfs.uint64
        ersb_current_fext_obj_id: _c_apfs.uint64
        ersb_file_offset: _c_apfs.uint64
        ersb_progress: _c_apfs.uint64
        ersb_total_blk_to_encrypt: _c_apfs.uint64
        ersb_blockmap_oid: _c_apfs.uint64
        ersb_tidemark_obj_id: _c_apfs.uint64
        ersb_recovery_extents_count: _c_apfs.uint64
        ersb_recovery_list_oid: _c_apfs.uint64
        ersb_recovery_length: _c_apfs.uint64
        @overload
        def __init__(
            self,
            ersb_header: _c_apfs.er_state_phys_header | None = ...,
            ersb_flags: _c_apfs.uint64 | None = ...,
            ersb_snap_xid: _c_apfs.uint64 | None = ...,
            ersb_current_fext_obj_id: _c_apfs.uint64 | None = ...,
            ersb_file_offset: _c_apfs.uint64 | None = ...,
            ersb_progress: _c_apfs.uint64 | None = ...,
            ersb_total_blk_to_encrypt: _c_apfs.uint64 | None = ...,
            ersb_blockmap_oid: _c_apfs.uint64 | None = ...,
            ersb_tidemark_obj_id: _c_apfs.uint64 | None = ...,
            ersb_recovery_extents_count: _c_apfs.uint64 | None = ...,
            ersb_recovery_list_oid: _c_apfs.uint64 | None = ...,
            ersb_recovery_length: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    er_state_phys_t: TypeAlias = er_state_phys
    class er_state_phys_v1(__cs__.Structure):
        ersb_header: _c_apfs.er_state_phys_header
        ersb_flags: _c_apfs.uint64
        ersb_snap_xid: _c_apfs.uint64
        ersb_current_fext_obj_id: _c_apfs.uint64
        ersb_file_offset: _c_apfs.uint64
        ersb_fext_pbn: _c_apfs.uint64
        ersb_paddr: _c_apfs.uint64
        ersb_progress: _c_apfs.uint64
        ersb_total_blk_to_encrypt: _c_apfs.uint64
        ersb_blockmap_oid: _c_apfs.uint64
        ersb_checksum_count: _c_apfs.uint32
        ersb_reserved: _c_apfs.uint32
        ersb_fext_cid: _c_apfs.uint64
        ersb_checksum: __cs__.Array[_c_apfs.uint8]
        @overload
        def __init__(
            self,
            ersb_header: _c_apfs.er_state_phys_header | None = ...,
            ersb_flags: _c_apfs.uint64 | None = ...,
            ersb_snap_xid: _c_apfs.uint64 | None = ...,
            ersb_current_fext_obj_id: _c_apfs.uint64 | None = ...,
            ersb_file_offset: _c_apfs.uint64 | None = ...,
            ersb_fext_pbn: _c_apfs.uint64 | None = ...,
            ersb_paddr: _c_apfs.uint64 | None = ...,
            ersb_progress: _c_apfs.uint64 | None = ...,
            ersb_total_blk_to_encrypt: _c_apfs.uint64 | None = ...,
            ersb_blockmap_oid: _c_apfs.uint64 | None = ...,
            ersb_checksum_count: _c_apfs.uint32 | None = ...,
            ersb_reserved: _c_apfs.uint32 | None = ...,
            ersb_fext_cid: _c_apfs.uint64 | None = ...,
            ersb_checksum: __cs__.Array[_c_apfs.uint8] | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    er_state_phys_v1_t: TypeAlias = er_state_phys_v1
    class er_recovery_block_phys(__cs__.Structure):
        erb_o: _c_apfs.obj_phys
        erb_offset: _c_apfs.uint64
        erb_next_oid: _c_apfs.uint64
        erb_data: __cs__.CharArray
        @overload
        def __init__(
            self,
            erb_o: _c_apfs.obj_phys | None = ...,
            erb_offset: _c_apfs.uint64 | None = ...,
            erb_next_oid: _c_apfs.uint64 | None = ...,
            erb_data: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    er_recovery_block_phys_t: TypeAlias = er_recovery_block_phys
    class gbitmap_block_phys(__cs__.Structure):
        bmb_o: _c_apfs.obj_phys
        bmb_field: __cs__.Array[_c_apfs.uint64]
        @overload
        def __init__(
            self, bmb_o: _c_apfs.obj_phys | None = ..., bmb_field: __cs__.Array[_c_apfs.uint64] | None = ...
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    gbitmap_block_phys_t: TypeAlias = gbitmap_block_phys
    class gbitmap_phys(__cs__.Structure):
        bm_o: _c_apfs.obj_phys
        bm_tree_oid: _c_apfs.uint64
        bm_bit_count: _c_apfs.uint64
        bm_flags: _c_apfs.uint64
        @overload
        def __init__(
            self,
            bm_o: _c_apfs.obj_phys | None = ...,
            bm_tree_oid: _c_apfs.uint64 | None = ...,
            bm_bit_count: _c_apfs.uint64 | None = ...,
            bm_flags: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    gbitmap_phys_t: TypeAlias = gbitmap_phys
    class nx_efi_jumpstart(__cs__.Structure):
        nej_o: _c_apfs.obj_phys
        nej_magic: _c_apfs.uint32
        nej_version: _c_apfs.uint32
        nej_efi_file_len: _c_apfs.uint32
        nej_num_extents: _c_apfs.uint32
        nej_reserved: __cs__.Array[_c_apfs.uint64]
        class prange(__cs__.Structure):
            pr_start_paddr: _c_apfs.int64
            pr_block_count: _c_apfs.uint64
            @overload
            def __init__(
                self, pr_start_paddr: _c_apfs.int64 | None = ..., pr_block_count: _c_apfs.uint64 | None = ...
            ): ...
            @overload
            def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

        nej_rec_extents: __cs__.Array[prange]
        @overload
        def __init__(
            self,
            nej_o: _c_apfs.obj_phys | None = ...,
            nej_magic: _c_apfs.uint32 | None = ...,
            nej_version: _c_apfs.uint32 | None = ...,
            nej_efi_file_len: _c_apfs.uint32 | None = ...,
            nej_num_extents: _c_apfs.uint32 | None = ...,
            nej_reserved: __cs__.Array[_c_apfs.uint64] | None = ...,
            nej_rec_extents: __cs__.Array[prange] | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    nx_efi_jumpstart_t: TypeAlias = nx_efi_jumpstart
    class NX_FEATURE(__cs__.Flag):
        DEFRAG = ...
        LCFD = ...

    class NX_INCOMPAT(__cs__.Flag):
        VERSION1 = ...
        VERSION2 = ...
        FUSION = ...

    class nx_superblock(__cs__.Structure):
        nx_o: _c_apfs.obj_phys
        nx_magic: _c_apfs.uint32
        nx_block_size: _c_apfs.uint32
        nx_block_count: _c_apfs.uint64
        nx_features: _c_apfs.uint64
        nx_readonly_compatible_features: _c_apfs.uint64
        nx_incompatible_features: _c_apfs.uint64
        nx_uuid: __cs__.CharArray
        nx_next_oid: _c_apfs.uint64
        nx_next_xid: _c_apfs.uint64
        nx_xp_desc_blocks: _c_apfs.uint32
        nx_xp_data_blocks: _c_apfs.uint32
        nx_xp_desc_base: _c_apfs.int64
        nx_xp_data_base: _c_apfs.int64
        nx_xp_desc_next: _c_apfs.uint32
        nx_xp_data_next: _c_apfs.uint32
        nx_xp_desc_index: _c_apfs.uint32
        nx_xp_desc_len: _c_apfs.uint32
        nx_xp_data_index: _c_apfs.uint32
        nx_xp_data_len: _c_apfs.uint32
        nx_spaceman_oid: _c_apfs.uint64
        nx_omap_oid: _c_apfs.uint64
        nx_reaper_oid: _c_apfs.uint64
        nx_test_type: _c_apfs.uint32
        nx_max_file_systems: _c_apfs.uint32
        nx_fs_oid: __cs__.Array[_c_apfs.uint64]
        nx_counters: __cs__.Array[_c_apfs.uint64]
        nx_blocked_out_prange: _c_apfs.prange
        nx_evict_mapping_tree_oid: _c_apfs.uint64
        nx_flags: _c_apfs.uint64
        nx_efi_jumpstart: _c_apfs.int64
        nx_fusion_uuid: __cs__.CharArray
        nx_keylocker: _c_apfs.prange
        nx_ephemeral_info: __cs__.Array[_c_apfs.uint64]
        nx_test_oid: _c_apfs.uint64
        nx_fusion_mt_oid: _c_apfs.uint64
        nx_fusion_wbc_oid: _c_apfs.uint64
        nx_fusion_wbc: _c_apfs.prange
        nx_newest_mounted_version: _c_apfs.uint64
        nx_mkb_locker: _c_apfs.prange
        @overload
        def __init__(
            self,
            nx_o: _c_apfs.obj_phys | None = ...,
            nx_magic: _c_apfs.uint32 | None = ...,
            nx_block_size: _c_apfs.uint32 | None = ...,
            nx_block_count: _c_apfs.uint64 | None = ...,
            nx_features: _c_apfs.uint64 | None = ...,
            nx_readonly_compatible_features: _c_apfs.uint64 | None = ...,
            nx_incompatible_features: _c_apfs.uint64 | None = ...,
            nx_uuid: __cs__.CharArray | None = ...,
            nx_next_oid: _c_apfs.uint64 | None = ...,
            nx_next_xid: _c_apfs.uint64 | None = ...,
            nx_xp_desc_blocks: _c_apfs.uint32 | None = ...,
            nx_xp_data_blocks: _c_apfs.uint32 | None = ...,
            nx_xp_desc_base: _c_apfs.int64 | None = ...,
            nx_xp_data_base: _c_apfs.int64 | None = ...,
            nx_xp_desc_next: _c_apfs.uint32 | None = ...,
            nx_xp_data_next: _c_apfs.uint32 | None = ...,
            nx_xp_desc_index: _c_apfs.uint32 | None = ...,
            nx_xp_desc_len: _c_apfs.uint32 | None = ...,
            nx_xp_data_index: _c_apfs.uint32 | None = ...,
            nx_xp_data_len: _c_apfs.uint32 | None = ...,
            nx_spaceman_oid: _c_apfs.uint64 | None = ...,
            nx_omap_oid: _c_apfs.uint64 | None = ...,
            nx_reaper_oid: _c_apfs.uint64 | None = ...,
            nx_test_type: _c_apfs.uint32 | None = ...,
            nx_max_file_systems: _c_apfs.uint32 | None = ...,
            nx_fs_oid: __cs__.Array[_c_apfs.uint64] | None = ...,
            nx_counters: __cs__.Array[_c_apfs.uint64] | None = ...,
            nx_blocked_out_prange: _c_apfs.prange | None = ...,
            nx_evict_mapping_tree_oid: _c_apfs.uint64 | None = ...,
            nx_flags: _c_apfs.uint64 | None = ...,
            nx_efi_jumpstart: _c_apfs.int64 | None = ...,
            nx_fusion_uuid: __cs__.CharArray | None = ...,
            nx_keylocker: _c_apfs.prange | None = ...,
            nx_ephemeral_info: __cs__.Array[_c_apfs.uint64] | None = ...,
            nx_test_oid: _c_apfs.uint64 | None = ...,
            nx_fusion_mt_oid: _c_apfs.uint64 | None = ...,
            nx_fusion_wbc_oid: _c_apfs.uint64 | None = ...,
            nx_fusion_wbc: _c_apfs.prange | None = ...,
            nx_newest_mounted_version: _c_apfs.uint64 | None = ...,
            nx_mkb_locker: _c_apfs.prange | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    class checkpoint_mapping(__cs__.Structure):
        cpm_type: _c_apfs.uint32
        cpm_subtype: _c_apfs.uint32
        cpm_size: _c_apfs.uint32
        cpm_pad: _c_apfs.uint32
        cpm_fs_oid: _c_apfs.uint64
        cpm_oid: _c_apfs.uint64
        cpm_paddr: _c_apfs.uint64
        @overload
        def __init__(
            self,
            cpm_type: _c_apfs.uint32 | None = ...,
            cpm_subtype: _c_apfs.uint32 | None = ...,
            cpm_size: _c_apfs.uint32 | None = ...,
            cpm_pad: _c_apfs.uint32 | None = ...,
            cpm_fs_oid: _c_apfs.uint64 | None = ...,
            cpm_oid: _c_apfs.uint64 | None = ...,
            cpm_paddr: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    checkpoint_mapping_t: TypeAlias = checkpoint_mapping
    class checkpoint_map_phys(__cs__.Structure):
        cpm_o: _c_apfs.obj_phys
        cpm_flags: _c_apfs.uint32
        cpm_count: _c_apfs.uint32
        class checkpoint_mapping(__cs__.Structure):
            cpm_type: _c_apfs.uint32
            cpm_subtype: _c_apfs.uint32
            cpm_size: _c_apfs.uint32
            cpm_pad: _c_apfs.uint32
            cpm_fs_oid: _c_apfs.uint64
            cpm_oid: _c_apfs.uint64
            cpm_paddr: _c_apfs.uint64
            @overload
            def __init__(
                self,
                cpm_type: _c_apfs.uint32 | None = ...,
                cpm_subtype: _c_apfs.uint32 | None = ...,
                cpm_size: _c_apfs.uint32 | None = ...,
                cpm_pad: _c_apfs.uint32 | None = ...,
                cpm_fs_oid: _c_apfs.uint64 | None = ...,
                cpm_oid: _c_apfs.uint64 | None = ...,
                cpm_paddr: _c_apfs.uint64 | None = ...,
            ): ...
            @overload
            def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

        cpm_map: __cs__.Array[checkpoint_mapping]
        @overload
        def __init__(
            self,
            cpm_o: _c_apfs.obj_phys | None = ...,
            cpm_flags: _c_apfs.uint32 | None = ...,
            cpm_count: _c_apfs.uint32 | None = ...,
            cpm_map: __cs__.Array[checkpoint_mapping] | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    checkpoint_map_phys_t: TypeAlias = checkpoint_map_phys
    class evict_mapping_val(__cs__.Structure):
        dst_paddr: _c_apfs.int64
        len: _c_apfs.uint64
        @overload
        def __init__(self, dst_paddr: _c_apfs.int64 | None = ..., len: _c_apfs.uint64 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    evict_mapping_val_t: TypeAlias = evict_mapping_val
    class apfs_modified_by(__cs__.Structure):
        id: __cs__.CharArray
        timestamp: _c_apfs.uint64
        last_xid: _c_apfs.uint64
        @overload
        def __init__(
            self,
            id: __cs__.CharArray | None = ...,
            timestamp: _c_apfs.uint64 | None = ...,
            last_xid: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    apfs_modified_by_t: TypeAlias = apfs_modified_by
    class apfs_superblock(__cs__.Structure):
        apfs_o: _c_apfs.obj_phys
        apfs_magic: _c_apfs.uint32
        apfs_fs_index: _c_apfs.uint32
        apfs_features: _c_apfs.uint64
        apfs_readonly_compatible_features: _c_apfs.uint64
        apfs_incompatible_features: _c_apfs.uint64
        apfs_unmount_time: _c_apfs.uint64
        apfs_fs_reserve_block_count: _c_apfs.uint64
        apfs_fs_quota_block_count: _c_apfs.uint64
        apfs_fs_alloc_count: _c_apfs.uint64
        apfs_meta_crypto: _c_apfs.wrapped_meta_crypto_state
        apfs_root_tree_type: _c_apfs.uint32
        apfs_extentref_tree_type: _c_apfs.uint32
        apfs_snap_meta_tree_type: _c_apfs.uint32
        apfs_omap_oid: _c_apfs.uint64
        apfs_root_tree_oid: _c_apfs.uint64
        apfs_extentref_tree_oid: _c_apfs.uint64
        apfs_snap_meta_tree_oid: _c_apfs.uint64
        apfs_revert_to_xid: _c_apfs.uint64
        apfs_revert_to_sblock_oid: _c_apfs.uint64
        apfs_next_obj_id: _c_apfs.uint64
        apfs_num_files: _c_apfs.uint64
        apfs_num_directories: _c_apfs.uint64
        apfs_num_symlinks: _c_apfs.uint64
        apfs_num_other_fsobjects: _c_apfs.uint64
        apfs_num_snapshots: _c_apfs.uint64
        apfs_total_blocks_alloced: _c_apfs.uint64
        apfs_total_blocks_freed: _c_apfs.uint64
        apfs_vol_uuid: __cs__.CharArray
        apfs_last_mod_time: _c_apfs.uint64
        apfs_fs_flags: _c_apfs.uint64
        apfs_formatted_by: _c_apfs.apfs_modified_by
        class apfs_modified_by(__cs__.Structure):
            id: __cs__.CharArray
            timestamp: _c_apfs.uint64
            last_xid: _c_apfs.uint64
            @overload
            def __init__(
                self,
                id: __cs__.CharArray | None = ...,
                timestamp: _c_apfs.uint64 | None = ...,
                last_xid: _c_apfs.uint64 | None = ...,
            ): ...
            @overload
            def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

        apfs_modified_by: __cs__.Array[_c_apfs.apfs_modified_by]
        apfs_volname: __cs__.CharArray
        apfs_next_doc_id: _c_apfs.uint32
        apfs_role: _c_apfs.uint16
        reserved: _c_apfs.uint16
        apfs_root_to_xid: _c_apfs.uint64
        apfs_er_state_oid: _c_apfs.uint64
        apfs_cloneinfo_id_epoch: _c_apfs.uint64
        apfs_cloneinfo_xid: _c_apfs.uint64
        apfs_snap_meta_ext_oid: _c_apfs.uint64
        apfs_volume_group_id: __cs__.CharArray
        apfs_integrity_meta_oid: _c_apfs.uint64
        apfs_fext_tree_oid: _c_apfs.uint64
        apfs_fext_tree_type: _c_apfs.uint32
        apfs_pfkur_tree_type: _c_apfs.uint32
        apfs_pfkur_tree_oid: _c_apfs.uint64
        apfs_doc_id_index_xid: _c_apfs.uint64
        apfs_doc_id_index_flags: _c_apfs.uint32
        apfs_doc_id_tree_type: _c_apfs.uint32
        apfs_doc_id_tree_oid: _c_apfs.uint64
        apfs_prev_doc_id_tree_oid: _c_apfs.uint64
        apfs_doc_id_fixup_cursor: _c_apfs.uint64
        apfs_sec_root_tree_oid: _c_apfs.uint64
        apfs_sec_root_tree_type: _c_apfs.uint32
        apfs_clone_group_tree_flags: _c_apfs.uint32
        @overload
        def __init__(
            self,
            apfs_o: _c_apfs.obj_phys | None = ...,
            apfs_magic: _c_apfs.uint32 | None = ...,
            apfs_fs_index: _c_apfs.uint32 | None = ...,
            apfs_features: _c_apfs.uint64 | None = ...,
            apfs_readonly_compatible_features: _c_apfs.uint64 | None = ...,
            apfs_incompatible_features: _c_apfs.uint64 | None = ...,
            apfs_unmount_time: _c_apfs.uint64 | None = ...,
            apfs_fs_reserve_block_count: _c_apfs.uint64 | None = ...,
            apfs_fs_quota_block_count: _c_apfs.uint64 | None = ...,
            apfs_fs_alloc_count: _c_apfs.uint64 | None = ...,
            apfs_meta_crypto: _c_apfs.wrapped_meta_crypto_state | None = ...,
            apfs_root_tree_type: _c_apfs.uint32 | None = ...,
            apfs_extentref_tree_type: _c_apfs.uint32 | None = ...,
            apfs_snap_meta_tree_type: _c_apfs.uint32 | None = ...,
            apfs_omap_oid: _c_apfs.uint64 | None = ...,
            apfs_root_tree_oid: _c_apfs.uint64 | None = ...,
            apfs_extentref_tree_oid: _c_apfs.uint64 | None = ...,
            apfs_snap_meta_tree_oid: _c_apfs.uint64 | None = ...,
            apfs_revert_to_xid: _c_apfs.uint64 | None = ...,
            apfs_revert_to_sblock_oid: _c_apfs.uint64 | None = ...,
            apfs_next_obj_id: _c_apfs.uint64 | None = ...,
            apfs_num_files: _c_apfs.uint64 | None = ...,
            apfs_num_directories: _c_apfs.uint64 | None = ...,
            apfs_num_symlinks: _c_apfs.uint64 | None = ...,
            apfs_num_other_fsobjects: _c_apfs.uint64 | None = ...,
            apfs_num_snapshots: _c_apfs.uint64 | None = ...,
            apfs_total_blocks_alloced: _c_apfs.uint64 | None = ...,
            apfs_total_blocks_freed: _c_apfs.uint64 | None = ...,
            apfs_vol_uuid: __cs__.CharArray | None = ...,
            apfs_last_mod_time: _c_apfs.uint64 | None = ...,
            apfs_fs_flags: _c_apfs.uint64 | None = ...,
            apfs_formatted_by: _c_apfs.apfs_modified_by | None = ...,
            apfs_modified_by: __cs__.Array[_c_apfs.apfs_modified_by] | None = ...,
            apfs_volname: __cs__.CharArray | None = ...,
            apfs_next_doc_id: _c_apfs.uint32 | None = ...,
            apfs_role: _c_apfs.uint16 | None = ...,
            reserved: _c_apfs.uint16 | None = ...,
            apfs_root_to_xid: _c_apfs.uint64 | None = ...,
            apfs_er_state_oid: _c_apfs.uint64 | None = ...,
            apfs_cloneinfo_id_epoch: _c_apfs.uint64 | None = ...,
            apfs_cloneinfo_xid: _c_apfs.uint64 | None = ...,
            apfs_snap_meta_ext_oid: _c_apfs.uint64 | None = ...,
            apfs_volume_group_id: __cs__.CharArray | None = ...,
            apfs_integrity_meta_oid: _c_apfs.uint64 | None = ...,
            apfs_fext_tree_oid: _c_apfs.uint64 | None = ...,
            apfs_fext_tree_type: _c_apfs.uint32 | None = ...,
            apfs_pfkur_tree_type: _c_apfs.uint32 | None = ...,
            apfs_pfkur_tree_oid: _c_apfs.uint64 | None = ...,
            apfs_doc_id_index_xid: _c_apfs.uint64 | None = ...,
            apfs_doc_id_index_flags: _c_apfs.uint32 | None = ...,
            apfs_doc_id_tree_type: _c_apfs.uint32 | None = ...,
            apfs_doc_id_tree_oid: _c_apfs.uint64 | None = ...,
            apfs_prev_doc_id_tree_oid: _c_apfs.uint64 | None = ...,
            apfs_doc_id_fixup_cursor: _c_apfs.uint64 | None = ...,
            apfs_sec_root_tree_oid: _c_apfs.uint64 | None = ...,
            apfs_sec_root_tree_type: _c_apfs.uint32 | None = ...,
            apfs_clone_group_tree_flags: _c_apfs.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    apfs_superblock_t: TypeAlias = apfs_superblock
    class APFS_FEATURE(__cs__.Flag):
        DEFRAG_PRERELEASE = ...
        HARDLINK_MAP_RECORDS = ...
        DEFRAG = ...
        STRICTATIME = ...
        VOLGRP_SYSTEM_INO_SPACE = ...

    class APFS_INCOMPAT(__cs__.Flag):
        CASE_INSENSITIVE = ...
        DATALESS_SNAPS = ...
        ENC_ROLLED = ...
        NORMALIZATION_INSENSITIVE = ...
        INCOMPLETE_RESTORE = ...
        SEALED_VOLUME = ...
        PFK = ...
        RESERVED_80 = ...
        SECONDARY_FSROOT = ...

    class APFS_FS(__cs__.Flag):
        UNENCRYPTED = ...
        RESERVED_2 = ...
        RESERVED_4 = ...
        ONEKEY = ...
        SPILLEDOVER = ...
        RUN_SPILLOVER_CLEANER = ...
        ALWAYS_CHECK_EXTENTREF = ...
        PREVIOUSLY_SEALED = ...
        PFK = ...
        RESERVED_200 = ...
        RESERVED_400 = ...
        RESERVED_800 = ...

    class APFS_VOL_ROLE(__cs__.Enum):
        NONE = ...
        SYSTEM = ...
        USER = ...
        RECOVERY = ...
        VM = ...
        PREBOOT = ...
        INSTALLER = ...
        DATA = ...
        BASEBAND = ...
        UPDATE = ...
        XART = ...
        HARDWARE = ...
        BACKUP = ...
        RESERVED_7 = ...
        RESERVED_8 = ...
        ENTERPRISE = ...
        RESERVED_10 = ...
        PRELOGIN = ...

    class apfs_hash_type_t(__cs__.Enum):
        APFS_HASH_INVALID = ...
        APFS_HASH_SHA256 = ...
        APFS_HASH_SHA512_256 = ...
        APFS_HASH_SHA384 = ...
        APFS_HASH_SHA512 = ...

    class integrity_meta_phys(__cs__.Structure):
        im_o: _c_apfs.obj_phys
        im_version: _c_apfs.uint32
        im_flags: _c_apfs.uint32
        im_hash_type: _c_apfs.apfs_hash_type_t
        im_root_hash_offset: _c_apfs.uint32
        im_broken_xid: _c_apfs.uint64
        im_reserved: __cs__.Array[_c_apfs.uint64]
        @overload
        def __init__(
            self,
            im_o: _c_apfs.obj_phys | None = ...,
            im_version: _c_apfs.uint32 | None = ...,
            im_flags: _c_apfs.uint32 | None = ...,
            im_hash_type: _c_apfs.apfs_hash_type_t | None = ...,
            im_root_hash_offset: _c_apfs.uint32 | None = ...,
            im_broken_xid: _c_apfs.uint64 | None = ...,
            im_reserved: __cs__.Array[_c_apfs.uint64] | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    integrity_meta_phys_t: TypeAlias = integrity_meta_phys
    class fext_tree_key(__cs__.Structure):
        private_id: _c_apfs.uint64
        logical_addr: _c_apfs.uint64
        @overload
        def __init__(self, private_id: _c_apfs.uint64 | None = ..., logical_addr: _c_apfs.uint64 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    fext_tree_key_t: TypeAlias = fext_tree_key
    class fext_tree_val(__cs__.Structure):
        len_and_flags: _c_apfs.uint64
        phys_block_num: _c_apfs.uint64
        @overload
        def __init__(self, len_and_flags: _c_apfs.uint64 | None = ..., phys_block_num: _c_apfs.uint64 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    fext_tree_val_t: TypeAlias = fext_tree_val
    class j_file_info_key(__cs__.Structure):
        hdr: _c_apfs.j_key
        info_and_lba: _c_apfs.uint64
        @overload
        def __init__(self, hdr: _c_apfs.j_key | None = ..., info_and_lba: _c_apfs.uint64 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_file_info_key_t: TypeAlias = j_key
    class j_file_data_hash_val(__cs__.Structure):
        hashed_len: _c_apfs.uint16
        hash_size: _c_apfs.uint8
        hash: __cs__.CharArray
        @overload
        def __init__(
            self,
            hashed_len: _c_apfs.uint16 | None = ...,
            hash_size: _c_apfs.uint8 | None = ...,
            hash: __cs__.CharArray | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_file_data_hash_val_t: TypeAlias = j_file_data_hash_val
    class j_file_info_val(__cs__.Structure):
        dhash: _c_apfs.j_file_data_hash_val
        @overload
        def __init__(self, dhash: _c_apfs.j_file_data_hash_val | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    j_file_info_val_t: TypeAlias = j_file_data_hash_val
    class APFS_FILE_INFO(__cs__.Enum):
        DATA_HASH = ...

    spaceman_free_queue_val_t: TypeAlias = _c_apfs.uint64
    class chunk_info(__cs__.Structure):
        ci_xid: _c_apfs.uint64
        ci_addr: _c_apfs.uint64
        ci_block_count: _c_apfs.uint32
        ci_free_count: _c_apfs.uint32
        ci_bitmap_addr: _c_apfs.int64
        @overload
        def __init__(
            self,
            ci_xid: _c_apfs.uint64 | None = ...,
            ci_addr: _c_apfs.uint64 | None = ...,
            ci_block_count: _c_apfs.uint32 | None = ...,
            ci_free_count: _c_apfs.uint32 | None = ...,
            ci_bitmap_addr: _c_apfs.int64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    chunk_info_t: TypeAlias = chunk_info
    class chunk_info_block(__cs__.Structure):
        cib_o: _c_apfs.obj_phys
        cib_index: _c_apfs.uint32
        cib_chunk_info_count: _c_apfs.uint32
        class chunk_info(__cs__.Structure):
            ci_xid: _c_apfs.uint64
            ci_addr: _c_apfs.uint64
            ci_block_count: _c_apfs.uint32
            ci_free_count: _c_apfs.uint32
            ci_bitmap_addr: _c_apfs.int64
            @overload
            def __init__(
                self,
                ci_xid: _c_apfs.uint64 | None = ...,
                ci_addr: _c_apfs.uint64 | None = ...,
                ci_block_count: _c_apfs.uint32 | None = ...,
                ci_free_count: _c_apfs.uint32 | None = ...,
                ci_bitmap_addr: _c_apfs.int64 | None = ...,
            ): ...
            @overload
            def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

        cib_chunk_info: __cs__.Array[chunk_info]
        @overload
        def __init__(
            self,
            cib_o: _c_apfs.obj_phys | None = ...,
            cib_index: _c_apfs.uint32 | None = ...,
            cib_chunk_info_count: _c_apfs.uint32 | None = ...,
            cib_chunk_info: __cs__.Array[chunk_info] | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    chunk_info_block_t: TypeAlias = chunk_info_block
    class cib_addr_block(__cs__.Structure):
        cab_o: _c_apfs.obj_phys
        cab_index: _c_apfs.uint32
        cab_cib_count: _c_apfs.uint32
        cab_cib_addr: __cs__.Array[_c_apfs.int64]
        @overload
        def __init__(
            self,
            cab_o: _c_apfs.obj_phys | None = ...,
            cab_index: _c_apfs.uint32 | None = ...,
            cab_cib_count: _c_apfs.uint32 | None = ...,
            cab_cib_addr: __cs__.Array[_c_apfs.int64] | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    cib_addr_block_t: TypeAlias = cib_addr_block
    class spaceman_free_queue_key(__cs__.Structure):
        sfqk_xid: _c_apfs.uint64
        sfqk_paddr: _c_apfs.int64
        @overload
        def __init__(self, sfqk_xid: _c_apfs.uint64 | None = ..., sfqk_paddr: _c_apfs.int64 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    spaceman_free_queue_key_t: TypeAlias = spaceman_free_queue_key
    class spaceman_free_queue_entry(__cs__.Structure):
        sfqe_key: _c_apfs.spaceman_free_queue_key
        sfqe_count: _c_apfs.uint64
        @overload
        def __init__(
            self, sfqe_key: _c_apfs.spaceman_free_queue_key | None = ..., sfqe_count: _c_apfs.uint64 | None = ...
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    spaceman_free_queue_entry_t: TypeAlias = spaceman_free_queue_entry
    class spaceman_free_queue(__cs__.Structure):
        sfq_count: _c_apfs.uint64
        sfq_tree_oid: _c_apfs.uint64
        sfq_oldest_xid: _c_apfs.uint64
        sfq_tree_node_limit: _c_apfs.uint16
        sfq_pad16: _c_apfs.uint16
        sfq_pad32: _c_apfs.uint32
        sfq_reserved: _c_apfs.uint64
        @overload
        def __init__(
            self,
            sfq_count: _c_apfs.uint64 | None = ...,
            sfq_tree_oid: _c_apfs.uint64 | None = ...,
            sfq_oldest_xid: _c_apfs.uint64 | None = ...,
            sfq_tree_node_limit: _c_apfs.uint16 | None = ...,
            sfq_pad16: _c_apfs.uint16 | None = ...,
            sfq_pad32: _c_apfs.uint32 | None = ...,
            sfq_reserved: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    spaceman_free_queue_t: TypeAlias = spaceman_free_queue
    class spaceman_device(__cs__.Structure):
        sm_block_count: _c_apfs.uint64
        sm_chunk_count: _c_apfs.uint64
        sm_cib_count: _c_apfs.uint32
        sm_cab_count: _c_apfs.uint32
        sm_free_count: _c_apfs.uint64
        sm_addr_offset: _c_apfs.uint32
        sm_reserved: _c_apfs.uint32
        sm_reserved2: _c_apfs.uint64
        @overload
        def __init__(
            self,
            sm_block_count: _c_apfs.uint64 | None = ...,
            sm_chunk_count: _c_apfs.uint64 | None = ...,
            sm_cib_count: _c_apfs.uint32 | None = ...,
            sm_cab_count: _c_apfs.uint32 | None = ...,
            sm_free_count: _c_apfs.uint64 | None = ...,
            sm_addr_offset: _c_apfs.uint32 | None = ...,
            sm_reserved: _c_apfs.uint32 | None = ...,
            sm_reserved2: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    spaceman_device_t: TypeAlias = spaceman_device
    class spaceman_allocation_zone_boundaries(__cs__.Structure):
        saz_zone_start: _c_apfs.uint64
        saz_zone_end: _c_apfs.uint64
        @overload
        def __init__(self, saz_zone_start: _c_apfs.uint64 | None = ..., saz_zone_end: _c_apfs.uint64 | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    spaceman_allocation_zone_boundaries_t: TypeAlias = spaceman_allocation_zone_boundaries
    class spaceman_allocation_zone_info_phys(__cs__.Structure):
        saz_current_boundaries: _c_apfs.spaceman_allocation_zone_boundaries
        class spaceman_allocation_zone_boundaries(__cs__.Structure):
            saz_zone_start: _c_apfs.uint64
            saz_zone_end: _c_apfs.uint64
            @overload
            def __init__(
                self, saz_zone_start: _c_apfs.uint64 | None = ..., saz_zone_end: _c_apfs.uint64 | None = ...
            ): ...
            @overload
            def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

        saz_previous_boundaries: __cs__.Array[spaceman_allocation_zone_boundaries]
        saz_zone_id: _c_apfs.uint16
        saz_previous_boundary_index: _c_apfs.uint16
        saz_reserved: _c_apfs.uint32
        @overload
        def __init__(
            self,
            saz_current_boundaries: _c_apfs.spaceman_allocation_zone_boundaries | None = ...,
            saz_previous_boundaries: __cs__.Array[spaceman_allocation_zone_boundaries] | None = ...,
            saz_zone_id: _c_apfs.uint16 | None = ...,
            saz_previous_boundary_index: _c_apfs.uint16 | None = ...,
            saz_reserved: _c_apfs.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    spaceman_allocation_zone_info_phys_t: TypeAlias = spaceman_allocation_zone_info_phys
    class spaceman_datazone_info_phys(__cs__.Structure):
        class spaceman_allocation_zone_info_phys(__cs__.Structure):
            saz_current_boundaries: _c_apfs.spaceman_allocation_zone_boundaries
            class spaceman_allocation_zone_boundaries(__cs__.Structure):
                saz_zone_start: _c_apfs.uint64
                saz_zone_end: _c_apfs.uint64
                @overload
                def __init__(
                    self, saz_zone_start: _c_apfs.uint64 | None = ..., saz_zone_end: _c_apfs.uint64 | None = ...
                ): ...
                @overload
                def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

            saz_previous_boundaries: __cs__.Array[spaceman_allocation_zone_boundaries]
            saz_zone_id: _c_apfs.uint16
            saz_previous_boundary_index: _c_apfs.uint16
            saz_reserved: _c_apfs.uint32
            @overload
            def __init__(
                self,
                saz_current_boundaries: _c_apfs.spaceman_allocation_zone_boundaries | None = ...,
                saz_previous_boundaries: __cs__.Array[spaceman_allocation_zone_boundaries] | None = ...,
                saz_zone_id: _c_apfs.uint16 | None = ...,
                saz_previous_boundary_index: _c_apfs.uint16 | None = ...,
                saz_reserved: _c_apfs.uint32 | None = ...,
            ): ...
            @overload
            def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

        sdz_allocation_zones: __cs__.Array[__cs__.Array[spaceman_allocation_zone_info_phys]]
        @overload
        def __init__(
            self, sdz_allocation_zones: __cs__.Array[__cs__.Array[spaceman_allocation_zone_info_phys]] | None = ...
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    spaceman_datazone_info_phys_t: TypeAlias = spaceman_datazone_info_phys
    class spaceman_phys(__cs__.Structure):
        sm_o: _c_apfs.obj_phys
        sm_block_size: _c_apfs.uint32
        sm_blocks_per_chunk: _c_apfs.uint32
        sm_chunks_per_cib: _c_apfs.uint32
        sm_cibs_per_cab: _c_apfs.uint32
        class spaceman_device(__cs__.Structure):
            sm_block_count: _c_apfs.uint64
            sm_chunk_count: _c_apfs.uint64
            sm_cib_count: _c_apfs.uint32
            sm_cab_count: _c_apfs.uint32
            sm_free_count: _c_apfs.uint64
            sm_addr_offset: _c_apfs.uint32
            sm_reserved: _c_apfs.uint32
            sm_reserved2: _c_apfs.uint64
            @overload
            def __init__(
                self,
                sm_block_count: _c_apfs.uint64 | None = ...,
                sm_chunk_count: _c_apfs.uint64 | None = ...,
                sm_cib_count: _c_apfs.uint32 | None = ...,
                sm_cab_count: _c_apfs.uint32 | None = ...,
                sm_free_count: _c_apfs.uint64 | None = ...,
                sm_addr_offset: _c_apfs.uint32 | None = ...,
                sm_reserved: _c_apfs.uint32 | None = ...,
                sm_reserved2: _c_apfs.uint64 | None = ...,
            ): ...
            @overload
            def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

        sm_dev: __cs__.Array[spaceman_device]
        sm_flags: _c_apfs.uint32
        sm_ip_bm_tx_multiplier: _c_apfs.uint32
        sm_ip_block_count: _c_apfs.uint64
        sm_ip_bm_size_in_blocks: _c_apfs.uint32
        sm_ip_bm_block_count: _c_apfs.uint32
        sm_ip_bm_base: _c_apfs.int64
        sm_ip_base: _c_apfs.int64
        sm_fs_reserve_block_count: _c_apfs.uint64
        sm_fs_reserve_alloc_count: _c_apfs.uint64
        class spaceman_free_queue(__cs__.Structure):
            sfq_count: _c_apfs.uint64
            sfq_tree_oid: _c_apfs.uint64
            sfq_oldest_xid: _c_apfs.uint64
            sfq_tree_node_limit: _c_apfs.uint16
            sfq_pad16: _c_apfs.uint16
            sfq_pad32: _c_apfs.uint32
            sfq_reserved: _c_apfs.uint64
            @overload
            def __init__(
                self,
                sfq_count: _c_apfs.uint64 | None = ...,
                sfq_tree_oid: _c_apfs.uint64 | None = ...,
                sfq_oldest_xid: _c_apfs.uint64 | None = ...,
                sfq_tree_node_limit: _c_apfs.uint16 | None = ...,
                sfq_pad16: _c_apfs.uint16 | None = ...,
                sfq_pad32: _c_apfs.uint32 | None = ...,
                sfq_reserved: _c_apfs.uint64 | None = ...,
            ): ...
            @overload
            def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

        sm_fq: __cs__.Array[spaceman_free_queue]
        sm_ip_bm_free_head: _c_apfs.uint16
        sm_ip_bm_free_tail: _c_apfs.uint16
        sm_ip_bm_xid_offset: _c_apfs.uint32
        sm_ip_bitmap_offset: _c_apfs.uint32
        sm_ip_bm_free_next_offset: _c_apfs.uint32
        sm_version: _c_apfs.uint32
        sm_struct_size: _c_apfs.uint32
        sm_datazone: _c_apfs.spaceman_datazone_info_phys
        @overload
        def __init__(
            self,
            sm_o: _c_apfs.obj_phys | None = ...,
            sm_block_size: _c_apfs.uint32 | None = ...,
            sm_blocks_per_chunk: _c_apfs.uint32 | None = ...,
            sm_chunks_per_cib: _c_apfs.uint32 | None = ...,
            sm_cibs_per_cab: _c_apfs.uint32 | None = ...,
            sm_dev: __cs__.Array[spaceman_device] | None = ...,
            sm_flags: _c_apfs.uint32 | None = ...,
            sm_ip_bm_tx_multiplier: _c_apfs.uint32 | None = ...,
            sm_ip_block_count: _c_apfs.uint64 | None = ...,
            sm_ip_bm_size_in_blocks: _c_apfs.uint32 | None = ...,
            sm_ip_bm_block_count: _c_apfs.uint32 | None = ...,
            sm_ip_bm_base: _c_apfs.int64 | None = ...,
            sm_ip_base: _c_apfs.int64 | None = ...,
            sm_fs_reserve_block_count: _c_apfs.uint64 | None = ...,
            sm_fs_reserve_alloc_count: _c_apfs.uint64 | None = ...,
            sm_fq: __cs__.Array[spaceman_free_queue] | None = ...,
            sm_ip_bm_free_head: _c_apfs.uint16 | None = ...,
            sm_ip_bm_free_tail: _c_apfs.uint16 | None = ...,
            sm_ip_bm_xid_offset: _c_apfs.uint32 | None = ...,
            sm_ip_bitmap_offset: _c_apfs.uint32 | None = ...,
            sm_ip_bm_free_next_offset: _c_apfs.uint32 | None = ...,
            sm_version: _c_apfs.uint32 | None = ...,
            sm_struct_size: _c_apfs.uint32 | None = ...,
            sm_datazone: _c_apfs.spaceman_datazone_info_phys | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    spaceman_phys_t: TypeAlias = spaceman_phys
    class APFS_REAP_PHASE(__cs__.Enum):
        START = ...
        SNAPSHOTS = ...
        ACTIVE_FS = ...
        DESTROY_OMAP = ...
        DONE = ...

    class nx_reaper_phys(__cs__.Structure):
        nr_o: _c_apfs.obj_phys
        nr_next_reap_id: _c_apfs.uint64
        nr_completed_id: _c_apfs.uint64
        nr_head: _c_apfs.uint64
        nr_tail: _c_apfs.uint64
        nr_flags: _c_apfs.uint32
        nr_rlcount: _c_apfs.uint32
        nr_type: _c_apfs.uint32
        nr_size: _c_apfs.uint32
        nr_fs_oid: _c_apfs.uint64
        nr_oid: _c_apfs.uint64
        nr_xid: _c_apfs.uint64
        nr_nrle_flags: _c_apfs.uint32
        nr_state_buffer_size: _c_apfs.uint32
        nr_state_buffer: __cs__.Array[_c_apfs.uint8]
        @overload
        def __init__(
            self,
            nr_o: _c_apfs.obj_phys | None = ...,
            nr_next_reap_id: _c_apfs.uint64 | None = ...,
            nr_completed_id: _c_apfs.uint64 | None = ...,
            nr_head: _c_apfs.uint64 | None = ...,
            nr_tail: _c_apfs.uint64 | None = ...,
            nr_flags: _c_apfs.uint32 | None = ...,
            nr_rlcount: _c_apfs.uint32 | None = ...,
            nr_type: _c_apfs.uint32 | None = ...,
            nr_size: _c_apfs.uint32 | None = ...,
            nr_fs_oid: _c_apfs.uint64 | None = ...,
            nr_oid: _c_apfs.uint64 | None = ...,
            nr_xid: _c_apfs.uint64 | None = ...,
            nr_nrle_flags: _c_apfs.uint32 | None = ...,
            nr_state_buffer_size: _c_apfs.uint32 | None = ...,
            nr_state_buffer: __cs__.Array[_c_apfs.uint8] | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    nx_reaper_phys_t: TypeAlias = nx_reaper_phys
    class nx_reap_list_entry(__cs__.Structure):
        nrle_next: _c_apfs.uint32
        nrle_flags: _c_apfs.uint32
        nrle_type: _c_apfs.uint32
        nrle_size: _c_apfs.uint32
        nrle_fs_oid: _c_apfs.uint64
        nrle_oid: _c_apfs.uint64
        nrle_xid: _c_apfs.uint64
        @overload
        def __init__(
            self,
            nrle_next: _c_apfs.uint32 | None = ...,
            nrle_flags: _c_apfs.uint32 | None = ...,
            nrle_type: _c_apfs.uint32 | None = ...,
            nrle_size: _c_apfs.uint32 | None = ...,
            nrle_fs_oid: _c_apfs.uint64 | None = ...,
            nrle_oid: _c_apfs.uint64 | None = ...,
            nrle_xid: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    nx_reap_list_entry_t: TypeAlias = nx_reap_list_entry
    class nx_reap_list_phys(__cs__.Structure):
        nrl_o: _c_apfs.obj_phys
        nrl_next: _c_apfs.uint64
        nrl_flags: _c_apfs.uint32
        nrl_max: _c_apfs.uint32
        nrl_count: _c_apfs.uint32
        nrl_first: _c_apfs.uint32
        nrl_last: _c_apfs.uint32
        nrl_free: _c_apfs.uint32
        @overload
        def __init__(
            self,
            nrl_o: _c_apfs.obj_phys | None = ...,
            nrl_next: _c_apfs.uint64 | None = ...,
            nrl_flags: _c_apfs.uint32 | None = ...,
            nrl_max: _c_apfs.uint32 | None = ...,
            nrl_count: _c_apfs.uint32 | None = ...,
            nrl_first: _c_apfs.uint32 | None = ...,
            nrl_last: _c_apfs.uint32 | None = ...,
            nrl_free: _c_apfs.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    nx_reap_list_phys_t: TypeAlias = nx_reap_list_phys
    class omap_reap_state(__cs__.Structure):
        omr_phase: _c_apfs.uint32
        omr_ok: _c_apfs.omap_key
        @overload
        def __init__(self, omr_phase: _c_apfs.uint32 | None = ..., omr_ok: _c_apfs.omap_key | None = ...): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    omap_reap_state_t: TypeAlias = omap_reap_state
    class omap_cleanup_state(__cs__.Structure):
        omc_cleaning: _c_apfs.uint32
        omc_omsflags: _c_apfs.uint32
        omc_sxidprev: _c_apfs.uint64
        omc_sxidstart: _c_apfs.uint64
        omc_sxidend: _c_apfs.uint64
        omc_sxidnext: _c_apfs.uint64
        omc_curkey: _c_apfs.omap_key
        @overload
        def __init__(
            self,
            omc_cleaning: _c_apfs.uint32 | None = ...,
            omc_omsflags: _c_apfs.uint32 | None = ...,
            omc_sxidprev: _c_apfs.uint64 | None = ...,
            omc_sxidstart: _c_apfs.uint64 | None = ...,
            omc_sxidend: _c_apfs.uint64 | None = ...,
            omc_sxidnext: _c_apfs.uint64 | None = ...,
            omc_curkey: _c_apfs.omap_key | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    omap_cleanup_state_t: TypeAlias = omap_cleanup_state
    class apfs_reap_state(__cs__.Structure):
        last_pbn: _c_apfs.uint64
        cur_snap_xid: _c_apfs.uint64
        phase: _c_apfs.uint32
        @overload
        def __init__(
            self,
            last_pbn: _c_apfs.uint64 | None = ...,
            cur_snap_xid: _c_apfs.uint64 | None = ...,
            phase: _c_apfs.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    apfs_reap_state_t: TypeAlias = apfs_reap_state
    fusion_mt_key_t: TypeAlias = _c_apfs.int64
    class fusion_wbc_phys(__cs__.Structure):
        fwp_objHdr: _c_apfs.obj_phys
        fwp_version: _c_apfs.uint64
        fwp_listHeadOid: _c_apfs.uint64
        fwp_listTailOid: _c_apfs.uint64
        fwp_stableHeadOffset: _c_apfs.uint64
        fwp_stableTailOffset: _c_apfs.uint64
        fwp_listBlocksCount: _c_apfs.uint32
        fwp_reserved: _c_apfs.uint32
        fwp_usedByRC: _c_apfs.uint64
        fwp_rcStash: _c_apfs.prange
        @overload
        def __init__(
            self,
            fwp_objHdr: _c_apfs.obj_phys | None = ...,
            fwp_version: _c_apfs.uint64 | None = ...,
            fwp_listHeadOid: _c_apfs.uint64 | None = ...,
            fwp_listTailOid: _c_apfs.uint64 | None = ...,
            fwp_stableHeadOffset: _c_apfs.uint64 | None = ...,
            fwp_stableTailOffset: _c_apfs.uint64 | None = ...,
            fwp_listBlocksCount: _c_apfs.uint32 | None = ...,
            fwp_reserved: _c_apfs.uint32 | None = ...,
            fwp_usedByRC: _c_apfs.uint64 | None = ...,
            fwp_rcStash: _c_apfs.prange | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    fusion_wbc_phys_t: TypeAlias = fusion_wbc_phys
    class fusion_wbc_list_entry(__cs__.Structure):
        fwle_wbcLba: _c_apfs.int64
        fwle_targetLba: _c_apfs.int64
        fwle_length: _c_apfs.uint64
        @overload
        def __init__(
            self,
            fwle_wbcLba: _c_apfs.int64 | None = ...,
            fwle_targetLba: _c_apfs.int64 | None = ...,
            fwle_length: _c_apfs.uint64 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    fusion_wbc_list_entry_t: TypeAlias = fusion_wbc_list_entry
    class fusion_wbc_list_phys(__cs__.Structure):
        fwlp_objHdr: _c_apfs.obj_phys
        fwlp_version: _c_apfs.uint64
        fwlp_tailOffset: _c_apfs.uint64
        fwlp_indexBegin: _c_apfs.uint32
        fwlp_indexEnd: _c_apfs.uint32
        fwlp_indexMax: _c_apfs.uint32
        fwlp_reserved: _c_apfs.uint32
        class fusion_wbc_list_entry(__cs__.Structure):
            fwle_wbcLba: _c_apfs.int64
            fwle_targetLba: _c_apfs.int64
            fwle_length: _c_apfs.uint64
            @overload
            def __init__(
                self,
                fwle_wbcLba: _c_apfs.int64 | None = ...,
                fwle_targetLba: _c_apfs.int64 | None = ...,
                fwle_length: _c_apfs.uint64 | None = ...,
            ): ...
            @overload
            def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

        fwlp_listEntries: __cs__.Array[fusion_wbc_list_entry]
        @overload
        def __init__(
            self,
            fwlp_objHdr: _c_apfs.obj_phys | None = ...,
            fwlp_version: _c_apfs.uint64 | None = ...,
            fwlp_tailOffset: _c_apfs.uint64 | None = ...,
            fwlp_indexBegin: _c_apfs.uint32 | None = ...,
            fwlp_indexEnd: _c_apfs.uint32 | None = ...,
            fwlp_indexMax: _c_apfs.uint32 | None = ...,
            fwlp_reserved: _c_apfs.uint32 | None = ...,
            fwlp_listEntries: __cs__.Array[fusion_wbc_list_entry] | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    fusion_wbc_list_phys_t: TypeAlias = fusion_wbc_list_phys
    class fusion_mt_val(__cs__.Structure):
        fmv_lba: _c_apfs.int64
        fmv_length: _c_apfs.uint32
        fmv_flags: _c_apfs.uint32
        @overload
        def __init__(
            self,
            fmv_lba: _c_apfs.int64 | None = ...,
            fmv_length: _c_apfs.uint32 | None = ...,
            fmv_flags: _c_apfs.uint32 | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    fusion_mt_val_t: TypeAlias = fusion_mt_val

# Technically `c_apfs` is an instance of `_c_apfs`, but then we can't use it in type hints
c_apfs: TypeAlias = _c_apfs

FILESYSTEM_OBJECT_TYPE_MAP: dict[c_apfs.APFS_TYPE, tuple[type[__cs__.Structure], type[__cs__.Structure]]]
XF_MAP: dict[c_apfs.INO_EXT_TYPE | c_apfs.DREC_EXT_TYPE, type[__cs__.BaseType]]
