#define xfs_trans_roll libxfs_trans_roll
#define xfs_verify_cksum libxfs_verify_cksum
+#define xfs_verify_dir_ino libxfs_verify_dir_ino
#define xfs_verify_ino libxfs_verify_ino
#define xfs_verify_rtbno libxfs_verify_rtbno
#define xfs_zero_extent libxfs_zero_extent
* inode chunk. returns number of new inodes if things are good
* and 0 if bad. start is the start of the discovered inode chunk.
* routine assumes that ino is a legal inode number
- * (verified by verify_inum()). If the inode chunk turns out
+ * (verified by libxfs_verify_ino()). If the inode chunk turns out
* to be good, this routine will put the inode chunk into
* the good inode chunk tree if required.
*
return 1;
}
-/*
- * returns 0 if inode number is valid, 1 if bogus
- */
-int
-verify_inum(xfs_mount_t *mp,
- xfs_ino_t ino)
-{
- xfs_agnumber_t agno;
- xfs_agino_t agino;
- xfs_agblock_t agbno;
- xfs_sb_t *sbp = &mp->m_sb;;
-
- /* range check ag #, ag block. range-checking offset is pointless */
-
- agno = XFS_INO_TO_AGNO(mp, ino);
- agino = XFS_INO_TO_AGINO(mp, ino);
- agbno = XFS_AGINO_TO_AGBNO(mp, agino);
- if (agbno == 0)
- return 1;
-
- if (ino == 0 || ino == NULLFSINO)
- return(1);
-
- if (ino != XFS_AGINO_TO_INO(mp, agno, agino))
- return(1);
-
- return verify_ag_bno(sbp, agno, agbno);
-}
-
/*
* have a separate routine to ensure that we don't accidentally
* lose illegally set bits in the agino by turning it into an FSINO
xfs_agnumber_t agno,
xfs_agino_t ino);
-int
-verify_inum(xfs_mount_t *mp,
- xfs_ino_t ino);
-
int
verify_aginum(xfs_mount_t *mp,
xfs_agnumber_t agno,
if (lino == ino) {
junkit = 1;
junkreason = _("current");
- } else if (verify_inum(mp, lino)) {
+ } else if (!libxfs_verify_dir_ino(mp, lino)) {
junkit = 1;
junkreason = _("invalid");
} else if (lino == mp->m_sb.sb_rbmino) {
* If the validation fails for the root inode we fix it in
* the next else case.
*/
- if (verify_inum(mp, *parent) && ino != mp->m_sb.sb_rootino) {
-
+ if (!libxfs_verify_dir_ino(mp, *parent) && ino != mp->m_sb.sb_rootino) {
do_warn(
_("bogus .. inode number (%" PRIu64 ") in directory inode %" PRIu64 ", "),
*parent, ino);
* (or did it ourselves) during phase 3.
*/
clearino = 0;
- } else if (verify_inum(mp, ent_ino)) {
+ } else if (!libxfs_verify_dir_ino(mp, ent_ino)) {
/*
* Bad inode number. Clear the inode number and the
* entry will get removed later. We don't trash the
ino_tree_node_t *irec;
if (mp->m_sb.sb_uquotino != NULLFSINO && mp->m_sb.sb_uquotino != 0) {
- if (verify_inum(mp, mp->m_sb.sb_uquotino))
+ if (!libxfs_verify_ino(mp, mp->m_sb.sb_uquotino))
irec = NULL;
else
irec = find_inode_rec(mp,
}
if (mp->m_sb.sb_gquotino != NULLFSINO && mp->m_sb.sb_gquotino != 0) {
- if (verify_inum(mp, mp->m_sb.sb_gquotino))
+ if (!libxfs_verify_ino(mp, mp->m_sb.sb_gquotino))
irec = NULL;
else
irec = find_inode_rec(mp,
}
if (mp->m_sb.sb_pquotino != NULLFSINO && mp->m_sb.sb_pquotino != 0) {
- if (verify_inum(mp, mp->m_sb.sb_pquotino))
+ if (!libxfs_verify_ino(mp, mp->m_sb.sb_pquotino))
irec = NULL;
else
irec = find_inode_rec(mp,
(mp->m_sb.sb_pquotino == NULLFSINO || mp->m_sb.sb_pquotino == 0)) {
lost_quotas = 1;
fs_quotas = 0;
- } else if (!verify_inum(mp, mp->m_sb.sb_uquotino) &&
- !verify_inum(mp, mp->m_sb.sb_gquotino) &&
- !verify_inum(mp, mp->m_sb.sb_pquotino)) {
+ } else if (libxfs_verify_ino(mp, mp->m_sb.sb_uquotino) &&
+ libxfs_verify_ino(mp, mp->m_sb.sb_gquotino) &&
+ libxfs_verify_ino(mp, mp->m_sb.sb_pquotino)) {
fs_quotas = 1;
}
}
}
continue;
}
- ASSERT(no_modify || !verify_inum(mp, inum));
+ ASSERT(no_modify || libxfs_verify_dir_ino(mp, inum));
/*
* special case the . entry. we know there's only one
* '.' and only '.' points to itself because bogus entries
/*
* skip entries with bogus inumbers if we're in no modify mode
*/
- if (no_modify && verify_inum(mp, inum))
+ if (no_modify && !libxfs_verify_dir_ino(mp, inum))
continue;
/* validate ftype field if supported */
fname[sfep->namelen] = '\0';
ASSERT(no_modify || (lino != NULLFSINO && lino != 0));
- ASSERT(no_modify || !verify_inum(mp, lino));
+ ASSERT(no_modify || libxfs_verify_dir_ino(mp, lino));
/*
* Also skip entries with bogus inode numbers if we're
* in no modify mode.
*/
- if (no_modify && verify_inum(mp, lino)) {
+ if (no_modify && !libxfs_verify_dir_ino(mp, lino)) {
next_sfep = libxfs_dir2_sf_nextentry(mp, sfp, sfep);
continue;
}