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

import dissect.cstruct as __cs__

class _c_md(__cs__.cstruct):
    MD_RESERVED_BYTES: Literal[65536] = ...
    MD_RESERVED_SECTORS: Literal[128] = ...
    MD_SB_GENERIC_CONSTANT_WORDS: Literal[32] = ...
    MD_SB_GENERIC_STATE_WORDS: Literal[32] = ...
    MD_SB_GENERIC_WORDS: Literal[64] = ...
    MD_SB_PERSONALITY_WORDS: Literal[64] = ...
    MD_SB_DESCRIPTOR_WORDS: Literal[32] = ...
    MD_SB_DISKS: Literal[27] = ...
    MD_SB_DISKS_WORDS: Literal[864] = ...
    MD_SB_RESERVED_WORDS: Literal[0] = ...
    MD_DISK_FAULTY: Literal[0] = ...
    MD_DISK_ACTIVE: Literal[1] = ...
    MD_DISK_SYNC: Literal[2] = ...
    MD_DISK_REMOVED: Literal[3] = ...
    MD_DISK_CLUSTER_ADD: Literal[4] = ...
    MD_DISK_CANDIDATE: Literal[5] = ...
    MD_DISK_FAILFAST: Literal[10] = ...
    MD_DISK_WRITEMOSTLY: Literal[9] = ...
    MD_DISK_JOURNAL: Literal[18] = ...
    MD_DISK_ROLE_SPARE: Literal[65535] = ...
    MD_DISK_ROLE_FAULTY: Literal[65534] = ...
    MD_DISK_ROLE_JOURNAL: Literal[65533] = ...
    MD_DISK_ROLE_MAX: Literal[65280] = ...
    MD_SB_MAGIC: Literal[2838187772] = ...
    WriteMostly1: Literal[1] = ...
    FailFast1: Literal[2] = ...
    LEVEL_MULTIPATH: Literal[-4] = ...
    LEVEL_LINEAR: Literal[-1] = ...
    LEVEL_FAULTY: Literal[-5] = ...
    ALGORITHM_LEFT_ASYMMETRIC: Literal[0] = ...
    ALGORITHM_RIGHT_ASYMMETRIC: Literal[1] = ...
    ALGORITHM_LEFT_SYMMETRIC: Literal[2] = ...
    ALGORITHM_RIGHT_SYMMETRIC: Literal[3] = ...
    ALGORITHM_PARITY_0: Literal[4] = ...
    ALGORITHM_PARITY_N: Literal[5] = ...
    ALGORITHM_ROTATING_ZERO_RESTART: Literal[8] = ...
    ALGORITHM_ROTATING_N_RESTART: Literal[9] = ...
    ALGORITHM_ROTATING_N_CONTINUE: Literal[10] = ...
    ALGORITHM_LEFT_ASYMMETRIC_6: Literal[16] = ...
    ALGORITHM_RIGHT_ASYMMETRIC_6: Literal[17] = ...
    ALGORITHM_LEFT_SYMMETRIC_6: Literal[18] = ...
    ALGORITHM_RIGHT_SYMMETRIC_6: Literal[19] = ...
    ALGORITHM_PARITY_0_6: Literal[20] = ...
    ALGORITHM_PARITY_N_6: Literal[5] = ...
    class mdp_device_descriptor_s(__cs__.Structure):
        number: _c_md.uint32
        major: _c_md.uint32
        minor: _c_md.uint32
        raid_disk: _c_md.uint32
        state: _c_md.uint32
        reserved: __cs__.Array[_c_md.uint32]
        @overload
        def __init__(
            self,
            number: _c_md.uint32 | None = ...,
            major: _c_md.uint32 | None = ...,
            minor: _c_md.uint32 | None = ...,
            raid_disk: _c_md.uint32 | None = ...,
            state: _c_md.uint32 | None = ...,
            reserved: __cs__.Array[_c_md.uint32] | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    mdp_disk_t: TypeAlias = mdp_device_descriptor_s
    class mdp_superblock_s(__cs__.Structure):
        md_magic: _c_md.uint32
        major_version: _c_md.uint32
        minor_version: _c_md.uint32
        patch_version: _c_md.uint32
        gvalid_words: _c_md.uint32
        set_uuid0: __cs__.CharArray
        ctime: _c_md.uint32
        level: _c_md.uint32
        size: _c_md.uint32
        nr_disks: _c_md.uint32
        raid_disks: _c_md.uint32
        md_minor: _c_md.uint32
        not_persistent: _c_md.uint32
        set_uuid1: __cs__.CharArray
        set_uuid2: __cs__.CharArray
        set_uuid3: __cs__.CharArray
        gstate_creserved: __cs__.Array[_c_md.uint32]
        utime: _c_md.uint32
        state: _c_md.uint32
        active_disks: _c_md.uint32
        working_disks: _c_md.uint32
        failed_disks: _c_md.uint32
        spare_disks: _c_md.uint32
        sb_csum: _c_md.uint32
        events_lo: _c_md.uint32
        events_hi: _c_md.uint32
        cp_events_lo: _c_md.uint32
        cp_events_hi: _c_md.uint32
        recovery_cp: _c_md.uint32
        reshape_position: _c_md.uint64
        new_level: _c_md.uint32
        delta_disks: _c_md.uint32
        new_layout: _c_md.uint32
        new_chunk: _c_md.uint32
        gstate_sreserved: __cs__.Array[_c_md.uint32]
        layout: _c_md.uint32
        chunk_size: _c_md.uint32
        root_pv: _c_md.uint32
        root_block: _c_md.uint32
        pstate_reserved: __cs__.Array[_c_md.uint32]
        class mdp_device_descriptor_s(__cs__.Structure):
            number: _c_md.uint32
            major: _c_md.uint32
            minor: _c_md.uint32
            raid_disk: _c_md.uint32
            state: _c_md.uint32
            reserved: __cs__.Array[_c_md.uint32]
            @overload
            def __init__(
                self,
                number: _c_md.uint32 | None = ...,
                major: _c_md.uint32 | None = ...,
                minor: _c_md.uint32 | None = ...,
                raid_disk: _c_md.uint32 | None = ...,
                state: _c_md.uint32 | None = ...,
                reserved: __cs__.Array[_c_md.uint32] | None = ...,
            ): ...
            @overload
            def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

        disks: __cs__.Array[mdp_device_descriptor_s]
        reserved: __cs__.Array[_c_md.uint32]
        this_disk: _c_md.mdp_device_descriptor_s
        @overload
        def __init__(
            self,
            md_magic: _c_md.uint32 | None = ...,
            major_version: _c_md.uint32 | None = ...,
            minor_version: _c_md.uint32 | None = ...,
            patch_version: _c_md.uint32 | None = ...,
            gvalid_words: _c_md.uint32 | None = ...,
            set_uuid0: __cs__.CharArray | None = ...,
            ctime: _c_md.uint32 | None = ...,
            level: _c_md.uint32 | None = ...,
            size: _c_md.uint32 | None = ...,
            nr_disks: _c_md.uint32 | None = ...,
            raid_disks: _c_md.uint32 | None = ...,
            md_minor: _c_md.uint32 | None = ...,
            not_persistent: _c_md.uint32 | None = ...,
            set_uuid1: __cs__.CharArray | None = ...,
            set_uuid2: __cs__.CharArray | None = ...,
            set_uuid3: __cs__.CharArray | None = ...,
            gstate_creserved: __cs__.Array[_c_md.uint32] | None = ...,
            utime: _c_md.uint32 | None = ...,
            state: _c_md.uint32 | None = ...,
            active_disks: _c_md.uint32 | None = ...,
            working_disks: _c_md.uint32 | None = ...,
            failed_disks: _c_md.uint32 | None = ...,
            spare_disks: _c_md.uint32 | None = ...,
            sb_csum: _c_md.uint32 | None = ...,
            events_lo: _c_md.uint32 | None = ...,
            events_hi: _c_md.uint32 | None = ...,
            cp_events_lo: _c_md.uint32 | None = ...,
            cp_events_hi: _c_md.uint32 | None = ...,
            recovery_cp: _c_md.uint32 | None = ...,
            reshape_position: _c_md.uint64 | None = ...,
            new_level: _c_md.uint32 | None = ...,
            delta_disks: _c_md.uint32 | None = ...,
            new_layout: _c_md.uint32 | None = ...,
            new_chunk: _c_md.uint32 | None = ...,
            gstate_sreserved: __cs__.Array[_c_md.uint32] | None = ...,
            layout: _c_md.uint32 | None = ...,
            chunk_size: _c_md.uint32 | None = ...,
            root_pv: _c_md.uint32 | None = ...,
            root_block: _c_md.uint32 | None = ...,
            pstate_reserved: __cs__.Array[_c_md.uint32] | None = ...,
            disks: __cs__.Array[mdp_device_descriptor_s] | None = ...,
            reserved: __cs__.Array[_c_md.uint32] | None = ...,
            this_disk: _c_md.mdp_device_descriptor_s | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

    mdp_super_t: TypeAlias = mdp_superblock_s
    class mdp_superblock_1(__cs__.Structure):
        magic: _c_md.uint32
        major_version: _c_md.uint32
        feature_map: _c_md.uint32
        pad0: _c_md.uint32
        set_uuid: __cs__.CharArray
        set_name: __cs__.CharArray
        ctime: _c_md.uint64
        level: _c_md.int32
        layout: _c_md.uint32
        size: _c_md.uint64
        chunksize: _c_md.uint32
        raid_disks: _c_md.uint32
        bitmap_offset: _c_md.uint32
        class __anonymous_0__(__cs__.Structure):
            offset: _c_md.uint16
            size: _c_md.uint16
            @overload
            def __init__(self, offset: _c_md.uint16 | None = ..., size: _c_md.uint16 | None = ...): ...
            @overload
            def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

        ppl: __anonymous_0__
        new_level: _c_md.uint32
        reshape_position: _c_md.uint64
        delta_disks: _c_md.uint32
        new_layout: _c_md.uint32
        new_chunk: _c_md.uint32
        new_offset: _c_md.uint32
        data_offset: _c_md.uint64
        data_size: _c_md.uint64
        super_offset: _c_md.uint64
        recovery_offset: _c_md.uint64
        journal_tail: _c_md.uint64
        dev_number: _c_md.uint32
        cnt_corrected_read: _c_md.uint32
        device_uuid: __cs__.CharArray
        devflags: _c_md.uint8
        bblog_shift: _c_md.uint8
        bblog_size: _c_md.uint16
        bblog_offset: _c_md.int32
        utime: _c_md.uint64
        events: _c_md.uint64
        resync_offset: _c_md.uint64
        sb_csum: _c_md.uint32
        max_dev: _c_md.uint32
        pad3: __cs__.CharArray
        dev_roles: __cs__.Array[_c_md.uint16]
        @overload
        def __init__(
            self,
            magic: _c_md.uint32 | None = ...,
            major_version: _c_md.uint32 | None = ...,
            feature_map: _c_md.uint32 | None = ...,
            pad0: _c_md.uint32 | None = ...,
            set_uuid: __cs__.CharArray | None = ...,
            set_name: __cs__.CharArray | None = ...,
            ctime: _c_md.uint64 | None = ...,
            level: _c_md.int32 | None = ...,
            layout: _c_md.uint32 | None = ...,
            size: _c_md.uint64 | None = ...,
            chunksize: _c_md.uint32 | None = ...,
            raid_disks: _c_md.uint32 | None = ...,
            bitmap_offset: _c_md.uint32 | None = ...,
            ppl: __anonymous_0__ | None = ...,
            new_level: _c_md.uint32 | None = ...,
            reshape_position: _c_md.uint64 | None = ...,
            delta_disks: _c_md.uint32 | None = ...,
            new_layout: _c_md.uint32 | None = ...,
            new_chunk: _c_md.uint32 | None = ...,
            new_offset: _c_md.uint32 | None = ...,
            data_offset: _c_md.uint64 | None = ...,
            data_size: _c_md.uint64 | None = ...,
            super_offset: _c_md.uint64 | None = ...,
            recovery_offset: _c_md.uint64 | None = ...,
            journal_tail: _c_md.uint64 | None = ...,
            dev_number: _c_md.uint32 | None = ...,
            cnt_corrected_read: _c_md.uint32 | None = ...,
            device_uuid: __cs__.CharArray | None = ...,
            devflags: _c_md.uint8 | None = ...,
            bblog_shift: _c_md.uint8 | None = ...,
            bblog_size: _c_md.uint16 | None = ...,
            bblog_offset: _c_md.int32 | None = ...,
            utime: _c_md.uint64 | None = ...,
            events: _c_md.uint64 | None = ...,
            resync_offset: _c_md.uint64 | None = ...,
            sb_csum: _c_md.uint32 | None = ...,
            max_dev: _c_md.uint32 | None = ...,
            pad3: __cs__.CharArray | None = ...,
            dev_roles: __cs__.Array[_c_md.uint16] | None = ...,
        ): ...
        @overload
        def __init__(self, fh: bytes | memoryview | bytearray | BinaryIO, /): ...

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

SECTOR_SIZE: int
