aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandan Babu R <chandan.babu@oracle.com>2022-06-22 14:28:52 -0500
committerEric Sandeen <sandeen@sandeen.net>2022-06-22 14:28:52 -0500
commit3a2414fac16baa75088d05df6f2c2117e303d9ce (patch)
tree3aef14dd260f5c9347e9e649738a87c1126cbfaa
parent099e5eb39cea603c723b098ea8c824e7faf86af6 (diff)
downloadxfsprogs-dev-3a2414fac16baa75088d05df6f2c2117e303d9ce.tar.gz
xfs: Use xfs_extnum_t instead of basic data types
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>
-rw-r--r--db/block.c4
-rw-r--r--db/bmap.c18
-rw-r--r--db/bmap.h5
-rw-r--r--db/check.c10
-rw-r--r--db/dquot.c2
-rw-r--r--db/faddr.c16
-rw-r--r--db/frag.c2
-rw-r--r--libxfs/xfs_bmap.c2
-rw-r--r--libxfs/xfs_inode_buf.c2
-rw-r--r--libxfs/xfs_inode_fork.c2
-rw-r--r--repair/dinode.c30
-rw-r--r--repair/dinode.h4
-rw-r--r--repair/scan.c8
-rw-r--r--repair/scan.h6
14 files changed, 56 insertions, 55 deletions
diff --git a/db/block.c b/db/block.c
index f31f9544c1..788337d370 100644
--- a/db/block.c
+++ b/db/block.c
@@ -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;
diff --git a/db/bmap.c b/db/bmap.c
index 53ef937ffa..ef6fa2b06b 100644
--- 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);
diff --git a/db/bmap.h b/db/bmap.h
index 723d6462dc..24dda82913 100644
--- 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);
diff --git a/db/check.c b/db/check.c
index a9c6e632ea..d09e33a481 100644
--- a/db/check.c
+++ b/db/check.c
@@ -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;
diff --git a/db/dquot.c b/db/dquot.c
index 76853a725e..338d064995 100644
--- a/db/dquot.c
+++ b/db/dquot.c
@@ -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;
diff --git a/db/faddr.c b/db/faddr.c
index 0127c5d1f4..ec4aae68bb 100644
--- a/db/faddr.c
+++ b/db/faddr.c
@@ -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) {
diff --git a/db/frag.c b/db/frag.c
index 022da96a74..34fe11481c 100644
--- 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)
diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c
index 3891de8e86..8eacf0ae7c 100644
--- a/libxfs/xfs_bmap.c
+++ b/libxfs/xfs_bmap.c
@@ -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 */
diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c
index 12c117c902..15b03d2144 100644
--- a/libxfs/xfs_inode_buf.c
+++ b/libxfs/xfs_inode_buf.c
@@ -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)) {
diff --git a/libxfs/xfs_inode_fork.c b/libxfs/xfs_inode_fork.c
index 625d81733f..4d908a7a6b 100644
--- a/libxfs/xfs_inode_fork.c
+++ b/libxfs/xfs_inode_fork.c
@@ -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;
diff --git a/repair/dinode.c b/repair/dinode.c
index 7cb80af2dc..61d7d49f7e 100644
--- a/repair/dinode.c
+++ b/repair/dinode.c
@@ -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;
diff --git a/repair/dinode.h b/repair/dinode.h
index 4ed8b46f51..333d96d26a 100644
--- a/repair/dinode.h
+++ b/repair/dinode.h
@@ -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,
diff --git a/repair/scan.c b/repair/scan.c
index 5a4b8dbdff..97ae5ae843 100644
--- a/repair/scan.c
+++ b/repair/scan.c
@@ -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;
diff --git a/repair/scan.h b/repair/scan.h
index bf1ee83ec9..ee16362b6d 100644
--- a/repair/scan.h
+++ b/repair/scan.h
@@ -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,