Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc.
0004  * Copyright (c) 2013 Red Hat, Inc.
0005  * All Rights Reserved.
0006  */
0007 #ifndef __XFS_ATTR_LEAF_H__
0008 #define __XFS_ATTR_LEAF_H__
0009 
0010 struct attrlist;
0011 struct xfs_attr_list_context;
0012 struct xfs_da_args;
0013 struct xfs_da_state;
0014 struct xfs_da_state_blk;
0015 struct xfs_inode;
0016 struct xfs_trans;
0017 
0018 /*
0019  * Incore version of the attribute leaf header.
0020  */
0021 struct xfs_attr3_icleaf_hdr {
0022     uint32_t    forw;
0023     uint32_t    back;
0024     uint16_t    magic;
0025     uint16_t    count;
0026     uint16_t    usedbytes;
0027     /*
0028      * Firstused is 32-bit here instead of 16-bit like the on-disk variant
0029      * to support maximum fsb size of 64k without overflow issues throughout
0030      * the attr code. Instead, the overflow condition is handled on
0031      * conversion to/from disk.
0032      */
0033     uint32_t    firstused;
0034     __u8        holes;
0035     struct {
0036         uint16_t    base;
0037         uint16_t    size;
0038     } freemap[XFS_ATTR_LEAF_MAPSIZE];
0039 };
0040 
0041 /*========================================================================
0042  * Function prototypes for the kernel.
0043  *========================================================================*/
0044 
0045 /*
0046  * Internal routines when attribute fork size < XFS_LITINO(mp).
0047  */
0048 void    xfs_attr_shortform_create(struct xfs_da_args *args);
0049 void    xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
0050 int xfs_attr_shortform_lookup(struct xfs_da_args *args);
0051 int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
0052 int xfs_attr_shortform_to_leaf(struct xfs_da_args *args);
0053 int xfs_attr_sf_removename(struct xfs_da_args *args);
0054 int xfs_attr_sf_findname(struct xfs_da_args *args,
0055                  struct xfs_attr_sf_entry **sfep,
0056                  unsigned int *basep);
0057 int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
0058 int xfs_attr_shortform_bytesfit(struct xfs_inode *dp, int bytes);
0059 xfs_failaddr_t xfs_attr_shortform_verify(struct xfs_inode *ip);
0060 void    xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp);
0061 
0062 /*
0063  * Internal routines when attribute fork size == XFS_LBSIZE(mp).
0064  */
0065 int xfs_attr3_leaf_to_node(struct xfs_da_args *args);
0066 int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
0067                    struct xfs_da_args *args, int forkoff);
0068 int xfs_attr3_leaf_clearflag(struct xfs_da_args *args);
0069 int xfs_attr3_leaf_setflag(struct xfs_da_args *args);
0070 int xfs_attr3_leaf_flipflags(struct xfs_da_args *args);
0071 
0072 /*
0073  * Routines used for growing the Btree.
0074  */
0075 int xfs_attr3_leaf_split(struct xfs_da_state *state,
0076                    struct xfs_da_state_blk *oldblk,
0077                    struct xfs_da_state_blk *newblk);
0078 int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf,
0079                     struct xfs_da_args *args);
0080 int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
0081 int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer,
0082                  struct xfs_da_args *args);
0083 int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer,
0084                     struct xfs_da_args *args);
0085 int xfs_attr3_leaf_list_int(struct xfs_buf *bp,
0086                 struct xfs_attr_list_context *context);
0087 
0088 /*
0089  * Routines used for shrinking the Btree.
0090  */
0091 int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
0092 void    xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
0093                        struct xfs_da_state_blk *drop_blk,
0094                        struct xfs_da_state_blk *save_blk);
0095 /*
0096  * Utility routines.
0097  */
0098 xfs_dahash_t    xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
0099 int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
0100                    struct xfs_buf *leaf2_bp);
0101 int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local);
0102 int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
0103             xfs_dablk_t bno, struct xfs_buf **bpp);
0104 void    xfs_attr3_leaf_hdr_from_disk(struct xfs_da_geometry *geo,
0105                      struct xfs_attr3_icleaf_hdr *to,
0106                      struct xfs_attr_leafblock *from);
0107 void    xfs_attr3_leaf_hdr_to_disk(struct xfs_da_geometry *geo,
0108                    struct xfs_attr_leafblock *to,
0109                    struct xfs_attr3_icleaf_hdr *from);
0110 
0111 #endif  /* __XFS_ATTR_LEAF_H__ */