/*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
- *
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
+ *
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
+ *
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
- *
+ *
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
+ *
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
* Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
if ((i = libxfs_trans_reserve(tp, 10, 0, 0, 0, 0)))
res_failed(i);
- error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, &ip);
+ error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, 0, &ip);
if (error) {
do_error(
_("couldn't iget realtime bitmap inode -- error - %d\n"),
bzero(&ip->i_d, sizeof(xfs_dinode_core_t));
ip->i_d.di_magic = XFS_DINODE_MAGIC;
- ip->i_d.di_mode = IFREG;
+ ip->i_d.di_mode = S_IFREG;
ip->i_d.di_version = XFS_DINODE_VERSION_1;
ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS;
ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
if ((error = libxfs_trans_reserve(tp, 10, 0, 0, 0, 0)))
res_failed(error);
- error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, &ip);
+ error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, 0, &ip);
if (error) {
do_error(
_("couldn't iget realtime bitmap inode -- error - %d\n"),
error = libxfs_trans_read_buf(
mp, tp, mp->m_dev,
- XFS_FSB_TO_DADDR(mp, map.br_startblock),
+ XFS_FSB_TO_DADDR(mp, map.br_startblock),
XFS_FSB_TO_BB(mp, 1), 1, &bp);
if (error) {
if ((error = libxfs_trans_reserve(tp, 10, 0, 0, 0, 0)))
res_failed(error);
- error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, &ip);
+ error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, 0, &ip);
if (error) {
do_error(
_("couldn't iget realtime summary inode -- error - %d\n"),
error = libxfs_trans_read_buf(
mp, tp, mp->m_dev,
- XFS_FSB_TO_DADDR(mp, map.br_startblock),
+ XFS_FSB_TO_DADDR(mp, map.br_startblock),
XFS_FSB_TO_BB(mp, 1), 1, &bp);
if (error) {
XFS_TRANS_PERM_LOG_RES, XFS_MKDIR_LOG_COUNT)))
res_failed(i);
- error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, &ip);
+ error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, 0, &ip);
if (error) {
do_error(
_("couldn't iget realtime summary inode -- error - %d\n"),
bzero(&ip->i_d, sizeof(xfs_dinode_core_t));
ip->i_d.di_magic = XFS_DINODE_MAGIC;
- ip->i_d.di_mode = IFREG;
+ ip->i_d.di_mode = S_IFREG;
ip->i_d.di_version = XFS_DINODE_VERSION_1;
ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS;
ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
libxfs_device_zero(mp->m_dev,
XFS_FSB_TO_DADDR(mp, ep->br_startblock),
XFS_FSB_TO_BB(mp, ep->br_blockcount));
- do_error(_("dev_zero of rtbitmap failed\n"));
bno += ep->br_blockcount;
}
}
XFS_TRANS_PERM_LOG_RES, XFS_MKDIR_LOG_COUNT)))
res_failed(i);
- error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rootino, 0, &ip);
+ error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rootino, 0, 0, &ip);
if (error) {
do_error(_("could not iget root inode -- error - %d\n"), error);
}
bzero(&ip->i_d, sizeof(xfs_dinode_core_t));
ip->i_d.di_magic = XFS_DINODE_MAGIC;
- ip->i_d.di_mode = (__uint16_t) mode|IFDIR;
+ ip->i_d.di_mode = (__uint16_t) mode|S_IFDIR;
ip->i_d.di_version = XFS_DINODE_VERSION_1;
ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS;
ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
do_error(_("%d - couldn't iget root inode to make %s\n"),
i, ORPHANAGE);
- error = libxfs_inode_alloc(&tp, pip, mode|IFDIR,
- 1, mp->m_dev, &zerocr, &ip);
+ error = libxfs_inode_alloc(&tp, pip, mode|S_IFDIR,
+ 1, 0, &zerocr, &ip);
if (error) {
do_error(_("%s inode allocation failed %d\n"),
} else
orphanage_entered = 1;
- /*
+ /*
* bump up the link count in the root directory to account
* for .. in the new directory
*/
* walk down left side of btree, release buffers as you
* go. if the root block is a leaf (single-level btree),
* just return it.
- *
+ *
*/
bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, fsbno),
junkit = 0;
- XFS_DIR_SF_GET_DIRINO_ARCH(&namest->inumber, &lino, ARCH_CONVERT);
+ XFS_DIR_SF_GET_DIRINO(&namest->inumber, &lino);
bcopy(namest->name, fname, entry->namelen);
fname[entry->namelen] = '\0';
*/
irec = find_inode_rec(XFS_INO_TO_AGNO(mp, lino),
XFS_INO_TO_AGINO(mp, lino));
-
+
if (irec == NULL) {
nbad++;
do_warn(
junkit = 0;
freetab = *freetabp;
if (isblock) {
- btp = XFS_DIR2_BLOCK_TAIL_P(mp, d);
- blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT);
+ btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)d);
+ blp = XFS_DIR2_BLOCK_LEAF_P(btp);
endptr = (char *)blp;
if (endptr > (char *)btp)
endptr = (char *)btp;
break;
/* check for invalid tag */
- if (INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(
- dup, ARCH_CONVERT), ARCH_CONVERT) !=
- (char *)dup - (char *)d)
+ if (INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup),
+ ARCH_CONVERT) != (char *)dup - (char *)d)
break;
/* check for block with no data entries */
}
leaf = bp->data;
ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
- bestsp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT);
+ bestsp = XFS_DIR2_LEAF_BESTS_P(ltp);
if (INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) !=
XFS_DIR2_LEAF1_MAGIC ||
INT_GET(leaf->hdr.info.forw, ARCH_CONVERT) ||
/* construct freelist */
block = (xfs_dir2_block_t *)data;
btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
- blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT);
+ blp = XFS_DIR2_BLOCK_LEAF_P(btp);
needlog = needscan = 0;
libxfs_dir2_data_make_free(tp, dbp, (char *)blp - (char *)block,
(char *)block + mp->m_dirblksize - (char *)blp,
ptr = (char *)data->u;
if (INT_GET(data->hdr.magic, ARCH_CONVERT) == XFS_DIR2_BLOCK_MAGIC) {
btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)data);
- endptr = (char *)XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT);
+ endptr = (char *)XFS_DIR2_BLOCK_LEAF_P(btp);
} else
endptr = (char *)data + mp->m_dirblksize;
fblock = fbp->data;
/*
* Finish the rebuild of a directory.
- * Stuff / in and then remove it, this forces the directory to end
+ * Stuff / in and then remove it, this forces the directory to end
* up in the right format.
*/
void
next_da_bno = da_bno + mp->m_dirblkfsbs - 1;
if (libxfs_bmap_next_offset(NULL, ip, &next_da_bno, XFS_DATA_FORK))
break;
- if (libxfs_da_read_bufr(NULL, ip, da_bno, -1, &bp,
- XFS_DATA_FORK)) {
+ if (libxfs_da_read_bufr(NULL, ip, da_bno,
+ da_bno == 0 ? -2 : -1, &bp, XFS_DATA_FORK)) {
do_error(_("can't read block %u for directory inode "
"%llu\n"),
da_bno, ino);
/* NOTREACHED */
}
+ /* is there a hole at the start? */
+ if (da_bno == 0 && bp == NULL)
+ continue;
longform_dir2_entry_check_data(mp, ip, num_illegal, need_dot,
stack, irec, ino_offset, &bp, hashtab, &freetab, da_bno,
isblock);
ASSERT(bp);
block = bp->data;
btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
- blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT);
+ blp = XFS_DIR2_BLOCK_LEAF_P(btp);
seeval = dir_hash_see_all(hashtab, blp, INT_GET(btp->count, ARCH_CONVERT), INT_GET(btp->stale, ARCH_CONVERT));
if (dir_hash_check(hashtab, ip, seeval))
fixit |= 1;
* no need to worry about '.' since it doesn't exist.
*/
sf_entry = next_sfe = &sf->list[0];
- if (sf == NULL) {
+ if (sf == NULL) {
junkit = 1;
do_warn(_("shortform dir inode %llu has null data entries \n"),
ino);
bad_sfnamelen = 0;
tmp_sfe = NULL;
- XFS_DIR_SF_GET_DIRINO_ARCH(&sf_entry->inumber, &lino, ARCH_CONVERT);
+ XFS_DIR_SF_GET_DIRINO(&sf_entry->inumber, &lino);
namelen = sf_entry->namelen;
sf_entry = next_sfe, i++) {
tmp_sfe = NULL;
- XFS_DIR_SF_GET_DIRINO_ARCH(&sf_entry->inumber, &lino, ARCH_CONVERT);
+ XFS_DIR_SF_GET_DIRINO(&sf_entry->inumber, &lino);
bcopy(sf_entry->name, fname, sf_entry->namelen);
fname[sf_entry->namelen] = '\0';
/*
* Initialise i8 counter -- the parent inode number counts as well.
*/
- i8 = (XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT) > XFS_DIR2_MAX_SHORT_INUM);
+ i8 = (XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent) > XFS_DIR2_MAX_SHORT_INUM);
/*
* now run through entries, stop at first bad entry, don't need
bad_sfnamelen = 0;
tmp_sfep = NULL;
- lino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT);
+ lino = XFS_DIR2_SF_GET_INUMBER(sfp, XFS_DIR2_SF_INUMBERP(sfep));
namelen = sfep->namelen;
irec = find_inode_rec(XFS_INO_TO_AGNO(mp, mp->m_sb.sb_rsumino),
XFS_INO_TO_AGINO(mp, mp->m_sb.sb_rsumino));
- offset = XFS_INO_TO_AGINO(mp, mp->m_sb.sb_rsumino) -
+ offset = XFS_INO_TO_AGINO(mp, mp->m_sb.sb_rsumino) -
irec->ino_startnum;
ASSERT(irec != NULL);