fs/xfs/libxfs/xfs_da_btree.h

Source file repositories/reference/linux-study-clean/fs/xfs/libxfs/xfs_da_btree.h

File Facts

System
Linux kernel
Corpus path
fs/xfs/libxfs/xfs_da_btree.h
Extension
.h
Size
9543 bytes
Lines
248
Domain
Core OS
Bucket
VFS And Filesystem Core
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct xfs_da_geometry {
	unsigned int	blksize;	/* da block size in bytes */
	unsigned int	fsbcount;	/* da block size in filesystem blocks */
	uint8_t		fsblog;		/* log2 of _filesystem_ block size */
	uint8_t		blklog;		/* log2 of da block size */
	unsigned int	node_hdr_size;	/* danode header size in bytes */
	unsigned int	node_ents;	/* # of entries in a danode */
	unsigned int	magicpct;	/* 37% of block size in bytes */
	xfs_dablk_t	datablk;	/* blockno of dir data v2 */
	unsigned int	leaf_hdr_size;	/* dir2 leaf header size */
	unsigned int	leaf_max_ents;	/* # of entries in dir2 leaf */
	xfs_dablk_t	leafblk;	/* blockno of leaf data v2 */
	unsigned int	free_hdr_size;	/* dir2 free header size */
	unsigned int	free_max_bests;	/* # of bests entries in dir2 free */
	xfs_dablk_t	freeblk;	/* blockno of free data v2 */
	xfs_extnum_t	max_extents;	/* Max. extents in corresponding fork */

	xfs_dir2_data_aoff_t data_first_offset;
	size_t		data_entry_offset;
};

/*========================================================================
 * Btree searching and modification structure definitions.
 *========================================================================*/

/*
 * Search comparison results
 */
enum xfs_dacmp {
	XFS_CMP_DIFFERENT,	/* names are completely different */
	XFS_CMP_EXACT,		/* names are exactly the same */
	XFS_CMP_CASE		/* names are same but differ in case */
};

/*
 * Structure to ease passing around component names.
 */
typedef struct xfs_da_args {
	struct xfs_da_geometry *geo;	/* da block geometry */
	const uint8_t	*name;		/* string (maybe not NULL terminated) */
	const uint8_t	*new_name;	/* new attr name */
	void		*value;		/* set of bytes (maybe contain NULLs) */
	void		*new_value;	/* new xattr value (may contain NULLs) */
	struct xfs_inode *dp;		/* directory inode to manipulate */
	struct xfs_trans *trans;	/* current trans (changes over time) */

	xfs_ino_t	inumber;	/* input/output inode number */
	xfs_ino_t	owner;		/* inode that owns the dir/attr data */

	int		valuelen;	/* length of value */
	int		new_valuelen;	/* length of new_value */
	uint8_t		filetype;	/* filetype of inode for directories */
	uint8_t		op_flags;	/* operation flags */
	uint8_t		attr_filter;	/* XFS_ATTR_{ROOT,SECURE,INCOMPLETE} */
	short		namelen;	/* length of string (maybe no NULL) */
	short		new_namelen;	/* length of new attr name */
	xfs_dahash_t	hashval;	/* hash value of name */
	xfs_extlen_t	total;		/* total blocks needed, for 1st bmap */
	int		whichfork;	/* data or attribute fork */
	xfs_dablk_t	blkno;		/* blkno of attr leaf of interest */
	int		index;		/* index of attr of interest in blk */
	xfs_dablk_t	rmtblkno;	/* remote attr value starting blkno */
	int		rmtblkcnt;	/* remote attr value block count */
	int		rmtvaluelen;	/* remote attr value length in bytes */
	xfs_dablk_t	blkno2;		/* blkno of 2nd attr leaf of interest */
	int		index2;		/* index of 2nd attr in blk */
	xfs_dablk_t	rmtblkno2;	/* remote attr value starting blkno */
	int		rmtblkcnt2;	/* remote attr value block count */
	int		rmtvaluelen2;	/* remote attr value length in bytes */
	enum xfs_dacmp	cmpresult;	/* name compare result for lookups */
} xfs_da_args_t;

/*
 * Operation flags:
 */
#define XFS_DA_OP_JUSTCHECK	(1u << 0) /* check for ok with no space */
#define XFS_DA_OP_REPLACE	(1u << 1) /* this is an atomic replace op */
#define XFS_DA_OP_ADDNAME	(1u << 2) /* this is an add operation */
#define XFS_DA_OP_OKNOENT	(1u << 3) /* lookup op, ENOENT ok, else die */
#define XFS_DA_OP_CILOOKUP	(1u << 4) /* lookup returns CI name if found */
#define XFS_DA_OP_RECOVERY	(1u << 5) /* Log recovery operation */
#define XFS_DA_OP_LOGGED	(1u << 6) /* Use intent items to track op */

#define XFS_DA_OP_FLAGS \
	{ XFS_DA_OP_JUSTCHECK,	"JUSTCHECK" }, \
	{ XFS_DA_OP_REPLACE,	"REPLACE" }, \
	{ XFS_DA_OP_ADDNAME,	"ADDNAME" }, \
	{ XFS_DA_OP_OKNOENT,	"OKNOENT" }, \
	{ XFS_DA_OP_CILOOKUP,	"CILOOKUP" }, \
	{ XFS_DA_OP_RECOVERY,	"RECOVERY" }, \

Annotation

Implementation Notes