1/* 2 * Copyright 2000 Hans Reiser 3 * See README for licensing and copyright details 4 * 5 * Ported to FreeBSD by Jean-Sébastien Pédron <jspedron@club-internet.fr> 6 * 7 * $FreeBSD$ 8 */ 9 10#ifndef _GNU_REISERFS_REISERFS_FS_SB_H 11#define _GNU_REISERFS_REISERFS_FS_SB_H 12 13typedef uint32_t (*hashf_t)(const signed char *, int); 14 15#define sb_block_count(sbp) (le32toh((sbp)->s_v1.s_block_count)) 16#define set_sb_block_count(sbp,v) ((sbp)->s_v1.s_block_count = htole32(v)) 17#define sb_free_blocks(sbp) (le32toh((sbp)->s_v1.s_free_blocks)) 18#define set_sb_free_blocks(sbp,v) ((sbp)->s_v1.s_free_blocks = htole32(v)) 19#define sb_root_block(sbp) (le32toh((sbp)->s_v1.s_root_block)) 20 21/* Bitmaps */ 22struct reiserfs_bitmap_info { 23 uint16_t first_zero_hint; 24 uint16_t free_count; 25 //struct buf *bp; /* The actual bitmap */ 26 caddr_t bp_data; /* The actual bitmap */ 27}; 28 29/* ReiserFS union of in-core super block data */ 30struct reiserfs_sb_info { 31 struct reiserfs_super_block *s_rs; 32 struct reiserfs_bitmap_info *s_ap_bitmap; 33 struct vnode *s_devvp; 34 35 unsigned short s_mount_state; 36 37 hashf_t s_hash_function; /* Pointer to function which 38 is used to sort names in 39 directory. Set on mount */ 40 unsigned long s_mount_opt; /* ReiserFS's mount options 41 are set here */ 42 int s_generation_counter; /* Increased by one every 43 time the tree gets 44 re-balanced */ 45 unsigned long s_properties; /* File system properties. 46 Currently holds on-disk 47 FS format */ 48 uint16_t s_blocksize; 49 uint16_t s_blocksize_bits; 50 char s_rd_only; /* Is it read-only ? */ 51 int s_is_unlinked_ok; 52}; 53 54#define sb_version(sbi) (le16toh((sbi)->s_v1.s_version)) 55#define set_sb_version(sbi, v) ((sbi)->s_v1.s_version = htole16(v)) 56 57#define sb_blocksize(sbi) (le16toh((sbi)->s_v1.s_blocksize)) 58#define set_sb_blocksize(sbi, v) ((sbi)->s_v1.s_blocksize = htole16(v)) 59 60#define sb_hash_function_code(sbi) \ 61 (le32toh((sbi)->s_v1.s_hash_function_code)) 62#define set_sb_hash_function_code(sbi, v) \ 63 ((sbi)->s_v1.s_hash_function_code = htole32(v)) 64 65#define sb_bmap_nr(sbi) (le16toh((sbi)->s_v1.s_bmap_nr)) 66#define set_sb_bmap_nr(sbi, v) ((sbi)->s_v1.s_bmap_nr = htole16(v)) 67 68/* Definitions of reiserfs on-disk properties: */ 69#define REISERFS_3_5 0 70#define REISERFS_3_6 1 71 72enum reiserfs_mount_options { 73 /* Mount options */ 74 REISERFS_LARGETAIL, /* Large tails will be created in a session */ 75 REISERFS_SMALLTAIL, /* Small (for files less than block size) tails 76 will be created in a session */ 77 REPLAYONLY, /* Replay journal and return 0. Use by fsck */ 78 REISERFS_CONVERT, /* -o conv: causes conversion of old format super 79 block to the new format. If not specified - 80 old partition will be dealt with in a manner 81 of 3.5.x */ 82 83 /* 84 * -o hash={tea, rupasov, r5, detect} is meant for properly mounting 85 * reiserfs disks from 3.5.19 or earlier. 99% of the time, this option 86 * is not required. If the normal autodection code can't determine 87 * which hash to use (because both hases had the same value for a 88 * file) use this option to force a specific hash. It won't allow you 89 * to override the existing hash on the FS, so if you have a tea hash 90 * disk, and mount with -o hash=rupasov, the mount will fail. 91 */ 92 FORCE_TEA_HASH, /* try to force tea hash on mount */ 93 FORCE_RUPASOV_HASH, /* try to force rupasov hash on mount */ 94 FORCE_R5_HASH, /* try to force rupasov hash on mount */ 95 FORCE_HASH_DETECT, /* try to detect hash function on mount */ 96 97 REISERFS_DATA_LOG, 98 REISERFS_DATA_ORDERED, 99 REISERFS_DATA_WRITEBACK, 100 101 /* 102 * used for testing experimental features, makes benchmarking new 103 * features with and without more convenient, should never be used by 104 * users in any code shipped to users (ideally) 105 */ 106 107 REISERFS_NO_BORDER, 108 REISERFS_NO_UNHASHED_RELOCATION, 109 REISERFS_HASHED_RELOCATION, 110 REISERFS_ATTRS, 111 REISERFS_XATTRS, 112 REISERFS_XATTRS_USER, 113 REISERFS_POSIXACL, 114 115 REISERFS_TEST1, 116 REISERFS_TEST2, 117 REISERFS_TEST3, 118 REISERFS_TEST4, 119}; 120 121#define reiserfs_r5_hash(sbi) \ 122 (REISERFS_SB(sbi)->s_mount_opt & (1 << FORCE_R5_HASH)) 123#define reiserfs_rupasov_hash(sbi) \ 124 (REISERFS_SB(sbi)->s_mount_opt & (1 << FORCE_RUPASOV_HASH)) 125#define reiserfs_tea_hash(sbi) \ 126 (REISERFS_SB(sbi)->s_mount_opt & (1 << FORCE_TEA_HASH)) 127#define reiserfs_hash_detect(sbi) \ 128 (REISERFS_SB(sbi)->s_mount_opt & (1 << FORCE_HASH_DETECT)) 129 130#define reiserfs_attrs(sbi) \ 131 (REISERFS_SB(sbi)->s_mount_opt & (1 << REISERFS_ATTRS)) 132 133#define reiserfs_data_log(sbi) \ 134 (REISERFS_SB(sbi)->s_mount_opt & (1 << REISERFS_DATA_LOG)) 135#define reiserfs_data_ordered(sbi) \ 136 (REISERFS_SB(sbi)->s_mount_opt & (1 << REISERFS_DATA_ORDERED)) 137#define reiserfs_data_writeback(sbi) \ 138 (REISERFS_SB(sbi)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) 139 140#define SB_BUFFER_WITH_SB(sbi) (REISERFS_SB(sbi)->s_sbh) 141#define SB_AP_BITMAP(sbi) (REISERFS_SB(sbi)->s_ap_bitmap) 142 143#endif /* !defined _GNU_REISERFS_REISERFS_FS_SB_H */ 144