⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reiserfs_fs.h

📁 unxi下共享内存的使用
💻 H
📖 第 1 页 / 共 5 页
字号:
/* * Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details */				/* this file has an amazingly stupid                                   name, yura please fix it to be                                   reiserfs.h, and merge all the rest                                   of our .h files that are in this                                   directory into it.  */#ifndef _LINUX_REISER_FS_H#define _LINUX_REISER_FS_H#include <linux/types.h>#ifdef __KERNEL__#include <linux/slab.h>#include <linux/tqueue.h>#include <asm/unaligned.h>#include <linux/bitops.h>#include <asm/hardirq.h>#include <linux/proc_fs.h>#endif/* *  include/linux/reiser_fs.h * *  Reiser File System constants and structures * *//* in reading the #defines, it may help to understand that they employ   the following abbreviations:   B = Buffer   I = Item header   H = Height within the tree (should be changed to LEV)   N = Number of the item in the node   STAT = stat data   DEH = Directory Entry Header   EC = Entry Count   E = Entry number   UL = Unsigned Long   BLKH = BLocK Header   UNFM = UNForMatted node   DC = Disk Child   P = Path   These #defines are named by concatenating these abbreviations,   where first comes the arguments, and last comes the return value,   of the macro.*/#define USE_INODE_GENERATION_COUNTER#define REISERFS_PREALLOCATE#define PREALLOCATION_SIZE 8/* n must be power of 2 */#define _ROUND_UP(x,n) (((x)+(n)-1u) & ~((n)-1u))// to be ok for alpha and others we have to align structures to 8 byte// boundary.// FIXME: do not change 4 by anything else: there is code which relies on that#define ROUND_UP(x) _ROUND_UP(x,8LL)/* debug levels.  Right now, CONFIG_REISERFS_CHECK means print all debug** messages.*/#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ /* assertions handling *//** always check a condition and panic if it's false. */#define RASSERT( cond, format, args... )					\if( !( cond ) ) 								\  reiserfs_panic( 0, "reiserfs[%i]: assertion " #cond " failed at "		\		  __FILE__ ":%i:" __FUNCTION__ ": " format "\n",		\		  in_interrupt() ? -1 : current -> pid, __LINE__ , ##args )#if defined( CONFIG_REISERFS_CHECK )#define RFALSE( cond, format, args... ) RASSERT( !( cond ), format, ##args )#else#define RFALSE( cond, format, args... ) do {;} while( 0 )#endif#define CONSTF __attribute__( ( const ) )/* * Disk Data Structures *//***************************************************************************//*                             SUPER BLOCK                                 *//***************************************************************************//* * Structure of super block on disk, a version of which in RAM is often accessed as s->u.reiserfs_sb.s_rs * the version in RAM is part of a larger structure containing fields never written to disk. */				/* used by gcc */#define REISERFS_SUPER_MAGIC 0x52654973				/* used by file system utilities that                                   look at the superblock, etc. */#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"extern char reiserfs_super_magic_string[];extern char reiser2fs_super_magic_string[];static inline int is_reiserfs_magic_string (const struct reiserfs_super_block * rs){    return (!strncmp (rs->s_magic, reiserfs_super_magic_string, 		      strlen ( reiserfs_super_magic_string)) ||	    !strncmp (rs->s_magic, reiser2fs_super_magic_string, 		      strlen ( reiser2fs_super_magic_string)));}/* ReiserFS leaves the first 64k unused, so that partition labels have   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_FIRST_BLOCK unused_define/* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024)// reiserfs internal error code (used by search_by_key adn fix_nodes))#define CARRY_ON      0#define REPEAT_SEARCH -1#define IO_ERROR      -2#define NO_DISK_SPACE -3#define NO_BALANCING_NEEDED  (-4)#define NO_MORE_UNUSED_CONTIGUOUS_BLOCKS (-5)typedef unsigned long b_blocknr_t;typedef __u32 unp_t;struct unfm_nodeinfo {    unp_t unfm_nodenum;    unsigned short unfm_freespace;};/* there are two formats of keys: 3.5 and 3.6 */#define KEY_FORMAT_3_5 0#define KEY_FORMAT_3_6 1/* there are two stat datas */#define STAT_DATA_V1 0#define STAT_DATA_V2 1/** this says about version of key of all items (but stat data) the    object consists of */#define get_inode_item_key_version( inode )                                    \    (((inode)->u.reiserfs_i.i_flags & i_item_key_version_mask) ? KEY_FORMAT_3_6 : KEY_FORMAT_3_5)#define set_inode_item_key_version( inode, version )                           \         ({ if((version)==KEY_FORMAT_3_6)                                      \                (inode)->u.reiserfs_i.i_flags |= i_item_key_version_mask;      \            else                                                               \                (inode)->u.reiserfs_i.i_flags &= ~i_item_key_version_mask; })#define get_inode_sd_version(inode)                                            \    (((inode)->u.reiserfs_i.i_flags & i_stat_data_version_mask) ? STAT_DATA_V2 : STAT_DATA_V1)#define set_inode_sd_version(inode, version)                                   \         ({ if((version)==STAT_DATA_V2)                                        \                (inode)->u.reiserfs_i.i_flags |= i_stat_data_version_mask;     \            else                                                               \                (inode)->u.reiserfs_i.i_flags &= ~i_stat_data_version_mask; })/* This is an aggressive tail suppression policy, I am hoping it   improves our benchmarks. The principle behind it is that percentage   space saving is what matters, not absolute space saving.  This is   non-intuitive, but it helps to understand it if you consider that the   cost to access 4 blocks is not much more than the cost to access 1   block, if you have to do a seek and rotate.  A tail risks a   non-linear disk access that is significant as a percentage of total   time cost for a 4 block file and saves an amount of space that is   less significant as a percentage of space, or so goes the hypothesis.   -Hans */#define STORE_TAIL_IN_UNFM(n_file_size,n_tail_size,n_block_size) \(\  (!(n_tail_size)) || \  (((n_tail_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) || \   ( (n_file_size) >= (n_block_size) * 4 ) || \   ( ( (n_file_size) >= (n_block_size) * 3 ) && \     ( (n_tail_size) >=   (MAX_DIRECT_ITEM_LEN(n_block_size))/4) ) || \   ( ( (n_file_size) >= (n_block_size) * 2 ) && \     ( (n_tail_size) >=   (MAX_DIRECT_ITEM_LEN(n_block_size))/2) ) || \   ( ( (n_file_size) >= (n_block_size) ) && \     ( (n_tail_size) >=   (MAX_DIRECT_ITEM_LEN(n_block_size) * 3)/4) ) ) \)/* * values for s_state field */#define REISERFS_VALID_FS    1#define REISERFS_ERROR_FS    2//// there are 5 item types currently//#define TYPE_STAT_DATA 0#define TYPE_INDIRECT 1#define TYPE_DIRECT 2#define TYPE_DIRENTRY 3 #define TYPE_MAXTYPE 3 #define TYPE_ANY 15 // FIXME: comment is required/***************************************************************************//*                       KEY & ITEM HEAD                                   *//***************************************************************************///// directories use this key as well as old files//struct offset_v1 {    __u32 k_offset;    __u32 k_uniqueness;} __attribute__ ((__packed__));struct offset_v2 {#ifdef __LITTLE_ENDIAN	    /* little endian version */	    __u64 k_offset:60;	    __u64 k_type: 4;#else	    /* big endian version */	    __u64 k_type: 4;	    __u64 k_offset:60;#endif} __attribute__ ((__packed__));#ifndef __LITTLE_ENDIANtypedef union {    struct offset_v2 offset_v2;    __u64 linear;} __attribute__ ((__packed__)) offset_v2_esafe_overlay;static inline __u16 offset_v2_k_type( const struct offset_v2 *v2 ){    offset_v2_esafe_overlay tmp = *(const offset_v2_esafe_overlay *)v2;    tmp.linear = le64_to_cpu( tmp.linear );    return (tmp.offset_v2.k_type <= TYPE_MAXTYPE)?tmp.offset_v2.k_type:TYPE_ANY;} static inline void set_offset_v2_k_type( struct offset_v2 *v2, int type ){    offset_v2_esafe_overlay *tmp = (offset_v2_esafe_overlay *)v2;    tmp->linear = le64_to_cpu(tmp->linear);    tmp->offset_v2.k_type = type;    tmp->linear = cpu_to_le64(tmp->linear);} static inline loff_t offset_v2_k_offset( const struct offset_v2 *v2 ){    offset_v2_esafe_overlay tmp = *(const offset_v2_esafe_overlay *)v2;    tmp.linear = le64_to_cpu( tmp.linear );    return tmp.offset_v2.k_offset;}static inline void set_offset_v2_k_offset( struct offset_v2 *v2, loff_t offset ){    offset_v2_esafe_overlay *tmp = (offset_v2_esafe_overlay *)v2;    tmp->linear = le64_to_cpu(tmp->linear);    tmp->offset_v2.k_offset = offset;    tmp->linear = cpu_to_le64(tmp->linear);}#else# define offset_v2_k_type(v2)           ((v2)->k_type)# define set_offset_v2_k_type(v2,val)   (offset_v2_k_type(v2) = (val))# define offset_v2_k_offset(v2)         ((v2)->k_offset)# define set_offset_v2_k_offset(v2,val) (offset_v2_k_offset(v2) = (val))#endif/* Key of an item determines its location in the S+tree, and   is composed of 4 components */struct key {    __u32 k_dir_id;    /* packing locality: by default parent			  directory object id */    __u32 k_objectid;  /* object identifier */    union {	struct offset_v1 k_offset_v1;	struct offset_v2 k_offset_v2;    } __attribute__ ((__packed__)) u;} __attribute__ ((__packed__));struct cpu_key {    struct key on_disk_key;    int version;    int key_length; /* 3 in all cases but direct2indirect and		       indirect2direct conversion */};/* Our function for comparing keys can compare keys of different   lengths.  It takes as a parameter the length of the keys it is to   compare.  These defines are used in determining what is to be passed   to it as that parameter. */#define REISERFS_FULL_KEY_LEN     4#define REISERFS_SHORT_KEY_LEN    2/* The result of the key compare */#define FIRST_GREATER 1#define SECOND_GREATER -1#define KEYS_IDENTICAL 0#define KEY_FOUND 1#define KEY_NOT_FOUND 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -