* and copyright details */
#ifndef REISER_FS_H
#define REISER_FS_H
#include <SupportDefs.h>
*/
#define KEY_FORMAT_3_5 0
#define KEY_FORMAT_3_6 1
#define STAT_DATA_V1 0
#define STAT_DATA_V2 1
#define SD_OFFSET 0
#define SD_UNIQUENESS 0
#define DOT_OFFSET 1
#define DOT_DOT_OFFSET 2
#define DIRENTRY_UNIQUENESS 500
#define FIRST_ITEM_OFFSET 1
#define REISERFS_ROOT_OBJECTID 2
#define REISERFS_ROOT_PARENT_OBJECTID 1
#define TYPE_STAT_DATA 0
#define TYPE_INDIRECT 1
#define TYPE_DIRECT 2
#define TYPE_DIRENTRY 3
#define TYPE_ANY 15 // FIXME: comment is required
#define V1_SD_UNIQUENESS 0
#define V1_INDIRECT_UNIQUENESS 0xfffffffe
#define V1_DIRECT_UNIQUENESS 0xffffffff
#define V1_DIRENTRY_UNIQUENESS 500
#define V1_ANY_UNIQUENESS 555 // FIXME: comment is required
static inline
uint32
offset_hash_value(uint64 offset)
{
return offset & 0x7fffff80ULL;
}
static inline
uint32
offset_generation_number(uint64 offset)
{
return offset & 0x7fULL;
}
#define MAX_GENERATION_NUMBER 127
struct offset_v1 {
uint32 k_offset;
uint32 k_uniqueness;
} _PACKED;
struct offset_v2 {
#if LITTLE_ENDIAN
uint64 k_offset:60;
uint64 k_type: 4;
#else
uint64 k_type: 4;
uint64 k_offset:60;
#endif
} _PACKED;
struct key {
uint32 k_dir_id;
directory object id */
uint32 k_objectid;
union {
offset_v1 k_offset_v1;
offset_v2 k_offset_v2;
} _PACKED u;
} _PACKED;
struct block_head {
uint16 blk_level;
uint16 blk_nr_item;
uint16 blk_free_space;
uint16 blk_reserved;
key blk_right_delim_key;
};
struct disk_child {
uint32 dc_block_number;
uint16 dc_size;
uint16 dc_reserved;
};
struct item_head
{
* its key.*/
struct key ih_key;
union {
indirect item if this is an indirect item. This
equals 0xFFFF iff this is a direct item or stat data
item. Note that the key, not this field, is used to
determine the item type, and thus which field this
union contains. */
uint16 ih_free_space_reserved;
number of directory entries in the directory item. */
uint16 ih_entry_count;
} _PACKED u;
uint16 ih_item_len;
uint16 ih_item_location;
* within the block */
uint16 ih_version;
ones. Highest bit is set by fsck
temporary, cleaned after all
done */
} _PACKED;
struct stat_data {
uint16 sd_mode;
uint16 sd_reserved;
uint32 sd_nlink;
uint64 sd_size;
uint32 sd_uid;
uint32 sd_gid;
uint32 sd_atime;
uint32 sd_mtime;
uint32 sd_ctime;
uint32 sd_blocks;
union {
uint32 sd_rdev;
uint32 sd_generation;
} _PACKED u;
} _PACKED;
struct stat_data_v1
{
uint16 sd_mode;
uint16 sd_nlink;
uint16 sd_uid;
uint16 sd_gid;
uint32 sd_size;
uint32 sd_atime;
uint32 sd_mtime;
uint32 sd_ctime;
union {
uint32 sd_rdev;
uint32 sd_blocks;
} _PACKED u;
uint32 sd_first_direct_byte;
in a direct item: except that if it
equals 1 it is a symlink and if it
equals ~(__u32)0 there is no
direct item. The existence of this
field really grates on me. Let's
replace it with a macro based on
sd_size and our tail suppression
policy. Someday. -Hans */
} _PACKED;
struct reiserfs_de_head
{
uint32 deh_offset;
uint32 deh_dir_id;
by directory entry */
uint32 deh_objectid;
uint16 deh_location;
uint16 deh_state;
entry is hidden (unlinked) */
} _PACKED;
#define DEH_Statdata 0 /* not used now */
#define DEH_Visible 2
enough space. If someone wants to write a fancy bootloader that
needs more than 64k, let us know, and this will be increased in size.
This number must be larger than than the largest block size on any
platform, or code will break. -Hans */
#define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024)
#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024)
#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
* values for s_state field
*/
#define REISERFS_VALID_FS 1
#define REISERFS_ERROR_FS 2
#define REISERFS_VERSION_0 0 /* undistributed bitmap */
#define REISERFS_VERSION_1 1 /* distributed bitmap and resizer*/
#define REISERFS_VERSION_2 2 /* distributed bitmap, resizer, 64-bit, etc*/
#define UNSET_HASH 0 // read_super will guess about, what hash names
#define TEA_HASH 1
#define YURA_HASH 2
#define R5_HASH 3
#define DEFAULT_HASH R5_HASH
struct reiserfs_super_block
{
uint32 s_block_count;
uint32 s_free_blocks;
uint32 s_root_block;
uint32 s_journal_block;
uint32 s_journal_dev;
** someone creates a disk with a 16MB journal and moves it to a
** system with 32MB journal default, they will overflow their journal
** when they mount the disk. s_orig_journal_size, plus some checks
** while mounting (inside journal_init) prevent that from happening
*/
uint32 s_orig_journal_size;
uint32 s_journal_trans_max ;
uint32 s_journal_block_count ;
uint32 s_journal_max_batch ;
uint32 s_journal_max_commit_age ;
uint32 s_journal_max_trans_age ;
uint16 s_blocksize;
uint16 s_oid_maxsize;
uint16 s_oid_cursize;
uint16 s_state;
char s_magic[12];
uint32 s_hash_function_code;
uint16 s_tree_height;
uint16 s_bmap_nr;
uint16 s_version;
something like "3.6.4", and maybe
16 bytes long mostly unused. We
don't need to save bytes in the
superblock. -Hans */
uint16 s_reserved;
uint32 s_inode_generation;
uint32 s_flags;
char s_uuid[16];
char s_label[16];
uint16 s_mnt_count;
uint16 s_max_mnt_count;
uint32 s_lastcheck;
uint32 s_check_interval;
char s_unused[76] ;
} _PACKED;
#define SB_SIZE (sizeof(struct reiserfs_super_block))
struct reiserfs_super_block_v1
{
uint32 s_block_count;
uint32 s_free_blocks;
uint32 s_root_block;
uint32 s_journal_block;
uint32 s_journal_dev;
uint32 s_orig_journal_size;
uint32 s_journal_trans_max ;
uint32 s_journal_block_count ;
uint32 s_journal_max_batch ;
uint32 s_journal_max_commit_age ;
uint32 s_journal_max_trans_age ;
uint16 s_blocksize;
uint16 s_oid_maxsize;
uint16 s_oid_cursize;
uint16 s_state;
char s_magic[16];
uint16 s_tree_height;
uint16 s_bmap_nr;
uint32 s_reserved;
} _PACKED;
#define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1))
#define REISERFS_3_5 0
#define REISERFS_3_6 1
#endif