#pragma once
#include <stdint.h>

namespace Ext2
{
    struct Superblock
    {
        uint32_t fs_inodes;           // Total number of inodes in file system
        uint32_t fs_blocks;           // Total number of blocks in file system
        uint32_t su_blocks;           // Number of blocks reserved for superuser
        uint32_t free_blocks;         // Total number of unallocated blocks
        uint32_t free_inodes;         // Total number of unallocated inodes
        uint32_t superblock_number;   // Block number of the block containing the superblock
        uint32_t block_size;          // log2(block size) - 10
        uint32_t frag_size;           // log2(fragment size) - 10
        uint32_t num_blocks;          // Number of blocks in each block group
        uint32_t num_frag;            // Number of fragments in each block group
        uint32_t num_inodes;          // Number of inodes in each block group
        uint32_t mount_time;          // Last mount time (in POSIX time)
        uint32_t write_time;          // Last written time (in POSIX time)
        uint16_t fsck_mounts;         // Number of times the volume has been mounted since its last consistency check
        uint16_t fsck_mounts_allowed; // Number of mounts allowed before a consistency check must be done
        uint16_t signature;           // Ext2 signature (0xef53)
        uint16_t fs_state;            // File system state
        uint16_t error_action;        // What to do when an error is detected
        uint16_t version_minor;       // Minor portion of version
        uint32_t fsck_time;           // POSIX time of last consistency check
        uint32_t fsck_interval;       // Interval (in POSIX time) between forced consistency checks
        uint32_t os_id;               // Operating system ID from which the filesystem on this volume was created
        uint32_t version_major;       // Major portion of version
        uint16_t su_uid;              // User ID that can use reserved blocks (superuser)
        uint16_t su_gid;              // Group ID that can use reserved blocks
    };
}