//! Default superblock initialization.

use super::Ext4Superblock;
use crate::{config::*, jbd2::jbdstruct::*};

impl Default for Ext4Superblock {
    fn default() -> Self {
        Self {
            s_inodes_count: 0,
            s_blocks_count_lo: 0,
            s_r_blocks_count_lo: 0,
            s_free_blocks_count_lo: 0,
            s_free_inodes_count: 0,
            s_first_data_block: 0,
            s_log_block_size: 0,
            s_log_cluster_size: 0,
            s_blocks_per_group: 0,
            s_clusters_per_group: 0,
            s_inodes_per_group: 0,
            s_mtime: 0,
            s_wtime: 0,
            s_mnt_count: 0,
            s_max_mnt_count: 0,
            s_magic: 0,
            s_state: 0,
            s_errors: 0,
            s_minor_rev_level: 0,
            s_lastcheck: 0,
            s_checkinterval: 0,
            s_creator_os: 0,
            s_rev_level: 0,
            s_def_resuid: 0,
            s_def_resgid: 0,
            s_first_ino: 0,
            s_inode_size: 0,
            s_block_group_nr: 0,
            s_feature_compat: Self::EXT4_FEATURE_COMPAT_HAS_JOURNAL,
            s_feature_incompat: Self::EXT4_FEATURE_INCOMPAT_EXTENTS,
            s_feature_ro_compat: Self::EXT4_FEATURE_RO_COMPAT_HUGE_FILE,
            s_uuid: [0; 16],
            s_volume_name: [0; 16],
            s_last_mounted: [0; 64],
            s_algorithm_usage_bitmap: 0,
            s_prealloc_blocks: 0,
            s_prealloc_dir_blocks: 0,
            s_reserved_gdt_blocks: RESERVED_GDT_BLOCKS as u16,
            s_journal_uuid: [0; 16],
            s_journal_inum: JOURNAL_FILE_INODE as u32,
            s_journal_dev: 0,
            s_last_orphan: 0,
            s_hash_seed: [0; 4],
            s_def_hash_version: 1,
            s_jnl_backup_type: 0,
            s_desc_size: 0,
            s_default_mount_opts: 0,
            s_first_meta_bg: 0,
            s_mkfs_time: 0,
            s_jnl_blocks: [0; 17],
            s_blocks_count_hi: 0,
            s_r_blocks_count_hi: 0,
            s_free_blocks_count_hi: 0,
            s_min_extra_isize: 0,
            s_want_extra_isize: 0,
            s_flags: 0,
            s_raid_stride: 0,
            s_mmp_interval: 0,
            s_mmp_block: 0,
            s_raid_stripe_width: 0,
            s_log_groups_per_flex: 0,
            s_checksum_type: 0,
            s_encryption_level: 0,
            s_reserved_pad: 0,
            s_kbytes_written: 0,
            s_snapshot_inum: 0,
            s_snapshot_id: 0,
            s_snapshot_r_blocks_count: 0,
            s_snapshot_list: 0,
            s_error_count: 0,
            s_first_error_time: 0,
            s_first_error_ino: 0,
            s_first_error_block: 0,
            s_first_error_func: [0; 32],
            s_first_error_line: 0,
            s_last_error_time: 0,
            s_last_error_ino: 0,
            s_last_error_line: 0,
            s_last_error_block: 0,
            s_last_error_func: [0; 32],
            s_mount_opts: [0; 64],
            s_usr_quota_inum: 0,
            s_grp_quota_inum: 0,
            s_overhead_blocks: 0,
            s_backup_bgs: [0; 2],
            s_encrypt_algos: [0; 4],
            s_encrypt_pw_salt: [0; 16],
            s_lpf_ino: 0,
            s_prj_quota_inum: 0,
            s_checksum_seed: 0,
            s_wtime_hi: 0,
            s_mtime_hi: 0,
            s_mkfs_time_hi: 0,
            s_lastcheck_hi: 0,
            s_first_error_time_hi: 0,
            s_last_error_time_hi: 0,
            s_first_error_errcode: 0,
            s_last_error_errcode: 0,
            s_encoding: 0,
            s_encoding_flags: 0,
            s_orphan_file_inum: 0,
            s_reserved: [0; 94],
            s_checksum: 0,
        }
    }
}
