]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: Use xfs_extnum_t instead of basic data types
authorChandan Babu R <chandan.babu@oracle.com>
Wed, 22 Jun 2022 19:28:52 +0000 (14:28 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 22 Jun 2022 19:28:52 +0000 (14:28 -0500)
Source kernel commit: bb1d50494cbdd9c5991ddc7feeeb14982872b2a8

xfs_extnum_t is the type to use to declare variables which have values
obtained from xfs_dinode->di_[a]nextents. This commit replaces basic
types (e.g. uint32_t) with xfs_extnum_t for such variables.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
14 files changed:
db/block.c
db/bmap.c
db/bmap.h
db/check.c
db/dquot.c
db/faddr.c
db/frag.c
libxfs/xfs_bmap.c
libxfs/xfs_inode_buf.c
libxfs/xfs_inode_fork.c
repair/dinode.c
repair/dinode.h
repair/scan.c
repair/scan.h

index f31f9544c17840bfad9ea1132d199e6a70a78fc0..788337d37092460ab7f133046d7a874b3feb7291 100644 (file)
@@ -62,7 +62,7 @@ ablock_f(
        xfs_fileoff_t           bno;
        xfs_fsblock_t           dfsbno;
        int                     haveattr;
-       int                     nex;
+       xfs_extnum_t            nex;
        char                    *p;
        struct xfs_dinode       *dip = iocur_top->data;
 
@@ -162,7 +162,7 @@ dblock_f(
        xfs_fileoff_t   bno;
        xfs_fsblock_t   dfsbno;
        int             nb;
-       int             nex;
+       xfs_extnum_t    nex;
        char            *p;
        typnm_t         type;
 
index 53ef937ffa1df11b731966b9ca518689a9d9c304..ef6fa2b06bbb0d1c05da62ed776e424516573393 100644 (file)
--- a/db/bmap.c
+++ b/db/bmap.c
@@ -19,7 +19,7 @@
 static int             bmap_f(int argc, char **argv);
 static int             bmap_one_extent(xfs_bmbt_rec_t *ep,
                                        xfs_fileoff_t *offp, xfs_fileoff_t eoff,
-                                       int *idxp, bmap_ext_t *bep);
+                                       xfs_extnum_t *idxp, bmap_ext_t *bep);
 static xfs_fsblock_t   select_child(xfs_fileoff_t off, xfs_bmbt_key_t *kp,
                                     xfs_bmbt_ptr_t *pp, int nrecs);
 
@@ -32,7 +32,7 @@ bmap(
        xfs_fileoff_t           offset,
        xfs_filblks_t           len,
        int                     whichfork,
-       int                     *nexp,
+       xfs_extnum_t            *nexp,
        bmap_ext_t              *bep)
 {
        struct xfs_btree_block  *block;
@@ -44,10 +44,10 @@ bmap(
        enum xfs_dinode_fmt     fmt;
        int                     fsize;
        xfs_bmbt_key_t          *kp;
-       int                     n;
+       xfs_extnum_t            n;
        int                     nex;
        xfs_fsblock_t           nextbno;
-       int                     nextents;
+       xfs_extnum_t            nextents;
        xfs_bmbt_ptr_t          *pp;
        xfs_bmdr_block_t        *rblock;
        typnm_t                 typ;
@@ -132,7 +132,7 @@ bmap_f(
        struct xfs_dinode       *dip;
        xfs_fileoff_t           eo;
        xfs_filblks_t           len;
-       int                     nex;
+       xfs_extnum_t            nex;
        char                    *p;
        int                     whichfork;
 
@@ -223,13 +223,13 @@ bmap_one_extent(
        xfs_bmbt_rec_t          *ep,
        xfs_fileoff_t           *offp,
        xfs_fileoff_t           eoff,
-       int                     *idxp,
+       xfs_extnum_t            *idxp,
        bmap_ext_t              *bep)
 {
        xfs_filblks_t           c;
        xfs_fileoff_t           curoffset;
        int                     f;
-       int                     idx;
+       xfs_extnum_t            idx;
        xfs_fileoff_t           o;
        xfs_fsblock_t           s;
 
@@ -276,10 +276,10 @@ convert_extent(
 void
 make_bbmap(
        bbmap_t         *bbmap,
-       int             nex,
+       xfs_extnum_t    nex,
        bmap_ext_t      *bmp)
 {
-       int             i;
+       xfs_extnum_t    i;
 
        for (i = 0; i < nex; i++) {
                bbmap->b[i].bm_bn = XFS_FSB_TO_DADDR(mp, bmp[i].startblock);
index 723d6462dc0a7de6311d179cf89602e7099089de..24dda82913913fa21f5fe7fc88da3592e5bf2fdd 100644 (file)
--- a/db/bmap.h
+++ b/db/bmap.h
@@ -15,8 +15,9 @@ typedef struct bmap_ext {
 } bmap_ext_t;
 
 extern void    bmap(xfs_fileoff_t offset, xfs_filblks_t len, int whichfork,
-                    int *nexp, bmap_ext_t *bep);
+                    xfs_extnum_t *nexp, bmap_ext_t *bep);
 extern void    bmap_init(void);
 extern void    convert_extent(struct xfs_bmbt_rec *rp, xfs_fileoff_t *op,
                               xfs_fsblock_t *sp, xfs_filblks_t *cp, int *fp);
-extern void    make_bbmap(struct bbmap *bbmap, int nex, bmap_ext_t *bmp);
+extern void    make_bbmap(struct bbmap *bbmap, xfs_extnum_t nex,
+                          bmap_ext_t *bmp);
index a9c6e632eaa60ecd25a96b883c4d8f2f14d37baf..d09e33a48172e212aa5534413bf9f84bc2a5e993 100644 (file)
@@ -272,9 +272,9 @@ static int          ncheck_f(int argc, char **argv);
 static char            *prepend_path(char *oldpath, char *parent);
 static xfs_ino_t       process_block_dir_v2(blkmap_t *blkmap, int *dot,
                                             int *dotdot, inodata_t *id);
-static void            process_bmbt_reclist(xfs_bmbt_rec_t *rp, int numrecs,
-                                            dbm_t type, inodata_t *id,
-                                            xfs_rfsblock_t *tot,
+static void            process_bmbt_reclist(xfs_bmbt_rec_t *rp,
+                                            xfs_extnum_t numrecs, dbm_t type,
+                                            inodata_t *id, xfs_rfsblock_t *tot,
                                             blkmap_t **blkmapp);
 static void            process_btinode(inodata_t *id, struct xfs_dinode *dip,
                                        dbm_t type, xfs_rfsblock_t *totd,
@@ -2176,7 +2176,7 @@ process_block_dir_v2(
 static void
 process_bmbt_reclist(
        xfs_bmbt_rec_t          *rp,
-       int                     numrecs,
+       xfs_extnum_t            numrecs,
        dbm_t                   type,
        inodata_t               *id,
        xfs_rfsblock_t          *tot,
@@ -2188,7 +2188,7 @@ process_bmbt_reclist(
        xfs_filblks_t           c;
        xfs_filblks_t           cp;
        int                     f;
-       int                     i;
+       xfs_extnum_t            i;
        xfs_agblock_t           iagbno;
        xfs_agnumber_t          iagno;
        xfs_fileoff_t           o;
index 76853a725e9d7329627158c6d0866b00a13ecc5b..338d064995155ed598dc187def559d3b8b3faf42 100644 (file)
@@ -92,7 +92,7 @@ dquot_f(
        int             doprj;
        xfs_dqid_t      id;
        xfs_ino_t       ino;
-       int             nex;
+       xfs_extnum_t    nex;
        char            *p;
        int             perblock;
        xfs_fileoff_t   qbno;
index 0127c5d1f4a3d5f9ccb804c4f6b38cae0f371ab9..ec4aae68bb5a8172cc69f9f9186d3f50b454a49f 100644 (file)
@@ -69,7 +69,7 @@ fa_attrblock(
        bmap_ext_t      bm;
        uint32_t        bno;
        xfs_fsblock_t   dfsbno;
-       int             nex;
+       xfs_extnum_t    nex;
 
        bno = (uint32_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
        if (bno == 0) {
@@ -97,7 +97,7 @@ fa_cfileoffa(
        bmap_ext_t      bm;
        xfs_fileoff_t   bno;
        xfs_fsblock_t   dfsbno;
-       int             nex;
+       xfs_extnum_t    nex;
 
        bno = (xfs_fileoff_t)getbitval(obj, bit, BMBT_STARTOFF_BITLEN,
                BVUNSIGNED);
@@ -127,8 +127,8 @@ fa_cfileoffd(
        bmap_ext_t      *bmp;
        xfs_fileoff_t   bno;
        xfs_fsblock_t   dfsbno;
-       int             nb;
-       int             nex;
+       xfs_extnum_t    nb;
+       xfs_extnum_t    nex;
 
        bno = (xfs_fileoff_t)getbitval(obj, bit, BMBT_STARTOFF_BITLEN,
                BVUNSIGNED);
@@ -183,7 +183,7 @@ fa_dfiloffa(
        bmap_ext_t      bm;
        xfs_fileoff_t   bno;
        xfs_fsblock_t   dfsbno;
-       int             nex;
+       xfs_extnum_t    nex;
 
        bno = (xfs_fileoff_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
        if (bno == NULLFILEOFF) {
@@ -212,8 +212,8 @@ fa_dfiloffd(
        bmap_ext_t      *bmp;
        xfs_fileoff_t   bno;
        xfs_fsblock_t   dfsbno;
-       int             nb;
-       int             nex;
+       xfs_extnum_t    nb;
+       xfs_extnum_t    nex;
 
        bno = (xfs_fileoff_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
        if (bno == NULLFILEOFF) {
@@ -266,7 +266,7 @@ fa_dirblock(
        bmap_ext_t      *bmp;
        uint32_t        bno;
        xfs_fsblock_t   dfsbno;
-       int             nex;
+       xfs_extnum_t    nex;
 
        bno = (uint32_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
        if (bno == 0) {
index 022da96a74b93b633a2dc48c4ff7315d717459ae..34fe11481c7d4f03d03f37b4ad20e3dfc6821f73 100644 (file)
--- a/db/frag.c
+++ b/db/frag.c
@@ -273,7 +273,7 @@ process_fork(
        int                     whichfork)
 {
        extmap_t                *extmap;
-       int                     nex;
+       xfs_extnum_t            nex;
 
        nex = XFS_DFORK_NEXTENTS(dip, whichfork);
        if (!nex)
index 3891de8e86a27822d7452ae304f9fd9487017f8d..8eacf0ae7c6c7f280279434b7d8b4d03897afb0c 100644 (file)
@@ -47,7 +47,7 @@ xfs_bmap_compute_maxlevels(
 {
        int             level;          /* btree level */
        uint            maxblocks;      /* max blocks at this level */
-       uint            maxleafents;    /* max leaf entries possible */
+       xfs_extnum_t    maxleafents;    /* max leaf entries possible */
        int             maxrootrecs;    /* max records in root block */
        int             minleafrecs;    /* min records in leaf block */
        int             minnoderecs;    /* min records in node block */
index 12c117c902cc74c0f7be90c7a6469aff1fa1221a..15b03d2144b66351e16c8c5909cfdfb7eca1ba84 100644 (file)
@@ -333,7 +333,7 @@ xfs_dinode_verify_fork(
        struct xfs_mount        *mp,
        int                     whichfork)
 {
-       uint32_t                di_nextents = XFS_DFORK_NEXTENTS(dip, whichfork);
+       xfs_extnum_t            di_nextents = XFS_DFORK_NEXTENTS(dip, whichfork);
        xfs_extnum_t            max_extents;
 
        switch (XFS_DFORK_FORMAT(dip, whichfork)) {
index 625d81733f30bcd93fca1a1b50a5fa6b1dbd1d7e..4d908a7a6b254eaf8cb1057b5f8014a54beeaafe 100644 (file)
@@ -103,7 +103,7 @@ xfs_iformat_extents(
        struct xfs_mount        *mp = ip->i_mount;
        struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
        int                     state = xfs_bmap_fork_to_state(whichfork);
-       int                     nex = XFS_DFORK_NEXTENTS(dip, whichfork);
+       xfs_extnum_t            nex = XFS_DFORK_NEXTENTS(dip, whichfork);
        int                     size = nex * sizeof(xfs_bmbt_rec_t);
        struct xfs_iext_cursor  icur;
        struct xfs_bmbt_rec     *dp;
index 7cb80af2dc3ce895b75de87bc821d4ec6f4fe1d0..61d7d49f7eb53263315ba090413dfc52db474ee8 100644 (file)
@@ -348,7 +348,7 @@ static int
 process_bmbt_reclist_int(
        xfs_mount_t             *mp,
        xfs_bmbt_rec_t          *rp,
-       int                     *numrecs,
+       xfs_extnum_t            *numrecs,
        int                     type,
        xfs_ino_t               ino,
        xfs_rfsblock_t          *tot,
@@ -365,7 +365,7 @@ process_bmbt_reclist_int(
        xfs_fsblock_t           b;
        char                    *ftype;
        char                    *forkname = get_forkname(whichfork);
-       int                     i;
+       xfs_extnum_t            i;
        int                     state;
        xfs_agnumber_t          agno;
        xfs_agblock_t           agbno;
@@ -651,7 +651,7 @@ int
 process_bmbt_reclist(
        xfs_mount_t             *mp,
        xfs_bmbt_rec_t          *rp,
-       int                     *numrecs,
+       xfs_extnum_t            *numrecs,
        int                     type,
        xfs_ino_t               ino,
        xfs_rfsblock_t          *tot,
@@ -672,7 +672,7 @@ int
 scan_bmbt_reclist(
        xfs_mount_t             *mp,
        xfs_bmbt_rec_t          *rp,
-       int                     *numrecs,
+       xfs_extnum_t            *numrecs,
        int                     type,
        xfs_ino_t               ino,
        xfs_rfsblock_t          *tot,
@@ -754,7 +754,7 @@ process_btinode(
        int                     type,
        int                     *dirty,
        xfs_rfsblock_t          *tot,
-       uint64_t                *nex,
+       xfs_extnum_t            *nex,
        blkmap_t                **blkmapp,
        int                     whichfork,
        int                     check_dups)
@@ -895,7 +895,7 @@ _("bad key in bmbt root (is %" PRIu64 ", would reset to %" PRIu64 ") in inode "
                        sizeof(xfs_bmbt_rec_t)) {
                do_warn(
        _("extent count for ino %" PRIu64 " %s fork too low (%" PRIu64 ") for file format\n"),
-                               lino, forkname, *nex);
+                               lino, forkname, (uint64_t)*nex);
                return(1);
        }
        /*
@@ -929,7 +929,7 @@ process_exinode(
        int                     type,
        int                     *dirty,
        xfs_rfsblock_t          *tot,
-       uint64_t                *nex,
+       xfs_extnum_t            *nex,
        blkmap_t                **blkmapp,
        int                     whichfork,
        int                     check_dups)
@@ -938,7 +938,7 @@ process_exinode(
        xfs_bmbt_rec_t          *rp;
        xfs_fileoff_t           first_key;
        xfs_fileoff_t           last_key;
-       int32_t                 numrecs;
+       xfs_extnum_t            numrecs;
        int                     ret;
 
        lino = XFS_AGINO_TO_INO(mp, agno, ino);
@@ -1024,8 +1024,8 @@ process_symlink_extlist(
        xfs_fileoff_t           expected_offset;
        xfs_bmbt_rec_t          *rp;
        xfs_bmbt_irec_t         irec;
-       int                     numrecs;
-       int                     i;
+       xfs_extnum_t            numrecs;
+       xfs_extnum_t            i;
        int                     max_blocks;
 
        if (be64_to_cpu(dino->di_size) <= XFS_DFORK_DSIZE(dino, mp)) {
@@ -1876,13 +1876,13 @@ process_inode_data_fork(
        int                     type,
        int                     *dirty,
        xfs_rfsblock_t          *totblocks,
-       uint64_t                *nextents,
+       xfs_extnum_t            *nextents,
        blkmap_t                **dblkmap,
        int                     check_dups)
 {
        xfs_ino_t               lino = XFS_AGINO_TO_INO(mp, agno, ino);
        int                     err = 0;
-       int                     nex;
+       xfs_extnum_t            nex;
 
        /*
         * extent count on disk is only valid for positive values. The kernel
@@ -1985,7 +1985,7 @@ process_inode_attr_fork(
        int                     type,
        int                     *dirty,
        xfs_rfsblock_t          *atotblocks,
-       uint64_t                *anextents,
+       xfs_extnum_t            *anextents,
        int                     check_dups,
        int                     extra_attr_check,
        int                     *retval)
@@ -2270,8 +2270,8 @@ process_dinode_int(xfs_mount_t *mp,
        int                     di_mode;
        int                     type;
        int                     retval = 0;
-       uint64_t                nextents;
-       uint64_t                anextents;
+       xfs_extnum_t            nextents;
+       xfs_extnum_t            anextents;
        xfs_ino_t               lino;
        const int               is_free = 0;
        const int               is_used = 1;
index 4ed8b46f516636dad8bb9282f01310a2c2f3c0cf..333d96d26a2f3e76b12bd75ae520a6d982b4cf20 100644 (file)
@@ -20,7 +20,7 @@ convert_extent(
 int
 process_bmbt_reclist(xfs_mount_t       *mp,
                xfs_bmbt_rec_t          *rp,
-               int                     *numrecs,
+               xfs_extnum_t            *numrecs,
                int                     type,
                xfs_ino_t               ino,
                xfs_rfsblock_t          *tot,
@@ -33,7 +33,7 @@ int
 scan_bmbt_reclist(
        xfs_mount_t             *mp,
        xfs_bmbt_rec_t          *rp,
-       int                     *numrecs,
+       xfs_extnum_t            *numrecs,
        int                     type,
        xfs_ino_t               ino,
        xfs_rfsblock_t          *tot,
index 5a4b8dbdff1c7dd1786080c304e5e68a1650a50f..97ae5ae843833249343ca778548d04be22346414 100644 (file)
@@ -133,7 +133,7 @@ scan_lbtree(
                                xfs_fsblock_t           bno,
                                xfs_ino_t               ino,
                                xfs_rfsblock_t          *tot,
-                               uint64_t                *nex,
+                               xfs_extnum_t            *nex,
                                blkmap_t                **blkmapp,
                                bmap_cursor_t           *bm_cursor,
                                int                     isroot,
@@ -144,7 +144,7 @@ scan_lbtree(
        int             whichfork,
        xfs_ino_t       ino,
        xfs_rfsblock_t  *tot,
-       uint64_t        *nex,
+       xfs_extnum_t    *nex,
        blkmap_t        **blkmapp,
        bmap_cursor_t   *bm_cursor,
        int             isroot,
@@ -204,7 +204,7 @@ scan_bmapbt(
        xfs_fsblock_t           bno,
        xfs_ino_t               ino,
        xfs_rfsblock_t          *tot,
-       uint64_t                *nex,
+       xfs_extnum_t            *nex,
        blkmap_t                **blkmapp,
        bmap_cursor_t           *bm_cursor,
        int                     isroot,
@@ -220,7 +220,7 @@ scan_bmapbt(
        xfs_fileoff_t           first_key;
        xfs_fileoff_t           last_key;
        char                    *forkname = get_forkname(whichfork);
-       int                     numrecs;
+       xfs_extnum_t            numrecs;
        xfs_agnumber_t          agno;
        xfs_agblock_t           agbno;
        int                     state;
index bf1ee83ec9f1d4a3c5e48496f1f03ef808fd0e0a..ee16362b6d3c693277ec7777af29bdd052d3093b 100644 (file)
@@ -20,7 +20,7 @@ int scan_lbtree(
                                xfs_fsblock_t           bno,
                                xfs_ino_t               ino,
                                xfs_rfsblock_t          *tot,
-                               uint64_t                *nex,
+                               xfs_extnum_t            *nex,
                                struct blkmap           **blkmapp,
                                bmap_cursor_t           *bm_cursor,
                                int                     isroot,
@@ -31,7 +31,7 @@ int scan_lbtree(
        int             whichfork,
        xfs_ino_t       ino,
        xfs_rfsblock_t  *tot,
-       uint64_t        *nex,
+       xfs_extnum_t    *nex,
        struct blkmap   **blkmapp,
        bmap_cursor_t   *bm_cursor,
        int             isroot,
@@ -47,7 +47,7 @@ int scan_bmapbt(
        xfs_fsblock_t           bno,
        xfs_ino_t               ino,
        xfs_rfsblock_t          *tot,
-       uint64_t                *nex,
+       xfs_extnum_t            *nex,
        struct blkmap           **blkmapp,
        bmap_cursor_t           *bm_cursor,
        int                     isroot,