ReactOS  0.4.13-dev-464-g6b95727
btrfs.h File Reference
#include <fs/crc32c.h>
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for btrfs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  btrfs_disk_key
 
struct  btrfs_header
 
struct  btrfs_item
 
struct  btrfs_leaf
 
struct  btrfs_key_ptr
 
struct  btrfs_node
 
struct  btrfs_dev_item
 
struct  btrfs_stripe
 
struct  btrfs_chunk
 
struct  btrfs_inode_ref
 
struct  btrfs_timespec
 
struct  btrfs_inode_item
 
struct  btrfs_dir_item
 
struct  btrfs_root_item
 
struct  btrfs_root_ref
 
struct  btrfs_file_extent_item
 
struct  btrfs_super_block
 
union  tree_buf
 
struct  btrfs_path
 
struct  btrfs_chunk_map_item
 
struct  btrfs_chunk_map
 
struct  btrfs_file_info
 

Macros

#define btrfs_crc32c(name, len)   crc32c_le((u32)~1, name, len)
 
#define BTRFS_SUPER_INFO_OFFSET   (64 * 1024)
 
#define BTRFS_SUPER_INFO_SIZE   4096
 
#define BTRFS_MAX_LEAF_SIZE   4096
 
#define BTRFS_BLOCK_SHIFT   12
 
#define BTRFS_BLOCK_SIZE   (1 << BTRFS_BLOCK_SHIFT)
 
#define BTRFS_SUPER_MIRROR_MAX   3
 
#define BTRFS_SUPER_MIRROR_SHIFT   12
 
#define BTRFS_CSUM_SIZE   32
 
#define BTRFS_FSID_SIZE   16
 
#define BTRFS_LABEL_SIZE   256
 
#define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE   2048
 
#define BTRFS_UUID_SIZE   16
 
#define BTRFS_VOL_NAME_MAX   255
 
#define BTRFS_NAME_MAX   255
 
#define BTRFS_MAGIC   "_BHRfS_M"
 
#define BTRFS_MAGIC_L   8
 
#define BTRFS_MAGIC_N   0x4d5f53665248425fULL
 
#define BTRFS_SUPER_FLAG_METADUMP   (1ULL << 33)
 
#define BTRFS_DEV_ITEM_KEY   216
 
#define BTRFS_CHUNK_ITEM_KEY   228
 
#define BTRFS_ROOT_REF_KEY   156
 
#define BTRFS_ROOT_ITEM_KEY   132
 
#define BTRFS_EXTENT_DATA_KEY   108
 
#define BTRFS_DIR_ITEM_KEY   84
 
#define BTRFS_DIR_INDEX_KEY   96
 
#define BTRFS_INODE_ITEM_KEY   1
 
#define BTRFS_INODE_REF_KEY   12
 
#define BTRFS_EXTENT_TREE_OBJECTID   2ULL
 
#define BTRFS_FS_TREE_OBJECTID   5ULL
 
#define BTRFS_FIRST_FREE_OBJECTID   256ULL
 
#define BTRFS_LAST_FREE_OBJECTID   -256ULL
 
#define BTRFS_FIRST_CHUNK_TREE_OBJECTID   256ULL
 
#define BTRFS_FILE_EXTENT_INLINE   0
 
#define BTRFS_FILE_EXTENT_REG   1
 
#define BTRFS_FILE_EXTENT_PREALLOC   2
 
#define BTRFS_MAX_LEVEL   8
 
#define BTRFS_MAX_CHUNK_ENTRIES   256
 
#define BTRFS_DEV_ITEMS_OBJECTID   1ULL
 
#define BTRFS_FT_REG_FILE   1
 
#define BTRFS_FT_DIR   2
 
#define BTRFS_FT_SYMLINK   7
 
#define BTRFS_FT_XATTR   8
 
#define BTRFS_FT_MAX   9
 
#define BTRFS_COMPRESS_NONE   0
 
#define BTRFS_COMPRESS_ZLIB   1
 
#define BTRFS_COMPRESS_LZO   2
 
#define ROOT_DIR_WORD   0x002f
 

Typedefs

typedef UCHAR u8
 
typedef USHORT u16
 
typedef ULONG32 u32
 
typedef ULONG64 u64
 
typedef u8 __u8
 
typedef u16 __u16
 
typedef u32 __u32
 
typedef u64 __u64
 
typedef struct btrfs_file_infopbtrfs_file_info
 

Functions

const DEVVTBLBtrFsMount (ULONG DeviceId)
 

Macro Definition Documentation

◆ BTRFS_BLOCK_SHIFT

#define BTRFS_BLOCK_SHIFT   12

Definition at line 28 of file btrfs.h.

◆ BTRFS_BLOCK_SIZE

#define BTRFS_BLOCK_SIZE   (1 << BTRFS_BLOCK_SHIFT)

Definition at line 29 of file btrfs.h.

◆ BTRFS_CHUNK_ITEM_KEY

#define BTRFS_CHUNK_ITEM_KEY   228

Definition at line 49 of file btrfs.h.

◆ BTRFS_COMPRESS_LZO

#define BTRFS_COMPRESS_LZO   2

Definition at line 82 of file btrfs.h.

◆ BTRFS_COMPRESS_NONE

#define BTRFS_COMPRESS_NONE   0

Definition at line 80 of file btrfs.h.

◆ BTRFS_COMPRESS_ZLIB

#define BTRFS_COMPRESS_ZLIB   1

Definition at line 81 of file btrfs.h.

◆ btrfs_crc32c

#define btrfs_crc32c (   name,
  len 
)    crc32c_le((u32)~1, name, len)

Definition at line 23 of file btrfs.h.

◆ BTRFS_CSUM_SIZE

#define BTRFS_CSUM_SIZE   32

Definition at line 33 of file btrfs.h.

◆ BTRFS_DEV_ITEM_KEY

#define BTRFS_DEV_ITEM_KEY   216

Definition at line 48 of file btrfs.h.

◆ BTRFS_DEV_ITEMS_OBJECTID

#define BTRFS_DEV_ITEMS_OBJECTID   1ULL

Definition at line 72 of file btrfs.h.

◆ BTRFS_DIR_INDEX_KEY

#define BTRFS_DIR_INDEX_KEY   96

Definition at line 54 of file btrfs.h.

◆ BTRFS_DIR_ITEM_KEY

#define BTRFS_DIR_ITEM_KEY   84

Definition at line 53 of file btrfs.h.

◆ BTRFS_EXTENT_DATA_KEY

#define BTRFS_EXTENT_DATA_KEY   108

Definition at line 52 of file btrfs.h.

◆ BTRFS_EXTENT_TREE_OBJECTID

#define BTRFS_EXTENT_TREE_OBJECTID   2ULL

Definition at line 58 of file btrfs.h.

◆ BTRFS_FILE_EXTENT_INLINE

#define BTRFS_FILE_EXTENT_INLINE   0

Definition at line 65 of file btrfs.h.

◆ BTRFS_FILE_EXTENT_PREALLOC

#define BTRFS_FILE_EXTENT_PREALLOC   2

Definition at line 67 of file btrfs.h.

◆ BTRFS_FILE_EXTENT_REG

#define BTRFS_FILE_EXTENT_REG   1

Definition at line 66 of file btrfs.h.

◆ BTRFS_FIRST_CHUNK_TREE_OBJECTID

#define BTRFS_FIRST_CHUNK_TREE_OBJECTID   256ULL

Definition at line 63 of file btrfs.h.

◆ BTRFS_FIRST_FREE_OBJECTID

#define BTRFS_FIRST_FREE_OBJECTID   256ULL

Definition at line 61 of file btrfs.h.

◆ BTRFS_FS_TREE_OBJECTID

#define BTRFS_FS_TREE_OBJECTID   5ULL

Definition at line 59 of file btrfs.h.

◆ BTRFS_FSID_SIZE

#define BTRFS_FSID_SIZE   16

Definition at line 34 of file btrfs.h.

◆ BTRFS_FT_DIR

#define BTRFS_FT_DIR   2

Definition at line 75 of file btrfs.h.

◆ BTRFS_FT_MAX

#define BTRFS_FT_MAX   9

Definition at line 78 of file btrfs.h.

◆ BTRFS_FT_REG_FILE

#define BTRFS_FT_REG_FILE   1

Definition at line 74 of file btrfs.h.

◆ BTRFS_FT_SYMLINK

#define BTRFS_FT_SYMLINK   7

Definition at line 76 of file btrfs.h.

◆ BTRFS_FT_XATTR

#define BTRFS_FT_XATTR   8

Definition at line 77 of file btrfs.h.

◆ BTRFS_INODE_ITEM_KEY

#define BTRFS_INODE_ITEM_KEY   1

Definition at line 55 of file btrfs.h.

◆ BTRFS_INODE_REF_KEY

#define BTRFS_INODE_REF_KEY   12

Definition at line 56 of file btrfs.h.

◆ BTRFS_LABEL_SIZE

#define BTRFS_LABEL_SIZE   256

Definition at line 35 of file btrfs.h.

◆ BTRFS_LAST_FREE_OBJECTID

#define BTRFS_LAST_FREE_OBJECTID   -256ULL

Definition at line 62 of file btrfs.h.

◆ BTRFS_MAGIC

#define BTRFS_MAGIC   "_BHRfS_M"

Definition at line 42 of file btrfs.h.

◆ BTRFS_MAGIC_L

#define BTRFS_MAGIC_L   8

Definition at line 43 of file btrfs.h.

◆ BTRFS_MAGIC_N

#define BTRFS_MAGIC_N   0x4d5f53665248425fULL

Definition at line 44 of file btrfs.h.

◆ BTRFS_MAX_CHUNK_ENTRIES

#define BTRFS_MAX_CHUNK_ENTRIES   256

Definition at line 70 of file btrfs.h.

◆ BTRFS_MAX_LEAF_SIZE

#define BTRFS_MAX_LEAF_SIZE   4096

Definition at line 27 of file btrfs.h.

◆ BTRFS_MAX_LEVEL

#define BTRFS_MAX_LEVEL   8

Definition at line 69 of file btrfs.h.

◆ BTRFS_NAME_MAX

#define BTRFS_NAME_MAX   255

Definition at line 40 of file btrfs.h.

◆ BTRFS_ROOT_ITEM_KEY

#define BTRFS_ROOT_ITEM_KEY   132

Definition at line 51 of file btrfs.h.

◆ BTRFS_ROOT_REF_KEY

#define BTRFS_ROOT_REF_KEY   156

Definition at line 50 of file btrfs.h.

◆ BTRFS_SUPER_FLAG_METADUMP

#define BTRFS_SUPER_FLAG_METADUMP   (1ULL << 33)

Definition at line 46 of file btrfs.h.

◆ BTRFS_SUPER_INFO_OFFSET

#define BTRFS_SUPER_INFO_OFFSET   (64 * 1024)

Definition at line 25 of file btrfs.h.

◆ BTRFS_SUPER_INFO_SIZE

#define BTRFS_SUPER_INFO_SIZE   4096

Definition at line 26 of file btrfs.h.

◆ BTRFS_SUPER_MIRROR_MAX

#define BTRFS_SUPER_MIRROR_MAX   3

Definition at line 31 of file btrfs.h.

◆ BTRFS_SUPER_MIRROR_SHIFT

#define BTRFS_SUPER_MIRROR_SHIFT   12

Definition at line 32 of file btrfs.h.

◆ BTRFS_SYSTEM_CHUNK_ARRAY_SIZE

#define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE   2048

Definition at line 36 of file btrfs.h.

◆ BTRFS_UUID_SIZE

#define BTRFS_UUID_SIZE   16

Definition at line 37 of file btrfs.h.

◆ BTRFS_VOL_NAME_MAX

#define BTRFS_VOL_NAME_MAX   255

Definition at line 39 of file btrfs.h.

◆ ROOT_DIR_WORD

#define ROOT_DIR_WORD   0x002f

Definition at line 84 of file btrfs.h.

Typedef Documentation

◆ __u16

typedef u16 __u16

Definition at line 18 of file btrfs.h.

◆ __u32

typedef u32 __u32

Definition at line 19 of file btrfs.h.

◆ __u64

typedef unsigned __int64 __u64

Definition at line 20 of file btrfs.h.

◆ __u8

typedef u8 __u8

Definition at line 17 of file btrfs.h.

◆ pbtrfs_file_info

◆ u16

typedef USHORT u16

Definition at line 13 of file btrfs.h.

◆ u32

typedef ULONG32 u32

Definition at line 14 of file btrfs.h.

◆ u64

typedef ULONG64 u64

Definition at line 15 of file btrfs.h.

◆ u8

typedef UCHAR u8

Definition at line 12 of file btrfs.h.

Function Documentation

◆ BtrFsMount()

const DEVVTBL* BtrFsMount ( ULONG  DeviceId)

Definition at line 1231 of file btrfs.c.

1232 {
1233  struct btrfs_path path;
1234  struct btrfs_root_item fs_root_item;
1235 
1236  TRACE("Enter BtrFsMount(), sizeof %d %d\n", sizeof(struct BTRFS_INFO), sizeof(struct btrfs_super_block));
1237 
1239  if (!BtrFsInfo)
1240  return NULL;
1241  RtlZeroMemory(BtrFsInfo, sizeof(struct BTRFS_INFO));
1242 
1243  /* Read the SuperBlock */
1244  if (!disk_read(BTRFS_SUPER_INFO_OFFSET, &BtrFsInfo->SuperBlock, sizeof(struct btrfs_super_block)))
1245  {
1247  return NULL;
1248  }
1249 
1250  /* Check if SuperBlock is valid. If yes, return BTRFS function table */
1251  if (BtrFsInfo->SuperBlock.magic == BTRFS_MAGIC_N)
1252  {
1253  BtrFsInfo->DeviceId = DeviceId;
1254  TRACE("BtrFsMount() superblock magic ok\n");
1255 
1257 
1260 
1261  /* setup roots */
1262  fs_root_item.bytenr = BtrFsInfo->SuperBlock.root;
1263  fs_root_item.level = BtrFsInfo->SuperBlock.root_level;
1264 
1265  init_path(&path);
1267  {
1269  free_path(&path);
1270  return NULL;
1271  }
1272 
1273  BtrFsInfo->FsRoot = *(struct btrfs_root_item *) path_current_data(&path);
1274 
1275  free_path(&path);
1276 
1277  TRACE("BtrFsMount success\n");
1278 
1279  return &BtrFsFuncTable;
1280  }
1281  else
1282  {
1283  return NULL;
1284  }
1285 }
#define BTRFS_FS_TREE_OBJECTID
Definition: btrfs.h:59
static void btrfs_init_crc32c(void)
Definition: crc32c.h:39
const DEVVTBL BtrFsFuncTable
Definition: btrfs.c:1221
#define BTRFS_ROOT_ITEM_KEY
Definition: btrfs.h:51
struct BTRFS_INFO * BtrFsInfo
Definition: btrfs.c:33
static void btrfs_read_sys_chunk_array()
Definition: btrfs.c:435
static void btrfs_read_chunk_tree()
Definition: btrfs.c:471
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:177
smooth NULL
Definition: ftsmooth.c:416
#define TAG_BTRFS_INFO
Definition: btrfs.c:15
#define TRACE(s)
Definition: solgame.cpp:4
static BOOLEAN BtrFsSearchTreeType(const struct btrfs_root_item *root, u64 objectid, u8 type, struct btrfs_path *path)
Definition: btrfs.c:362
static void init_path(struct btrfs_path *path)
Definition: btrfs.c:167
#define BTRFS_SUPER_INFO_OFFSET
Definition: btrfs.h:25
Definition: services.c:325
RtlZeroMemory(r->fcbs_ptrs, sizeof(LIST_ENTRY *) *256)
static UCHAR * path_current_data(struct btrfs_path *path)
Definition: btrfs.c:183
#define BTRFS_MAGIC_N
Definition: btrfs.h:44
static BOOLEAN disk_read(u64 physical, void *dest, u32 count)
Definition: btrfs.c:254
static void free_path(struct btrfs_path *path)
Definition: btrfs.c:173
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:186

Referenced by ArcOpen().