2020-05-13 02:54:17 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
2005-11-02 06:58:39 +03:00
|
|
|
* Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc.
|
2013-04-24 12:58:55 +04:00
|
|
|
* Copyright (c) 2013 Red Hat, Inc.
|
2005-11-02 02:33:33 +03:00
|
|
|
* All Rights Reserved.
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
|
|
|
#ifndef __XFS_ATTR_LEAF_H__
|
|
|
|
#define __XFS_ATTR_LEAF_H__
|
|
|
|
|
|
|
|
struct attrlist;
|
2008-06-23 07:23:48 +04:00
|
|
|
struct xfs_attr_list_context;
|
2005-04-17 02:20:36 +04:00
|
|
|
struct xfs_da_args;
|
|
|
|
struct xfs_da_state;
|
|
|
|
struct xfs_da_state_blk;
|
|
|
|
struct xfs_inode;
|
|
|
|
struct xfs_trans;
|
|
|
|
|
2019-11-09 01:52:06 +03:00
|
|
|
/*
|
|
|
|
* Incore version of the attribute leaf header.
|
|
|
|
*/
|
|
|
|
struct xfs_attr3_icleaf_hdr {
|
|
|
|
uint32_t forw;
|
|
|
|
uint32_t back;
|
|
|
|
uint16_t magic;
|
|
|
|
uint16_t count;
|
|
|
|
uint16_t usedbytes;
|
|
|
|
/*
|
|
|
|
* Firstused is 32-bit here instead of 16-bit like the on-disk variant
|
|
|
|
* to support maximum fsb size of 64k without overflow issues throughout
|
|
|
|
* the attr code. Instead, the overflow condition is handled on
|
|
|
|
* conversion to/from disk.
|
|
|
|
*/
|
|
|
|
uint32_t firstused;
|
|
|
|
__u8 holes;
|
|
|
|
struct {
|
|
|
|
uint16_t base;
|
|
|
|
uint16_t size;
|
|
|
|
} freemap[XFS_ATTR_LEAF_MAPSIZE];
|
|
|
|
};
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/*========================================================================
|
|
|
|
* Function prototypes for the kernel.
|
|
|
|
*========================================================================*/
|
|
|
|
|
|
|
|
/*
|
2005-11-02 02:34:53 +03:00
|
|
|
* Internal routines when attribute fork size < XFS_LITINO(mp).
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
2005-11-02 02:34:53 +03:00
|
|
|
void xfs_attr_shortform_create(struct xfs_da_args *args);
|
|
|
|
void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
|
2005-04-17 02:20:36 +04:00
|
|
|
int xfs_attr_shortform_lookup(struct xfs_da_args *args);
|
|
|
|
int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
|
2017-12-08 06:07:02 +03:00
|
|
|
int xfs_attr_shortform_to_leaf(struct xfs_da_args *args,
|
|
|
|
struct xfs_buf **leaf_bp);
|
2021-05-29 01:15:05 +03:00
|
|
|
int xfs_attr_sf_removename(struct xfs_da_args *args);
|
2020-07-21 07:47:22 +03:00
|
|
|
int xfs_attr_sf_findname(struct xfs_da_args *args,
|
|
|
|
struct xfs_attr_sf_entry **sfep,
|
|
|
|
unsigned int *basep);
|
2012-06-22 12:50:14 +04:00
|
|
|
int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
|
2016-11-08 03:56:20 +03:00
|
|
|
int xfs_attr_shortform_bytesfit(struct xfs_inode *dp, int bytes);
|
2018-01-08 21:51:05 +03:00
|
|
|
xfs_failaddr_t xfs_attr_shortform_verify(struct xfs_inode *ip);
|
2015-05-29 00:40:08 +03:00
|
|
|
void xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/*
|
2005-11-02 02:34:53 +03:00
|
|
|
* Internal routines when attribute fork size == XFS_LBSIZE(mp).
|
2005-04-17 02:20:36 +04:00
|
|
|
*/
|
2013-04-24 12:58:55 +04:00
|
|
|
int xfs_attr3_leaf_to_node(struct xfs_da_args *args);
|
|
|
|
int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
|
2005-11-02 02:34:53 +03:00
|
|
|
struct xfs_da_args *args, int forkoff);
|
2013-04-24 12:58:55 +04:00
|
|
|
int xfs_attr3_leaf_clearflag(struct xfs_da_args *args);
|
|
|
|
int xfs_attr3_leaf_setflag(struct xfs_da_args *args);
|
|
|
|
int xfs_attr3_leaf_flipflags(struct xfs_da_args *args);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Routines used for growing the Btree.
|
|
|
|
*/
|
2013-04-24 12:58:55 +04:00
|
|
|
int xfs_attr3_leaf_split(struct xfs_da_state *state,
|
2005-04-17 02:20:36 +04:00
|
|
|
struct xfs_da_state_blk *oldblk,
|
|
|
|
struct xfs_da_state_blk *newblk);
|
2013-04-24 12:58:55 +04:00
|
|
|
int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf,
|
2005-04-17 02:20:36 +04:00
|
|
|
struct xfs_da_args *args);
|
2013-04-24 12:58:55 +04:00
|
|
|
int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
|
|
|
|
int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer,
|
2005-04-17 02:20:36 +04:00
|
|
|
struct xfs_da_args *args);
|
2013-04-24 12:58:55 +04:00
|
|
|
int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer,
|
2005-04-17 02:20:36 +04:00
|
|
|
struct xfs_da_args *args);
|
2019-10-29 02:12:33 +03:00
|
|
|
int xfs_attr3_leaf_list_int(struct xfs_buf *bp,
|
|
|
|
struct xfs_attr_list_context *context);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Routines used for shrinking the Btree.
|
|
|
|
*/
|
2013-04-24 12:58:55 +04:00
|
|
|
int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
|
|
|
|
void xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
|
2005-04-17 02:20:36 +04:00
|
|
|
struct xfs_da_state_blk *drop_blk,
|
|
|
|
struct xfs_da_state_blk *save_blk);
|
|
|
|
/*
|
|
|
|
* Utility routines.
|
|
|
|
*/
|
2012-06-22 12:50:14 +04:00
|
|
|
xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
|
|
|
|
int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
|
|
|
|
struct xfs_buf *leaf2_bp);
|
2014-06-06 09:21:27 +04:00
|
|
|
int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local);
|
2013-04-24 12:58:55 +04:00
|
|
|
int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
|
2019-11-20 20:46:02 +03:00
|
|
|
xfs_dablk_t bno, struct xfs_buf **bpp);
|
2015-04-13 04:26:02 +03:00
|
|
|
void xfs_attr3_leaf_hdr_from_disk(struct xfs_da_geometry *geo,
|
|
|
|
struct xfs_attr3_icleaf_hdr *to,
|
2013-04-24 12:58:55 +04:00
|
|
|
struct xfs_attr_leafblock *from);
|
2015-04-13 04:26:02 +03:00
|
|
|
void xfs_attr3_leaf_hdr_to_disk(struct xfs_da_geometry *geo,
|
|
|
|
struct xfs_attr_leafblock *to,
|
2013-08-12 14:49:31 +04:00
|
|
|
struct xfs_attr3_icleaf_hdr *from);
|
2012-11-14 10:54:40 +04:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif /* __XFS_ATTR_LEAF_H__ */
|