/*
* Copyright (c) 2000-2001 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/
*/
#include <libxfs.h>
#include "command.h"
-#include "data.h"
#include "freesp.h"
#include "io.h"
#include "type.h"
#include "output.h"
-#include "mount.h"
+#include "init.h"
#include "malloc.h"
typedef struct histent
static const cmdinfo_t freesp_cmd =
{ "freesp", NULL, freesp_f, 0, -1, 0,
- "[-bcdfs] [-a agno]... [-e binsize] [-h h1]... [-m binmult]",
+ "[-bcdfs] [-a agno]... [-e binsize] [-h h1]... [-m binmult]",
"summarize free space for filesystem", NULL };
static int
aglistadd(optarg);
break;
case 'b':
- if (speced)
+ if (speced)
return usage();
multsize = 2;
speced = 1;
xfs_agf_t *agf;
push_cur();
- set_cur(&typtab[TYP_AGF], XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR), 1,
- DB_RING_IGN, NULL);
+ set_cur(&typtab[TYP_AGF],
+ XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),
+ XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL);
agf = iocur_top->data;
scan_freelist(agf);
if (countflag)
return;
push_cur();
set_cur(&typtab[TYP_AGFL],
- XFS_AG_DADDR(mp, seqno, XFS_AGFL_DADDR), 1,
- DB_RING_IGN, NULL);
+ XFS_AG_DADDR(mp, seqno, XFS_AGFL_DADDR(mp)),
+ XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL);
agfl = iocur_top->data;
i = INT_GET(agf->agf_flfirst, ARCH_CONVERT);
for (;;) {
addtohist(seqno, bno, 1);
if (i == INT_GET(agf->agf_fllast, ARCH_CONVERT))
break;
- if (++i == XFS_AGFL_SIZE)
+ if (++i == XFS_AGFL_SIZE(mp))
i = 0;
}
pop_cur();
blkbb, DB_RING_IGN, NULL);
if (iocur_top->data == NULL) {
dbprintf("can't read btree block %u/%u\n", seqno, root);
- return;
+ return;
}
(*func)((xfs_btree_sblock_t *)iocur_top->data, typ, nlevels - 1, agf);
pop_cur();
1, mp->m_alloc_mxr[0]);
for (i = 0; i < INT_GET(block->bb_numrecs, ARCH_CONVERT); i++)
addtohist(INT_GET(agf->agf_seqno, ARCH_CONVERT),
- INT_GET(rp[i].ar_startblock, ARCH_CONVERT), INT_GET(rp[i].ar_blockcount, ARCH_CONVERT));
+ INT_GET(rp[i].ar_startblock, ARCH_CONVERT),
+ INT_GET(rp[i].ar_blockcount, ARCH_CONVERT));
return;
}
pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, xfs_alloc, block, 1,
mp->m_alloc_mxr[1]);
for (i = 0; i < INT_GET(block->bb_numrecs, ARCH_CONVERT); i++)
- scan_sbtree(agf, pp[i], typ, level, scanfunc_bno);
+ scan_sbtree(agf, INT_GET(pp[i], ARCH_CONVERT), typ, level,
+ scanfunc_bno);
}
static void
1, mp->m_alloc_mxr[0]);
for (i = 0; i < INT_GET(block->bb_numrecs, ARCH_CONVERT); i++)
addtohist(INT_GET(agf->agf_seqno, ARCH_CONVERT),
- INT_GET(rp[i].ar_startblock, ARCH_CONVERT), INT_GET(rp[i].ar_blockcount, ARCH_CONVERT));
+ INT_GET(rp[i].ar_startblock, ARCH_CONVERT),
+ INT_GET(rp[i].ar_blockcount, ARCH_CONVERT));
return;
}
pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, xfs_alloc, block, 1,
mp->m_alloc_mxr[1]);
for (i = 0; i < INT_GET(block->bb_numrecs, ARCH_CONVERT); i++)
- scan_sbtree(agf, pp[i], typ, level, scanfunc_cnt);
+ scan_sbtree(agf, INT_GET(pp[i], ARCH_CONVERT), typ, level,
+ scanfunc_cnt);
}
static void