1 /*
2  * COPYRIGHT:        See COPYING in the top level directory
3  * PROJECT:          ReactOS File System Recognizer
4  * FILE:             drivers/filesystems/fs_rec/btrfs.h
5  * PURPOSE:          BTRFS Header File
6  * PROGRAMMER:       Peter Hater
7  *                   Pierre Schweitzer (pierre@reactos.org)
8  */
9 
10 #include <pshpack1.h>
11 struct journal_params {
12     // Block number of the block containing the first journal node.
13     UINT32 jp_journal_1st_block;	      /* where does journal start from on its device */
14 
15     // Journal device number (?? for if the journal is on a separate drive ??)
16     UINT32 jp_journal_dev;	      /* journal device st_rdev */
17 
18     // Original journal size.  (Needed when using partition on systems w/ different default journal sizes).
19     UINT32 jp_journal_size;	      /* size of the journal */
20 
21     UINT32 jp_journal_trans_max;	      /* max number of blocks in a transaction. */
22     UINT32 jp_journal_magic; 	      /* random value made on fs creation (this was sb_journal_block_count) */
23     UINT32 jp_journal_max_batch;	      /* max number of blocks to batch into a trans */
24     UINT32 jp_journal_max_commit_age;  /* in seconds, how old can an async commit be */
25     UINT32 jp_journal_max_trans_age;   /* in seconds, how old can a transaction be */
26 };
27 
28 typedef struct _RFSD_SUPER_BLOCK
29 {
30     // The number of blocks in the partition
31     UINT32 s_blocks_count;	   /* blocks count         */			//[mark] was _s_blocks_count
32 
33     // The number of free blocks in the partition
34     UINT32 s_free_blocks_count;           /* free blocks count    */  //[mark] was _s_free_blocks
35 
36     // Block number of the block containing the root node
37     UINT32 s_root_block;            /* root block number    */
38 
39     struct journal_params s_journal;
40 
41     // The size (in bytes) of a block
42     UINT16 s_blocksize;             /* block size */
43 
44     UINT16 s_oid_maxsize;	   /* max size of object id array, see get_objectid() commentary  */
45     UINT16 s_oid_cursize;	   /* current size of object id array */
46     UINT16 s_umount_state;          /* this is set to 1 when filesystem was umounted, to 2 - when not */
47     char s_magic[10];              /* reiserfs magic string indicates that
48                                     * file system is reiserfs:
49                                     * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */
50 
51     // State of the partition: valid(1), error (2)
52     UINT16 s_fs_state;	           /* it is set to used by fsck to mark which phase of rebuilding is done */
53 
54     UINT32 s_hash_function_code;    /* indicate, what hash function is being use
55                                      * to sort names in a directory*/
56     UINT16 s_tree_height;           /* height of disk tree */
57     UINT16 s_bmap_nr;               /* amount of bitmap blocks needed to address
58                                      * each block of file system */
59 
60     // The reiserfs version number
61     UINT16 s_version;               /* this field is only reliable on filesystem
62                                      * with non-standard journal */
63     UINT16 s_reserved_for_journal;  /* size in blocks of journal area on main
64                                      * device, we need to keep after
65                                      * making fs with non-standard journal */
66 } RFSD_SUPER_BLOCK, *PRFSD_SUPER_BLOCK;
67 #include <poppack.h>
68 
69 C_ASSERT(FIELD_OFFSET(RFSD_SUPER_BLOCK, s_blocksize) == 44);
70 C_ASSERT(FIELD_OFFSET(RFSD_SUPER_BLOCK, s_magic) == 52);
71 
72 #define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024)
73 #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
74 #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
75 #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
76 #define MAGIC_KEY_LENGTH 9
77