I hereby relicense all my work on Sortix under the ISC license as below. All Sortix contributions by other people are already under this license, are not substantial enough to be copyrightable, or have been removed. All imported code from other projects is compatible with this license. All GPL licensed code from other projects had previously been removed. Copyright 2011-2016 Jonas 'Sortie' Termansen and contributors. Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
129 lines
3.1 KiB
C
129 lines
3.1 KiB
C
/*
|
|
* Copyright (c) 2013 Jonas 'Sortie' Termansen.
|
|
*
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*
|
|
* ext-structs.h
|
|
* Data structures for the extended filesystem.
|
|
*/
|
|
|
|
#ifndef EXT_STRUCTS_H
|
|
#define EXT_STRUCTS_H
|
|
|
|
struct ext_superblock
|
|
{
|
|
uint32_t s_inodes_count;
|
|
uint32_t s_blocks_count;
|
|
uint32_t s_r_blocks_count;
|
|
uint32_t s_free_blocks_count;
|
|
uint32_t s_free_inodes_count;
|
|
uint32_t s_first_data_block;
|
|
uint32_t s_log_block_size;
|
|
int32_t s_log_frag_size;
|
|
uint32_t s_blocks_per_group;
|
|
uint32_t s_frags_per_group;
|
|
uint32_t s_inodes_per_group;
|
|
uint32_t s_mtime;
|
|
uint32_t s_wtime;
|
|
uint16_t s_mnt_count;
|
|
uint16_t s_max_mnt_count;
|
|
uint16_t s_magic;
|
|
uint16_t s_state;
|
|
uint16_t s_errors;
|
|
uint16_t s_minor_rev_level;
|
|
uint32_t s_lastcheck;
|
|
uint32_t s_checkinterval;
|
|
uint32_t s_creator_os;
|
|
uint32_t s_rev_level;
|
|
uint16_t s_def_resuid;
|
|
uint16_t s_def_resgid;
|
|
// EXT2_DYNAMIC_REV
|
|
uint32_t s_first_ino;
|
|
uint16_t s_inode_size;
|
|
uint16_t s_block_group_nr;
|
|
uint32_t s_feature_compat;
|
|
uint32_t s_feature_incompat;
|
|
uint32_t s_feature_ro_compat;
|
|
uint8_t s_uuid[16];
|
|
/*uint8_t*/ char s_volume_name[16];
|
|
/*uint8_t*/ char s_last_mounted[64];
|
|
uint32_t s_algo_bitmap;
|
|
// Performance Hints
|
|
uint8_t s_prealloc_blocks;
|
|
uint8_t s_prealloc_dir_blocks;
|
|
uint16_t alignment0;
|
|
// Journaling Support
|
|
uint8_t s_journal_uuid[16];
|
|
uint32_t s_journal_inum;
|
|
uint32_t s_journal_dev;
|
|
uint32_t s_last_orphan;
|
|
// Directory Indexing Support
|
|
uint32_t s_hash_seed[4];
|
|
uint8_t s_def_hash_version;
|
|
uint8_t alignment1[3];
|
|
// Other options
|
|
uint32_t s_default_mount_options;
|
|
uint32_t s_first_meta_bg;
|
|
uint8_t alignment2[760];
|
|
};
|
|
|
|
struct ext_blockgrpdesc
|
|
{
|
|
uint32_t bg_block_bitmap;
|
|
uint32_t bg_inode_bitmap;
|
|
uint32_t bg_inode_table;
|
|
uint16_t bg_free_blocks_count;
|
|
uint16_t bg_free_inodes_count;
|
|
uint16_t bg_used_dirs_count;
|
|
uint16_t alignment0;
|
|
uint8_t alignment1[12];
|
|
};
|
|
|
|
struct ext_inode
|
|
{
|
|
uint16_t i_mode;
|
|
uint16_t i_uid;
|
|
uint32_t i_size;
|
|
uint32_t i_atime;
|
|
uint32_t i_ctime;
|
|
uint32_t i_mtime;
|
|
uint32_t i_dtime;
|
|
uint16_t i_gid;
|
|
uint16_t i_links_count;
|
|
uint32_t i_blocks;
|
|
uint32_t i_flags;
|
|
uint32_t i_osd1;
|
|
uint32_t i_block[15];
|
|
uint32_t i_generation;
|
|
uint32_t i_file_acl;
|
|
uint32_t i_dir_acl;
|
|
uint32_t i_faddr;
|
|
uint8_t i_frag;
|
|
uint8_t i_fsize;
|
|
uint16_t i_mode_high;
|
|
uint16_t i_uid_high;
|
|
uint16_t i_gid_high;
|
|
uint32_t i_osd2_alignment0;
|
|
};
|
|
|
|
struct ext_dirent
|
|
{
|
|
uint32_t inode;
|
|
uint16_t reclen;
|
|
uint8_t name_len;
|
|
uint8_t file_type;
|
|
char name[0];
|
|
};
|
|
|
|
#endif
|