changes mainly, also some build minor build cleanups here and there.
Add in the po subdir for I18N support.
SUBDIRS = include libxfs libxlog libhandle libdisk \
bmap db freeze fsck growfs imap logprint mkfile mkfs repair rtcp \
- man doc debian build
+ man doc po debian build
default: $(CONFIGURE)
ifeq ($(HAVE_BUILDDEFS), no)
#
PKG_MAJOR=2
PKG_MINOR=3
-PKG_REVISION=7
+PKG_REVISION=8
PKG_BUILD=0
int option;
progname = basename(argv[0]);
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
while ((option = getopt(argc, argv, "adln:pvV")) != EOF) {
switch (option) {
case 'a':
vflag++;
break;
case 'V':
- printf("%s version %s\n", progname, VERSION);
+ printf(_("%s version %s\n"), progname, VERSION);
exit(0);
default:
- fprintf(stderr, "Usage: %s [-adlpV] [-n nx] file...\n",
- progname);
+ fprintf(stderr,
+ _("Usage: %s [-adlpV] [-n nx] file...\n"),
+ progname);
exit(1);
}
}
off64_t
file_size(int fd, char *fname)
{
- struct stat64 st;
+ struct stat64 st;
int i;
int errno_save;
errno_save = errno; /* in case fstat64 fails */
i = fstat64(fd, &st);
if (i < 0) {
- fprintf(stderr, "%s: fstat64 failed for %s: %s\n",
+ fprintf(stderr, _("%s: fstat64 failed for %s: %s\n"),
progname, fname, strerror(errno));
errno = errno_save;
return -1;
fd = open(fname, O_RDONLY);
if (fd < 0) {
- fprintf(stderr, "%s: cannot open \"%s\": %s\n",
+ fprintf(stderr, _("%s: cannot open \"%s\": %s\n"),
progname, fname, strerror(errno));
return 1;
}
fstatfs(fd, &buf);
if (statfstype(&buf) != XFS_SUPER_MAGIC) {
- fprintf(stderr, "%s: "
- "specified file [\"%s\"] is not on an XFS filesystem\n",
+ fprintf(stderr, _("%s: specified file "
+ "[\"%s\"] is not on an XFS filesystem\n"),
progname, fname);
close(fd);
return 1;
if (vflag) {
if (ioctl(fd, XFS_IOC_FSGEOMETRY_V1, &fsgeo) < 0) {
- fprintf(stderr, "%s: can't get geometry [\"%s\"]: %s\n",
+ fprintf(stderr,
+ _("%s: can't get geometry [\"%s\"]: %s\n"),
progname, fname, strerror(errno));
close(fd);
return 1;
}
if (vflag > 1)
- printf(
- "xfs_bmap: fsgeo.agblocks=%u, fsgeo.blocksize=%u, fsgeo.agcount=%u\n",
+ printf(_(
+ "xfs_bmap: fsgeo.agblocks=%u, fsgeo.blocksize=%u, fsgeo.agcount=%u\n"),
fsgeo.agblocks, fsgeo.blocksize,
fsgeo.agcount);
if ((ioctl(fd, XFS_IOC_FSGETXATTR, &fsx)) < 0) {
- fprintf(stderr, "%s: cannot read attrs on \"%s\": %s\n",
+ fprintf(stderr,
+ _("%s: cannot read attrs on \"%s\": %s\n"),
progname, fname, strerror(errno));
close(fd);
return 1;
}
if (vflag > 1)
- printf(
- "xfs_bmap: fsx.dsx_xflags=%u, fsx.fsx_extsize=%u, fsx.fsx_nextents=%u\n",
+ printf(_(
+ "xfs_bmap: fsx.dsx_xflags=%u, fsx.fsx_extsize=%u, fsx.fsx_nextents=%u\n"),
fsx.fsx_xflags, fsx.fsx_extsize,
fsx.fsx_nextents);
map_size = nflag ? nflag+1 : 32; /* initial guess - 256 for checkin KCM */
map = malloc(map_size*sizeof(*map));
if (map == NULL) {
- fprintf(stderr, "%s: malloc of %d bytes failed.\n",
+ fprintf(stderr, _("%s: malloc of %d bytes failed.\n"),
progname, (int)(map_size * sizeof(*map)));
close(fd);
return 1;
i = ioctl(fd, XFS_IOC_GETBMAPX, map);
if (vflag > 1)
- printf(
+ printf(_(
"xfs_bmap: i=%d map.bmv_offset=%lld, map.bmv_block=%lld, "
- "map.bmv_length=%lld, map.bmv_count=%d, map.bmv_entries=%d\n",
+ "map.bmv_length=%lld, map.bmv_count=%d, map.bmv_entries=%d\n"),
i, (long long)map->bmv_offset,
(long long)map->bmv_block,
(long long)map->bmv_length,
&& !aflag && file_size(fd, fname) == 0) {
break;
} else {
- fprintf(stderr, "%s: ioctl(XFS_IOC_GETBMAPX) "
- "iflags=0x%x [\"%s\"]: %s\n",
+ fprintf(stderr, _("%s: ioctl(XFS_IOC_GETBMAPX) "
+ "iflags=0x%x [\"%s\"]: %s\n"),
progname, map->bmv_iflags, fname,
strerror(errno));
close(fd);
*/
i = ioctl(fd, aflag ? XFS_IOC_FSGETXATTRA : XFS_IOC_FSGETXATTR, &fsx);
if (i < 0) {
- fprintf(stderr, "%s: ioctl(XFS_IOC_FSGETXATTR%s) "
- "[\"%s\"]: %s\n", progname, aflag ? "A" : "",
+ fprintf(stderr, _("%s: ioctl(XFS_IOC_FSGETXATTR%s) "
+ "[\"%s\"]: %s\n"), progname, aflag ? "A" : "",
fname, strerror(errno));
close(fd);
free(map);
map_size = 2*(fsx.fsx_nextents+1);
map = realloc(map, map_size*sizeof(*map));
if (map == NULL) {
- fprintf(stderr, "%s: cannot realloc %d bytes\n",
+ fprintf(stderr,
+ _("%s: cannot realloc %d bytes\n"),
progname, (int)(map_size*sizeof(*map)));
close(fd);
return 1;
} while (++loop < 2);
if (!nflag) {
if (map->bmv_entries <= 0) {
- printf("%s: no extents\n", fname);
+ printf(_("%s: no extents\n"), fname);
close(fd);
free(map);
return 0;
(long long)(map[i + 1].bmv_offset +
map[i + 1].bmv_length - 1LL));
if (map[i + 1].bmv_block == -1)
- printf("hole");
+ printf(_("hole"));
else {
printf("%lld..%lld",
(long long) map[i + 1].bmv_block,
}
if (lflag)
- printf(" %lld blocks\n", (long long)map[i+1].bmv_length);
+ printf(_(" %lld blocks\n"),
+ (long long)map[i+1].bmv_length);
else
printf("\n");
}
}
agno_w = max(MINAG_WIDTH, numlen(fsgeo.agcount));
printf("%4s: %-*s %-*s %*s %-*s %*s\n",
- "EXT",
- foff_w, "FILE-OFFSET",
- boff_w, "BLOCK-RANGE",
- agno_w, "AG",
- aoff_w, "AG-OFFSET",
- tot_w, "TOTAL");
+ _("EXT"),
+ foff_w, _("FILE-OFFSET"),
+ boff_w, _("BLOCK-RANGE"),
+ agno_w, _("AG"),
+ aoff_w, _("AG-OFFSET"),
+ tot_w, _("TOTAL"));
for (i = 0; i < map->bmv_entries; i++) {
snprintf(rbuf, sizeof(rbuf), "[%lld..%lld]:",
(long long) map[i + 1].bmv_offset,
printf("%4d: %-*s %-*s %*s %-*s %*lld\n",
i,
foff_w, rbuf,
- boff_w, "hole",
+ boff_w, _("hole"),
agno_w, "",
aoff_w, "",
tot_w, (long long)map[i+1].bmv_length);
dnl unpacking check - this file must exist
AC_INIT(include/libxfs.h)
+AC_CONFIG_HEADER(include/platform_defs.h)
+
pkg_name="xfsprogs"
AC_SUBST(pkg_name)
# Note: the following environment variables may be set to override the
# defaults (to change paths and/or executables, build parameters, etc):
#
-# DEBUG OPTIMIZER MAKE CC LD TAR ZIP RPM AWK SED ECHO
-# LIBTOOL MALLOCLIB DISTRIBUTION PACKAGE_BUILDER
+# DEBUG OPTIMIZER MALLOCLIB
+# PLATFORM DISTRIBUTION BUILDER
+# MAKE CC LD TAR ZIP AWK SED ECHO RPM LIBTOOL
+# MSGFMT MSGMERGE XGETTEXT
#
DEBUG=${DEBUG:-'-DDEBUG'} # -DNDEBUG
-OPTIMIZER=${OPTIMIZER:-'-g'} # (-O1 enforced default)
+OPTIMIZER=${OPTIMIZER:-'-O1 -g'} # some gcc's miscompile at -O2
MALLOCLIB=${MALLOCLIB:-''} # /usr/lib/libefence.a
dnl Debug build?
AC_SUBST(pkg_version)
AC_SUBST(pkg_release)
-pkg_distribution="SGI XFS"
+pkg_platform=`uname -s`
+pkg_distribution="Generic $pkg_platform"
+pkg_platform=`echo $pkg_platform | tr 'A-Z' 'a-z'`
+test -z "$PLATFORM" || pkg_platform="$PLATFORM"
test -z "$DISTRIBUTION" || pkg_distribution="$DISTRIBUTION"
AC_SUBST(pkg_distribution)
+AC_SUBST(pkg_platform)
pkg_builder=`id -u -n`@`hostname`
-test -z "$PACKAGE_BUILDER" || pkg_builder="$PACKAGE_BUILDER"
+test -z "$BUILDER" || pkg_builder="$BUILDER"
AC_SUBST(pkg_builder)
-dnl output header with cpp defs HAVE_*, etc
-AC_CONFIG_HEADER(include/platform_defs.h)
-
dnl check if user wants their own C compiler
test -z "$CC" && AC_PROG_CC
cc=$CC
zip=$ZIP
AC_SUBST(zip)
+dnl check if the makedepend program is available
+test -z "$MAKEDEPEND" && AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
+makedepend=$MAKEDEPEND
+AC_SUBST(makedepend)
+
dnl check if the rpm program is available
test -z "$RPM" && AC_PATH_PROG(RPM, rpm, /bin/rpm)
rpm=$RPM
else
rpmbuild=$RPM
fi
-
AC_SUBST(rpmbuild)
-
-dnl check if the msgfmt program is available
-test -z "$MSGFMT" && AC_CHECK_PROG(MSGFMT, msgfmt, /usr/bin/msgfmt)
-msgfmt=$MSGFMT
-AC_SUBST(msgfmt)
-
-dnl check if the makedepend program is available
-test -z "$MAKEDEPEND" && AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
-makedepend=$MAKEDEPEND
-AC_SUBST(makedepend)
dnl check if symbolic links are supported
AC_PROG_LN_S
echo=$ECHO
AC_SUBST(echo)
+dnl check if the msgfmt program is available
+test -z "$MSGFMT" && AC_CHECK_PROG(MSGFMT, msgfmt, /usr/bin/msgfmt)
+msgfmt=$MSGFMT
+AC_SUBST(msgfmt)
+
+dnl check if the msgmerge program is available
+test -z "$MSGMERGE" && AC_CHECK_PROG(MSGMERGE, msgmerge, /usr/bin/msgmerge)
+msgmerge=$MSGMERGE
+AC_SUBST(msgmerge)
+
+dnl ensure xgettext is installed
+test -z "$XGETTEXT" && AC_CHECK_PROG(XGETTEXT, xgettext, /usr/bin/xgettext)
+if test "$XGETTEXT" = ""; then
+ echo
+ echo 'FATAL ERROR: xgettext does not seem to be installed.'
+ echo $pkg_name cannot be built without a working gettext installation.
+ exit 1
+fi
+xgettext=$XGETTEXT
+AC_SUBST(xgettext)
+
dnl ensure libtool is installed
test -z "$LIBTOOL" && AC_PATH_PROG(LIBTOOL, libtool,,/usr/bin)
if test "$LIBTOOL" = ""; then
enable_shared=yes)
AC_SUBST(enable_shared)
+dnl will we be making use of gettext?
+AC_ARG_ENABLE(gettext,
+ [ --enable-gettext=[yes/no] Enable alternate language support [default=yes]],,
+ enable_gettext=yes)
+test $enable_gettext = "yes" && AC_DEFINE(ENABLE_GETTEXT)
+AC_SUBST(enable_gettext)
+
dnl Checks for UUID header and library.
AC_CHECK_HEADER(uuid/uuid.h,, [
echo
echo 'Install either the e2fsprogs-devel (rpm) or the uuid-dev (deb) package.'
exit 1
])
+
dnl
dnl Caution - using libuuid shared adds an additional runtime dependency,
dnl but the rpm spec file and debian control file do _not_ enforce this.
"\n"
" agf 2 - move location to AGF in 2nd filesystem allocation group\n"
"\n"
-" Located in the 2nd 512 byte block of each allocation group,\n"
-" the AGF contains the root of two different freespace btrees:\n"
+" Located in the second sector of each allocation group, the AGF\n"
+" contains the root of two different freespace btrees:\n"
" The 'cnt' btree keeps track freespace indexed on section size.\n"
" The 'bno' btree tracks sections of freespace indexed on block number.\n"
);
} else if (cur_agno == NULLAGNUMBER)
cur_agno = 0;
ASSERT(typtab[TYP_AGF].typnm == TYP_AGF);
- set_cur(&typtab[TYP_AGF], XFS_AG_DADDR(mp, cur_agno, XFS_AGF_DADDR), 1,
- DB_RING_ADD, NULL);
+ set_cur(&typtab[TYP_AGF],
+ XFS_AG_DADDR(mp, cur_agno, XFS_AGF_DADDR(mp)),
+ XFS_FSS_TO_BB(mp, 1), DB_RING_ADD, NULL);
return 0;
}
#include "output.h"
#include "mount.h"
+static int agfl_bno_size(void *obj, int startoff);
static int agfl_f(int argc, char **argv);
static void agfl_help(void);
{ "agfl", NULL, agfl_f, 0, 1, 1, "[agno]",
"set address to agfl block", agfl_help };
-const field_t agfl_hfld[] = {
- { "", FLDT_AGFL, OI(0), C1, 0, TYP_NONE },
+const field_t agfl_hfld[] = { {
+ "", FLDT_AGFL, OI(0), C1, 0, TYP_NONE, },
{ NULL }
};
#define OFF(f) bitize(offsetof(xfs_agfl_t, agfl_ ## f))
const field_t agfl_flds[] = {
- { "bno", FLDT_AGBLOCKNZ, OI(OFF(bno)), CI(XFS_AGFL_SIZE), FLD_ARRAY,
- TYP_DATA },
+ { "bno", FLDT_AGBLOCKNZ, OI(OFF(bno)), agfl_bno_size,
+ FLD_ARRAY|FLD_COUNT, TYP_DATA },
{ NULL }
};
+static int
+agfl_bno_size(
+ void *obj,
+ int startoff)
+{
+ return XFS_AGFL_SIZE(mp);
+}
+
static void
agfl_help(void)
{
"\n"
" agfl 5"
"\n"
-" Located in the 4th 512 byte block of each allocation group,\n"
+" Located in the fourth sector of each allocation group,\n"
" the agfl freelist for internal btree space allocation is maintained\n"
" for each allocation group. This acts as a reserved pool of space\n"
" separate from the general filesystem freespace (not used for user data).\n"
} else if (cur_agno == NULLAGNUMBER)
cur_agno = 0;
ASSERT(typtab[TYP_AGFL].typnm == TYP_AGFL);
- set_cur(&typtab[TYP_AGFL], XFS_AG_DADDR(mp, cur_agno, XFS_AGFL_DADDR),
- 1, DB_RING_ADD, NULL);
+ set_cur(&typtab[TYP_AGFL],
+ XFS_AG_DADDR(mp, cur_agno, XFS_AGFL_DADDR(mp)),
+ XFS_FSS_TO_BB(mp, 1), DB_RING_ADD, NULL);
return 0;
}
} else if (cur_agno == NULLAGNUMBER)
cur_agno = 0;
ASSERT(typtab[TYP_AGI].typnm == TYP_AGI);
- set_cur(&typtab[TYP_AGI], XFS_AG_DADDR(mp, cur_agno, XFS_AGI_DADDR), 1,
- DB_RING_ADD, NULL);
+ set_cur(&typtab[TYP_AGI],
+ XFS_AG_DADDR(mp, cur_agno, XFS_AGI_DADDR(mp)),
+ XFS_FSS_TO_BB(mp, 1), DB_RING_ADD, NULL);
return 0;
}
agffreeblks = agflongest = 0;
agicount = agifreecount = 0;
push_cur();
- set_cur(&typtab[TYP_SB], XFS_AG_DADDR(mp, agno, XFS_SB_DADDR), 1,
- DB_RING_IGN, NULL);
+ set_cur(&typtab[TYP_SB],
+ XFS_AG_DADDR(mp, agno, XFS_SB_DADDR),
+ XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL);
if (!iocur_top->data) {
dbprintf("can't read superblock for ag %u\n", agno);
set_dbmap(agno, XFS_FSB_TO_AGBNO(mp, sb->sb_logstart),
sb->sb_logblocks, DBM_LOG, agno, XFS_SB_BLOCK(mp));
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);
if ((agf = iocur_top->data) == NULL) {
dbprintf("can't read agf block for ag %u\n", agno);
pop_cur();
sb->sb_agblocks - INT_GET(agf->agf_length, ARCH_CONVERT),
DBM_MISSING, agno, XFS_SB_BLOCK(mp));
push_cur();
- set_cur(&typtab[TYP_AGI], XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR), 1,
- DB_RING_IGN, NULL);
+ set_cur(&typtab[TYP_AGI],
+ XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
+ XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL);
if ((agi = iocur_top->data) == NULL) {
dbprintf("can't read agi block for ag %u\n", agno);
serious_error++;
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);
if ((agfl = iocur_top->data) == NULL) {
dbprintf("can't read agfl block for ag %u\n", seqno);
serious_error++;
count++;
if (i == INT_GET(agf->agf_fllast, ARCH_CONVERT))
break;
- if (++i == XFS_AGFL_SIZE)
+ if (++i == XFS_AGFL_SIZE(mp))
i = 0;
}
if (count != INT_GET(agf->agf_flcount, ARCH_CONVERT)) {
if (nex > 1)
make_bbmap(&bbmap, nex, bmp);
set_cur(&typtab[next], (__int64_t)XFS_FSB_TO_DADDR(mp, dfsbno),
- (int)XFS_FSB_TO_DADDR(mp, mp->m_dirblkfsbs), DB_RING_ADD,
+ XFS_FSB_TO_BB(mp, mp->m_dirblkfsbs), DB_RING_ADD,
nex > 1 ? &bbmap : NULL);
free(bmp);
}
xfs_agi_t *agi;
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);
if ((agf = iocur_top->data) == NULL) {
dbprintf("can't read agf block for ag %u\n", agno);
pop_cur();
return;
}
push_cur();
- set_cur(&typtab[TYP_AGI], XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR), 1,
- DB_RING_IGN, NULL);
+ set_cur(&typtab[TYP_AGI],
+ XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
+ XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL);
if ((agi = iocur_top->data) == NULL) {
dbprintf("can't read agi block for ag %u\n", agno);
pop_cur();
set_cur(&typtab[TYP_INODE],
XFS_AGB_TO_DADDR(mp, seqno,
XFS_AGINO_TO_AGBNO(mp, agino)),
- (int)XFS_FSB_TO_BB(mp, XFS_IALLOC_BLOCKS(mp)),
+ XFS_FSB_TO_BB(mp, XFS_IALLOC_BLOCKS(mp)),
DB_RING_IGN, NULL);
if (iocur_top->data == NULL) {
dbprintf("can't read inode block %u/%u\n",
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();
{ "unit", FLDT_UINT32D, OI(OFF(unit)), C1, 0, TYP_NONE },
{ "width", FLDT_UINT32D, OI(OFF(width)), C1, 0, TYP_NONE },
{ "dirblklog", FLDT_UINT8D, OI(OFF(dirblklog)), C1, 0, TYP_NONE },
+ { "logsectlog", FLDT_UINT8D, OI(OFF(logsectlog)), C1, 0, TYP_NONE },
+ { "logsectsize", FLDT_UINT16D, OI(OFF(logsectsize)), C1, 0, TYP_NONE },
{ "logsunit", FLDT_UINT32D, OI(OFF(logsunit)), C1, 0, TYP_NONE },
{ NULL }
};
"\n"
" 'sb 7' - set location to 7th allocation group superblock, set type to 'sb'\n"
"\n"
-" Located in the 1st 512 byte block of each allocation group,\n"
-" the superblock contains the base information for the filesystem.\n"
+" Located in the first sector of each allocation group, the superblock\n"
+" contains the base information for the filesystem.\n"
" The superblock in allocation group 0 is the primary. The copies in the\n"
" remaining allocation groups only serve as backup for filesystem recovery.\n"
" The icount/ifree/fdblocks/frextents are only updated in superblock 0.\n"
} else if (cur_agno == NULLAGNUMBER)
cur_agno = 0;
ASSERT(typtab[TYP_SB].typnm == TYP_SB);
- set_cur(&typtab[TYP_SB], XFS_AG_DADDR(mp, cur_agno, XFS_SB_DADDR), 1,
- DB_RING_ADD, NULL);
+ set_cur(&typtab[TYP_SB],
+ XFS_AG_DADDR(mp, cur_agno, XFS_SB_DADDR),
+ XFS_FSS_TO_BB(mp, 1), DB_RING_ADD, NULL);
return 0;
}
get_sb(xfs_agnumber_t agno, xfs_sb_t *sb)
{
push_cur();
- set_cur(&typtab[TYP_SB], XFS_AG_DADDR(mp, agno, XFS_SB_DADDR), 1,
- DB_RING_IGN, NULL);
+ set_cur(&typtab[TYP_SB],
+ XFS_AG_DADDR(mp, agno, XFS_SB_DADDR),
+ XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL);
if (!iocur_top->data) {
dbprintf("can't read superblock for AG %u\n", agno);
#
OPTS=""
-USAGE="Usage: xfs_admin [-flu] [-L label] [-U uuid] special"
+USAGE="Usage: xfs_admin [-fluV] [-L label] [-U uuid] special"
-while getopts "fluL:U:" c
+while getopts "fluL:U:V" c
do
case $c in
f) OPTS=$OPTS" -f";;
L) OPTS=$OPTS" -c 'label "$OPTARG"'";;
u) OPTS=$OPTS" -r -c uuid";;
U) OPTS=$OPTS" -c 'uuid "$OPTARG"'";;
+ V) OPTS=$OPTS" -V";;
\?) echo $USAGE 1>&2
exit 2
;;
#
# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
#
-#ident "$Revision: 1.5 $"
+#ident "$Revision: 1.6 $"
OPTS=" "
ISFILE=" "
-USAGE="usage: xfs_check [-svf] [-i ino]... [-b bno]... special"
+USAGE="usage: xfs_check [-svfV] [-i ino]... [-b bno]... special"
-while getopts "b:fi:sv" c
+while getopts "b:fi:svV" c
do
case $c in
s) OPTS=$OPTS"-s ";;
v) OPTS=$OPTS"-v ";;
+ V) OPTS=$OPTS"-V ";;
i) OPTS=$OPTS"-i "$OPTARG" ";;
b) OPTS=$OPTS"-b "$OPTARG" ";;
f) ISFILE=" -f";;
#
# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
#
-#ident "$Revision: 1.5 $"
+#ident "$Revision: 1.6 $"
OPTS=" "
ISFILE=" "
-USAGE="usage: xfs_check64 [-svf] [-i ino]... [-b bno]... special"
+USAGE="usage: xfs_check64 [-sfvV] [-i ino]... [-b bno]... special"
-while getopts "b:fi:sv" c
+while getopts "b:fi:svV" c
do
case $c in
s) OPTS=$OPTS"-s ";;
v) OPTS=$OPTS"-v ";;
+ V) OPTS=$OPTS"-V ";;
i) OPTS=$OPTS"-i "$OPTARG" ";;
b) OPTS=$OPTS"-b "$OPTARG" ";;
f) ISFILE=" -f";;
#
# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
#
-#ident "$Revision: 1.5 $"
+#ident "$Revision: 1.6 $"
OPTS=" "
ISFILE=" "
-USAGE="usage: xfs_ncheck [-sf] [-i ino]... special"
+USAGE="usage: xfs_ncheck [-sfV] [-i ino]... special"
-while getopts "b:fi:sv" c
+while getopts "b:fi:svV" c
do
case $c in
s) OPTS=$OPTS"-s ";;
i) OPTS=$OPTS"-i "$OPTARG" ";;
+ v) OPTS=$OPTS"-v ";;
+ V) OPTS=$OPTS"-V ";;
f) ISFILE=" -f";;
\?) echo $USAGE 1>&2
exit 2
#
# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
#
-#ident "$Revision: 1.5 $"
+#ident "$Revision: 1.6 $"
OPTS=" "
ISFILE=" "
-USAGE="usage: xfs_ncheck64 [-sf] [-i ino]... special"
+USAGE="usage: xfs_ncheck64 [-sfvV] [-i ino]... special"
-while getopts "b:fi:sv" c
+while getopts "b:fi:svV" c
do
case $c in
s) OPTS=$OPTS"-s ";;
i) OPTS=$OPTS"-i "$OPTARG" ";;
+ v) OPTS=$OPTS"-v ";;
+ V) OPTS=$OPTS"-V ";;
f) ISFILE=" -f";;
\?) echo $USAGE 1>&2
exit 2
+xfsprogs (2.3.8-1) unstable; urgency=low
+
+ * New upstream release
+
+ -- Nathan Scott <nathans@debian.org> Wed, 18 Dec 2002 14:29:05 +1100
+
xfsprogs (2.3.7-1) unstable; urgency=low
* New upstream release
stdenv = @GZIP=-q; export GZIP;
options = DEBUG=-DNDEBUG; DISTRIBUTION=debian; export DEBUG DISTRIBUTION;
-bfsopts = OPTIMIZER=-Os; LOCAL_CONFIGURE_OPTIONS=--enable-shared-uuid=yes; \
+bfsopts = OPTIMIZER=-Os; LOCAL_CONFIGURE_OPTIONS= \
+ "--enable-shared-uuid=yes --enable-gettext=no"; \
$(options) export OPTIMIZER LOCAL_CONFIGURE_OPTIONS;
checkdir = test -f debian/rules
+xfsprogs-2.3.8 (18 December 2002)
+ - Initial support for I18N (still more to do here).
+ - Initial changes for filesystems with greater than 512 byte
+ sector sizes (still plenty more to do here too).
+ - Tidy up libxfs functions which take a "flags" argument.
+ - Sync up user/kernel source in lib{xfs,xlog} and headers.
+ - Fixed incorrect use of XFS_FSB_TO_DADDR macro in xfs_db's
+ faddr.c::fa_dirblock routine - now use XFS_FSB_TO_BB here,
+ as set_cur() takes basic blocks as its third parameter.
+ - Fixed obscure issue in mkfs where only the first AG would
+ get its AGFL freelist "fixed" - not clear this caused any
+ issues in practice (on Linux its always been this way, we
+ now match up with IRIX though).
+ - Made xfs_growfs filesystem geometry output match up with
+ that displayed by mkfs.xfs (xfs_growfs was missing a comma
+ before the log version field).
+ - Fixed an issue in xfs_repair where data past the end of the
+ valid superblock fields was sometimes not cleared, when it
+ really should have been (due to a libxfs problem).
+ - Shell scripts (xfs_info, xfs_check, etc) now also report
+ the xfsprogs version number via -V, like other commands.
+
xfsprogs-2.3.7 (14 November 2002)
- Fix an endian bug in xfs_db freesp command when descending
into multi-level agf cnt/bno btrees.
xfs-cmds-1.0.0 (16 June 2000)
- initial release for USENIX CDs
- early alpha code
-
static void
usage(void)
{
- fprintf(stderr,
+ fprintf(stderr, _(
"Usage: %s [options] mountpoint\n\n\
Options:\n\
-f freeze filesystem access\n\
- -u unfreeze filesystem access\n",
+ -u unfreeze filesystem access\n"),
progname);
exit(2);
}
fflag = uflag = 0;
progname = basename(argv[0]);
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
while ((c = getopt(argc, argv, "fu")) != EOF) {
switch (c) {
case 'f':
}
fstatfs(ffd, &buf);
if (statfstype(&buf) != XFS_SUPER_MAGIC) {
- fprintf(stderr,
- "%s: specified file is not on an XFS filesystem\n",
- progname);
+ fprintf(stderr, _("%s: specified file "
+ "[\"%s\"] is not on an XFS filesystem\n"),
+ progname, argv[optind]);
exit(1);
}
if (fflag) {
level = 1;
if (ioctl(ffd, XFS_IOC_FREEZE, &level) < 0) {
- fprintf(stderr, "%s: cannot freeze filesystem"
- " mounted at %s: %s\n",
+ fprintf(stderr, _("%s: cannot freeze filesystem"
+ " mounted at %s: %s\n"),
progname, argv[optind], strerror(errno));
exit(1);
}
if (uflag) {
if (ioctl(ffd, XFS_IOC_THAW, &level) < 0) {
- fprintf(stderr, "%s: cannot unfreeze filesystem"
- " mounted at %s: %s\n",
+ fprintf(stderr, _("%s: cannot unfreeze filesystem"
+ " mounted at %s: %s\n"),
progname, argv[optind], strerror(errno));
exit(1);
}
LTCOMMAND = xfs_growfs
-CFILES = explore.c xfs_growfs.c
+CFILES = xfs_growfs.c
+ifeq ($(PKG_PLATFORM),linux)
+CFILES += explore.c
+else
+LSRCFILES = explore.c
+endif
HFILES = explore.h
LLDLIBS = $(LIBXFS) $(LIBUUID)
mtab = MOUNTED;
if ((mtp = setmntent(mtab, "r")) == NULL) {
- fprintf(stderr, "%s: cannot access mount list %s: %s\n",
+ fprintf(stderr, _("%s: cannot access mount list %s: %s\n"),
progname, MOUNTED, strerror(errno));
exit(1);
}
if (stat64(mntpoint, &statuser) < 0) {
- fprintf(stderr, "%s: cannot access mount point %s: %s\n",
+ fprintf(stderr, _("%s: cannot access mount point %s: %s\n"),
progname, mntpoint, strerror(errno));
exit(1);
}
while ((mnt = getmntent(mtp)) != NULL) {
if (stat64(mnt->mnt_dir, &statmtab) < 0) {
- fprintf(stderr, "%s: ignoring entry %s in %s: %s\n",
+ fprintf(stderr, _("%s: ignoring entry %s in %s: %s\n"),
progname, mnt->mnt_dir, mtab, strerror(errno));
continue;
}
statuser.st_dev != statmtab.st_dev)
continue;
else if (strcmp(mnt->mnt_type, "xfs") != 0) {
- fprintf(stderr, "%s: %s is not an XFS filesystem\n",
+ fprintf(stderr, _("%s: %s is not an XFS filesystem\n"),
progname, mntpoint);
exit(1);
}
if (mnt == NULL) {
fprintf(stderr,
- "%s: %s is not a filesystem mount point, according to %s\n",
+ _("%s: %s is not a filesystem mount point, according to %s\n"),
progname, mntpoint, MOUNTED);
exit(1);
}
static void
usage(void)
{
- fprintf(stderr,
+ fprintf(stderr, _(
"Usage: %s [options] mountpoint\n\n\
Options:\n\
-d grow data/metadata section\n\
-R size grow realtime section to size blks\n\
-e size set realtime extent size to size blks\n\
-m imaxpct set inode max percent to imaxpct\n\
- -V print version information\n",
+ -V print version information\n"),
progname, XFS_MAX_INODE_SIG_BITS);
exit(2);
}
int logversion,
int isint)
{
- printf("meta-data=%-22s isize=%-6d agcount=%d, agsize=%d blks\n"
- "data =%-22s bsize=%-6d blocks=%lld, imaxpct=%d\n"
- " =%-22s sunit=%-6d swidth=%d blks, unwritten=%d\n"
- "naming =version %-14d bsize=%-6d\n"
- "log =%-22s bsize=%-6d blocks=%d version=%d\n"
- " =%-22s sunit=%d blks\n"
- "realtime =%-22s extsz=%-6d blocks=%lld, rtextents=%lld\n",
- mntpoint, geo.inodesize, geo.agcount, geo.agblocks,
- "", geo.blocksize, (long long)geo.datablocks, geo.imaxpct,
- "", geo.sunit, geo.swidth, unwritten,
- dirversion, geo.dirblocksize,
- isint ? "internal" : "external", geo.blocksize, geo.logblocks,
- logversion,
- "", geo.logsunit / geo.blocksize,
- geo.rtblocks ? "external" : "none",
- geo.rtextsize * geo.blocksize,
- (long long)geo.rtblocks, (long long)geo.rtextents);
+ printf(_(
+ "meta-data=%-22s isize=%-6u agcount=%u, agsize=%u blks\n"
+ " =%-22s sectsz=%-5u\n"
+ "data =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n"
+ " =%-22s sunit=%-6u swidth=%u blks, unwritten=%u\n"
+ "naming =version %-14u bsize=%-6u\n"
+ "log =%-22s bsize=%-6u blocks=%u, version=%u\n"
+ " =%-22s sectsz=%-5u sunit=%u blks\n"
+ "realtime =%-22s extsz=%-6u blocks=%llu, rtextents=%llu\n"),
+
+ mntpoint, geo.inodesize, geo.agcount, geo.agblocks,
+ "", geo.sectsize,
+ "", geo.blocksize, (unsigned long long)geo.datablocks,
+ geo.imaxpct,
+ "", geo.sunit, geo.swidth, unwritten,
+ dirversion, geo.dirblocksize,
+ isint ? _("internal") : _("external"), geo.blocksize,
+ geo.logblocks, logversion,
+ "", geo.logsectsize, geo.logsunit / geo.blocksize,
+ geo.rtblocks ? _("external") : _("none"),
+ geo.rtextsize * geo.blocksize, (unsigned long long)geo.rtblocks,
+ (unsigned long long)geo.rtextents);
}
int
libxfs_init_t xi; /* libxfs structure */
progname = basename(argv[0]);
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
mtab = NULL;
maxpct = esize = 0;
lflag = xflag = 1;
break;
case 'V':
- printf("%s version %s\n", progname, VERSION);
+ printf(_("%s version %s\n"), progname, VERSION);
exit(0);
case '?':
default:
* Only field added in the v2 geometry ioctl is "logsunit"
* so we'll zero that out for later display (as zero).
*/
- geo.logsunit = 1; /* 1 BB */
+ geo.logsunit = 0;
if (ioctl(ffd, XFS_IOC_FSGEOMETRY_V1, &geo) < 0) {
- fprintf(stderr,
+ fprintf(stderr, _(
"%s: cannot determine geometry of filesystem"
- " mounted at %s: %s\n",
+ " mounted at %s: %s\n"),
progname, fname, strerror(errno));
exit(1);
}
/* check we got the info for all the sections we are trying to modify */
if (!xi.ddev) {
- fprintf(stderr, "%s: failed to access data device for %s\n",
+ fprintf(stderr, _("%s: failed to access data device for %s\n"),
progname, fname);
exit(1);
}
if (lflag && !isint && !xi.logdev) {
- fprintf(stderr, "%s: failed to access external log for %s\n",
+ fprintf(stderr, _("%s: failed to access external log for %s\n"),
progname, fname);
exit(1);
}
if (rflag && !xi.rtdev) {
- fprintf(stderr, "%s: failed to access realtime device for %s\n",
+ fprintf(stderr,
+ _("%s: failed to access realtime device for %s\n"),
progname, fname);
exit(1);
}
if (!dsize)
dsize = ddsize / (geo.blocksize / BBSIZE);
else if (dsize > ddsize / (geo.blocksize / BBSIZE)) {
- fprintf(stderr,
- "data size %lld too large, maximum is %lld\n",
+ fprintf(stderr, _(
+ "data size %lld too large, maximum is %lld\n"),
(long long)dsize,
(long long)(ddsize/(geo.blocksize/BBSIZE)));
error = 1;
+ (dsize % geo.agblocks != 0);
if (!error && dsize < geo.datablocks) {
- fprintf(stderr, "data size %lld too small,"
- " old size is %lld\n",
+ fprintf(stderr, _("data size %lld too small,"
+ " old size is %lld\n"),
(long long)dsize, (long long)geo.datablocks);
error = 1;
} else if (!error &&
dsize == geo.datablocks && maxpct == geo.imaxpct) {
if (dflag)
- fprintf(stderr,
- "data size unchanged, skipping\n");
+ fprintf(stderr, _(
+ "data size unchanged, skipping\n"));
if (mflag)
- fprintf(stderr,
- "inode max pct unchanged, skipping\n");
+ fprintf(stderr, _(
+ "inode max pct unchanged, skipping\n"));
} else if (!error && !nflag) {
in.newblocks = (__u64)dsize;
in.imaxpct = (__u32)maxpct;
if (ioctl(ffd, XFS_IOC_FSGROWFSDATA, &in) < 0) {
if (errno == EWOULDBLOCK)
- fprintf(stderr,
- "%s: growfs operation in progress already\n",
+ fprintf(stderr, _(
+ "%s: growfs operation in progress already\n"),
progname);
else
- fprintf(stderr,
- "%s: ioctl failed - XFS_IOC_FSGROWFSDATA: %s\n",
+ fprintf(stderr, _(
+ "%s: XFS_IOC_FSGROWFSDATA ioctl failed: %s\n"),
progname, strerror(errno));
error = 1;
}
if (!rsize)
rsize = drsize / (geo.blocksize / BBSIZE);
else if (rsize > drsize / (geo.blocksize / BBSIZE)) {
- fprintf(stderr,
- "realtime size %lld too large, maximum is %lld\n",
+ fprintf(stderr, _(
+ "realtime size %lld too large, maximum is %lld\n"),
rsize, drsize / (geo.blocksize / BBSIZE));
error = 1;
}
if (!error && rsize < geo.rtblocks) {
- fprintf(stderr,
- "realtime size %lld too small, old size is %lld\n",
+ fprintf(stderr, _(
+ "realtime size %lld too small, old size is %lld\n"),
(long long)rsize, (long long)geo.rtblocks);
error = 1;
} else if (!error && rsize == geo.rtblocks) {
if (rflag)
- fprintf(stderr,
- "realtime size unchanged, skipping\n");
+ fprintf(stderr, _(
+ "realtime size unchanged, skipping\n"));
} else if (!error && !nflag) {
in.newblocks = (__u64)rsize;
in.extsize = (__u32)esize;
if (ioctl(ffd, XFS_IOC_FSGROWFSRT, &in) < 0) {
if (errno == EWOULDBLOCK)
- fprintf(stderr,
- "%s: growfs operation in progress already\n",
+ fprintf(stderr, _(
+ "%s: growfs operation in progress already\n"),
progname);
else if (errno == ENOSYS)
- fprintf(stderr,
- "%s: realtime growth not implemented\n",
+ fprintf(stderr, _(
+ "%s: realtime growth not implemented\n"),
progname);
else
- fprintf(stderr,
- "%s: ioctl failed - XFS_IOC_FSGROWFSRT: %s\n",
+ fprintf(stderr, _(
+ "%s: XFS_IOC_FSGROWFSRT ioctl failed: %s\n"),
progname, strerror(errno));
error = 1;
}
if (lsize == geo.logblocks && (in.isint == isint)) {
if (lflag)
fprintf(stderr,
- "log size unchanged, skipping\n");
+ _("log size unchanged, skipping\n"));
} else if (!nflag) {
in.newblocks = (__u32)lsize;
if (ioctl(ffd, XFS_IOC_FSGROWFSLOG, &in) < 0) {
if (errno == EWOULDBLOCK)
fprintf(stderr,
- "%s: growfs operation in progress already\n",
+ _("%s: growfs operation in progress already\n"),
progname);
else if (errno == ENOSYS)
fprintf(stderr,
- "%s: log growth not supported yet\n", progname);
+ _("%s: log growth not supported yet\n"),
+ progname);
else
fprintf(stderr,
- "%s: ioctl failed - XFS_IOC_FSGROWFSLOG: %s\n",
+ _("%s: XFS_IOC_FSGROWFSLOG ioctl failed: %s\n"),
progname, strerror(errno));
error = 1;
}
}
if (ioctl(ffd, XFS_IOC_FSGEOMETRY_V1, &ngeo) < 0) {
- fprintf(stderr, "%s: ioctl failed - XFS_IOC_FSGEOMETRY: %s\n",
+ fprintf(stderr, _("%s: XFS_IOC_FSGEOMETRY ioctl failed: %s\n"),
progname, strerror(errno));
exit(1);
}
if (geo.datablocks != ngeo.datablocks)
- printf("data blocks changed from %lld to %lld\n",
+ printf(_("data blocks changed from %lld to %lld\n"),
(long long)geo.datablocks, (long long)ngeo.datablocks);
if (geo.imaxpct != ngeo.imaxpct)
- printf("inode max percent changed from %d to %d\n",
+ printf(_("inode max percent changed from %d to %d\n"),
geo.imaxpct, ngeo.imaxpct);
if (geo.logblocks != ngeo.logblocks)
- printf("log blocks changed from %d to %d\n",
+ printf(_("log blocks changed from %d to %d\n"),
geo.logblocks, ngeo.logblocks);
if ((geo.logstart == 0) != (ngeo.logstart == 0))
- printf("log changed from %s to %s\n",
- geo.logstart ? "internal" : "external",
- ngeo.logstart ? "internal" : "external");
+ printf(_("log changed from %s to %s\n"),
+ geo.logstart ? _("internal") : _("external"),
+ ngeo.logstart ? _("internal") : _("external"));
if (geo.rtblocks != ngeo.rtblocks)
- printf("realtime blocks changed from %lld to %lld\n",
+ printf(_("realtime blocks changed from %lld to %lld\n"),
(long long)geo.rtblocks, (long long)ngeo.rtblocks);
if (geo.rtextsize != ngeo.rtextsize)
- printf("realtime extent size changed from %d to %d\n",
+ printf(_("realtime extent size changed from %d to %d\n"),
geo.rtextsize, ngeo.rtextsize);
exit(0);
}
#
OPTS=""
-USAGE="Usage: xfs_info [-t mtab] mountpoint"
+USAGE="Usage: xfs_info [-V] [-t mtab] mountpoint"
-while getopts "t:" c
+while getopts "t:V" c
do
case $c in
t) OPTS="-t $OPTARG" ;;
+ V) OPTS="-V $OPTARG" ;;
*) echo $USAGE 1>&2
exit 2
;;
struct statfs buf;
progname = basename(argv[0]);
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
if (argc < 2)
name = ".";
}
fstatfs(fd, &buf);
if (statfstype(&buf) != XFS_SUPER_MAGIC) {
- fprintf(stderr, "%s: "
- "specified file [\"%s\"] is not on an XFS filesystem\n",
+ fprintf(stderr, _("%s: specified file "
+ "[\"%s\"] is not on an XFS filesystem\n"),
progname, name);
exit(1);
}
if (count == 0)
return 0;
for (i = 0; i < count; i++) {
- printf("ino %10llu count %2d mask %016llx\n",
+ printf(_("ino %10llu count %2d mask %016llx\n"),
(unsigned long long)t[i].xi_startino,
t[i].xi_alloccount,
(unsigned long long)t[i].xi_allocmask);
TOPDIR = ..
include $(TOPDIR)/include/builddefs
-HFILES = handle.h jdm.h libxfs.h libxlog.h xqm.h \
+HFILES = handle.h jdm.h libxfs.h libxlog.h swab.h xqm.h \
xfs_ag.h xfs_alloc.h xfs_alloc_btree.h xfs_arch.h xfs_attr_leaf.h \
xfs_attr_sf.h xfs_bit.h xfs_bmap.h xfs_bmap_btree.h xfs_btree.h \
xfs_buf_item.h xfs_da_btree.h xfs_dfrag.h xfs_dinode.h \
LIBDISK = $(TOPDIR)/libdisk/libdisk.la
LIBHANDLE = $(TOPDIR)/libhandle/libhandle.la
+DK_INC_DIR = @includedir@/disk
+
prefix = @prefix@
exec_prefix = @exec_prefix@
-DK_INC_DIR = @includedir@/disk
+PKG_NAME = @pkg_name@
+PKG_RELEASE = @pkg_release@
+PKG_VERSION = @pkg_version@
+PKG_PLATFORM = @pkg_platform@
+PKG_DISTRIBUTION= @pkg_distribution@
+PKG_BUILDER = @pkg_builder@
+PKG_BIN_DIR = @bindir@
+PKG_SBIN_DIR = @sbindir@
+PKG_LIB_DIR = @libdir@
+PKG_DEVLIB_DIR = @libexecdir@
+PKG_INC_DIR = @includedir@/xfs
+PKG_MAN_DIR = @mandir@
+PKG_DOC_DIR = @datadir@/doc/@pkg_name@
+PKG_LOCALE_DIR = @datadir@/locale
-PKG_NAME = @pkg_name@
-PKG_RELEASE = @pkg_release@
-PKG_VERSION = @pkg_version@
-PKG_DISTRIBUTION = @pkg_distribution@
-PKG_BUILDER = @pkg_builder@
-PKG_BIN_DIR = @bindir@
-PKG_LIB_DIR = @libdir@
-PKG_INC_DIR = @includedir@/xfs
-PKG_MAN_DIR = @mandir@
-PKG_DOC_DIR = @datadir@/doc/@pkg_name@
-PKG_SBIN_DIR = @sbindir@
-PKG_DEVLIB_DIR = @libexecdir@
-
-CC = @cc@
-LD = @ld@
-AWK = @awk@
-SED = @sed@
-MAKE = @make@
-ECHO = @echo@
-LN_S = @LN_S@
-ZIP = @zip@
-TAR = @tar@
-RPM = @rpm@
-RPMBUILD= @rpmbuild@
-MSGFMT = @msgfmt@
-
-RPM_VERSION = @rpm_version@
-HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
-MAKEDEPEND = @makedepend@
+CC = @cc@
+LD = @ld@
+AWK = @awk@
+SED = @sed@
+TAR = @tar@
+ZIP = @zip@
+MAKE = @make@
+ECHO = @echo@
+LN_S = @LN_S@
+LIBTOOL = @LIBTOOL@
+MAKEDEPEND = @makedepend@
+
+MSGFMT = @msgfmt@
+MSGMERGE = @msgmerge@
+XGETTEXT = @xgettext@ --omit-header --language=C --keyword=_
+
+RPM = @rpm@
+RPMBUILD = @rpmbuild@
+RPM_VERSION = @rpm_version@
-LIBTOOL = @LIBTOOL@
ENABLE_SHARED = @enable_shared@
+ENABLE_GETTEXT = @enable_gettext@
+HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@
+
+LCFLAGS += -DXFS_BIG_FILES=1 -DXFS_BIG_FILESYSTEMS=1
+
+ifeq ($(PKG_PLATFORM),linux)
+PCFLAGS = -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
+else
+PCFLAGS = -traditional-cpp
+endif
+
+GCFLAGS += $(OPTIMIZER) $(DEBUG) -funsigned-char -Wall -I$(TOPDIR)/include \
+ -DVERSION=\"$(PKG_VERSION)\" -DLOCALEDIR=\"$(PKG_LOCALE_DIR)\" \
+ -DPACKAGE=\"$(PKG_NAME)\"
-CFLAGS += -O1 $(OPTIMIZER) $(DEBUG) -funsigned-char -Wall $(LCFLAGS) \
- -I$(TOPDIR)/include '-DVERSION="$(PKG_VERSION)"' -D_GNU_SOURCE \
- -D_FILE_OFFSET_BITS=64 -DXFS_BIG_FILES=1 -DXFS_BIG_FILESYSTEMS=1
+# Global, Platform, Local CFLAGS
+CFLAGS += $(GCFLAGS) $(PCFLAGS) $(LCFLAGS)
include $(TOPDIR)/include/buildmacros
MAKEOPTS = --no-print-directory
SRCFILES = Makefile $(HFILES) $(CFILES) $(LSRCFILES) $(LFILES) $(YFILES)
-DIRT = $(LDIRT) dep dep.bak $(OBJECTS) $(LTOBJECTS) *.[1-9].gz \
- $(LTCOMMAND) $(LTLIBRARY)
+
+DEPDIRT = dep dep.bak
+MANDIRT = *.[1-9].gz
+PODIRT = *.tmpo *.mo
+CDIRT = $(OBJECTS) $(LTOBJECTS) $(LTCOMMAND) $(LTLIBRARY)
+DIRT = $(LDIRT) $(DEPDIRT) $(MANDIRT) $(PODIRT) $(CDIRT)
OBJECTS = $(ASFILES:.s=.o) \
$(CFILES:.c=.o) \
done; \
done
+ifeq ($(ENABLE_GETTEXT),yes)
+INSTALL_LINGUAS = \
+ @for l in $(LINGUAS); do \
+ ldir=$(PKG_LOCALE_DIR)/$$l/LC_MESSAGES; \
+ $(INSTALL) -m 755 -d $$ldir; \
+ $(INSTALL) -m 644 $$l.mo $$ldir/$(PKG_NAME).mo; \
+ done
+endif
+
SUBDIRS_MAKERULE = \
@for d in $(SUBDIRS) ""; do \
if test -d "$$d" -a ! -z "$$d"; then \
$(LTCOMPILE) -c $<
endif
+ifdef LINGUAS
+%.pot: $(XGETTEXTFILES)
+ $(XGETTEXT) -o $@ $(XGETTEXTFILES)
+
+%.tmpo: %.po
+ $(MSGMERGE) -o $@ $< $(PKG_NAME).pot
+
+%.mo: %.tmpo
+ $(MSGFMT) -o $@ $<
+endif
+
source :
$(SOURCE_MAKERULE)
int setblksize; /* attempt to set device block size */
} libxfs_init_t;
-#define LIBXFS_ISREADONLY 0x0069 /* disallow all mounted filesystems */
-#define LIBXFS_ISINACTIVE 0x6900 /* allow mounted only if mounted ro */
+#define LIBXFS_EXIT_ON_FAILURE 0x0001 /* exit the program if a call fails */
+#define LIBXFS_ISREADONLY 0x0002 /* disallow all mounted filesystems */
+#define LIBXFS_ISINACTIVE 0x0004 /* allow mounted only if mounted ro */
extern char *progname;
extern int libxfs_init (libxfs_init_t *);
__uint8_t m_dircook_elog; /* log d-cookie entry bits */
__uint8_t m_blkbit_log; /* blocklog + NBBY */
__uint8_t m_blkbb_log; /* blocklog - BBSHIFT */
+ __uint8_t m_sectbb_log; /* sectorlog - BBSHIFT */
__uint8_t m_agno_log; /* log #ag's */
__uint8_t m_agino_log; /* #bits for agino in inum */
__uint16_t m_inode_cluster_size;/* min inode buf size */
#include <getopt.h>
#include <endian.h>
-#if defined (__powerpc__) /* ppc fix from: Robert Ramiega (jedi@plukwa.net) */
-# define __BYTEORDER_HAS_U64__
-#endif
-#include <asm/byteorder.h>
+#include "swab.h"
#ifndef O_DIRECT
# if defined (__powerpc__)
# ifdef HAVE_64BIT_LONG
typedef long __psint_t;
# else
-/* This is a very strange architecture, which has 64 bit pointers but
- * not 64 bit longs. So, I'd just punt here and assume long long is Ok */
+/* This is a very strange architecture, which has 64 bit pointers but */
+/* not 64 bit longs. So, just punt here and assume long long is OK. */
typedef long long __psint_t;
# endif
# else
# ifdef HAVE_64BIT_LONG
typedef long __psunsigned_t;
# else
-/* This is a very strange architecture, which has 64 bit pointers but
- * not 64 bit longs. So, I'd just punt here and assume long long is Ok */
+/* This is a very strange architecture, which has 64 bit pointers but */
+/* not 64 bit longs. So, just punt here and assume long long is OK. */
typedef unsigned long long __psunsigned_t;
# endif
# else
# endif
#endif
+/* Define if you want gettext (I18N) support */
+#undef ENABLE_GETTEXT
+#ifdef ENABLE_GETTEXT
+# include <libintl.h>
+# define _(x) gettext(x)
+#else
+# define _(x) (x)
+# define textdomain(d) do { } while (0)
+# define bindtextdomain(d,dir) do { } while (0)
+#endif
+
#ifdef DEBUG
# define ASSERT assert
#else
--- /dev/null
+#ifndef SWAB_H
+#define SWAB_H
+
+/* casts are necessary for constants, because we never know how for sure
+ * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
+ */
+#define ___swab16(x) \
+({ \
+ __u16 __x = (x); \
+ ((__u16)( \
+ (((__u16)(__x) & (__u16)0x00ffU) << 8) | \
+ (((__u16)(__x) & (__u16)0xff00U) >> 8) )); \
+})
+
+#define ___swab32(x) \
+({ \
+ __u32 __x = (x); \
+ ((__u32)( \
+ (((__u32)(__x) & (__u32)0x000000ffUL) << 24) | \
+ (((__u32)(__x) & (__u32)0x0000ff00UL) << 8) | \
+ (((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) | \
+ (((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); \
+})
+
+#define ___swab64(x) \
+({ \
+ __u64 __x = (x); \
+ ((__u64)( \
+ (__u64)(((__u64)(__x) & (__u64)0x00000000000000ffULL) << 56) | \
+ (__u64)(((__u64)(__x) & (__u64)0x000000000000ff00ULL) << 40) | \
+ (__u64)(((__u64)(__x) & (__u64)0x0000000000ff0000ULL) << 24) | \
+ (__u64)(((__u64)(__x) & (__u64)0x00000000ff000000ULL) << 8) | \
+ (__u64)(((__u64)(__x) & (__u64)0x000000ff00000000ULL) >> 8) | \
+ (__u64)(((__u64)(__x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
+ (__u64)(((__u64)(__x) & (__u64)0x00ff000000000000ULL) >> 40) | \
+ (__u64)(((__u64)(__x) & (__u64)0xff00000000000000ULL) >> 56) )); \
+})
+
+#define ___constant_swab16(x) \
+ ((__u16)( \
+ (((__u16)(x) & (__u16)0x00ffU) << 8) | \
+ (((__u16)(x) & (__u16)0xff00U) >> 8) ))
+#define ___constant_swab32(x) \
+ ((__u32)( \
+ (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
+ (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
+ (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
+ (((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
+#define ___constant_swab64(x) \
+ ((__u64)( \
+ (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
+ (__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
+ (__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
+ (__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \
+ (__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \
+ (__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
+ (__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
+ (__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
+
+/*
+ * provide defaults when no architecture-specific optimization is detected
+ */
+#ifndef __arch__swab16
+# define __arch__swab16(x) ({ __u16 __tmp = (x) ; ___swab16(__tmp); })
+#endif
+#ifndef __arch__swab32
+# define __arch__swab32(x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); })
+#endif
+#ifndef __arch__swab64
+# define __arch__swab64(x) ({ __u64 __tmp = (x) ; ___swab64(__tmp); })
+#endif
+
+#ifndef __arch__swab16p
+# define __arch__swab16p(x) __arch__swab16(*(x))
+#endif
+#ifndef __arch__swab32p
+# define __arch__swab32p(x) __arch__swab32(*(x))
+#endif
+#ifndef __arch__swab64p
+# define __arch__swab64p(x) __arch__swab64(*(x))
+#endif
+
+#ifndef __arch__swab16s
+# define __arch__swab16s(x) do { *(x) = __arch__swab16p((x)); } while (0)
+#endif
+#ifndef __arch__swab32s
+# define __arch__swab32s(x) do { *(x) = __arch__swab32p((x)); } while (0)
+#endif
+#ifndef __arch__swab64s
+# define __arch__swab64s(x) do { *(x) = __arch__swab64p((x)); } while (0)
+#endif
+
+
+/*
+ * Allow constant folding
+ */
+# define __swab16(x) \
+(__builtin_constant_p((__u16)(x)) ? \
+ ___swab16((x)) : \
+ __fswab16((x)))
+# define __swab32(x) \
+(__builtin_constant_p((__u32)(x)) ? \
+ ___swab32((x)) : \
+ __fswab32((x)))
+# define __swab64(x) \
+(__builtin_constant_p((__u64)(x)) ? \
+ ___swab64((x)) : \
+ __fswab64((x)))
+
+
+static __inline__ __const__ __u16 __fswab16(__u16 x)
+{
+ return __arch__swab16(x);
+}
+static __inline__ __u16 __swab16p(__u16 *x)
+{
+ return __arch__swab16p(x);
+}
+static __inline__ void __swab16s(__u16 *addr)
+{
+ __arch__swab16s(addr);
+}
+
+static __inline__ __const__ __u32 __fswab32(__u32 x)
+{
+ return __arch__swab32(x);
+}
+static __inline__ __u32 __swab32p(__u32 *x)
+{
+ return __arch__swab32p(x);
+}
+static __inline__ void __swab32s(__u32 *addr)
+{
+ __arch__swab32s(addr);
+}
+
+static __inline__ __const__ __u64 __fswab64(__u64 x)
+{
+# ifdef __SWAB_64_THRU_32__
+ __u32 h = x >> 32;
+ __u32 l = x & ((1ULL<<32)-1);
+ return (((__u64)__swab32(l)) << 32) | ((__u64)(__swab32(h)));
+# else
+ return __arch__swab64(x);
+# endif
+}
+static __inline__ __u64 __swab64p(__u64 *x)
+{
+ return __arch__swab64p(x);
+}
+static __inline__ void __swab64s(__u64 *addr)
+{
+ __arch__swab64s(addr);
+}
+
+#endif /* SWAB_H */
#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1)
/* disk block (xfs_daddr_t) in the AG */
-#define XFS_AGF_DADDR ((xfs_daddr_t)1)
+#define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGF_BLOCK)
xfs_agblock_t xfs_agf_block(struct xfs_mount *mp);
#define XFS_AGF_BLOCK(mp) xfs_agf_block(mp)
#else
-#define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR)
+#define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp))
#endif
/*
#define XFS_AGI_ALL_BITS ((1 << XFS_AGI_NUM_BITS) - 1)
/* disk block (xfs_daddr_t) in the AG */
-#define XFS_AGI_DADDR ((xfs_daddr_t)2)
+#define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGI_BLOCK)
xfs_agblock_t xfs_agi_block(struct xfs_mount *mp);
#define XFS_AGI_BLOCK(mp) xfs_agi_block(mp)
#else
-#define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR)
+#define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp))
#endif
/*
* The third a.g. block contains the a.g. freelist, an array
* of block pointers to blocks owned by the allocation btree code.
*/
-#define XFS_AGFL_DADDR ((xfs_daddr_t)3)
+#define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGFL_BLOCK)
xfs_agblock_t xfs_agfl_block(struct xfs_mount *mp);
#define XFS_AGFL_BLOCK(mp) xfs_agfl_block(mp)
#else
-#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR)
+#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))
#endif
-#define XFS_AGFL_SIZE (BBSIZE / sizeof(xfs_agblock_t))
-typedef struct xfs_agfl
-{
- xfs_agblock_t agfl_bno[XFS_AGFL_SIZE];
+#define XFS_AGFL_SIZE(mp) ((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock_t))
+
+/* -- nathans TODO ... use of BBSIZE here - should be sector size -- */
+typedef struct xfs_agfl {
+ xfs_agblock_t agfl_bno[BBSIZE/sizeof(xfs_agblock_t)];
} xfs_agfl_t;
/*
xfs_extlen_t xfs_ag_best_blocks(int bl, xfs_drfsbno_t blks);
#define XFS_AG_BEST_BLOCKS(bl,blks) xfs_ag_best_blocks(bl,blks)
#else
-/*--#define XFS_AG_BEST_BLOCKS(bl) ((xfs_extlen_t)(XFS_AG_BEST_BYTES >> bl))*/
+/*--#define XFS_AG_BEST_BLOCKS(bl) ((xfs_extlen_t)(XFS_AG_BEST_BYTES >> bl))*/
/*
* Best is XFS_AG_BEST_BLOCKS at and below 64 Gigabyte filesystems, and
* XFS_AG_MAX_BLOCKS above 64 Gigabytes.
*/
-#define XFS_AG_BEST_BLOCKS(bl,blks) ((xfs_extlen_t)((1LL << (36 - bl)) >= \
- blks) ? \
- ((xfs_extlen_t)(XFS_AG_BEST_BYTES >> bl)) : \
- XFS_AG_MAX_BLOCKS(bl))
+#define XFS_AG_BEST_BLOCKS(bl,blks) \
+ ((xfs_extlen_t)((1LL << (36 - bl)) >= blks) ? \
+ ((xfs_extlen_t)(XFS_AG_BEST_BYTES >> bl)) : \
+ XFS_AG_MAX_BLOCKS(bl))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_MAX_BLOCKS)
xfs_extlen_t xfs_ag_max_blocks(int bl);
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGB_TO_DADDR)
xfs_daddr_t xfs_agb_to_daddr(struct xfs_mount *mp, xfs_agnumber_t agno,
- xfs_agblock_t agbno);
+ xfs_agblock_t agbno);
#define XFS_AGB_TO_DADDR(mp,agno,agbno) xfs_agb_to_daddr(mp,agno,agbno)
#else
#define XFS_AGB_TO_DADDR(mp,agno,agbno) \
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_DADDR)
-xfs_daddr_t xfs_ag_daddr(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_daddr_t d);
+xfs_daddr_t xfs_ag_daddr(struct xfs_mount *mp, xfs_agnumber_t agno,
+ xfs_daddr_t d);
#define XFS_AG_DADDR(mp,agno,d) xfs_ag_daddr(mp,agno,d)
#else
#define XFS_AG_DADDR(mp,agno,d) (XFS_AGB_TO_DADDR(mp, agno, 0) + (d))
xfs_alloc_compute_maxlevels(
struct xfs_mount *mp); /* file system mount structure */
-/*
- * Decide whether to use this allocation group for this allocation.
- * If so, fix up the btree freelist's size.
- * This is external so mkfs can call it, too.
- */
-int /* error */
-xfs_alloc_fix_freelist(
- xfs_alloc_arg_t *args, /* allocation argument structure */
- int flags); /* XFS_ALLOC_FLAG_... */
-
/*
* Get a block from the freelist.
* Returns with the buffer for the block gotten.
#endif
/*
- * Minimum and maximum blocksize.
+ * Minimum and maximum blocksize and sectorsize.
* The blocksize upper limit is pretty much arbitrary.
+ * The sectorsize upper limit is due to sizeof(sb_sectsize).
*/
#define XFS_MIN_BLOCKSIZE_LOG 9 /* i.e. 512 bytes */
#define XFS_MAX_BLOCKSIZE_LOG 16 /* i.e. 65536 bytes */
#define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG)
#define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG)
+#define XFS_MIN_SECTORSIZE_LOG 9 /* i.e. 512 bytes */
+#define XFS_MAX_SECTORSIZE_LOG 15 /* i.e. 32768 bytes */
+#define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG)
+#define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG)
/*
- * block numbers in the AG; SB is BB 0, AGF is BB 1, AGI is BB 2, AGFL is BB 3
+ * Block numbers in the AG:
+ * SB is sector 0, AGF is sector 1, AGI is sector 2, AGFL is sector 3.
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BNO_BLOCK)
xfs_agblock_t xfs_bno_block(struct xfs_mount *mp);
(XFS_SB_VERSION_HASEXTFLGBIT(&((x)->i_mount->m_sb)) ? \
XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE)
#endif
-#define ISUNWRITTEN(x) ((x) == XFS_EXT_UNWRITTEN)
+#define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN)
/*
* Incore version of above.
#define XFS_FSOP_GEOM_VERSION 0
-#define XFS_FSOP_GEOM_FLAGS_ATTR 0x01 /* attributes in use */
-#define XFS_FSOP_GEOM_FLAGS_NLINK 0x02 /* 32-bit nlink values */
-#define XFS_FSOP_GEOM_FLAGS_QUOTA 0x04 /* quotas enabled */
-#define XFS_FSOP_GEOM_FLAGS_IALIGN 0x08 /* inode alignment */
-#define XFS_FSOP_GEOM_FLAGS_DALIGN 0x10 /* large data alignment */
-#define XFS_FSOP_GEOM_FLAGS_SHARED 0x20 /* read-only shared */
-#define XFS_FSOP_GEOM_FLAGS_EXTFLG 0x40 /* special extent flag */
-#define XFS_FSOP_GEOM_FLAGS_DIRV2 0x80 /* directory version 2 */
-#define XFS_FSOP_GEOM_FLAGS_LOGV2 0x100 /* log format version 2 */
+#define XFS_FSOP_GEOM_FLAGS_ATTR 0x0001 /* attributes in use */
+#define XFS_FSOP_GEOM_FLAGS_NLINK 0x0002 /* 32-bit nlink values */
+#define XFS_FSOP_GEOM_FLAGS_QUOTA 0x0004 /* quotas enabled */
+#define XFS_FSOP_GEOM_FLAGS_IALIGN 0x0008 /* inode alignment */
+#define XFS_FSOP_GEOM_FLAGS_DALIGN 0x0010 /* large data alignment */
+#define XFS_FSOP_GEOM_FLAGS_SHARED 0x0020 /* read-only shared */
+#define XFS_FSOP_GEOM_FLAGS_EXTFLG 0x0040 /* special extent flag */
+#define XFS_FSOP_GEOM_FLAGS_DIRV2 0x0080 /* directory version 2 */
+#define XFS_FSOP_GEOM_FLAGS_LOGV2 0x0100 /* log format version 2 */
+#define XFS_FSOP_GEOM_FLAGS_SECTOR 0x0200 /* sector sizes >1BB */
/*
__uint8_t m_mk_sharedro; /* mark shared ro on unmount */
__uint8_t m_inode_quiesce;/* call quiesce on new inodes.
field governed by m_ilock */
+ __uint8_t m_sectbb_log; /* sectlog - BBSHIFT */
__uint8_t m_dirversion; /* 1 or 2 */
xfs_dirops_t m_dirops; /* table of dir funcs */
int m_dirblksize; /* directory block sz--bytes */
int xfs_unmount_flush(xfs_mount_t *, int);
int xfs_mod_incore_sb(xfs_mount_t *, xfs_sb_field_t, int, int);
int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *, uint, int);
-int xfs_readsb(xfs_mount_t *mp);
+int xfs_readsb(xfs_mount_t *mp, unsigned int, int, int);
struct xfs_buf *xfs_getsb(xfs_mount_t *, int);
void xfs_freesb(xfs_mount_t *);
void xfs_do_force_shutdown(bhv_desc_t *, int, char *, int);
/*
* Super block
- * Fits into a 512-byte buffer at daddr_t 0 of each allocation group.
+ * Fits into a sector-sized buffer at address 0 of each allocation group.
* Only the first of these is ever updated except during growfs.
*/
#define XFS_SB_VERSION_DALIGNBIT 0x0100
#define XFS_SB_VERSION_SHAREDBIT 0x0200
#define XFS_SB_VERSION_LOGV2BIT 0x0400
+#define XFS_SB_VERSION_SECTORBIT 0x0800
#define XFS_SB_VERSION_EXTFLGBIT 0x1000
#define XFS_SB_VERSION_DIRV2BIT 0x2000
#define XFS_SB_VERSION_OKSASHFBITS \
XFS_SB_VERSION_ALIGNBIT | \
XFS_SB_VERSION_DALIGNBIT | \
XFS_SB_VERSION_SHAREDBIT | \
- XFS_SB_VERSION_LOGV2BIT)
+ XFS_SB_VERSION_LOGV2BIT | \
+ XFS_SB_VERSION_SECTORBIT)
#define XFS_SB_VERSION_OKSASHBITS \
(XFS_SB_VERSION_NUMBITS | \
XFS_SB_VERSION_REALFBITS | \
(XFS_SB_VERSION_NUMBITS | \
XFS_SB_VERSION_OKREALFBITS | \
XFS_SB_VERSION_OKSASHFBITS)
-#define XFS_SB_VERSION_MKFS(ia,dia,extflag,dirv2,na) \
+#define XFS_SB_VERSION_MKFS(ia,dia,extflag,dirv2,na,sflag) \
(((ia) || (dia) || (extflag) || (dirv2) || (na)) ? \
(XFS_SB_VERSION_4 | \
((ia) ? XFS_SB_VERSION_ALIGNBIT : 0) | \
((dia) ? XFS_SB_VERSION_DALIGNBIT : 0) | \
((extflag) ? XFS_SB_VERSION_EXTFLGBIT : 0) | \
((dirv2) ? XFS_SB_VERSION_DIRV2BIT : 0) | \
- ((na) ? XFS_SB_VERSION_LOGV2BIT : 0)) : \
+ ((na) ? XFS_SB_VERSION_LOGV2BIT : 0) | \
+ ((sflag) ? XFS_SB_VERSION_SECTORBIT : 0)) : \
XFS_SB_VERSION_1)
typedef struct xfs_sb
__uint32_t sb_unit; /* stripe or raid unit */
__uint32_t sb_width; /* stripe or raid width */
__uint8_t sb_dirblklog; /* log2 of dir block size (fsbs) */
- __uint8_t sb_dummy[3]; /* padding */
+ __uint8_t sb_logsectlog; /* log2 of the log sector size */
+ __uint16_t sb_logsectsize; /* sector size for the log, bytes */
__uint32_t sb_logsunit; /* stripe unit size for the log */
} xfs_sb_t;
XFS_SBS_IFREE, XFS_SBS_FDBLOCKS, XFS_SBS_FREXTENTS, XFS_SBS_UQUOTINO,
XFS_SBS_GQUOTINO, XFS_SBS_QFLAGS, XFS_SBS_FLAGS, XFS_SBS_SHARED_VN,
XFS_SBS_INOALIGNMT, XFS_SBS_UNIT, XFS_SBS_WIDTH, XFS_SBS_DIRBLKLOG,
- XFS_SBS_DUMMY, XFS_SBS_LOGSUNIT,
+ XFS_SBS_LOGSECTLOG, XFS_SBS_LOGSECTSIZE, XFS_SBS_LOGSUNIT,
XFS_SBS_FIELDCOUNT
} xfs_sb_field_t;
((sbp)->sb_versionnum & ~XFS_SB_VERSION_EXTFLGBIT))
#endif
+#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASSECTOR)
+int xfs_sb_version_hassector(xfs_sb_t *sbp);
+#define XFS_SB_VERSION_HASSECTOR(sbp) xfs_sb_version_hassector(sbp)
+#else
+#define XFS_SB_VERSION_HASSECTOR(sbp) \
+ ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
+ ((sbp)->sb_versionnum & XFS_SB_VERSION_SECTORBIT))
+#endif
+
/*
* end of superblock version macros
*/
-#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */
+#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_BLOCK)
xfs_agblock_t xfs_sb_block(struct xfs_mount *mp);
#define XFS_SB_BLOCK(mp) xfs_sb_block(mp)
XFS_FSB_TO_AGBNO(mp,fsbno))
#endif
+#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_SBP)
+xfs_sb_t *xfs_buf_to_sbp(struct xfs_buf *bp);
+#define XFS_BUF_TO_SBP(bp) xfs_buf_to_sbp(bp)
+#else
+#define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp))
+#endif
+
+/*
+ * File system sector to basic block conversions.
+ */
+#define XFS_FSS_TO_BB(mp,sec) ((sec) << (mp)->m_sectbb_log)
+#define XFS_BB_TO_FSS(mp,bb) \
+ (((bb) + (XFS_FSS_TO_BB(mp,1) - 1)) >> (mp)->m_sectbb_log)
+#define XFS_BB_TO_FSST(mp,bb) ((bb) >> (mp)->m_sectbb_log)
+
+/*
+ * File system sector to byte conversions.
+ */
+#define XFS_FSS_TO_B(mp,sectno) ((xfs_fsize_t)(sectno) << (mp)->m_sb.sb_sectlog)
+#define XFS_B_TO_FSST(mp,b) (((__uint64_t)(b)) >> (mp)->m_sb.sb_sectlog)
+
/*
* File system block to basic block conversions.
*/
/*
* File system block to byte conversions.
*/
-#define XFS_FSB_TO_B(mp,fsbno) ((xfs_fsize_t)(fsbno) << \
- (mp)->m_sb.sb_blocklog)
+#define XFS_FSB_TO_B(mp,fsbno) ((xfs_fsize_t)(fsbno) << (mp)->m_sb.sb_blocklog)
#define XFS_B_TO_FSB(mp,b) \
((((__uint64_t)(b)) + (mp)->m_blockmask) >> (mp)->m_sb.sb_blocklog)
#define XFS_B_TO_FSBT(mp,b) (((__uint64_t)(b)) >> (mp)->m_sb.sb_blocklog)
#define XFS_B_FSB_OFFSET(mp,b) ((b) & (mp)->m_blockmask)
-#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_SBP)
-xfs_sb_t *xfs_buf_to_sbp(struct xfs_buf *bp);
-#define XFS_BUF_TO_SBP(bp) xfs_buf_to_sbp(bp)
-#else
-#define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp))
-#endif
-
#endif /* __XFS_SB_H__ */
unsigned int t_rtx_res_used; /* # of resvd rt extents used */
xfs_log_ticket_t t_ticket; /* log mgr ticket */
sema_t t_sema; /* sema for commit completion */
- xfs_lsn_t t_lsn; /* log seq num of trans commit*/
+ xfs_lsn_t t_lsn; /* log seq num of start of
+ * transaction. */
+ xfs_lsn_t t_commit_lsn; /* log seq num of end of
+ * transaction. */
struct xfs_mount *t_mountp; /* ptr to fs mount struct */
struct xfs_dquot_acct *t_dqinfo; /* accting info for dquots */
xfs_trans_callback_t t_callback; /* transaction callback */
xfs_agnumber_t ag,
xfs_extlen_t idx);
-/*
- * Not necessarily exported, but used outside a single file.
- */
-int xfs_trans_lsn_danger(struct xfs_mount *, xfs_lsn_t);
-
#endif /* __KERNEL__ */
#endif /* __XFS_TRANS_H__ */
#ifdef __KERNEL__
+#include <linux/types.h>
+
/*
* POSIX Extensions
*/
typedef signed long long int __int64_t;
typedef unsigned long long int __uint64_t;
+typedef enum { B_FALSE, B_TRUE } boolean_t;
+
+
typedef __int64_t prid_t; /* project ID */
typedef __uint32_t inst_t; /* an instruction */
typedef char * xfs_caddr_t; /* <core address> type */
typedef __u32 xfs_dev_t;
-typedef struct xfs_dirent { /* data from readdir() */
- xfs_ino_t d_ino; /* inode number of entry */
- xfs_off_t d_off; /* offset of disk directory entry */
- unsigned short d_reclen; /* length of this record */
- char d_name[1]; /* name of file */
-} xfs_dirent_t;
-
-#define DIRENTBASESIZE (((xfs_dirent_t *)0)->d_name - (char *)0)
-#define DIRENTSIZE(namelen) \
- ((DIRENTBASESIZE + (namelen) + \
- sizeof(xfs_off_t)) & ~(sizeof(xfs_off_t) - 1))
+typedef struct timespec timespec_t;
+
+typedef struct {
+ unsigned char __u_bits[16];
+} uuid_t;
/* __psint_t is the same size as a pointer */
#if (BITS_PER_LONG == 32)
LT_REVISION = 0
LT_AGE = 0
-CFILES = drivers.c fstype.c pttype.c md.c xvm.c evms.c lvm.c
+CFILES = drivers.c fstype.c pttype.c
+ifeq ($(PKG_PLATFORM),linux)
+CFILES += md.c xvm.c evms.c lvm.c
+else
+LSRCFILES = md.c xvm.c evms.c lvm.c
+endif
HFILES = drivers.h fstype.h pttype.h md.h xvm.h evms.h
default: $(LTLIBRARY)
if (dev == NULL)
return;
-
+
if (stat64(dev, &sb)) {
- fprintf(stderr, "Cannot stat %s: %s\n", dev, strerror(errno));
+ fprintf(stderr, _("Cannot stat %s: %s\n"),
+ dev, strerror(errno));
exit(1);
}
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
+#include <libxfs.h>
#include <sys/stat.h>
#include <volume.h>
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <volume.h>
+#include "drivers.h"
#ifndef LVM_BLK_MAJOR
#define LVM_BLK_MAJOR 58
/* Open pipe */
if (pipe(lvpipe) < 0) {
- fprintf(stderr, "Could not open pipe\n");
+ fprintf(stderr, _("Could not open pipe\n"));
exit(1);
}
execv(largv[0], largv);
- fprintf(stderr, "\nFailed to execute %s\n", largv[0]);
+ fprintf(stderr, _("Failed to execute %s\n"), largv[0]);
exit(1);
case -1:
- fprintf(stderr, "Failed forking lvdisplay process\n");
+ fprintf(stderr, _("Failed forking lvdisplay process\n"));
exit(1);
default:
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-#include <stdio.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <volume.h>
+#include "drivers.h"
#include "md.h"
int
/* Is this thing on... */
if (ioctl(fd, GET_ARRAY_INFO, &md)) {
- fprintf(stderr, "Error getting MD array info from %s\n",
+ fprintf(stderr,
+ _("Error getting MD array info from %s\n"),
dfile);
exit(1);
}
/* Check state */
if (md.state) {
- fprintf(stderr, "MD array %s not in clean state\n",
+ fprintf(stderr, _("MD array %s not in clean state\n"),
dfile);
exit(1);
}
LT_REVISION = 0
LT_AGE = 0
-HFILES = xfs.h
+HFILES = xfs.h init.h
CFILES = bit.c init.c logitem.c rdwr.c trans.c util.c \
xfs_alloc.c xfs_ialloc.c xfs_rtalloc.c \
xfs_inode.c xfs_btree.c xfs_alloc_btree.c xfs_ialloc_btree.c \
xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \
xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \
xfs_mount.c xfs_trans.c
-#LCFLAGS += -DHAVE_BLKBSZSET
+
+CFILES += $(PKG_PLATFORM).c
+LSRCFILES = $(shell echo linux.c | sed -e "s/$(PKG_PLATFORM).c//g")
#
# Tracing flags:
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-#define ustat __kernel_ustat
#include <libxfs.h>
-#include <mntent.h>
#include <sys/stat.h>
-#undef ustat
-#include <sys/ustat.h>
-#include <sys/ioctl.h>
-#include <sys/mount.h>
-
-/* Until glibc catches up... */
-#ifndef BLKGETSIZE64
-#define BLKGETSIZE64 _IOR(0x12,114,sizeof(__uint64_t))
-#endif
+#include "init.h"
#define findrawpath(x) x
#define findblockpath(x) x
#define MAX_DEVS 10 /* arbitary maximum */
int nextfakedev = -1; /* device number to give to next fake device */
static struct dev_to_fd {
- dev_t dev;
- int fd;
+ dev_t dev;
+ int fd;
} dev_map[MAX_DEVS]={{0}};
-static int
-check_ismounted(char *name, char *block)
-{
- struct ustat ust;
- struct stat64 st;
-
- if (stat64(block, &st) < 0)
- return 0;
- if ((st.st_mode & S_IFMT) != S_IFBLK)
- return 0;
- if (ustat(st.st_rdev, &ust) >= 0) {
- fprintf(stderr, "%s: %s contains a mounted filesystem\n",
- progname, name);
- return 1;
- }
- return 0;
-}
-
/*
* Checks whether a given device has a mounted, writable
* filesystem, returns 1 if it does & fatal (just warns
static int
check_isactive(char *name, char *block, int fatal)
{
-#define PROC_MOUNTED "/proc/mounts"
- int sts = 0;
- FILE *f;
- struct mntent *mnt;
- struct stat64 st, mst;
- struct ustat ust;
- char mounts[MAXPATHLEN];
+ struct stat64 st;
if (stat64(block, &st) < 0)
- return sts;
+ return 0;
if ((st.st_mode & S_IFMT) != S_IFBLK)
- return sts;
- if (ustat(st.st_rdev, &ust) < 0)
- return sts;
-
- strcpy(mounts, access(PROC_MOUNTED, R_OK)? PROC_MOUNTED : MOUNTED);
- if ((f = setmntent(mounts, "r")) == NULL) {
- fprintf(stderr, "%s: %s contains a possibly writable, mounted "
- "filesystem\n", progname, name);
- return fatal;
- }
- while ((mnt = getmntent(f)) != NULL) {
- if (stat64(mnt->mnt_fsname, &mst) < 0)
- continue;
- if ((mst.st_mode & S_IFMT) != S_IFBLK)
- continue;
- if (mst.st_rdev == st.st_rdev
- && hasmntopt(mnt, MNTOPT_RO) != NULL)
- break;
- }
- if (mnt == NULL) {
- fprintf(stderr, "%s: %s contains a writable, mounted "
- "filesystem\n", progname, name);
- sts = fatal;
- }
- endmntent(f);
-
- return sts;
-}
-
-static __int64_t
-findsize(char *path)
-{
- int fd;
- int error;
- __uint64_t size;
- struct stat64 st;
-
- /* Test to see if we are dealing with a regular file rather than a
- * block device, if we are just use the size returned by stat64
- */
- if (stat64(path, &st) < 0) {
- fprintf(stderr, "%s: "
- "cannot stat the device special file \"%s\": %s\n",
- progname, path, strerror(errno));
- exit(1);
- }
- if ((st.st_mode & S_IFMT) == S_IFREG) {
- return (__int64_t)(st.st_size >> 9);
- }
-
- if ((fd = open(path, 0)) < 0) {
- fprintf(stderr, "%s: "
- "error opening the device special file \"%s\": %s\n",
- progname, path, strerror(errno));
- exit(1);
- }
- error = ioctl(fd, BLKGETSIZE64, &size);
- if (error >= 0) {
- /* BLKGETSIZE64 returns size in bytes not 512-byte blocks */
- size = size >> 9;
- } else {
- /* If BLKGETSIZE64 fails, try BLKGETSIZE */
- unsigned long tmpsize;
- error = ioctl(fd, BLKGETSIZE, &tmpsize);
- if (error < 0) {
- fprintf(stderr, "%s: can't determine device size\n",
- progname);
- exit(1);
- }
- size = (__uint64_t)tmpsize;
- }
-
- close(fd);
-
- return (__int64_t)size;
+ return 0;
+ if (check_ismounted(name, block, &st, 0))
+ return 0;
+ return check_iswritable(name, block, &st, fatal);
}
-
/* libxfs_device_to_fd:
* lookup a device number in the device map
* return the associated fd
int
libxfs_device_to_fd(dev_t device)
{
- int d;
+ int d;
- for (d=0;d<MAX_DEVS;d++)
+ for (d = 0; d < MAX_DEVS; d++)
if (dev_map[d].dev == device)
return dev_map[d].fd;
- fprintf(stderr, "%s: device_to_fd: device %lld is not open\n",
- progname, (long long)device);
+ fprintf(stderr, _("%s: %s: device %lld is not open\n"),
+ progname, __FUNCTION__, (long long)device);
exit(1);
}
(readonly ? O_RDONLY : O_RDWR) |
(creat ? O_CREAT|O_TRUNC : 0),
0666)) < 0) {
- fprintf(stderr, "%s: cannot open %s: %s\n",
+ fprintf(stderr, _("%s: cannot open %s: %s\n"),
progname, path, strerror(errno));
exit(1);
}
if (stat(path, &statb)<0) {
- fprintf(stderr, "%s: cannot stat %s: %s\n",
+ fprintf(stderr, _("%s: cannot stat %s: %s\n"),
progname, path, strerror(errno));
exit(1);
}
- /*
- * Set device blocksize to 512 bytes (see bug #801063)
- */
-#ifndef BLKBSZSET
-#define BLKBSZSET _IOW(0x12,113,sizeof(int)) /* set device block size */
-#endif
if (!readonly && setblksize && (statb.st_mode & S_IFMT) == S_IFBLK) {
- int blocksize = 512; /* bytes */
- if (ioctl(fd, BLKBSZSET, &blocksize) < 0) {
- fprintf(stderr, "%s: warning - cannot set blocksize on "
- "block device %s: %s\n",
- progname, path, strerror(errno));
- }
+ set_blocksize(fd, path, 512);
}
/*
for (d = 0; d < MAX_DEVS; d++)
if (dev_map[d].dev == dev) {
- fprintf(stderr, "%s: device %lld is already open\n",
+ fprintf(stderr, _("%s: device %lld is already open\n"),
progname, (long long)dev);
exit(1);
}
return dev;
}
- fprintf(stderr, "%s: device_open: too many open devices\n", progname);
+ fprintf(stderr, _("%s: %s: too many open devices\n"),
+ progname, __FUNCTION__);
exit(1);
}
dev_map[d].dev = dev_map[d].fd = 0;
fsync(fd);
- ioctl(fd, BLKFLSBUF, 0);
+ flush_device(fd);
close(fd);
return;
}
- fprintf(stderr, "%s: device_close: device %lld is not open\n",
- progname, (long long)dev);
- ASSERT(0);
+ fprintf(stderr, _("%s: %s: device %lld is not open\n"),
+ progname, __FUNCTION__, (long long)dev);
exit(1);
}
goto done;
}
if (!(rawfile = findrawpath(a->volname))) {
- fprintf(stderr, "%s: "
- "can't find a character device matching %s\n",
+ fprintf(stderr, _("%s: "
+ "can't find a character device matching %s\n"),
progname, a->volname);
goto done;
}
if (!(blockfile = findblockpath(a->volname))) {
- fprintf(stderr, "%s: "
- "can't find a block device matching %s\n",
+ fprintf(stderr, _("%s: "
+ "can't find a block device matching %s\n"),
progname, a->volname);
goto done;
}
if (!readonly && !inactive && check_ismounted(
- a->volname, blockfile))
+ a->volname, blockfile, NULL, 1))
goto done;
if (inactive && check_isactive(
a->volname, blockfile, readonly))
a->volname = NULL;
goto voldone;
}
- fprintf(stderr, "%s: "
- "%s is not a volume device name\n",
+ fprintf(stderr, _("%s: "
+ "%s is not a volume device name\n"),
progname, a->volname);
if (a->notvolmsg)
fprintf(stderr, a->notvolmsg, a->volname);
}
#ifdef HAVE_VOLUME_MANAGER
if (getdev.data_subvol_dev && dname) {
- fprintf(stderr, "%s: "
- "%s has a data subvolume, cannot specify %s\n",
+ fprintf(stderr, _("%s: "
+ "%s has a data subvolume, cannot specify %s\n"),
progname, a->volname, dname);
goto done;
}
if (getdev.log_subvol_dev && logname) {
- fprintf(stderr, "%s: "
- "%s has a log subvolume, cannot specify %s\n",
+ fprintf(stderr, _("%s: "
+ "%s has a log subvolume, cannot specify %s\n"),
progname, a->volname, logname);
goto done;
}
if (getdev.rt_subvol_dev && rtname) {
- fprintf(stderr, "%s: %s has a realtime subvolume, "
- "cannot specify %s\n",
+ fprintf(stderr, _("%s: %s has a realtime subvolume, "
+ "cannot specify %s\n"),
progname, a->volname, rtname);
goto done;
}
(void)mktemp(dpath);
if (mknod(dpath, S_IFCHR | 0600,
getdev.data_subvol_dev) < 0) {
- fprintf(stderr, "%s: mknod failed: %s\n",
+ fprintf(stderr, _("%s: mknod failed: %s\n"),
progname, strerror(errno));
goto done;
}
(void)mktemp(logpath);
if (mknod(logpath, S_IFCHR | 0600,
getdev.log_subvol_dev) < 0) {
- fprintf(stderr, "%s: mknod failed: %s\n",
+ fprintf(stderr, _("%s: mknod failed: %s\n"),
progname, strerror(errno));
goto done;
}
(void)mktemp(rtpath);
if (mknod(rtpath, S_IFCHR | 0600,
getdev.rt_subvol_dev) < 0) {
- fprintf(stderr, "%s: mknod failed: %s\n",
+ fprintf(stderr, _("%s: mknod failed: %s\n"),
progname, strerror(errno));
goto done;
}
a->dfd = libxfs_device_to_fd(a->ddev);
} else {
if (stat64(dname, &stbuf) < 0) {
- fprintf(stderr, "%s: stat64 failed on %s: %s\n",
+ fprintf(stderr,
+ _("%s: stat64 failed on %s: %s\n"),
progname, dname, strerror(errno));
goto done;
}
if (!(rawfile = findrawpath(dname))) {
- fprintf(stderr, "%s: can't find a char device "
- "matching %s\n", progname, dname);
+ fprintf(stderr,
+ _("%s: can't find a char device "
+ "matching %s\n"), progname, dname);
goto done;
}
if (!(blockfile = findblockpath(dname))) {
- fprintf(stderr, "%s: can't find a block device "
- "matching %s\n", progname, dname);
+ fprintf(stderr,
+ _("%s: can't find a block device "
+ "matching %s\n"), progname, dname);
goto done;
}
if (!readonly && !inactive && check_ismounted(
- dname, blockfile))
+ dname, blockfile, NULL, 1))
goto done;
if (inactive && check_isactive(
dname, blockfile, readonly))
a->logfd = libxfs_device_to_fd(a->logdev);
} else {
if (stat64(logname, &stbuf) < 0) {
- fprintf(stderr, "%s: stat64 failed on %s: %s\n",
+ fprintf(stderr,
+ _("%s: stat64 failed on %s: %s\n"),
progname, logname, strerror(errno));
goto done;
}
if (!(rawfile = findrawpath(logname))) {
- fprintf(stderr, "%s: can't find a char device "
- "matching %s\n", progname, logname);
+ fprintf(stderr,
+ _("%s: can't find a char device "
+ "matching %s\n"), progname, logname);
goto done;
}
if (!(blockfile = findblockpath(logname))) {
- fprintf(stderr, "%s: can't find a block device "
- "matching %s\n", progname, logname);
+ fprintf(stderr,
+ _("%s: can't find a block device "
+ "matching %s\n"), progname, logname);
goto done;
}
if (!readonly && !inactive && check_ismounted(
- logname, blockfile))
+ logname, blockfile, NULL, 1))
goto done;
else if (inactive && check_isactive(
logname, blockfile, readonly))
a->rtfd = libxfs_device_to_fd(a->rtdev);
} else {
if (stat64(rtname, &stbuf) < 0) {
- fprintf(stderr, "%s: stat64 failed on %s: %s\n",
+ fprintf(stderr,
+ _("%s: stat64 failed on %s: %s\n"),
progname, rtname, strerror(errno));
goto done;
}
if (!(rawfile = findrawpath(rtname))) {
- fprintf(stderr, "%s: can't find a char device "
- "matching %s\n", progname, rtname);
+ fprintf(stderr,
+ _("%s: can't find a char device "
+ "matching %s\n"), progname, rtname);
goto done;
}
if (!(blockfile = findblockpath(rtname))) {
- fprintf(stderr, "%s: can't find a block device "
- "matching %s\n", progname, rtname);
+ fprintf(stderr,
+ _("%s: can't find a block device "
+ "matching %s\n"), progname, rtname);
goto done;
}
if (!readonly && !inactive && check_ismounted(
- rtname, blockfile))
+ rtname, blockfile, NULL, 1))
goto done;
if (inactive && check_isactive(
rtname, blockfile, readonly))
} else
a->rtsize = 0;
if (a->dsize < 0) {
- fprintf(stderr, "%s: can't get size for data subvolume\n",
+ fprintf(stderr, _("%s: can't get size for data subvolume\n"),
progname);
goto done;
}
if (a->logBBsize < 0) {
- fprintf(stderr, "%s: can't get size for log subvolume\n",
+ fprintf(stderr, _("%s: can't get size for log subvolume\n"),
progname);
goto done;
}
if (a->rtsize < 0) {
- fprintf(stderr, "%s: can't get size for realtime subvolume\n",
+ fprintf(stderr, _("%s: can't get size for realtime subvolume\n"),
progname);
goto done;
}
return 0;
error = libxfs_iread(mp, NULL, sbp->sb_rbmino, &mp->m_rbmip, 0);
if (error) {
- fprintf(stderr, "%s: cannot read realtime bitmap inode (%d)\n",
+ fprintf(stderr,
+ _("%s: cannot read realtime bitmap inode (%d)\n"),
progname, error);
return error;
}
ASSERT(sbp->sb_rsumino != NULLFSINO);
error = libxfs_iread(mp, NULL, sbp->sb_rsumino, &mp->m_rsumip, 0);
if (error) {
- fprintf(stderr, "%s: cannot read realtime summary inode (%d)\n",
+ fprintf(stderr,
+ _("%s: cannot read realtime summary inode (%d)\n"),
progname, error);
return error;
}
if (sbp->sb_rblocks == 0)
return 0;
if (mp->m_rtdev == 0) {
- fprintf(stderr, "%s: filesystem has a realtime subvolume\n",
+ fprintf(stderr, _("%s: filesystem has a realtime subvolume\n"),
progname);
return -1;
}
*/
d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_rblocks);
if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_rblocks) {
- fprintf(stderr, "%s: realtime init - %llu != %llu\n", progname,
- (unsigned long long) XFS_BB_TO_FSB(mp, d),
+ fprintf(stderr, _("%s: realtime init - %llu != %llu\n"),
+ progname, (unsigned long long) XFS_BB_TO_FSB(mp, d),
(unsigned long long) mp->m_sb.sb_rblocks);
return -1;
}
- bp = libxfs_readbuf(mp->m_rtdev, d - 1, 1, 0);
+ bp = libxfs_readbuf(mp->m_rtdev,
+ d - XFS_FSB_TO_BB(mp, 1), XFS_FSB_TO_BB(mp, 1), 0);
if (bp == NULL) {
- fprintf(stderr, "%s: realtime size check failed\n", progname);
+ fprintf(stderr, _("%s: realtime size check failed\n"),
+ progname);
return -1;
}
libxfs_putbuf(bp);
/*
* Check that the data (and log if separate) are an ok size.
*/
- d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks);
+ d = (xfs_daddr_t) XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks);
if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) {
- fprintf(stderr, "%s: size check failed\n", progname);
+ fprintf(stderr, _("%s: size check failed\n"), progname);
return NULL;
}
if (dev == 0) /* maxtrres, we have no device so leave now */
return mp;
- bp = libxfs_readbuf(mp->m_dev, d - 1, 1, 0);
- if (bp == NULL) {
- fprintf(stderr, "%s: data size check failed\n", progname);
+ bp = libxfs_readbuf(mp->m_dev,
+ d - XFS_FSS_TO_BB(mp, 1), XFS_FSS_TO_BB(mp, 1), 1);
+ if (!bp) {
+ fprintf(stderr, _("%s: data size check failed\n"), progname);
return NULL;
}
libxfs_putbuf(bp);
if (mp->m_logdev && mp->m_logdev != mp->m_dev) {
- d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
+ d = (xfs_daddr_t) XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
if ( (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) ||
- (!(bp = libxfs_readbuf(mp->m_logdev, d - 1, 1, 1)))) {
- fprintf(stderr, "%s: log size checks failed\n",
+ (!(bp = libxfs_readbuf(mp->m_logdev,
+ d - XFS_FSB_TO_BB(mp, 1),
+ XFS_FSB_TO_BB(mp, 1), 1)))) {
+ fprintf(stderr, _("%s: log size checks failed\n"),
progname);
return NULL;
}
/* Initialize realtime fields in the mount structure */
if (rtmount_init(mp)) {
- fprintf(stderr, "%s: realtime device init failed\n", progname);
+ fprintf(stderr, _("%s: realtime device init failed\n"),
+ progname);
return NULL;
}
/* Allocate and initialize the per-ag data */
size = sbp->sb_agcount * sizeof(xfs_perag_t);
if ((mp->m_perag = calloc(size, 1)) == NULL) {
- fprintf(stderr, "%s: failed to alloc %ld bytes: %s\n",
+ fprintf(stderr, _("%s: failed to alloc %ld bytes: %s\n"),
progname, (long)size, strerror(errno));
exit(1);
}
error = libxfs_iread(mp, NULL, sbp->sb_rootino,
&mp->m_rootip, 0);
if (error) {
- fprintf(stderr, "%s: cannot read root inode (%d)\n",
+ fprintf(stderr, _("%s: cannot read root inode (%d)\n"),
progname, error);
return NULL;
}
}
/*
- * Release any resourse obtained during a mount.
+ * Release any resource obtained during a mount.
*/
void
libxfs_umount(xfs_mount_t *mp)
/*
- * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
- *
+ * Copyright (c) 2000-2002 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
+ * 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/
*/
+#ifndef LIBXFS_INIT_H
+#define LIBXFS_INIT_H
-char *setup_proto(char *fname);
-void parseproto(xfs_mount_t *mp, xfs_inode_t *pip, char **pp, char *name);
-void res_failed(int err);
+struct stat64;
+
+extern int check_ismounted (char *path, char *block,
+ struct stat64 *sptr, int verbose);
+extern int check_iswritable (char *path, char *block,
+ struct stat64 *sptr, int fatal);
+extern __int64_t findsize (char *path);
+extern void set_blocksize (int fd, char *path, int blocksize);
+extern void flush_device (int fd);
+
+#endif /* LIBXFS_INIT_H */
--- /dev/null
+/*
+ * Copyright (c) 2000-2002 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://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#define ustat __kernel_ustat
+#include <libxfs.h>
+#include <mntent.h>
+#include <sys/stat.h>
+#undef ustat
+#include <sys/ustat.h>
+#include <sys/mount.h>
+#include <sys/ioctl.h>
+
+extern char *progname;
+
+#ifndef BLKGETSIZE64
+# define BLKGETSIZE64 _IOR(0x12,114,sizeof(__uint64_t))
+#endif
+#ifndef BLKBSZSET
+# define BLKBSZSET _IOW(0x12,113,sizeof(int))
+#endif
+
+#define PROC_MOUNTED "/proc/mounts"
+
+int
+check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
+{
+ struct ustat ust;
+ struct stat64 st;
+
+ if (!s) {
+ if (stat64(block, &st) < 0)
+ return 0;
+ if ((st.st_mode & S_IFMT) != S_IFBLK)
+ return 0;
+ s = &st;
+ }
+
+ if (ustat(s->st_rdev, &ust) >= 0) {
+ if (verbose)
+ fprintf(stderr,
+ _("%s: %s contains a mounted filesystem\n"),
+ progname, name);
+ return 1;
+ }
+ return 0;
+}
+
+int
+check_iswritable(char *name, char *block, struct stat64 *s, int fatal)
+{
+ int sts = 0;
+ FILE *f;
+ struct stat64 mst;
+ struct mntent *mnt;
+ char mounts[MAXPATHLEN];
+
+ strcpy(mounts, access(PROC_MOUNTED, R_OK)? PROC_MOUNTED : MOUNTED);
+ if ((f = setmntent(mounts, "r")) == NULL) {
+ fprintf(stderr, _("%s: %s contains a possibly writable, "
+ "mounted filesystem\n"), progname, name);
+ return fatal;
+ }
+ while ((mnt = getmntent(f)) != NULL) {
+ if (stat64(mnt->mnt_fsname, &mst) < 0)
+ continue;
+ if ((mst.st_mode & S_IFMT) != S_IFBLK)
+ continue;
+ if (mst.st_rdev == s->st_rdev
+ && hasmntopt(mnt, MNTOPT_RO) != NULL)
+ break;
+ }
+ if (mnt != NULL) {
+ fprintf(stderr, _("%s: %s contains a mounted and writable "
+ "filesystem\n"), progname, name);
+ sts = fatal;
+ }
+ endmntent(f);
+ return sts;
+}
+
+void
+set_blocksize(int fd, char *path, int blocksize)
+{
+ if (ioctl(fd, BLKBSZSET, &blocksize) < 0) {
+ fprintf(stderr, _("%s: warning - cannot set blocksize "
+ "on block device %s: %s\n"),
+ progname, path, strerror(errno));
+ }
+}
+
+void
+flush_device(int fd)
+{
+ ioctl(fd, BLKFLSBUF, 0);
+}
+
+__int64_t
+findsize(char *path)
+{
+ int fd;
+ int error;
+ __int64_t ssize;
+ __uint64_t size;
+ struct stat64 st;
+
+ if (stat64(path, &st) < 0) {
+ fprintf(stderr, _("%s: "
+ "cannot stat the device file \"%s\": %s\n"),
+ progname, path, strerror(errno));
+ exit(1);
+ }
+ if ((st.st_mode & S_IFMT) == S_IFREG)
+ return (__int64_t)(st.st_size >> 9);
+
+ if ((fd = open(path, O_RDONLY, 0)) < 0) {
+ fprintf(stderr, _("%s: "
+ "error opening the device special file \"%s\": %s\n"),
+ progname, path, strerror(errno));
+ exit(1);
+ }
+
+ error = ioctl(fd, BLKGETSIZE64, &size);
+ if (error >= 0) {
+ /* BLKGETSIZE64 returns size in bytes not 512-byte blocks */
+ ssize = size >> 9;
+ } else {
+ /* If BLKGETSIZE64 fails, try BLKGETSIZE */
+ unsigned long tmpsize;
+ error = ioctl(fd, BLKGETSIZE, &tmpsize);
+ if (error < 0) {
+ fprintf(stderr, _("%s: can't determine device size\n"),
+ progname);
+ exit(1);
+ }
+ ssize = (__int64_t)tmpsize;
+ }
+
+ close(fd);
+
+ return ssize;
+}
size = BDSTRAT_SIZE <= BBTOB(len) ? BDSTRAT_SIZE : BBTOB(len);
if ((z = memalign(getpagesize(), size)) == NULL) {
- fprintf(stderr, "%s: device_zero can't memalign %d bytes: %s\n",
- progname, size, strerror(errno));
+ fprintf(stderr,
+ _("%s: %s can't memalign %d bytes: %s\n"),
+ progname, __FUNCTION__, size, strerror(errno));
exit(1);
}
memset(z, 0, size);
nblks = (uint)(start + len - bno);
if (pwrite64(fd, z, BBTOB(nblks), BBTOOFF64(bno)) <
BBTOB(nblks)) {
- fprintf(stderr, "%s: device_zero write failed: %s\n",
- progname, strerror(errno));
+ fprintf(stderr,
+ _("%s: %s write failed: %s\n"),
+ progname, __FUNCTION__, strerror(errno));
exit(1);
}
bno += nblks;
total = sizeof(xfs_buf_t) + BBTOB(len);
if ((buf = calloc(total, 1)) == NULL) {
- fprintf(stderr, "%s: buf calloc failed (%ld bytes): %s\n",
+ fprintf(stderr, _("%s: buf calloc failed (%ld bytes): %s\n"),
progname, (long)total, strerror(errno));
exit(1);
}
}
int
-libxfs_readbufr(dev_t dev, xfs_daddr_t blkno, xfs_buf_t *buf, int len, int die)
+libxfs_readbufr(dev_t dev, xfs_daddr_t blkno, xfs_buf_t *buf, int len, int flags)
{
int fd = libxfs_device_to_fd(dev);
ASSERT(BBTOB(len) <= buf->b_bcount);
if (pread64(fd, buf->b_addr, BBTOB(len), BBTOOFF64(blkno)) < 0) {
- fprintf(stderr, "%s: read failed: %s\n",
+ fprintf(stderr, _("%s: read failed: %s\n"),
progname, strerror(errno));
- if (die)
+ if (flags & LIBXFS_EXIT_ON_FAILURE)
exit(1);
return errno;
}
}
xfs_buf_t *
-libxfs_readbuf(dev_t dev, xfs_daddr_t blkno, int len, int die)
+libxfs_readbuf(dev_t dev, xfs_daddr_t blkno, int len, int flags)
{
xfs_buf_t *buf;
int error;
buf = libxfs_getbuf(dev, blkno, len);
- error = libxfs_readbufr(dev, blkno, buf, len, die);
+ error = libxfs_readbufr(dev, blkno, buf, len, flags);
if (error) {
libxfs_putbuf(buf);
return NULL;
}
xfs_buf_t *
-libxfs_getsb(xfs_mount_t *mp, int die)
+libxfs_getsb(xfs_mount_t *mp, int flags)
{
return libxfs_readbuf(mp->m_dev, XFS_SB_DADDR,
- XFS_FSB_TO_BB(mp, 1), die);
+ XFS_FSB_TO_BB(mp, 1), flags);
}
int
-libxfs_writebuf_int(xfs_buf_t *buf, int die)
+libxfs_writebuf_int(xfs_buf_t *buf, int flags)
{
int sts;
int fd = libxfs_device_to_fd(buf->b_dev);
#endif
sts = pwrite64(fd, buf->b_addr, buf->b_bcount, BBTOOFF64(buf->b_blkno));
if (sts < 0) {
- fprintf(stderr, "%s: write failed: %s\n",
+ fprintf(stderr, _("%s: pwrite64 failed: %s\n"),
progname, strerror(errno));
- ASSERT(0);
- if (die)
+ if (flags & LIBXFS_EXIT_ON_FAILURE)
exit(1);
return errno;
}
else if (sts != buf->b_bcount) {
- fprintf(stderr, "%s: error - wrote only %d of %d bytes\n",
+ fprintf(stderr, _("%s: error - wrote only %d of %d bytes\n"),
progname, sts, buf->b_bcount);
- if (die)
+ if (flags & LIBXFS_EXIT_ON_FAILURE)
exit(1);
return EIO;
}
}
int
-libxfs_writebuf(xfs_buf_t *buf, int die)
+libxfs_writebuf(xfs_buf_t *buf, int flags)
{
- int error = libxfs_writebuf_int(buf, die);
+ int error = libxfs_writebuf_int(buf, flags);
libxfs_putbuf(buf);
return error;
}
xfs_zone_t *ptr;
if ((ptr = malloc(sizeof(xfs_zone_t))) == NULL) {
- fprintf(stderr, "%s: zone init failed (%s, %d bytes): %s\n",
+ fprintf(stderr, _("%s: zone init failed (%s, %d bytes): %s\n"),
progname, name, (int)sizeof(xfs_zone_t), strerror(errno));
exit(1);
}
{
void *ptr;
- ASSERT(z != NULL);
if ((ptr = calloc(z->zone_unitsize, 1)) == NULL) {
- fprintf(stderr, "%s: zone calloc failed (%s, %d bytes): %s\n",
+ fprintf(stderr, _("%s: zone calloc failed (%s, %d bytes): %s\n"),
progname, z->zone_name, z->zone_unitsize,
strerror(errno));
exit(1);
void *ptr;
if ((ptr = calloc(1, size)) == NULL) {
- fprintf(stderr, "%s: calloc failed (%d bytes): %s\n",
+ fprintf(stderr, _("%s: calloc failed (%d bytes): %s\n"),
progname, (int)size, strerror(errno));
exit(1);
}
void *optr=ptr;
#endif
if ((ptr = realloc(ptr, size)) == NULL) {
- fprintf(stderr, "%s: realloc failed (%d bytes): %s\n",
+ fprintf(stderr, _("%s: realloc failed (%d bytes): %s\n"),
progname, (int)size, strerror(errno));
exit(1);
}
bp = libxfs_getbuf(mp->m_dev, XFS_SB_DADDR, 1);
libxfs_xlate_sb(XFS_BUF_PTR(bp), &mp->m_sb, -1, ARCH_CONVERT,
XFS_SB_ALL_BITS);
- libxfs_writebuf(bp, 1);
+ libxfs_writebuf(bp, LIBXFS_EXIT_ON_FAILURE);
}
xfs_trans_t *ptr;
if ((ptr = calloc(sizeof(xfs_trans_t), 1)) == NULL) {
- fprintf(stderr, "%s: xact calloc failed (%d bytes): %s\n",
+ fprintf(stderr, _("%s: xact calloc failed (%d bytes): %s\n"),
progname, (int)sizeof(xfs_trans_t), strerror(errno));
exit(1);
}
*/
error = libxfs_itobp(mp, NULL, ip, &dip, &bp, 0);
if (error) {
- fprintf(stderr, "%s: warning - itobp failed (%d)\n",
+ fprintf(stderr, _("%s: warning - itobp failed (%d)\n"),
progname, error);
goto ili_done;
}
XFS_BUF_SET_FSPRIVATE(bp, iip);
error = libxfs_iflush_int(ip, bp);
if (error) {
- fprintf(stderr, "%s: warning - iflush_int failed (%d)\n",
+ fprintf(stderr, _("%s: warning - iflush_int failed (%d)\n"),
progname, error);
goto ili_done;
}
else if (lip->li_type == XFS_LI_INODE)
inode_item_done((xfs_inode_log_item_t *)lidp->lid_item);
else {
- fprintf(stderr, "%s: unrecognised log item type\n",
+ fprintf(stderr, _("%s: unrecognised log item type\n"),
progname);
ASSERT(0);
}
iip->ili_flags &= ~XFS_ILI_HOLD;
}
else {
- fprintf(stderr, "%s: unrecognised log item type\n",
+ fprintf(stderr, _("%s: unrecognised log item type\n"),
progname);
ASSERT(0);
}
xfs_trans_commit(*tp, 0, NULL);
*tp = ntp;
if ((i = xfs_trans_reserve(*tp, 0, 0, 0, 0, 0))) {
- fprintf(stderr, "%s: cannot reserve space: %s\n",
+ fprintf(stderr, _("%s: cannot reserve space: %s\n"),
progname, strerror(errno));
exit(1);
}
xfs_buf_t **bpp) /* buffer for the ag free block array */
{
xfs_buf_t *bp; /* return value */
- xfs_daddr_t d; /* disk block address */
int error;
ASSERT(agno != NULLAGNUMBER);
- d = XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR);
- if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d, 1, 0, &bp)))
+ error = xfs_trans_read_buf(
+ mp, tp, mp->m_ddev_targp,
+ XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR(mp)),
+ XFS_FSS_TO_BB(mp, 1), 0, &bp);
+ if (error)
return error;
ASSERT(bp);
ASSERT(!XFS_BUF_GETERROR(bp));
(void *)(__psunsigned_t)INT_GET(agf->agf_seqno, ARCH_CONVERT),
(void *)(__psunsigned_t)INT_GET(agf->agf_length, ARCH_CONVERT),
(void *)(__psunsigned_t)INT_GET(agf->agf_roots[XFS_BTNUM_BNO],
- ARCH_CONVERT);
+ ARCH_CONVERT),
(void *)(__psunsigned_t)INT_GET(agf->agf_roots[XFS_BTNUM_CNT],
- ARCH_CONVERT);
+ ARCH_CONVERT),
(void *)(__psunsigned_t)INT_GET(agf->agf_levels[XFS_BTNUM_BNO],
- ARCH_CONVERT);
+ ARCH_CONVERT),
(void *)(__psunsigned_t)INT_GET(agf->agf_levels[XFS_BTNUM_CNT],
- ARCH_CONVERT);
+ ARCH_CONVERT),
(void *)(__psunsigned_t)INT_GET(agf->agf_flfirst, ARCH_CONVERT),
(void *)(__psunsigned_t)INT_GET(agf->agf_fllast, ARCH_CONVERT),
(void *)(__psunsigned_t)INT_GET(agf->agf_flcount, ARCH_CONVERT),
bno = INT_GET(agfl->agfl_bno[INT_GET(agf->agf_flfirst, ARCH_CONVERT)], ARCH_CONVERT);
INT_MOD(agf->agf_flfirst, ARCH_CONVERT, 1);
xfs_trans_brelse(tp, agflbp);
- if (INT_GET(agf->agf_flfirst, ARCH_CONVERT) == XFS_AGFL_SIZE)
+ if (INT_GET(agf->agf_flfirst, ARCH_CONVERT) == XFS_AGFL_SIZE(mp))
INT_ZERO(agf->agf_flfirst, ARCH_CONVERT);
pag = &mp->m_perag[INT_GET(agf->agf_seqno, ARCH_CONVERT)];
INT_MOD(agf->agf_flcount, ARCH_CONVERT, -1);
return error;
agfl = XFS_BUF_TO_AGFL(agflbp);
INT_MOD(agf->agf_fllast, ARCH_CONVERT, 1);
- if (INT_GET(agf->agf_fllast, ARCH_CONVERT) == XFS_AGFL_SIZE)
+ if (INT_GET(agf->agf_fllast, ARCH_CONVERT) == XFS_AGFL_SIZE(mp))
INT_ZERO(agf->agf_fllast, ARCH_CONVERT);
pag = &mp->m_perag[INT_GET(agf->agf_seqno, ARCH_CONVERT)];
INT_MOD(agf->agf_flcount, ARCH_CONVERT, 1);
xfs_trans_agflist_delta(tp, 1);
pag->pagf_flcount++;
- ASSERT(INT_GET(agf->agf_flcount, ARCH_CONVERT) <= XFS_AGFL_SIZE);
+ ASSERT(INT_GET(agf->agf_flcount, ARCH_CONVERT) <= XFS_AGFL_SIZE(mp));
blockp = &agfl->agfl_bno[INT_GET(agf->agf_fllast, ARCH_CONVERT)];
INT_SET(*blockp, ARCH_CONVERT, bno);
TRACE_MODAGF(NULL, agf, XFS_AGF_FLLAST | XFS_AGF_FLCOUNT);
xfs_agf_t *agf; /* ag freelist header */
int agf_ok; /* set if agf is consistent */
xfs_buf_t *bp; /* return value */
- xfs_daddr_t d; /* disk block address */
- int error;
xfs_perag_t *pag; /* per allocation group data */
+ int error;
ASSERT(agno != NULLAGNUMBER);
- d = XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR);
- if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d, 1,
+ error = xfs_trans_read_buf(
+ mp, tp, mp->m_ddev_targp,
+ XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),
+ XFS_FSS_TO_BB(mp, 1),
(flags & XFS_ALLOC_FLAG_TRYLOCK) ? XFS_BUF_TRYLOCK : 0U,
- &bp)))
+ &bp);
+ if (error)
return error;
ASSERT(!bp || !XFS_BUF_GETERROR(bp));
if (!bp) {
agf = XFS_BUF_TO_AGF(bp);
agf_ok =
INT_GET(agf->agf_magicnum, ARCH_CONVERT) == XFS_AGF_MAGIC &&
- XFS_AGF_GOOD_VERSION(INT_GET(agf->agf_versionnum, ARCH_CONVERT)) &&
+ XFS_AGF_GOOD_VERSION(
+ INT_GET(agf->agf_versionnum, ARCH_CONVERT)) &&
INT_GET(agf->agf_freeblks, ARCH_CONVERT) <=
INT_GET(agf->agf_length, ARCH_CONVERT) &&
- INT_GET(agf->agf_flfirst, ARCH_CONVERT) < XFS_AGFL_SIZE &&
- INT_GET(agf->agf_fllast, ARCH_CONVERT) < XFS_AGFL_SIZE &&
- INT_GET(agf->agf_flcount, ARCH_CONVERT) <= XFS_AGFL_SIZE;
+ INT_GET(agf->agf_flfirst, ARCH_CONVERT) < XFS_AGFL_SIZE(mp) &&
+ INT_GET(agf->agf_fllast, ARCH_CONVERT) < XFS_AGFL_SIZE(mp) &&
+ INT_GET(agf->agf_flcount, ARCH_CONVERT) <= XFS_AGFL_SIZE(mp);
if (XFS_TEST_ERROR(!agf_ok, mp, XFS_ERRTAG_ALLOC_READ_AGF,
XFS_RANDOM_ALLOC_READ_AGF)) {
xfs_trans_brelse(tp, bp);
cmn_err(CE_NOTE, "Bad freeblks %d %d",
INT_GET(agf->agf_freeblks, ARCH_CONVERT),
INT_GET(agf->agf_length, ARCH_CONVERT));
- if (!(INT_GET(agf->agf_flfirst, ARCH_CONVERT) < XFS_AGFL_SIZE))
+ if (!(INT_GET(agf->agf_flfirst, ARCH_CONVERT) < XFS_AGFL_SIZE(mp)))
cmn_err(CE_NOTE, "Bad flfirst %d",
INT_GET(agf->agf_flfirst, ARCH_CONVERT));
- if (!(INT_GET(agf->agf_fllast, ARCH_CONVERT) < XFS_AGFL_SIZE))
+ if (!(INT_GET(agf->agf_fllast, ARCH_CONVERT) < XFS_AGFL_SIZE(mp)))
cmn_err(CE_NOTE, "Bad fllast %d",
INT_GET(agf->agf_fllast, ARCH_CONVERT));
- if (!(INT_GET(agf->agf_flcount, ARCH_CONVERT) <= XFS_AGFL_SIZE))
+ if (!(INT_GET(agf->agf_flcount, ARCH_CONVERT) <= XFS_AGFL_SIZE(mp)))
cmn_err(CE_NOTE, "Bad flcount %d",
INT_GET(agf->agf_flcount, ARCH_CONVERT));
#endif
xfs_agi_t *agi; /* allocation group header */
agi = XFS_BUF_TO_AGI(bp);
- ASSERT(INT_GET(agi->agi_magicnum, ARCH_CONVERT) ==
- XFS_AGI_MAGIC);
+ ASSERT(INT_GET(agi->agi_magicnum, ARCH_CONVERT) == XFS_AGI_MAGIC);
#endif
/*
* Compute byte offsets for the first and last fields.
xfs_agi_t *agi; /* allocation group header */
int agi_ok; /* agi is consistent */
xfs_buf_t *bp; /* allocation group hdr buf */
- xfs_daddr_t d; /* disk block address */
- int error;
-#ifdef DEBUG
- int i;
-#endif
xfs_perag_t *pag; /* per allocation group data */
-
+ int error;
ASSERT(agno != NULLAGNUMBER);
- d = XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR);
- if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d, 1, 0, &bp)))
+ error = xfs_trans_read_buf(
+ mp, tp, mp->m_ddev_targp,
+ XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
+ XFS_FSS_TO_BB(mp, 1), 0, &bp);
+ if (error)
return error;
ASSERT(bp && !XFS_BUF_GETERROR(bp));
+
/*
* Validate the magic number of the agi block.
*/
agi = XFS_BUF_TO_AGI(bp);
agi_ok =
INT_GET(agi->agi_magicnum, ARCH_CONVERT) == XFS_AGI_MAGIC &&
- XFS_AGI_GOOD_VERSION(INT_GET(agi->agi_versionnum, ARCH_CONVERT));
+ XFS_AGI_GOOD_VERSION(
+ INT_GET(agi->agi_versionnum, ARCH_CONVERT));
if (XFS_TEST_ERROR(!agi_ok, mp, XFS_ERRTAG_IALLOC_READ_AGI,
XFS_RANDOM_IALLOC_READ_AGI)) {
xfs_trans_brelse(tp, bp);
* It's possible for these to be out of sync if
* we are in the middle of a forced shutdown.
*/
- ASSERT(pag->pagi_freecount == INT_GET(agi->agi_freecount, ARCH_CONVERT)
+ ASSERT(pag->pagi_freecount ==
+ INT_GET(agi->agi_freecount, ARCH_CONVERT)
|| XFS_FORCED_SHUTDOWN(mp));
}
+
#ifdef DEBUG
- for (i = 0; i < XFS_AGI_UNLINKED_BUCKETS; i++)
- ASSERT(!INT_ISZERO(agi->agi_unlinked[i], ARCH_CONVERT));
+ {
+ int i;
+
+ for (i = 0; i < XFS_AGI_UNLINKED_BUCKETS; i++)
+ ASSERT(!INT_ISZERO(agi->agi_unlinked[i], ARCH_CONVERT));
+ }
#endif
+
XFS_BUF_SET_VTYPE_REF(bp, B_FS_AGI, XFS_AGI_REF);
*bpp = bp;
return 0;
mp->m_maxagi = mp->m_sb.sb_agcount;
mp->m_blkbit_log = sbp->sb_blocklog + XFS_NBBYLOG;
mp->m_blkbb_log = sbp->sb_blocklog - BBSHIFT;
+ mp->m_sectbb_log = sbp->sb_sectlog - BBSHIFT;
mp->m_agno_log = xfs_highbit32(sbp->sb_agcount - 1) + 1;
mp->m_agino_log = sbp->sb_inopblog + sbp->sb_agblklog;
mp->m_litino = sbp->sb_inodesize -
{ offsetof(xfs_sb_t, sb_unit), 0 },
{ offsetof(xfs_sb_t, sb_width), 0 },
{ offsetof(xfs_sb_t, sb_dirblklog), 0 },
- { offsetof(xfs_sb_t, sb_dummy), 1 },
+ { offsetof(xfs_sb_t, sb_logsectlog), 0 },
+ { offsetof(xfs_sb_t, sb_logsectsize),0 },
{ offsetof(xfs_sb_t, sb_logsunit), 0 },
{ sizeof(xfs_sb_t), 0 }
};
uuid_unparse(mp->m_sb.sb_uuid, uu_sb);
uuid_unparse(head->h_fs_uuid, uu_log);
- printf("* ERROR: mismatched uuid in log\n"
- "* SB : %s\n* log: %s\n",
+ printf(_("* ERROR: mismatched uuid in log\n"
+ "* SB : %s\n* log: %s\n"),
uu_sb, uu_log);
memcpy(&mp->m_sb.sb_uuid, head->h_fs_uuid, sizeof(uuid_t));
xlog_header_check_recover(xfs_mount_t *mp, xlog_rec_header_t *head)
{
if (print_record_header)
- printf("\nLOG REC AT LSN cycle %d block %d (0x%x, 0x%x)\n",
+ printf(_("\nLOG REC AT LSN cycle %d block %d (0x%x, 0x%x)\n"),
CYCLE_LSN(head->h_lsn, ARCH_CONVERT),
BLOCK_LSN(head->h_lsn, ARCH_CONVERT),
CYCLE_LSN(head->h_lsn, ARCH_CONVERT),
if (INT_GET(head->h_magicno, ARCH_CONVERT) != XLOG_HEADER_MAGIC_NUM) {
- printf("* ERROR: bad magic number in log header: 0x%x\n",
+ printf(_("* ERROR: bad magic number in log header: 0x%x\n"),
INT_GET(head->h_magicno, ARCH_CONVERT));
} else if (header_check_uuid(mp, head)) {
} else if (INT_GET(head->h_fmt, ARCH_CONVERT) != XLOG_FMT) {
- printf("* ERROR: log format incompatible (log=%d, ours=%d)\n",
+ printf(_("* ERROR: log format incompatible (log=%d, ours=%d)\n"),
INT_GET(head->h_fmt, ARCH_CONVERT), XLOG_FMT);
} else {
/* bail out now or just carry on regardless */
if (print_exit)
- xlog_exit("Bad log");
+ xlog_exit(_("Bad log"));
return 0;
}
if (header_check_uuid(mp, head)) {
/* bail out now or just carry on regardless */
if (print_exit)
- xlog_exit("Bad log");
+ xlog_exit(_("Bad log"));
}
return 0;
}
.SH SYNOPSIS
.nf
\f3mkfs.xfs\f1 [ \f3\-b\f1 subopt=value ] [ \f3\-d\f1 subopt[=value] ]
- [ \f3\-i\f1 subopt=value ] [ \f3\-l\f1 subopt[=value] ]
+ [ \f3\-i\f1 subopt=value ] [ \f3\-l\f1 subopt[=value] ] [ \f3\-f\f1 ]
[ \f3\-n\f1 subopt[=value] ] [ \f3\-p\f1 protofile ] [ \f3\-q\f1 ]
[ \f3\-r\f1 subopt[=value] ] [ \f3\-N\f1 ] [ \f3\-L\f1 label ] device
.fi
Sizes are treated as hexadecimal if prefixed by 0x or 0X,
octal if prefixed by 0, or decimal otherwise.
If suffixed with \f3s\f1 then the size is converted by multiplying it
-by 512 (sector size).
+by the filesystems sector size (defaults to 512, see \f3\-s\f1 option below).
If suffixed with \f3b\f1 then the size is converted by multiplying it
-by the filesystem's block size.
+by the filesystems block size (defaults to 4K, see \f3\-b\f1 option below).
If suffixed with \f3k\f1 then the size is converted by multiplying it by 1024.
If suffixed with \f3m\f1 then the size is converted by multiplying it by
1048576 (1024 * 1024).
filesystem should occupy
less space than the size of the partition or logical volume containing the section.
.TP
+.B \-s
+Sector size options.
+.IP
+This option specifies the fundamental sector size of the filesystem.
+The valid suboptions are:
+.BI log= value
+and
+\f3size=\f1\f2value\f1;
+only one can be supplied.
+The sector size is specified either as a base two logarithm value with
+.BR log= ,
+or in bytes with
+.BR size= .
+The default value is 512 bytes.
+.\" The minimum value for sector size is 512; the maximum is 32768 (32 KB).
+.\" The sector size cannot be made larger than the filesystem block size.
+This option is not yet implemented and sector size other than 512
+bytes cannot be set at this stage.
+.TP
\f3\-L\f1 \f2label\f1
Set the filesystem label.
XFS filesystem labels can be at most 12 characters long; if
Causes the file system parameters to be printed out without really
creating the file system.
.SH SEE ALSO
+xfs(5),
mkfs(8),
mount(8),
xfs_info(8),
static void
usage(void)
{
- fprintf(stderr, "%s: [-npv] <size> <name1> [<name2>] ...\n", progname);
+ fprintf(stderr, _("%s: [-npv] <size> <name1> [<name2>] ...\n"),
+ progname);
exit(2);
}
fstatfs(fd, &buf);
if (statfstype(&buf) != XFS_SUPER_MAGIC) {
- fprintf(stderr, "%s: "
- "file [\"%s\"] is not on an XFS filesystem\n",
+ fprintf(stderr, _("%s: "
+ "file [\"%s\"] is not on an XFS filesystem\n"),
progname, name);
return -1;
}
xfs_flock64_t flck;
progname = basename(argv[0]);
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
while ((c = getopt(argc, argv, "npvV")) != EOF) {
switch(c) {
case 'n':
verbose++;
break;
case 'V':
- printf("%s version %s\n", progname, VERSION);
+ printf(_("%s version %s\n"), progname, VERSION);
exit(0);
default:
errflg++;
mult *= 1024;
break;
default:
- fprintf(stderr, "unknown size %s\n", argv[optind]);
+ fprintf(stderr, _("unknown size %s\n"), argv[optind]);
usage();
}
while (optind < argc) {
if (verbose)
- fprintf(stdout, "%s %lld bytes %s\n",
+ fprintf(stdout, _("%s %lld bytes %s\n"),
argv[optind], (long long)size,
prealloc
- ? "(pre-allocated)"
+ ? _("(pre-allocated)")
: "");
oflags = O_CREAT|O_TRUNC|O_WRONLY|(nobytes ? 0 : O_DIRECT);
}
if ((result = lseek64(fd, size - 1, SEEK_SET)) < 0LL) {
- /*
- * This check doesn't actually work for 6.2
- * efs and nfs2, although it should.
- */
- fprintf(stderr, "lseek64 error, result = %lld\n",
+ fprintf(stderr, _("lseek64 error, result = %lld\n"),
(long long)result);
if (errno)
perror(argv[optind]);
flck.l_start = 0LL;
flck.l_len = size;
if (prealloc)
- (void)ioctl(fd, XFS_IOC_RESVSP64, &flck);
+ ioctl(fd, XFS_IOC_RESVSP64, &flck);
if (oflags & O_DIRECT) {
nbufalign = da.d_mem;
MAXTRRES = maxtrres
FSTYP = fstyp
-HFILES = xfs_mkfs.h proto.h
-CFILES = $(HFILES:.h=.c)
+HFILES = xfs_mkfs.h
+CFILES = trtab.c proto.c xfs_mkfs.c
LLDLIBS = $(LIBXFS) $(LIBUUID) $(LIBDISK)
LTDEPENDENCIES = $(LIBXFS) $(LIBDISK)
int
main(int argc, char **argv)
{
- int bl;
- int dl;
- int dv;
- int i;
- int il;
+ unsigned int sl, bl, il, dl, dv;
+ unsigned int i, mul;
xfs_mount_t m;
xfs_sb_t *sbp;
- int mul;
progname = basename(argv[0]);
if (argc > 1) {
memset(&m, 0, sizeof(m));
sbp = &m.m_sb;
sbp->sb_magicnum = XFS_SB_MAGIC;
- sbp->sb_sectlog = 9;
- sbp->sb_sectsize = 1 << sbp->sb_sectlog;
- for (bl = XFS_MIN_BLOCKSIZE_LOG; bl <= XFS_MAX_BLOCKSIZE_LOG; bl++) {
- sbp->sb_blocklog = bl;
- sbp->sb_blocksize = 1 << bl;
- sbp->sb_agblocks = XFS_AG_MIN_BYTES / (1 << bl);
- for (il = XFS_DINODE_MIN_LOG; il <= XFS_DINODE_MAX_LOG; il++) {
- if ((1 << il) > (1 << bl) / XFS_MIN_INODE_PERBLOCK)
+
+ for (sl = XFS_MIN_SECTORSIZE_LOG;
+ sl <= XFS_MAX_SECTORSIZE_LOG;
+ sl++) {
+ sbp->sb_sectlog = sl;
+ sbp->sb_sectsize = 1 << sbp->sb_sectlog;
+
+ for (bl = XFS_MIN_BLOCKSIZE_LOG;
+ bl <= XFS_MAX_BLOCKSIZE_LOG;
+ bl++) {
+ if (bl < sl)
continue;
- sbp->sb_inodelog = il;
- sbp->sb_inopblog = bl - il;
- sbp->sb_inodesize = 1 << il;
- sbp->sb_inopblock = 1 << (bl - il);
- for (dl = bl; dl <= XFS_MAX_BLOCKSIZE_LOG; dl++) {
- sbp->sb_dirblklog = dl - bl;
- for (dv = 1; dv <= 2; dv++) {
- if (dv == 1 && dl != bl)
- continue;
- sbp->sb_versionnum =
- XFS_SB_VERSION_4 |
- (dv == 2 ?
- XFS_SB_VERSION_DIRV2BIT :
- 0);
- libxfs_mount(&m, sbp, 0, 0, 0, 0);
- i = max_trans_res(&m, &mul);
- printf(
- "#define\tMAXTRRES_B%d_I%d_D%d_V%d\t%lld\t"
- "/* LOG_FACTOR %d */\n",
- bl, il, dl, dv, (long long)
- XFS_B_TO_FSB(&m, i), mul);
- libxfs_umount(&m);
+ sbp->sb_blocklog = bl;
+ sbp->sb_blocksize = 1 << bl;
+ sbp->sb_agblocks = XFS_AG_MIN_BYTES / (1 << bl);
+
+ for (il = XFS_DINODE_MIN_LOG;
+ il <= XFS_DINODE_MAX_LOG;
+ il++) {
+ if ((1<<il) > (1<<bl) / XFS_MIN_INODE_PERBLOCK)
+ continue;
+ sbp->sb_inodelog = il;
+ sbp->sb_inopblog = bl - il;
+ sbp->sb_inodesize = 1 << il;
+ sbp->sb_inopblock = 1 << (bl - il);
+
+ for (dl = bl;
+ dl <= XFS_MAX_BLOCKSIZE_LOG;
+ dl++) {
+ sbp->sb_dirblklog = dl - bl;
+ for (dv = 1; dv <= 2; dv++) {
+ if (dv == 1 && dl != bl)
+ continue;
+ sbp->sb_versionnum =
+ XFS_SB_VERSION_4 |
+ (dv == 2 ?
+ XFS_SB_VERSION_DIRV2BIT : 0);
+ libxfs_mount(&m, sbp, 0,0,0,0);
+ i = max_trans_res(&m, &mul);
+ printf(
+ "#define\tMAXTRRES_S%d_B%d_I%d_D%d_V%d\t%lld\t"
+ "/* LOG_FACTOR %d */\n", sl, bl, il, dl, dv,
+ (long long)
+ XFS_B_TO_FSB(&m, i),
+ mul);
+ libxfs_umount(&m);
+ }
}
}
}
#include <libxfs.h>
#include <sys/stat.h>
-#include "proto.h"
+#include "xfs_mkfs.h"
/*
* Prototypes for internal functions.
*/
-extern long long cvtnum(int blocksize, char *s);
+extern long long cvtnum(int blocksize, int sectorsize, char *s);
extern void parseproto(xfs_mount_t *mp, xfs_inode_t *pip, char **pp,
char *name);
static long getnum(char **pp);
if (!fname)
return dflt;
if ((fd = open(fname, O_RDONLY)) < 0 || (size = filesize(fd)) < 0) {
- fprintf(stderr, "%s: failed to open %s: %s\n",
+ fprintf(stderr, _("%s: failed to open %s: %s\n"),
progname, fname, strerror(errno));
exit(1);
}
buf = malloc(size + 1);
if (read(fd, buf, size) < size) {
- fprintf(stderr, "%s: read failed on %s: %s\n",
+ fprintf(stderr, _("%s: read failed on %s: %s\n"),
progname, fname, strerror(errno));
exit(1);
}
if (buf[size - 1] != '\n') {
- fprintf(stderr, "%s: proto file %s premature EOF\n",
+ fprintf(stderr, _("%s: proto file %s premature EOF\n"),
progname, fname);
exit(1);
}
res_failed(
int i)
{
- fail("cannot reserve space", i);
+ fail(_("cannot reserve space"), i);
}
static void
}
}
if (!c) {
- fprintf(stderr, "%s: premature EOF in prototype file\n",
+ fprintf(stderr, _("%s: premature EOF in prototype file\n"),
progname);
exit(1);
}
error = libxfs_alloc_file_space(ip, 0, llen, 1, 0);
if (error) {
- fail("error reserving space for a file", error);
+ fail(_("error reserving space for a file"), error);
exit(1);
}
error = libxfs_bmapi(tp, ip, 0, nb, XFS_BMAPI_WRITE, first, nb,
&map, &nmap, flist);
if (error) {
- fail("error allocating space for a file", error);
+ fail(_("error allocating space for a file"), error);
}
if (nmap != 1) {
- fprintf(stderr, "%s: cannot allocate space for file\n",
+ fprintf(stderr,
+ _("%s: cannot allocate space for file\n"),
progname);
exit(1);
}
if (logit)
libxfs_trans_log_buf(tp, bp, 0, XFS_BUF_COUNT(bp) - 1);
else
- libxfs_writebuf(bp, 1);
+ libxfs_writebuf(bp, LIBXFS_EXIT_ON_FAILURE);
}
ip->i_d.di_size = len;
return flags;
fname = getstr(pp);
if ((fd = open(fname, O_RDONLY)) < 0 || (size = filesize(fd)) < 0) {
- fprintf(stderr, "%s: cannot open %s: %s\n",
+ fprintf(stderr, _("%s: cannot open %s: %s\n"),
progname, fname, strerror(errno));
exit(1);
}
if ((*len = (int)size)) {
buf = malloc(size);
if (read(fd, buf, size) < size) {
- fprintf(stderr, "%s: read failed on %s: %s\n",
+ fprintf(stderr, _("%s: read failed on %s: %s\n"),
progname, fname, strerror(errno));
exit(1);
}
error = libxfs_dir_createname(tp, pip, name, namelen,
inum, first, flist, total);
if (error)
- fail("directory createname error", error);
+ fail(_("directory createname error"), error);
}
static void
else
error = libxfs_dir_init(tp, dp, pdp);
if (error)
- fail("directory create error", error);
+ fail(_("directory create error"), error);
}
void
fmt = IF_FIFO;
break;
default:
- fprintf(stderr, "%s: bad format string %s\n", progname, mstr);
+ fprintf(stderr, _("%s: bad format string %s\n"),
+ progname, mstr);
exit(1);
}
mode = 0;
mode |= ISUID;
break;
default:
- fprintf(stderr, "%s: bad format string %s\n", progname, mstr);
+ fprintf(stderr, _("%s: bad format string %s\n"),
+ progname, mstr);
exit(1);
}
switch (mstr[2]) {
mode |= ISGID;
break;
default:
- fprintf(stderr, "%s: bad format string %s\n", progname, mstr);
+ fprintf(stderr, _("%s: bad format string %s\n"),
+ progname, mstr);
exit(1);
}
val = 0;
for (i = 3; i < 6; i++) {
if (mstr[i] < '0' || mstr[i] > '7') {
- fprintf(stderr, "%s: bad format string %s\n",
+ fprintf(stderr, _("%s: bad format string %s\n"),
progname, mstr);
exit(1);
}
error = libxfs_inode_alloc(&tp, pip, mode|IFREG, 1,
mp->m_dev, &creds, &ip);
if (error)
- fail("Inode allocation failed", error);
+ fail(_("Inode allocation failed"), error);
flags |= newfile(tp, ip, &flist, &first, 0, 0, buf, len);
if (buf)
free(buf);
case IF_RESERVED: /* pre-allocated space only */
value = getstr(pp);
- llen = cvtnum(mp->m_sb.sb_blocksize, value);
+ llen = cvtnum(mp->m_sb.sb_blocksize, mp->m_sb.sb_sectsize, value);
getres(tp, XFS_B_TO_FSB(mp, llen));
error = libxfs_inode_alloc(&tp, pip, mode|IFREG, 1,
mp->m_dev, &creds, &ip);
if (error)
- fail("Inode pre-allocation failed", error);
+ fail(_("Inode pre-allocation failed"), error);
libxfs_trans_ijoin(tp, pip, 0);
error = libxfs_bmap_finish(&tp, &flist, first, &committed);
if (error)
- fail("Pre-allocated file creation failed", error);
+ fail(_("Pre-allocated file creation failed"), error);
libxfs_trans_commit(tp, 0, NULL);
rsvfile(mp, ip, llen);
return;
error = libxfs_inode_alloc(&tp, pip, mode|IFBLK, 1,
makedev(majdev, mindev), &creds, &ip);
if (error) {
- fail("Inode allocation failed", error);
+ fail(_("Inode allocation failed"), error);
}
libxfs_trans_ijoin(tp, pip, 0);
i = strlen(name);
error = libxfs_inode_alloc(&tp, pip, mode|IFCHR, 1,
makedev(majdev, mindev), &creds, &ip);
if (error)
- fail("Inode allocation failed", error);
+ fail(_("Inode allocation failed"), error);
libxfs_trans_ijoin(tp, pip, 0);
i = strlen(name);
newdirent(mp, tp, pip, name, i, ip->i_ino, &first, &flist, 1);
error = libxfs_inode_alloc(&tp, pip, mode|IFIFO, 1,
mp->m_dev, &creds, &ip);
if (error)
- fail("Inode allocation failed", error);
+ fail(_("Inode allocation failed"), error);
libxfs_trans_ijoin(tp, pip, 0);
i = strlen(name);
newdirent(mp, tp, pip, name, i, ip->i_ino, &first, &flist, 1);
error = libxfs_inode_alloc(&tp, pip, mode|IFLNK, 1,
mp->m_dev, &creds, &ip);
if (error)
- fail("Inode allocation failed", error);
+ fail(_("Inode allocation failed"), error);
flags |= newfile(tp, ip, &flist, &first, 1, 1, buf, len);
libxfs_trans_ijoin(tp, pip, 0);
i = strlen(name);
error = libxfs_inode_alloc(&tp, pip, mode|IFDIR, 1,
mp->m_dev, &creds, &ip);
if (error)
- fail("Inode allocation failed", error);
+ fail(_("Inode allocation failed"), error);
ip->i_d.di_nlink++; /* account for . */
if (!pip) {
pip = ip;
libxfs_trans_log_inode(tp, ip, flags);
error = libxfs_bmap_finish(&tp, &flist, first, &committed);
if (error)
- fail("Directory creation failed", error);
+ fail(_("Directory creation failed"), error);
libxfs_trans_ihold(tp, ip);
libxfs_trans_commit(tp, 0, NULL);
/*
libxfs_trans_log_inode(tp, ip, flags);
error = libxfs_bmap_finish(&tp, &flist, first, &committed);
if (error) {
- fail("Error encountered creating file from prototype", error);
+ fail(_("Error encountered creating file from prototype file"),
+ error);
}
libxfs_trans_commit(tp, 0, NULL);
}
error = libxfs_inode_alloc(&tp, mp->m_rootip, IFREG, 1,
mp->m_dev, &creds, &rbmip);
if (error) {
- fail("Realtime bitmap inode allocation failed", error);
+ fail(_("Realtime bitmap inode allocation failed"), error);
}
/*
* Do our thing with rbmip before allocating rsumip,
error = libxfs_inode_alloc(&tp, mp->m_rootip, IFREG, 1,
mp->m_dev, &creds, &rsumip);
if (error) {
- fail("Realtime summary inode allocation failed", error);
+ fail(_("Realtime summary inode allocation failed"), error);
}
mp->m_sb.sb_rsumino = rsumip->i_ino;
rsumip->i_d.di_size = mp->m_rsumsize;
XFS_BMAPI_WRITE, &first, mp->m_sb.sb_rbmblocks,
map, &nmap, &flist);
if (error) {
- fail("Allocation of the realtime bitmap failed", error);
+ fail(_("Allocation of the realtime bitmap failed"),
+ error);
}
for (i = 0, ep = map; i < nmap; i++, ep++) {
libxfs_device_zero(mp->m_dev,
error = libxfs_bmap_finish(&tp, &flist, first, &committed);
if (error) {
- fail("Allocation of the realtime bitmap failed", error);
+ fail(_("Completion of the realtime bitmap failed"), error);
}
libxfs_trans_commit(tp, 0, NULL);
+
/*
* Give the summary file some zero-filled blocks.
*/
XFS_BMAPI_WRITE, &first, nsumblocks,
map, &nmap, &flist);
if (error) {
- fail("Allocation of the realtime bitmap failed", error);
+ fail(_("Allocation of the realtime summary failed"),
+ error);
}
for (i = 0, ep = map; i < nmap; i++, ep++) {
libxfs_device_zero(mp->m_dev,
}
error = libxfs_bmap_finish(&tp, &flist, first, &committed);
if (error) {
- fail("Allocation of the realtime bitmap failed", error);
+ fail(_("Completion of the realtime summary failed"), error);
}
libxfs_trans_commit(tp, 0, NULL);
+
/*
* Free the whole area using transactions.
* Do one transaction per bitmap block.
bno + NBBY * mp->m_sb.sb_blocksize);
error = libxfs_rtfree_extent(tp, bno, (xfs_extlen_t)(ebno-bno));
if (error) {
- fail("Error initializing the realtime bitmap", error);
+ fail(_("Error initializing the realtime space"),
+ error);
}
error = libxfs_bmap_finish(&tp, &flist, first, &committed);
if (error) {
- fail("Error initializing the realtime bitmap", error);
+ fail(_("Error completing the realtime space"), error);
}
libxfs_trans_commit(tp, 0, NULL);
}
--- /dev/null
+/*
+ * Copyright (c) 2002 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://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include <libxfs.h>
+#include "xfs_mkfs.h"
+#include "maxtrres.h"
+
+/*
+ * Maximum transaction reservation tables
+ *
+ * Version 1 directories:
+ * first dimension log(sectorsize) (base XFS_MIN_SECTORSIZE_LOG)
+ * second dimension log(blocksize) (base XFS_MIN_BLOCKSIZE_LOG)
+ * third dimension log(inodesize) (base XFS_DINODE_MIN_LOG)
+ *
+ * Version 2 directories:
+ * first dimension log(sectorsize) (base XFS_MIN_SECTORSIZE_LOG)
+ * second dimension log(blocksize) (base XFS_MIN_BLOCKSIZE_LOG)
+ * third dimension log(inodesize) (base XFS_DINODE_MIN_LOG)
+ * fourth dimension log(dirblocksize) (base XFS_MIN_BLOCKSIZE_LOG)
+ */
+
+const int max_trres_v1[DFL_S][DFL_B][DFL_I] = {
+
+ /* ssize (7) x bsize[==dsize] (8) x isize (4) */
+
+ { { MAXTRRES_S9_B9_I8_D9_V1, 0,
+ 0, 0 },
+ { MAXTRRES_S9_B10_I8_D10_V1, MAXTRRES_S9_B10_I9_D10_V1,
+ 0, 0 },
+ { MAXTRRES_S9_B11_I8_D11_V1, MAXTRRES_S9_B11_I9_D11_V1,
+ MAXTRRES_S9_B11_I10_D11_V1, 0 },
+ { MAXTRRES_S9_B12_I8_D12_V1, MAXTRRES_S9_B12_I9_D12_V1,
+ MAXTRRES_S9_B12_I10_D12_V1, MAXTRRES_S9_B12_I11_D12_V1 },
+ { MAXTRRES_S9_B13_I8_D13_V1, MAXTRRES_S9_B13_I9_D13_V1,
+ MAXTRRES_S9_B13_I10_D13_V1, MAXTRRES_S9_B13_I11_D13_V1 },
+ { MAXTRRES_S9_B14_I8_D14_V1, MAXTRRES_S9_B14_I9_D14_V1,
+ MAXTRRES_S9_B14_I10_D14_V1, MAXTRRES_S9_B14_I11_D14_V1 },
+ { MAXTRRES_S9_B15_I8_D15_V1, MAXTRRES_S9_B15_I9_D15_V1,
+ MAXTRRES_S9_B15_I10_D15_V1, MAXTRRES_S9_B15_I11_D15_V1 },
+ { MAXTRRES_S9_B16_I8_D16_V1, MAXTRRES_S9_B16_I9_D16_V1,
+ MAXTRRES_S9_B16_I10_D16_V1, MAXTRRES_S9_B16_I11_D16_V1 },
+ },
+
+ { { 0, 0, 0, 0 },
+ { MAXTRRES_S10_B10_I8_D10_V1, MAXTRRES_S10_B10_I9_D10_V1,
+ 0, 0 },
+ { MAXTRRES_S10_B11_I8_D11_V1, MAXTRRES_S10_B11_I9_D11_V1,
+ MAXTRRES_S10_B11_I10_D11_V1, 0 },
+ { MAXTRRES_S10_B12_I8_D12_V1, MAXTRRES_S10_B12_I9_D12_V1,
+ MAXTRRES_S10_B12_I10_D12_V1, MAXTRRES_S10_B12_I11_D12_V1 },
+ { MAXTRRES_S10_B13_I8_D13_V1, MAXTRRES_S10_B13_I9_D13_V1,
+ MAXTRRES_S10_B13_I10_D13_V1, MAXTRRES_S10_B13_I11_D13_V1 },
+ { MAXTRRES_S10_B14_I8_D14_V1, MAXTRRES_S10_B14_I9_D14_V1,
+ MAXTRRES_S10_B14_I10_D14_V1, MAXTRRES_S10_B14_I11_D14_V1 },
+ { MAXTRRES_S10_B15_I8_D15_V1, MAXTRRES_S10_B15_I9_D15_V1,
+ MAXTRRES_S10_B15_I10_D15_V1, MAXTRRES_S10_B15_I11_D15_V1 },
+ { MAXTRRES_S10_B16_I8_D16_V1, MAXTRRES_S10_B16_I9_D16_V1,
+ MAXTRRES_S10_B16_I10_D16_V1, MAXTRRES_S10_B16_I11_D16_V1 },
+ },
+
+ { { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { MAXTRRES_S11_B11_I8_D11_V1, MAXTRRES_S11_B11_I9_D11_V1,
+ MAXTRRES_S11_B11_I10_D11_V1, 0 },
+ { MAXTRRES_S11_B12_I8_D12_V1, MAXTRRES_S11_B12_I9_D12_V1,
+ MAXTRRES_S11_B12_I10_D12_V1, MAXTRRES_S11_B12_I11_D12_V1 },
+ { MAXTRRES_S11_B13_I8_D13_V1, MAXTRRES_S11_B13_I9_D13_V1,
+ MAXTRRES_S11_B13_I10_D13_V1, MAXTRRES_S11_B13_I11_D13_V1 },
+ { MAXTRRES_S11_B14_I8_D14_V1, MAXTRRES_S11_B14_I9_D14_V1,
+ MAXTRRES_S11_B14_I10_D14_V1, MAXTRRES_S11_B14_I11_D14_V1 },
+ { MAXTRRES_S11_B15_I8_D15_V1, MAXTRRES_S11_B15_I9_D15_V1,
+ MAXTRRES_S11_B15_I10_D15_V1, MAXTRRES_S11_B15_I11_D15_V1 },
+ { MAXTRRES_S11_B16_I8_D16_V1, MAXTRRES_S11_B16_I9_D16_V1,
+ MAXTRRES_S11_B16_I10_D16_V1, MAXTRRES_S11_B16_I11_D16_V1 },
+ },
+
+ { { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { MAXTRRES_S12_B12_I8_D12_V1, MAXTRRES_S12_B12_I9_D12_V1,
+ MAXTRRES_S12_B12_I10_D12_V1, MAXTRRES_S12_B12_I11_D12_V1 },
+ { MAXTRRES_S12_B13_I8_D13_V1, MAXTRRES_S12_B13_I9_D13_V1,
+ MAXTRRES_S12_B13_I10_D13_V1, MAXTRRES_S12_B13_I11_D13_V1 },
+ { MAXTRRES_S12_B14_I8_D14_V1, MAXTRRES_S12_B14_I9_D14_V1,
+ MAXTRRES_S12_B14_I10_D14_V1, MAXTRRES_S12_B14_I11_D14_V1 },
+ { MAXTRRES_S12_B15_I8_D15_V1, MAXTRRES_S12_B15_I9_D15_V1,
+ MAXTRRES_S12_B15_I10_D15_V1, MAXTRRES_S12_B15_I11_D15_V1 },
+ { MAXTRRES_S12_B16_I8_D16_V1, MAXTRRES_S12_B16_I9_D16_V1,
+ MAXTRRES_S12_B16_I10_D16_V1, MAXTRRES_S12_B16_I11_D16_V1 },
+ },
+
+ { { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { MAXTRRES_S13_B13_I8_D13_V1, MAXTRRES_S13_B13_I9_D13_V1,
+ MAXTRRES_S13_B13_I10_D13_V1, MAXTRRES_S13_B13_I11_D13_V1 },
+ { MAXTRRES_S13_B14_I8_D14_V1, MAXTRRES_S13_B14_I9_D14_V1,
+ MAXTRRES_S13_B14_I10_D14_V1, MAXTRRES_S13_B14_I11_D14_V1 },
+ { MAXTRRES_S13_B15_I8_D15_V1, MAXTRRES_S13_B15_I9_D15_V1,
+ MAXTRRES_S13_B15_I10_D15_V1, MAXTRRES_S13_B15_I11_D15_V1 },
+ { MAXTRRES_S13_B16_I8_D16_V1, MAXTRRES_S13_B16_I9_D16_V1,
+ MAXTRRES_S13_B16_I10_D16_V1, MAXTRRES_S13_B16_I11_D16_V1 },
+ },
+
+ { { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { MAXTRRES_S14_B14_I8_D14_V1, MAXTRRES_S14_B14_I9_D14_V1,
+ MAXTRRES_S14_B14_I10_D14_V1, MAXTRRES_S14_B14_I11_D14_V1 },
+ { MAXTRRES_S14_B15_I8_D15_V1, MAXTRRES_S14_B15_I9_D15_V1,
+ MAXTRRES_S14_B15_I10_D15_V1, MAXTRRES_S14_B15_I11_D15_V1 },
+ { MAXTRRES_S14_B16_I8_D16_V1, MAXTRRES_S14_B16_I9_D16_V1,
+ MAXTRRES_S14_B16_I10_D16_V1, MAXTRRES_S14_B16_I11_D16_V1 },
+ },
+
+ { { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { MAXTRRES_S15_B15_I8_D15_V1, MAXTRRES_S15_B15_I9_D15_V1,
+ MAXTRRES_S15_B15_I10_D15_V1, MAXTRRES_S15_B15_I11_D15_V1 },
+ { MAXTRRES_S15_B16_I8_D16_V1, MAXTRRES_S15_B16_I9_D16_V1,
+ MAXTRRES_S15_B16_I10_D16_V1, MAXTRRES_S15_B16_I11_D16_V1 },
+ },
+};
+
+
+const int max_trres_v2[DFL_S][DFL_B][DFL_I][DFL_D] = {
+
+ /* ssize (7) x bsize (8) x isize (4) x dsize (8) */
+
+ { { { MAXTRRES_S9_B9_I8_D9_V2, MAXTRRES_S9_B9_I8_D10_V2,
+ MAXTRRES_S9_B9_I8_D11_V2, MAXTRRES_S9_B9_I8_D12_V2,
+ MAXTRRES_S9_B9_I8_D13_V2, MAXTRRES_S9_B9_I8_D14_V2,
+ MAXTRRES_S9_B9_I8_D15_V2, MAXTRRES_S9_B9_I8_D16_V2 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, MAXTRRES_S9_B10_I8_D10_V2,
+ MAXTRRES_S9_B10_I8_D11_V2, MAXTRRES_S9_B10_I8_D12_V2,
+ MAXTRRES_S9_B10_I8_D13_V2, MAXTRRES_S9_B10_I8_D14_V2,
+ MAXTRRES_S9_B10_I8_D15_V2, MAXTRRES_S9_B10_I8_D16_V2 },
+ { 0, MAXTRRES_S9_B10_I9_D10_V2,
+ MAXTRRES_S9_B10_I9_D11_V2, MAXTRRES_S9_B10_I9_D12_V2,
+ MAXTRRES_S9_B10_I9_D13_V2, MAXTRRES_S9_B10_I9_D14_V2,
+ MAXTRRES_S9_B10_I9_D15_V2, MAXTRRES_S9_B10_I9_D16_V2 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0,
+ MAXTRRES_S9_B11_I8_D11_V2, MAXTRRES_S9_B11_I8_D12_V2,
+ MAXTRRES_S9_B11_I8_D13_V2, MAXTRRES_S9_B11_I8_D14_V2,
+ MAXTRRES_S9_B11_I8_D15_V2, MAXTRRES_S9_B11_I8_D16_V2 },
+ { 0, 0,
+ MAXTRRES_S9_B11_I9_D11_V2, MAXTRRES_S9_B11_I9_D12_V2,
+ MAXTRRES_S9_B11_I9_D13_V2, MAXTRRES_S9_B11_I9_D14_V2,
+ MAXTRRES_S9_B11_I9_D15_V2, MAXTRRES_S9_B11_I9_D16_V2 },
+ { 0, 0,
+ MAXTRRES_S9_B11_I10_D11_V2, MAXTRRES_S9_B11_I10_D12_V2,
+ MAXTRRES_S9_B11_I10_D13_V2, MAXTRRES_S9_B11_I10_D14_V2,
+ MAXTRRES_S9_B11_I10_D15_V2, MAXTRRES_S9_B11_I10_D16_V2 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0,
+ 0, MAXTRRES_S9_B12_I8_D12_V2,
+ MAXTRRES_S9_B12_I8_D13_V2, MAXTRRES_S9_B12_I8_D14_V2,
+ MAXTRRES_S9_B12_I8_D15_V2, MAXTRRES_S9_B12_I8_D16_V2 },
+ { 0, 0,
+ 0, MAXTRRES_S9_B12_I9_D12_V2,
+ MAXTRRES_S9_B12_I9_D13_V2, MAXTRRES_S9_B12_I9_D14_V2,
+ MAXTRRES_S9_B12_I9_D15_V2, MAXTRRES_S9_B12_I9_D16_V2 },
+ { 0, 0,
+ 0, MAXTRRES_S9_B12_I10_D12_V2,
+ MAXTRRES_S9_B12_I10_D13_V2, MAXTRRES_S9_B12_I10_D14_V2,
+ MAXTRRES_S9_B12_I10_D15_V2, MAXTRRES_S9_B12_I10_D16_V2 },
+ { 0, 0,
+ 0, MAXTRRES_S9_B12_I11_D12_V2,
+ MAXTRRES_S9_B12_I11_D13_V2, MAXTRRES_S9_B12_I11_D14_V2,
+ MAXTRRES_S9_B12_I11_D15_V2, MAXTRRES_S9_B12_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ MAXTRRES_S9_B13_I8_D13_V2, MAXTRRES_S9_B13_I8_D14_V2,
+ MAXTRRES_S9_B13_I8_D15_V2, MAXTRRES_S9_B13_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S9_B13_I9_D13_V2, MAXTRRES_S9_B13_I9_D14_V2,
+ MAXTRRES_S9_B13_I9_D15_V2, MAXTRRES_S9_B13_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S9_B13_I10_D13_V2, MAXTRRES_S9_B13_I10_D14_V2,
+ MAXTRRES_S9_B13_I10_D15_V2, MAXTRRES_S9_B13_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S9_B13_I11_D13_V2, MAXTRRES_S9_B13_I11_D14_V2,
+ MAXTRRES_S9_B13_I11_D15_V2, MAXTRRES_S9_B13_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S9_B14_I8_D14_V2,
+ MAXTRRES_S9_B14_I8_D15_V2, MAXTRRES_S9_B14_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S9_B14_I9_D14_V2,
+ MAXTRRES_S9_B14_I9_D15_V2, MAXTRRES_S9_B14_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S9_B14_I10_D14_V2,
+ MAXTRRES_S9_B14_I10_D15_V2, MAXTRRES_S9_B14_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S9_B14_I11_D14_V2,
+ MAXTRRES_S9_B14_I11_D15_V2, MAXTRRES_S9_B14_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S9_B15_I8_D15_V2, MAXTRRES_S9_B15_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S9_B15_I9_D15_V2, MAXTRRES_S9_B15_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S9_B15_I10_D15_V2, MAXTRRES_S9_B15_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S9_B15_I11_D15_V2, MAXTRRES_S9_B15_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S9_B16_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S9_B16_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S9_B16_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S9_B16_I11_D16_V2 },
+ },
+ },
+
+ { { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, MAXTRRES_S9_B10_I8_D10_V2,
+ MAXTRRES_S10_B10_I8_D11_V2, MAXTRRES_S10_B10_I8_D12_V2,
+ MAXTRRES_S10_B10_I8_D13_V2, MAXTRRES_S10_B10_I8_D14_V2,
+ MAXTRRES_S10_B10_I8_D15_V2, MAXTRRES_S10_B10_I8_D16_V2 },
+ { 0, MAXTRRES_S10_B10_I9_D10_V2,
+ MAXTRRES_S10_B10_I9_D11_V2, MAXTRRES_S10_B10_I9_D12_V2,
+ MAXTRRES_S10_B10_I9_D13_V2, MAXTRRES_S10_B10_I9_D14_V2,
+ MAXTRRES_S10_B10_I9_D15_V2, MAXTRRES_S10_B10_I9_D16_V2 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0,
+ MAXTRRES_S10_B11_I8_D11_V2, MAXTRRES_S10_B11_I8_D12_V2,
+ MAXTRRES_S10_B11_I8_D13_V2, MAXTRRES_S10_B11_I8_D14_V2,
+ MAXTRRES_S10_B11_I8_D15_V2, MAXTRRES_S10_B11_I8_D16_V2 },
+ { 0, 0,
+ MAXTRRES_S10_B11_I9_D11_V2, MAXTRRES_S10_B11_I9_D12_V2,
+ MAXTRRES_S10_B11_I9_D13_V2, MAXTRRES_S10_B11_I9_D14_V2,
+ MAXTRRES_S10_B11_I9_D15_V2, MAXTRRES_S10_B11_I9_D16_V2 },
+ { 0, 0,
+ MAXTRRES_S10_B11_I10_D11_V2, MAXTRRES_S10_B11_I10_D12_V2,
+ MAXTRRES_S10_B11_I10_D13_V2, MAXTRRES_S10_B11_I10_D14_V2,
+ MAXTRRES_S10_B11_I10_D15_V2, MAXTRRES_S10_B11_I10_D16_V2 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0,
+ 0, MAXTRRES_S10_B12_I8_D12_V2,
+ MAXTRRES_S10_B12_I8_D13_V2, MAXTRRES_S10_B12_I8_D14_V2,
+ MAXTRRES_S10_B12_I8_D15_V2, MAXTRRES_S10_B12_I8_D16_V2 },
+ { 0, 0,
+ 0, MAXTRRES_S10_B12_I9_D12_V2,
+ MAXTRRES_S10_B12_I9_D13_V2, MAXTRRES_S10_B12_I9_D14_V2,
+ MAXTRRES_S10_B12_I9_D15_V2, MAXTRRES_S10_B12_I9_D16_V2 },
+ { 0, 0,
+ 0, MAXTRRES_S10_B12_I10_D12_V2,
+ MAXTRRES_S10_B12_I10_D13_V2, MAXTRRES_S10_B12_I10_D14_V2,
+ MAXTRRES_S10_B12_I10_D15_V2, MAXTRRES_S10_B12_I10_D16_V2 },
+ { 0, 0,
+ 0, MAXTRRES_S10_B12_I11_D12_V2,
+ MAXTRRES_S10_B12_I11_D13_V2, MAXTRRES_S10_B12_I11_D14_V2,
+ MAXTRRES_S10_B12_I11_D15_V2, MAXTRRES_S10_B12_I11_D16_V2 },
+ },
+
+ { { 0, 0,
+ 0, 0,
+ MAXTRRES_S10_B13_I8_D13_V2, MAXTRRES_S10_B13_I8_D14_V2,
+ MAXTRRES_S10_B13_I8_D15_V2, MAXTRRES_S10_B13_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S10_B13_I9_D13_V2, MAXTRRES_S10_B13_I9_D14_V2,
+ MAXTRRES_S10_B13_I9_D15_V2, MAXTRRES_S10_B13_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S10_B13_I10_D13_V2, MAXTRRES_S10_B13_I10_D14_V2,
+ MAXTRRES_S10_B13_I10_D15_V2, MAXTRRES_S10_B13_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S10_B13_I11_D13_V2, MAXTRRES_S10_B13_I11_D14_V2,
+ MAXTRRES_S10_B13_I11_D15_V2, MAXTRRES_S10_B13_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S10_B14_I8_D14_V2,
+ MAXTRRES_S10_B14_I8_D15_V2, MAXTRRES_S10_B14_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S10_B14_I9_D14_V2,
+ MAXTRRES_S10_B14_I9_D15_V2, MAXTRRES_S10_B14_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S10_B14_I10_D14_V2,
+ MAXTRRES_S10_B14_I10_D15_V2, MAXTRRES_S10_B14_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S10_B14_I11_D14_V2,
+ MAXTRRES_S10_B14_I11_D15_V2, MAXTRRES_S10_B14_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S10_B15_I8_D15_V2, MAXTRRES_S10_B15_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S10_B15_I9_D15_V2, MAXTRRES_S10_B15_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S10_B15_I10_D15_V2, MAXTRRES_S10_B15_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S10_B15_I11_D15_V2, MAXTRRES_S10_B15_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S10_B16_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S10_B16_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S10_B16_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S10_B16_I11_D16_V2 },
+ },
+ },
+
+ { { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0,
+ MAXTRRES_S11_B11_I8_D11_V2, MAXTRRES_S11_B11_I8_D12_V2,
+ MAXTRRES_S11_B11_I8_D13_V2, MAXTRRES_S11_B11_I8_D14_V2,
+ MAXTRRES_S11_B11_I8_D15_V2, MAXTRRES_S11_B11_I8_D16_V2 },
+ { 0, 0,
+ MAXTRRES_S11_B11_I9_D11_V2, MAXTRRES_S11_B11_I9_D12_V2,
+ MAXTRRES_S11_B11_I9_D13_V2, MAXTRRES_S11_B11_I9_D14_V2,
+ MAXTRRES_S11_B11_I9_D15_V2, MAXTRRES_S11_B11_I9_D16_V2 },
+ { 0, 0,
+ MAXTRRES_S11_B11_I10_D11_V2, MAXTRRES_S11_B11_I10_D12_V2,
+ MAXTRRES_S11_B11_I10_D13_V2, MAXTRRES_S11_B11_I10_D14_V2,
+ MAXTRRES_S11_B11_I10_D15_V2, MAXTRRES_S11_B11_I10_D16_V2 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0,
+ 0, MAXTRRES_S11_B12_I8_D12_V2,
+ MAXTRRES_S11_B12_I8_D13_V2, MAXTRRES_S11_B12_I8_D14_V2,
+ MAXTRRES_S11_B12_I8_D15_V2, MAXTRRES_S11_B12_I8_D16_V2 },
+ { 0, 0,
+ 0, MAXTRRES_S11_B12_I9_D12_V2,
+ MAXTRRES_S11_B12_I9_D13_V2, MAXTRRES_S11_B12_I9_D14_V2,
+ MAXTRRES_S11_B12_I9_D15_V2, MAXTRRES_S11_B12_I9_D16_V2 },
+ { 0, 0,
+ 0, MAXTRRES_S11_B12_I10_D12_V2,
+ MAXTRRES_S11_B12_I10_D13_V2, MAXTRRES_S11_B12_I10_D14_V2,
+ MAXTRRES_S11_B12_I10_D15_V2, MAXTRRES_S11_B12_I10_D16_V2 },
+ { 0, 0,
+ 0, MAXTRRES_S11_B12_I11_D12_V2,
+ MAXTRRES_S11_B12_I11_D13_V2, MAXTRRES_S11_B12_I11_D14_V2,
+ MAXTRRES_S11_B12_I11_D15_V2, MAXTRRES_S11_B12_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ MAXTRRES_S11_B13_I8_D13_V2, MAXTRRES_S11_B13_I8_D14_V2,
+ MAXTRRES_S11_B13_I8_D15_V2, MAXTRRES_S11_B13_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S11_B13_I9_D13_V2, MAXTRRES_S11_B13_I9_D14_V2,
+ MAXTRRES_S11_B13_I9_D15_V2, MAXTRRES_S11_B13_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S11_B13_I10_D13_V2, MAXTRRES_S11_B13_I10_D14_V2,
+ MAXTRRES_S11_B13_I10_D15_V2, MAXTRRES_S11_B13_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S11_B13_I11_D13_V2, MAXTRRES_S11_B13_I11_D14_V2,
+ MAXTRRES_S11_B13_I11_D15_V2, MAXTRRES_S11_B13_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S11_B14_I8_D14_V2,
+ MAXTRRES_S11_B14_I8_D15_V2, MAXTRRES_S11_B14_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S11_B14_I9_D14_V2,
+ MAXTRRES_S11_B14_I9_D15_V2, MAXTRRES_S11_B14_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S11_B14_I10_D14_V2,
+ MAXTRRES_S11_B14_I10_D15_V2, MAXTRRES_S11_B14_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S11_B14_I11_D14_V2,
+ MAXTRRES_S11_B14_I11_D15_V2, MAXTRRES_S11_B14_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S11_B15_I8_D15_V2, MAXTRRES_S11_B15_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S11_B15_I9_D15_V2, MAXTRRES_S11_B15_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S11_B15_I10_D15_V2, MAXTRRES_S11_B15_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S11_B15_I11_D15_V2, MAXTRRES_S11_B15_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S11_B16_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S11_B16_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S11_B16_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S11_B16_I11_D16_V2 },
+ },
+ },
+
+ { { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0,
+ 0, MAXTRRES_S12_B12_I8_D12_V2,
+ MAXTRRES_S12_B12_I8_D13_V2, MAXTRRES_S12_B12_I8_D14_V2,
+ MAXTRRES_S12_B12_I8_D15_V2, MAXTRRES_S12_B12_I8_D16_V2 },
+ { 0, 0,
+ 0, MAXTRRES_S12_B12_I9_D12_V2,
+ MAXTRRES_S12_B12_I9_D13_V2, MAXTRRES_S12_B12_I9_D14_V2,
+ MAXTRRES_S12_B12_I9_D15_V2, MAXTRRES_S12_B12_I9_D16_V2 },
+ { 0, 0,
+ 0, MAXTRRES_S12_B12_I10_D12_V2,
+ MAXTRRES_S12_B12_I10_D13_V2, MAXTRRES_S12_B12_I10_D14_V2,
+ MAXTRRES_S12_B12_I10_D15_V2, MAXTRRES_S12_B12_I10_D16_V2 },
+ { 0, 0,
+ 0, MAXTRRES_S12_B12_I11_D12_V2,
+ MAXTRRES_S12_B12_I11_D13_V2, MAXTRRES_S12_B12_I11_D14_V2,
+ MAXTRRES_S12_B12_I11_D15_V2, MAXTRRES_S12_B12_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ MAXTRRES_S12_B13_I8_D13_V2, MAXTRRES_S12_B13_I8_D14_V2,
+ MAXTRRES_S12_B13_I8_D15_V2, MAXTRRES_S12_B13_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S12_B13_I9_D13_V2, MAXTRRES_S12_B13_I9_D14_V2,
+ MAXTRRES_S12_B13_I9_D15_V2, MAXTRRES_S12_B13_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S12_B13_I10_D13_V2, MAXTRRES_S12_B13_I10_D14_V2,
+ MAXTRRES_S12_B13_I10_D15_V2, MAXTRRES_S12_B13_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S12_B13_I11_D13_V2, MAXTRRES_S12_B13_I11_D14_V2,
+ MAXTRRES_S12_B13_I11_D15_V2, MAXTRRES_S12_B13_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S12_B14_I8_D14_V2,
+ MAXTRRES_S12_B14_I8_D15_V2, MAXTRRES_S12_B14_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S12_B14_I9_D14_V2,
+ MAXTRRES_S12_B14_I9_D15_V2, MAXTRRES_S12_B14_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S12_B14_I10_D14_V2,
+ MAXTRRES_S12_B14_I10_D15_V2, MAXTRRES_S12_B14_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S12_B14_I11_D14_V2,
+ MAXTRRES_S12_B14_I11_D15_V2, MAXTRRES_S12_B14_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S12_B15_I8_D15_V2, MAXTRRES_S12_B15_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S12_B15_I9_D15_V2, MAXTRRES_S12_B15_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S12_B15_I10_D15_V2, MAXTRRES_S12_B15_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S12_B15_I11_D15_V2, MAXTRRES_S12_B15_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S12_B16_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S12_B16_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S12_B16_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S12_B16_I11_D16_V2 },
+ },
+ },
+
+ { { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0,
+ 0, 0,
+ MAXTRRES_S13_B13_I8_D13_V2, MAXTRRES_S13_B13_I8_D14_V2,
+ MAXTRRES_S13_B13_I8_D15_V2, MAXTRRES_S13_B13_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S13_B13_I9_D13_V2, MAXTRRES_S13_B13_I9_D14_V2,
+ MAXTRRES_S13_B13_I9_D15_V2, MAXTRRES_S13_B13_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S13_B13_I10_D13_V2, MAXTRRES_S13_B13_I10_D14_V2,
+ MAXTRRES_S13_B13_I10_D15_V2, MAXTRRES_S13_B13_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ MAXTRRES_S13_B13_I11_D13_V2, MAXTRRES_S13_B13_I11_D14_V2,
+ MAXTRRES_S13_B13_I11_D15_V2, MAXTRRES_S13_B13_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S13_B14_I8_D14_V2,
+ MAXTRRES_S13_B14_I8_D15_V2, MAXTRRES_S13_B14_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S13_B14_I9_D14_V2,
+ MAXTRRES_S13_B14_I9_D15_V2, MAXTRRES_S13_B14_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S13_B14_I10_D14_V2,
+ MAXTRRES_S13_B14_I10_D15_V2, MAXTRRES_S13_B14_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S13_B14_I11_D14_V2,
+ MAXTRRES_S13_B14_I11_D15_V2, MAXTRRES_S13_B14_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S13_B15_I8_D15_V2, MAXTRRES_S13_B15_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S13_B15_I9_D15_V2, MAXTRRES_S13_B15_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S13_B15_I10_D15_V2, MAXTRRES_S13_B15_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S13_B15_I11_D15_V2, MAXTRRES_S13_B15_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S13_B16_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S13_B16_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S13_B16_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S13_B16_I11_D16_V2 },
+ },
+ },
+
+ { { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S14_B14_I8_D14_V2,
+ MAXTRRES_S14_B14_I8_D15_V2, MAXTRRES_S14_B14_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S14_B14_I9_D14_V2,
+ MAXTRRES_S14_B14_I9_D15_V2, MAXTRRES_S14_B14_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S14_B14_I10_D14_V2,
+ MAXTRRES_S14_B14_I10_D15_V2, MAXTRRES_S14_B14_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S14_B14_I11_D14_V2,
+ MAXTRRES_S14_B14_I11_D15_V2, MAXTRRES_S14_B14_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S14_B15_I8_D15_V2, MAXTRRES_S14_B15_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S14_B15_I9_D15_V2, MAXTRRES_S14_B15_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S14_B15_I10_D15_V2, MAXTRRES_S14_B15_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S14_B15_I11_D15_V2, MAXTRRES_S14_B15_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S14_B16_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S14_B16_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S14_B16_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S14_B16_I11_D16_V2 },
+ },
+ },
+
+ { { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S15_B15_I8_D15_V2, MAXTRRES_S15_B15_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S15_B15_I9_D15_V2, MAXTRRES_S15_B15_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S15_B15_I10_D15_V2, MAXTRRES_S15_B15_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ MAXTRRES_S15_B15_I11_D15_V2, MAXTRRES_S15_B15_I11_D16_V2 },
+ },
+ { { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S15_B16_I8_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S15_B16_I9_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S15_B16_I10_D16_V2 },
+ { 0, 0,
+ 0, 0,
+ 0, 0,
+ 0, MAXTRRES_S15_B16_I11_D16_V2 },
+ },
+ },
+};
#include <volume.h>
#include <libxfs.h>
#include <ctype.h>
-
#include "xfs_mkfs.h"
-#include "maxtrres.h"
-#include "proto.h"
/*
* Prototypes for internal functions.
/*
* option tables for getsubopt calls
*/
-char *bopts[] = {
+char *bopts[] = {
#define B_LOG 0
"log",
#define B_SIZE 1
"su",
#define L_DEV 6
"logdev",
+#define L_SECTLOG 7
+ "sectlog",
+#define L_SECTSIZE 8
+ "sectsize",
#ifdef MKFS_SIMULATION
-#define L_FILE 7
+#define L_FILE 9
"file",
-#define L_NAME 8
+#define L_NAME 10
"name",
#endif
NULL
NULL
};
-/*
- * max transaction reservation values
- * version 1:
- * first dimension log(blocksize) (base XFS_MIN_BLOCKSIZE_LOG)
- * second dimension log(inodesize) (base XFS_DINODE_MIN_LOG)
- * version 2:
- * first dimension log(blocksize) (base XFS_MIN_BLOCKSIZE_LOG)
- * second dimension log(inodesize) (base XFS_DINODE_MIN_LOG)
- * third dimension log(dirblocksize) (base XFS_MIN_BLOCKSIZE_LOG)
- */
-#define DFL_B (XFS_MAX_BLOCKSIZE_LOG + 1 - XFS_MIN_BLOCKSIZE_LOG)
-#define DFL_I (XFS_DINODE_MAX_LOG + 1 - XFS_DINODE_MIN_LOG)
-#define DFL_D (XFS_MAX_BLOCKSIZE_LOG + 1 - XFS_MIN_BLOCKSIZE_LOG)
-
-static const int max_trres_v1[DFL_B][DFL_I] = {
- { MAXTRRES_B9_I8_D9_V1, 0, 0, 0 },
- { MAXTRRES_B10_I8_D10_V1, MAXTRRES_B10_I9_D10_V1, 0, 0 },
- { MAXTRRES_B11_I8_D11_V1, MAXTRRES_B11_I9_D11_V1,
- MAXTRRES_B11_I10_D11_V1, 0 },
- { MAXTRRES_B12_I8_D12_V1, MAXTRRES_B12_I9_D12_V1,
- MAXTRRES_B12_I10_D12_V1, MAXTRRES_B12_I11_D12_V1 },
- { MAXTRRES_B13_I8_D13_V1, MAXTRRES_B13_I9_D13_V1,
- MAXTRRES_B13_I10_D13_V1, MAXTRRES_B13_I11_D13_V1 },
- { MAXTRRES_B14_I8_D14_V1, MAXTRRES_B14_I9_D14_V1,
- MAXTRRES_B14_I10_D14_V1, MAXTRRES_B14_I11_D14_V1 },
- { MAXTRRES_B15_I8_D15_V1, MAXTRRES_B15_I9_D15_V1,
- MAXTRRES_B15_I10_D15_V1, MAXTRRES_B15_I11_D15_V1 },
- { MAXTRRES_B16_I8_D16_V1, MAXTRRES_B16_I9_D16_V1,
- MAXTRRES_B16_I10_D16_V1, MAXTRRES_B16_I11_D16_V1 },
-};
-
-static const int max_trres_v2[DFL_B][DFL_I][DFL_D] = {
- { { MAXTRRES_B9_I8_D9_V2, MAXTRRES_B9_I8_D10_V2, MAXTRRES_B9_I8_D11_V2,
- MAXTRRES_B9_I8_D12_V2, MAXTRRES_B9_I8_D13_V2, MAXTRRES_B9_I8_D14_V2,
- MAXTRRES_B9_I8_D15_V2, MAXTRRES_B9_I8_D16_V2 },
- { 0, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0 } },
- { { 0, MAXTRRES_B10_I8_D10_V2, MAXTRRES_B10_I8_D11_V2,
- MAXTRRES_B10_I8_D12_V2, MAXTRRES_B10_I8_D13_V2,
- MAXTRRES_B10_I8_D14_V2, MAXTRRES_B10_I8_D15_V2,
- MAXTRRES_B10_I8_D16_V2 },
- { 0, MAXTRRES_B10_I9_D10_V2, MAXTRRES_B10_I9_D11_V2,
- MAXTRRES_B10_I9_D12_V2, MAXTRRES_B10_I9_D13_V2,
- MAXTRRES_B10_I9_D14_V2, MAXTRRES_B10_I9_D15_V2,
- MAXTRRES_B10_I9_D16_V2 },
- { 0, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0 } },
- { { 0, 0, MAXTRRES_B11_I8_D11_V2, MAXTRRES_B11_I8_D12_V2,
- MAXTRRES_B11_I8_D13_V2, MAXTRRES_B11_I8_D14_V2,
- MAXTRRES_B11_I8_D15_V2, MAXTRRES_B11_I8_D16_V2 },
- { 0, 0, MAXTRRES_B11_I9_D11_V2, MAXTRRES_B11_I9_D12_V2,
- MAXTRRES_B11_I9_D13_V2, MAXTRRES_B11_I9_D14_V2,
- MAXTRRES_B11_I9_D15_V2, MAXTRRES_B11_I9_D16_V2 },
- { 0, 0, MAXTRRES_B11_I10_D11_V2, MAXTRRES_B11_I10_D12_V2,
- MAXTRRES_B11_I10_D13_V2, MAXTRRES_B11_I10_D14_V2,
- MAXTRRES_B11_I10_D15_V2, MAXTRRES_B11_I10_D16_V2 },
- { 0, 0, 0, 0, 0, 0, 0, 0 } },
- { { 0, 0, 0, MAXTRRES_B12_I8_D12_V2, MAXTRRES_B12_I8_D13_V2,
- MAXTRRES_B12_I8_D14_V2, MAXTRRES_B12_I8_D15_V2,
- MAXTRRES_B12_I8_D16_V2 },
- { 0, 0, 0, MAXTRRES_B12_I9_D12_V2, MAXTRRES_B12_I9_D13_V2,
- MAXTRRES_B12_I9_D14_V2, MAXTRRES_B12_I9_D15_V2,
- MAXTRRES_B12_I9_D16_V2 },
- { 0, 0, 0, MAXTRRES_B12_I10_D12_V2, MAXTRRES_B12_I10_D13_V2,
- MAXTRRES_B12_I10_D14_V2, MAXTRRES_B12_I10_D15_V2,
- MAXTRRES_B12_I10_D16_V2 },
- { 0, 0, 0, MAXTRRES_B12_I11_D12_V2, MAXTRRES_B12_I11_D13_V2,
- MAXTRRES_B12_I11_D14_V2, MAXTRRES_B12_I11_D15_V2,
- MAXTRRES_B12_I11_D16_V2 } },
- { { 0, 0, 0, 0, MAXTRRES_B13_I8_D13_V2, MAXTRRES_B13_I8_D14_V2,
- MAXTRRES_B13_I8_D15_V2, MAXTRRES_B13_I8_D16_V2 },
- { 0, 0, 0, 0, MAXTRRES_B13_I9_D13_V2, MAXTRRES_B13_I9_D14_V2,
- MAXTRRES_B13_I9_D15_V2, MAXTRRES_B13_I9_D16_V2 },
- { 0, 0, 0, 0, MAXTRRES_B13_I10_D13_V2, MAXTRRES_B13_I10_D14_V2,
- MAXTRRES_B13_I10_D15_V2, MAXTRRES_B13_I10_D16_V2 },
- { 0, 0, 0, 0, MAXTRRES_B13_I11_D13_V2, MAXTRRES_B13_I11_D14_V2,
- MAXTRRES_B13_I11_D15_V2, MAXTRRES_B13_I11_D16_V2 } },
- { { 0, 0, 0, 0, 0, MAXTRRES_B14_I8_D14_V2, MAXTRRES_B14_I8_D15_V2,
- MAXTRRES_B14_I8_D16_V2 },
- { 0, 0, 0, 0, 0, MAXTRRES_B14_I9_D14_V2, MAXTRRES_B14_I9_D15_V2,
- MAXTRRES_B14_I9_D16_V2 },
- { 0, 0, 0, 0, 0, MAXTRRES_B14_I10_D14_V2, MAXTRRES_B14_I10_D15_V2,
- MAXTRRES_B14_I10_D16_V2 },
- { 0, 0, 0, 0, 0, MAXTRRES_B14_I11_D14_V2, MAXTRRES_B14_I11_D15_V2,
- MAXTRRES_B14_I11_D16_V2 } },
- { { 0, 0, 0, 0, 0, 0, MAXTRRES_B15_I8_D15_V2, MAXTRRES_B15_I8_D16_V2 },
- { 0, 0, 0, 0, 0, 0, MAXTRRES_B15_I9_D15_V2, MAXTRRES_B15_I9_D16_V2 },
- { 0, 0, 0, 0, 0, 0, MAXTRRES_B15_I10_D15_V2,
- MAXTRRES_B15_I10_D16_V2 },
- { 0, 0, 0, 0, 0, 0, MAXTRRES_B15_I11_D15_V2,
- MAXTRRES_B15_I11_D16_V2 } },
- { { 0, 0, 0, 0, 0, 0, 0, MAXTRRES_B16_I8_D16_V2 },
- { 0, 0, 0, 0, 0, 0, 0, MAXTRRES_B16_I9_D16_V2 },
- { 0, 0, 0, 0, 0, 0, 0, MAXTRRES_B16_I10_D16_V2 },
- { 0, 0, 0, 0, 0, 0, 0, MAXTRRES_B16_I11_D16_V2, } },
+char *sopts[] = {
+#define S_LOG 0
+ "log",
+#define S_SECTLOG 1
+ "sectlog",
+#define S_SIZE 2
+ "size",
+#define S_SECTSIZE 3
+ "sectsize",
+ NULL
};
/*
- * Use this before we have a superblock, else would use XFS_DTOBT
+ * Use this macro before we have superblock and mount structure
*/
#define DTOBT(d) ((xfs_drfsbno_t)((d) >> (blocklog - BBSHIFT)))
(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1) + (rb)))
static void
-calc_stripe_factors(int dsu, int dsw, int lsu, int *dsunit, int *dswidth, int *lsunit)
+calc_stripe_factors(
+ int dsu,
+ int dsw,
+ int dsectsz,
+ int lsu,
+ int lsectsz,
+ int *dsunit,
+ int *dswidth,
+ int *lsunit)
{
/* Handle data sunit/swidth options */
if (*dsunit || *dswidth) {
if (dsu || dsw) {
fprintf(stderr,
- "data su/sw should not be used in conjunction with data sunit/swidth\n");
+ _("data su/sw must not be used in "
+ "conjunction with data sunit/swidth\n"));
usage();
}
if ((*dsunit && !*dswidth) || (!*dsunit && *dswidth)) {
fprintf(stderr,
- "both data sunit and data swidth options must be specified\n");
+ _("both data sunit and data swidth options "
+ "must be specified\n"));
usage();
}
}
if (dsu || dsw) {
if (*dsunit || *dswidth) {
fprintf(stderr,
- "data sunit/swidth should not be used in conjunction with data su/sw\n");
+ _("data sunit/swidth must not be used in "
+ "conjunction with data su/sw\n"));
usage();
}
if ((dsu && !dsw) || (!dsu && dsw)) {
fprintf(stderr,
- "both data su and data sw options must be specified\n");
+ _("both data su and data sw options "
+ "must be specified\n"));
usage();
}
- if (dsu % BBSIZE) {
- fprintf(stderr, "data su must be a multiple of %d\n",
- BBSIZE);
+ if (dsu % dsectsz) {
+ fprintf(stderr,
+ _("data su must be a multiple of the "
+ "sector size (%d)\n"), dsectsz);
usage();
}
if (*dsunit && (*dswidth % *dsunit != 0)) {
fprintf(stderr,
- "data stripe width (%d) must be a multiple of the data stripe unit (%d)\n",
- *dswidth, *dsunit);
+ _("data stripe width (%d) must be a multiple of the "
+ "data stripe unit (%d)\n"), *dswidth, *dsunit);
usage();
}
if (*lsunit) {
if (lsu) {
fprintf(stderr,
- "log su should not be used in conjunction with log sunit\n");
+ _("log su should not be used in "
+ "conjunction with log sunit\n"));
usage();
}
}
if (lsu) {
if (*lsunit) {
fprintf(stderr,
- "log sunit should not be used in conjunction with log su\n");
+ _("log sunit should not be used in "
+ "conjunction with log su\n"));
usage();
}
- if (lsu % BBSIZE) {
- fprintf(stderr, "log su must be a multiple of %d\n",
- BBSIZE);
+ if (lsu % lsectsz) {
+ fprintf(stderr,
+ _("log su must be a multiple of the "
+ "sector size (%d)\n"), lsectsz);
usage();
}
- *lsunit = (int)BTOBBT(lsu);
+ *lsunit = (int)BTOBBT(lsu);
}
}
static int
-check_overwrite(char *device)
+check_overwrite(
+ char *device)
{
- char *type;
+ char *type;
if (device && *device) {
if ((type = fstype(device)) != NULL) {
fprintf(stderr,
- "%s: %s appears to contain an existing filesystem (%s).\n",
- progname, device, type);
+ _("%s: %s appears to contain an existing "
+ "filesystem (%s).\n"), progname, device, type);
return 1;
}
if ((type = pttype(device)) != NULL) {
fprintf(stderr,
- "%s: %s appears to contain a partition table (%s).\n",
- progname, device, type);
+ _("%s: %s appears to contain a partition "
+ "table (%s).\n"), progname, device, type);
return 1;
}
}
return 0;
}
-xfs_dfsbno_t
+static xfs_dfsbno_t
fixup_log_stripe(
xfs_mount_t *mp,
int lsflag,
*logblocks = tmp_logblocks;
} else {
fprintf(stderr,
- "internal log size %lld is not a multiple of the log stripe unit %d\n",
- (long long)*logblocks, sunit);
+ _("internal log size %lld is not a multiple "
+ "of the log stripe unit %d\n"),
+ (long long) *logblocks, sunit);
usage();
}
}
- if (*logblocks > agsize-XFS_FSB_TO_AGBNO(mp,logstart)) {
+ if (*logblocks > agsize - XFS_FSB_TO_AGBNO(mp, logstart)) {
fprintf(stderr,
- "Due to stripe alignment, the internal log size %lld is too large.\n"
- "Must fit in allocation group\n",
- (long long)*logblocks);
+ _("Due to stripe alignment, the internal log size "
+ "(%lld) is too large.\n"), (long long) *logblocks);
+ fprintf(stderr, _("Must fit within an allocation group.\n"));
usage();
}
return logstart;
}
int
-main(int argc, char **argv)
+main(
+ int argc,
+ char **argv)
{
__uint64_t agcount;
xfs_agf_t *agf;
int logversion;
int lvflag;
int lsflag;
+ int lsectorlog;
+ int lsectorsize;
int lsu;
int lsunit;
int min_logblocks;
char *rtfile;
char *rtsize;
xfs_sb_t *sbp;
- int sectlog;
+ int sectorlog;
+ int sectorsize;
+ int slflag;
+ int ssflag;
__uint64_t tmp_agsize;
uuid_t uuid;
int worst_freelist;
int xlv_dswidth;
progname = basename(argv[0]);
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
agcount = 8;
- blflag = bsflag = 0;
- dasize = daflag = 0;
+ blflag = bsflag = slflag = ssflag = 0;
blocklog = blocksize = 0;
- agsize = daflag = dblocks = 0;
+ sectorlog = BBSHIFT;
+ sectorsize = BBSIZE;
+ lsectorlog = 0;
+ lsectorsize = 0;
+ agsize = daflag = dasize = dblocks = 0;
ilflag = imflag = ipflag = isflag = 0;
liflag = laflag = lsflag = ldflag = lvflag = 0;
loginternal = 1;
qflag = 0;
imaxpct = inodelog = inopblock = isize = 0;
iaflag = XFS_IFLAG_ALIGN;
- bzero(&xi, sizeof(xi));
- xi.notvolok = 1;
- xi.setblksize = 1;
dfile = logfile = rtfile = NULL;
dsize = logsize = rtsize = rtextsize = protofile = NULL;
- opterr = 0;
dsu = dsw = dsunit = dswidth = nodsflag = lalign = lsu = lsunit = 0;
extent_flagging = 0;
force_overwrite = 0;
worst_freelist = 0;
- while ((c = getopt(argc, argv, "b:d:i:l:L:n:Np:qr:CfV")) != EOF) {
+ bzero(&xi, sizeof(xi));
+ xi.notvolok = 1;
+ xi.setblksize = 1;
+
+ while ((c = getopt(argc, argv, "b:d:i:l:L:n:Np:qr:s:CfV")) != EOF) {
switch (c) {
case 'C':
case 'f':
if (blflag)
conflict('b', bopts, B_LOG,
B_SIZE);
- blocksize = cvtnum(0, value);
+ blocksize = cvtnum(
+ blocksize, sectorsize, value);
if (blocksize <= 0 ||
!ispow2(blocksize))
illegal(value, "b size");
reqval('d', dopts, D_AGSIZE);
if (dasize)
respec('d', dopts, D_AGSIZE);
- agsize = cvtnum(blocksize, value);
+ agsize = cvtnum(
+ blocksize, sectorsize, value);
dasize = 1;
break;
case D_FILE:
respec('d', dopts, D_SUNIT);
if (!isdigits(value)) {
fprintf(stderr,
- "%s: Specify data sunit in 512-byte blocks, no unit suffix\n",
+ _("%s: Specify data sunit in 512-byte blocks, no unit suffix\n"),
progname);
exit(1);
}
- dsunit = cvtnum(0, value);
+ dsunit = cvtnum(0, 0, value);
break;
case D_SWIDTH:
if (!value)
respec('d', dopts, D_SWIDTH);
if (!isdigits(value)) {
fprintf(stderr,
- "%s: Specify data swidth in 512-byte blocks, no unit suffix\n",
+ _("%s: Specify data swidth in 512-byte blocks, no unit suffix\n"),
progname);
exit(1);
}
- dswidth = cvtnum(0, value);
+ dswidth = cvtnum(0, 0, value);
break;
case D_SU:
if (!value)
reqval('d', dopts, D_SU);
if (dsu)
respec('d', dopts, D_SU);
- dsu = cvtnum(blocksize, value);
+ dsu = cvtnum(
+ blocksize, sectorsize, value);
break;
case D_SW:
if (!value)
respec('d', dopts, D_SW);
if (!isdigits(value)) {
fprintf(stderr,
- "%s: Specify data sw as multiple of su, no unit suffix\n",
+ _("%s: Specify data sw as multiple of su, no unit suffix\n"),
progname);
exit(1);
}
- dsw = cvtnum(0, value);
+ dsw = cvtnum(0, 0, value);
break;
case D_UNWRITTEN:
if (!value)
I_SIZE);
if (isflag)
respec('i', iopts, I_SIZE);
- isize = cvtnum(0, value);
+ isize = cvtnum(0, 0, value);
if (isize <= 0 || !ispow2(isize))
illegal(value, "i size");
inodelog = libxfs_highbit32(isize);
break;
case L_DEV:
if (!value) {
- fprintf (stderr, "Must specify log device\n");
+ fprintf(stderr,
+ _("Must specify log device\n"));
usage();
}
reqval('l', lopts, L_SU);
if (lsu)
respec('l', lopts, L_SU);
- lsu = cvtnum(blocksize, value);
+ lsu = cvtnum(
+ blocksize, sectorsize, value);
break;
case L_SUNIT:
if (!value)
respec('l', lopts, L_SUNIT);
if (!isdigits(value)) {
fprintf(stderr,
- "Specify log sunit in 512-byte blocks, no size suffix\n");
+ _("Specify log sunit in 512-byte blocks, no size suffix\n"));
usage();
}
- lsunit = cvtnum(0, value);
+ lsunit = cvtnum(0, 0, value);
break;
#ifdef HAVE_VOLUME_MANAGER
case L_NAME:
logsize = value;
lsflag = 1;
break;
+ case L_SECTLOG:
+ if (!value)
+ reqval('s', sopts, L_SECTLOG);
+ if (lsectorlog)
+ respec('s', sopts, L_SECTLOG);
+ lsectorlog = atoi(value);
+ if (lsectorlog <= 0)
+ illegal(value, "l sectlog");
+ lsectorsize = 1 << lsectorlog;
+ break;
+ case L_SECTSIZE:
+ if (!value)
+ reqval('l', lopts, L_SECTSIZE);
+ if (lsectorsize)
+ respec('l', lopts, L_SECTSIZE);
+ lsectorsize = cvtnum(
+ blocksize, sectorsize, value);
+ if (lsectorsize <= 0 ||
+ !ispow2(lsectorsize))
+ illegal(value, "l sectsize");
+ lsectorlog =
+ libxfs_highbit32(lsectorsize);
+ break;
default:
unknown('l', value);
}
if (nlflag)
conflict('n', nopts, N_LOG,
N_SIZE);
- dirblocksize = cvtnum(0, value);
+ dirblocksize = cvtnum(
+ blocksize, sectorsize, value);
if (dirblocksize <= 0 ||
!ispow2(dirblocksize))
illegal(value, "n size");
}
}
break;
+ case 's':
+ p = optarg;
+ while (*p != '\0') {
+ char *value;
+
+ switch (getsubopt(&p, (constpp)sopts, &value)) {
+ case S_LOG:
+ case S_SECTLOG:
+ if (!value)
+ reqval('s', sopts, S_LOG);
+ if (slflag)
+ respec('s', sopts, S_LOG);
+ if (ssflag)
+ conflict('s', sopts, S_SIZE,
+ S_LOG);
+ sectorlog = atoi(value);
+ if (sectorlog <= 0)
+ illegal(value, "s log");
+ sectorsize = 1 << sectorlog;
+ slflag = 1;
+ break;
+ case S_SIZE:
+ case S_SECTSIZE:
+ if (!value)
+ reqval('s', sopts, S_SIZE);
+ if (ssflag)
+ respec('s', sopts, S_SIZE);
+ if (slflag)
+ conflict('s', sopts, S_LOG,
+ S_SIZE);
+ sectorsize = cvtnum(
+ blocksize, sectorsize, value);
+ if (sectorsize <= 0 ||
+ !ispow2(sectorsize))
+ illegal(value, "s size");
+ sectorlog =
+ libxfs_highbit32(sectorsize);
+ ssflag = 1;
+ break;
+ default:
+ unknown('s', value);
+ }
+ }
+ break;
case 'V':
- printf("%s version %s\n", progname, VERSION);
+ printf(_("%s version %s\n"), progname, VERSION);
exit(0);
case '?':
unknown(optopt, "");
}
}
if (argc - optind > 1) {
- fprintf(stderr, "extra arguments\n");
+ fprintf(stderr, _("extra arguments\n"));
usage();
} else if (argc - optind == 1) {
dfile = xi.volname = argv[optind];
if (xi.dname) {
fprintf(stderr,
- "cannot specify both %s and -d name=%s\n",
+ _("cannot specify both %s and -d name=%s\n"),
xi.volname, xi.dname);
usage();
}
} else
dfile = xi.dname;
- /* option post-processing */
+
/*
- * blocksize first, other things depend on it
+ * Blocksize and sectorsize first, other things depend on them
*/
if (!blflag && !bsflag) {
blocklog = XFS_DFL_BLOCKSIZE_LOG;
blocksize = 1 << XFS_DFL_BLOCKSIZE_LOG;
}
if (blocksize < XFS_MIN_BLOCKSIZE || blocksize > XFS_MAX_BLOCKSIZE) {
- fprintf(stderr, "illegal block size %d\n", blocksize);
+ fprintf(stderr, _("illegal block size %d\n"), blocksize);
+ usage();
+ }
+ if (sectorsize < XFS_MIN_SECTORSIZE ||
+ sectorsize > XFS_MAX_SECTORSIZE || sectorsize > blocksize) {
+ fprintf(stderr, _("illegal sector size %d\n"), sectorsize);
+ usage();
+ }
+
+ /*
+ * Support for non-512 byte sector sizes is a work-in-progress...
+ */
+
+#ifdef EXPERIMENTAL_LARGE_SECTORS
+ if (!lsectorsize) {
+ lsectorlog = BBSHIFT;
+ lsectorsize = BBSIZE;
+ }
+ if (lsectorsize < XFS_MIN_SECTORSIZE ||
+ lsectorsize > XFS_MAX_SECTORSIZE || lsectorsize > sectorsize) {
+ fprintf(stderr, _("illegal log sector size %d\n"), sectorsize);
+ usage();
+ }
+#else
+ if (sectorsize != BBSIZE) {
+ fprintf(stderr, _("illegal sector size %d\n"),
+ sectorsize);
usage();
}
+ if (lsectorsize != BBSIZE && lsectorsize) {
+ fprintf(stderr, _("illegal log sector size %d\n"), lsectorsize);
+ usage();
+ }
+ lsectorlog = BBSHIFT;
+ lsectorsize = BBSIZE;
+#endif
+
if (!nvflag)
dirversion = (nsflag || nlflag) ? 2 : XFS_DFL_DIR_VERSION;
switch (dirversion) {
case 1:
if ((nsflag || nlflag) && dirblocklog != blocklog) {
- fprintf(stderr, "illegal directory block size %d\n",
+ fprintf(stderr, _("illegal directory block size %d\n"),
dirblocksize);
usage();
}
if (dirblocksize < blocksize ||
dirblocksize > XFS_MAX_BLOCKSIZE) {
fprintf(stderr,
- "illegal directory block size %d\n",
+ _("illegal directory block size %d\n"),
dirblocksize);
usage();
}
if (daflag && dasize) {
fprintf(stderr,
- "both -d agcount= and agsize= specified, use one or the other\n");
+ _("both -d agcount= and agsize= specified, use one or the other\n"));
usage();
}
if (xi.disfile && (!dsize || !xi.dname)) {
fprintf(stderr,
- "if -d file then -d name and -d size are required\n");
+ _("if -d file then -d name and -d size are required\n"));
usage();
}
if (dsize) {
__uint64_t dbytes;
- dbytes = cvtnum(blocksize, dsize);
+ dbytes = cvtnum(blocksize, sectorsize, dsize);
if (dbytes % XFS_MIN_BLOCKSIZE) {
fprintf(stderr,
- "illegal data length %lld, not a multiple of %d\n",
+ _("illegal data length %lld, not a multiple of %d\n"),
(long long)dbytes, XFS_MIN_BLOCKSIZE);
usage();
}
dblocks = (xfs_drfsbno_t)(dbytes >> blocklog);
if (dbytes % blocksize)
- fprintf(stderr,
- "warning: data length %lld not a multiple of %d, truncated to %lld\n",
+ fprintf(stderr, _("warning: "
+ "data length %lld not a multiple of %d, truncated to %lld\n"),
(long long)dbytes, blocksize,
(long long)(dblocks << blocklog));
}
#ifdef HAVE_VOLUME_MANAGER
if (xi.lisfile && (!logsize || !xi.logname)) {
fprintf(stderr,
- "if -l file then -l name and -l size are required\n");
+ _("if -l file then -l name and -l size are required\n"));
usage();
}
#endif
if (logsize) {
__uint64_t logbytes;
- logbytes = cvtnum(blocksize, logsize);
+ logbytes = cvtnum(blocksize, sectorsize, logsize);
if (logbytes % XFS_MIN_BLOCKSIZE) {
fprintf(stderr,
- "illegal log length %lld, not a multiple of %d\n",
+ _("illegal log length %lld, not a multiple of %d\n"),
(long long)logbytes, XFS_MIN_BLOCKSIZE);
usage();
}
logblocks = (xfs_drfsbno_t)(logbytes >> blocklog);
if (logbytes % blocksize)
fprintf(stderr,
- "warning: log length %lld not a multiple of %d, truncated to %lld\n",
+ _("warning: log length %lld not a multiple of %d, truncated to %lld\n"),
(long long)logbytes, blocksize,
(long long)(logblocks << blocklog));
}
#ifdef HAVE_VOLUME_MANAGER
if (xi.risfile && (!rtsize || !xi.rtname)) {
fprintf(stderr,
- "if -r file then -r name and -r size are required\n");
+ _("if -r file then -r name and -r size are required\n"));
usage();
}
#endif
if (rtsize) {
__uint64_t rtbytes;
- rtbytes = cvtnum(blocksize, rtsize);
+ rtbytes = cvtnum(blocksize, sectorsize, rtsize);
if (rtbytes % XFS_MIN_BLOCKSIZE) {
fprintf(stderr,
- "illegal rt length %lld, not a multiple of %d\n",
+ _("illegal rt length %lld, not a multiple of %d\n"),
(long long)rtbytes, XFS_MIN_BLOCKSIZE);
usage();
}
rtblocks = (xfs_drfsbno_t)(rtbytes >> blocklog);
if (rtbytes % blocksize)
fprintf(stderr,
- "warning: rt length %lld not a multiple of %d, truncated to %lld\n",
+ _("warning: rt length %lld not a multiple of %d, truncated to %lld\n"),
(long long)rtbytes, blocksize,
(long long)(rtblocks << blocklog));
}
if (rtextsize) {
__uint64_t rtextbytes;
- rtextbytes = cvtnum(blocksize, rtextsize);
+ rtextbytes = cvtnum(blocksize, sectorsize, rtextsize);
if (rtextbytes % blocksize) {
fprintf(stderr,
- "illegal rt extent size %lld, not a multiple of %d\n",
+ _("illegal rt extent size %lld, not a multiple of %d\n"),
(long long)rtextbytes, blocksize);
usage();
}
if (rtextbytes > XFS_MAX_RTEXTSIZE) {
fprintf(stderr,
- "rt extent size %s too large, maximum %d\n",
+ _("rt extent size %s too large, maximum %d\n"),
rtextsize, XFS_MAX_RTEXTSIZE);
usage();
}
if (rtextbytes < XFS_MIN_RTEXTSIZE) {
fprintf(stderr,
- "rt extent size %s too small, minimum %d\n",
+ _("rt extent size %s too small, minimum %d\n"),
rtextsize, XFS_MIN_RTEXTSIZE);
usage();
}
* and the underlying volume is striped, then set rtextblocks
* to the stripe width.
*/
- int dummy1, rswidth;
- __uint64_t rtextbytes;
+ int dummy1, rswidth;
+ __uint64_t rtextbytes;
+
dummy1 = rswidth = 0;
if (!xi.disfile)
isize > XFS_DINODE_MAX_SIZE) {
int maxsz;
- fprintf(stderr, "illegal inode size %d\n", isize);
+ fprintf(stderr, _("illegal inode size %d\n"), isize);
maxsz = MIN(blocksize / XFS_MIN_INODE_PERBLOCK,
XFS_DINODE_MAX_SIZE);
if (XFS_DINODE_MIN_SIZE == maxsz)
fprintf(stderr,
- "allowable inode size with %d byte blocks is %d\n",
+ _("allowable inode size with %d byte blocks is %d\n"),
blocksize, XFS_DINODE_MIN_SIZE);
else
fprintf(stderr,
- "allowable inode size with %d byte blocks is between %d and %d\n",
+ _("allowable inode size with %d byte blocks is between %d and %d\n"),
blocksize, XFS_DINODE_MIN_SIZE, maxsz);
usage();
}
/* if lsu or lsunit was specified, automatically use v2 logs */
if ((lsu || lsunit) && logversion == 1) {
- fprintf(stderr, "log stripe unit specified, using v2 logs\n");
+ fprintf(stderr,
+ _("log stripe unit specified, using v2 logs\n"));
logversion = 2;
}
- calc_stripe_factors(dsu, dsw, lsu, &dsunit, &dswidth, &lsunit);
-
- /* other global variables */
- sectlog = 9; /* i.e. 512 bytes */
+ calc_stripe_factors(dsu, dsw, sectorsize, lsu, lsectorsize,
+ &dsunit, &dswidth, &lsunit);
/*
* Initialize. This will open the log and rt devices as well.
if (!libxfs_init(&xi))
usage();
if (!xi.ddev) {
- fprintf(stderr, "no device name given in argument list\n");
+ fprintf(stderr, _("no device name given in argument list\n"));
usage();
}
if (check_overwrite(dfile) ||
check_overwrite(logfile) ||
check_overwrite(xi.rtname)) {
- fprintf(stderr, "%s: "
- "Use the -f option to force overwrite.\n",
+ fprintf(stderr,
+ _("%s: Use the -f option to force overwrite.\n"),
progname);
exit(1);
}
if (xi.logname)
logfile = xi.logname;
else if (loginternal)
- logfile = "internal log";
+ logfile = _("internal log");
else if (xi.volname && xi.logdev)
- logfile = "volume log";
+ logfile = _("volume log");
else if (!ldflag) {
- fprintf(stderr, "no log subvolume or internal log\n");
+ fprintf(stderr, _("no log subvolume or internal log\n"));
usage();
}
if (xi.rtname)
rtfile = xi.rtname;
else
if (xi.volname && xi.rtdev)
- rtfile = "volume rt";
+ rtfile = _("volume rt");
else if (!xi.rtdev)
- rtfile = "none";
+ rtfile = _("none");
if (dsize && xi.dsize > 0 && dblocks > DTOBT(xi.dsize)) {
fprintf(stderr,
-"size %s specified for data subvolume is too large, maximum is %lld blocks\n",
+ _("size %s specified for data subvolume is too large, "
+ "maximum is %lld blocks\n"),
dsize, (long long)DTOBT(xi.dsize));
usage();
} else if (!dsize && xi.dsize > 0)
dblocks = DTOBT(xi.dsize);
else if (!dsize) {
- fprintf(stderr, "can't get size of data subvolume\n");
+ fprintf(stderr, _("can't get size of data subvolume\n"));
usage();
}
if (dblocks < XFS_MIN_DATA_BLOCKS) {
fprintf(stderr,
- "size %lld of data subvolume is too small, minimum %d blocks\n",
+ _("size %lld of data subvolume is too small, minimum %d blocks\n"),
(long long)dblocks, XFS_MIN_DATA_BLOCKS);
usage();
}
- if (xi.logdev && loginternal) {
- fprintf(stderr, "can't have both external and internal logs\n");
+ if (loginternal && xi.logdev) {
+ fprintf(stderr,
+ _("can't have both external and internal logs\n"));
+ usage();
+ } else if (loginternal && sectorsize != lsectorsize) {
+ fprintf(stderr,
+ _("data and log sector sizes must be equal for internal logs\n"));
usage();
}
if (dirversion == 1)
- i = max_trres_v1[blocklog - XFS_MIN_BLOCKSIZE_LOG]
+ i = max_trres_v1[sectorlog - XFS_MIN_SECTORSIZE_LOG]
+ [blocklog - XFS_MIN_BLOCKSIZE_LOG]
[inodelog - XFS_DINODE_MIN_LOG];
else
- i = max_trres_v2[blocklog - XFS_MIN_BLOCKSIZE_LOG]
+ i = max_trres_v2[sectorlog - XFS_MIN_SECTORSIZE_LOG]
+ [blocklog - XFS_MIN_BLOCKSIZE_LOG]
[inodelog - XFS_DINODE_MIN_LOG]
[dirblocklog - XFS_MIN_BLOCKSIZE_LOG];
+ ASSERT(i);
min_logblocks = MAX(XFS_MIN_LOG_BLOCKS, i * XFS_MIN_LOG_FACTOR);
if (logsize && xi.logBBsize > 0 && logblocks > DTOBT(xi.logBBsize)) {
fprintf(stderr,
-"size %s specified for log subvolume is too large, maximum is %lld blocks\n",
+_("size %s specified for log subvolume is too large, maximum is %lld blocks\n"),
logsize, (long long)DTOBT(xi.logBBsize));
usage();
} else if (!logsize && xi.logBBsize > 0)
logblocks = DTOBT(xi.logBBsize);
else if (logsize && !xi.logdev && !loginternal) {
fprintf(stderr,
- "size specified for non-existent log subvolume\n");
+ _("size specified for non-existent log subvolume\n"));
usage();
} else if (loginternal && logsize && logblocks >= dblocks) {
- fprintf(stderr, "size %lld too large for internal log\n",
+ fprintf(stderr, _("size %lld too large for internal log\n"),
(long long)logblocks);
usage();
} else if (!loginternal && !xi.logdev)
}
if (logblocks < min_logblocks) {
fprintf(stderr,
- "log size %lld blocks too small, minimum size is %d blocks\n",
+ _("log size %lld blocks too small, minimum size is %d blocks\n"),
(long long)logblocks, min_logblocks);
usage();
}
if (logblocks > XFS_MAX_LOG_BLOCKS) {
fprintf(stderr,
- "log size %lld blocks too large, maximum size is %d blocks\n",
+ _("log size %lld blocks too large, maximum size is %d blocks\n"),
(long long)logblocks, XFS_MAX_LOG_BLOCKS);
usage();
}
if ((logblocks << blocklog) > XFS_MAX_LOG_BYTES) {
fprintf(stderr,
- "log size %lld bytes too large, maximum size is %d bytes\n",
+ _("log size %lld bytes too large, maximum size is %d bytes\n"),
(long long)(logblocks << blocklog), XFS_MAX_LOG_BYTES);
usage();
}
if (rtsize && xi.rtsize > 0 && rtblocks > DTOBT(xi.rtsize)) {
fprintf(stderr,
-"size %s specified for rt subvolume is too large, maximum is %lld blocks\n",
+ _("size %s specified for rt subvolume is too large, "
+ "maximum is %lld blocks\n"),
rtsize, (long long)DTOBT(xi.rtsize));
usage();
} else if (!rtsize && xi.rtsize > 0)
rtblocks = DTOBT(xi.rtsize);
else if (rtsize && !xi.rtdev) {
fprintf(stderr,
- "size specified for non-existent rt subvolume\n");
+ _("size specified for non-existent rt subvolume\n"));
usage();
}
if (xi.rtdev) {
*/
if (agsize % blocksize) {
fprintf(stderr,
- "agsize (%lld) not a multiple of fs blk size (%d)\n",
+ _("agsize (%lld) not a multiple of fs blk size (%d)\n"),
(long long)agsize, blocksize);
usage();
}
*/
if (agsize < XFS_AG_MIN_BLOCKS(blocklog)) {
fprintf(stderr,
- "agsize (%lldb) too small, need at least %lld blocks\n",
+ _("agsize (%lldb) too small, need at least %lld blocks\n"),
(long long)agsize,
(long long)XFS_AG_MIN_BLOCKS(blocklog));
usage();
if (agsize > XFS_AG_MAX_BLOCKS(blocklog)) {
fprintf(stderr,
- "agsize (%lldb) too big, maximum is %lld blocks\n",
+ _("agsize (%lldb) too big, maximum is %lld blocks\n"),
(long long)agsize,
(long long)XFS_AG_MAX_BLOCKS(blocklog));
usage();
if (agsize > dblocks) {
fprintf(stderr,
- "agsize (%lldb) too big, data area is %lld blocks\n",
+ _("agsize (%lldb) too big, data area is %lld blocks\n"),
(long long)agsize, (long long)dblocks);
usage();
}
if (agsize < XFS_AG_MIN_BLOCKS(blocklog)) {
if (daflag || dasize) {
fprintf(stderr,
- "too many allocation groups for size = %lld\n",
+ _("too many allocation groups for size = %lld\n"),
(long long)agsize);
- fprintf(stderr, "need at most %lld allocation groups\n",
+ fprintf(stderr,
+ _("need at most %lld allocation groups\n"),
(long long)
(dblocks / XFS_AG_MIN_BLOCKS(blocklog) +
(dblocks % XFS_AG_MIN_BLOCKS(blocklog) != 0)));
*/
else if (agsize > XFS_AG_MAX_BLOCKS(blocklog)) {
if (daflag || dasize) {
- fprintf(stderr, "too few allocation groups for size = %lld\n",
+ fprintf(stderr,
+ _("too few allocation groups for size = %lld\n"),
(long long)agsize);
fprintf(stderr,
- "need at least %lld allocation groups\n",
+ _("need at least %lld allocation groups\n"),
(long long)
(dblocks / XFS_AG_MAX_BLOCKS(blocklog) +
(dblocks % XFS_AG_MAX_BLOCKS(blocklog) != 0)));
if (dasize || daflag)
fprintf(stderr,
- "agsize set to %lld, agcount %lld > max (%lld)\n",
+ _("agsize set to %lld, agcount %lld > max (%lld)\n"),
(long long)agsize, (long long)agcount,
(long long)XFS_MAX_AGNUMBER+1);
/*
* We're confused.
*/
- fprintf(stderr, "%s: can't compute agsize/agcount\n",
+ fprintf(stderr, _("%s: can't compute agsize/agcount\n"),
progname);
exit(1);
}
if (dsunit) {
if (xlv_dsunit && xlv_dsunit != dsunit) {
- fprintf(stderr, "%s: "
- "Specified data stripe unit %d is not the same as the xlv stripe unit %d\n",
+ fprintf(stderr,
+ _("%s: Specified data stripe unit %d is not "
+ "the same as the volume stripe unit %d\n"),
progname, dsunit, xlv_dsunit);
}
if (xlv_dswidth && xlv_dswidth != dswidth) {
- fprintf(stderr, "%s: "
-"Specified data stripe width %d is not the same as the xlv stripe width %d\n",
+ fprintf(stderr,
+ _("%s: Specified data stripe width %d is not "
+ "the same as the volume stripe width %d\n"),
progname, dswidth, xlv_dswidth);
}
} else {
(dblocks % agsize != 0);
if (dasize || daflag)
fprintf(stderr,
- "agsize rounded to %lld, swidth = %d\n",
+ _("agsize rounded to %lld, swidth = %d\n"),
(long long)agsize, dswidth);
} else {
if (nodsflag) {
dsunit = dswidth = 0;
} else {
fprintf(stderr,
-"Allocation group size %lld is not a multiple of the stripe unit %d\n",
+_("Allocation group size (%lld) is not a multiple of the stripe unit (%d)\n"),
(long long)agsize, dsunit);
exit(1);
}
}
}
if (daflag || dasize) {
- fprintf(stderr,
+ fprintf(stderr, _(
"Warning: AG size is a multiple of stripe width. This can cause performance\n\
problems by aligning all AGs on the same disk. To avoid this, run mkfs with\n\
-an AG size that is one stripe unit smaller, for example %llu\n",
+an AG size that is one stripe unit smaller, for example %llu.\n"),
(unsigned long long)tmp_agsize);
} else {
agsize = tmp_agsize;
if (nodsflag)
dsunit = dswidth = 0;
else {
- fprintf(stderr, "%s: "
-"Stripe unit(%d) or stripe width(%d) is not a multiple of the block size(%d)\n",
+ fprintf(stderr,
+ _("%s: Stripe unit(%d) or stripe width(%d) is "
+ "not a multiple of the block size(%d)\n"),
progname, BBTOB(dsunit), BBTOB(dswidth),
blocksize);
exit(1);
if (lsunit) {
if ((BBTOB(lsunit) % blocksize != 0)) {
fprintf(stderr,
-"log stripe unit (%d) must be a multiple of the block size (%d)\n",
+ _("log stripe unit (%d) must be a multiple of the block size (%d)\n"),
BBTOB(lsunit), blocksize);
exit(1);
}
if ((lsunit * blocksize) > 256 * 1024) {
fprintf(stderr,
-"log stripe unit (%d bytes) is too large for kernel to handle (max 256k)\n",
+_("log stripe unit (%d bytes) is too large for kernel to handle (max 256k)\n"),
(lsunit * blocksize));
exit(1);
}
sbp = &mp->m_sb;
bzero(mp, sizeof(xfs_mount_t));
sbp->sb_blocklog = (__uint8_t)blocklog;
+ sbp->sb_sectlog = (__uint8_t)sectorlog;
sbp->sb_agblklog = (__uint8_t)libxfs_log2_roundup((unsigned int)agsize);
mp->m_blkbb_log = sbp->sb_blocklog - BBSHIFT;
+ mp->m_sectbb_log = sbp->sb_sectlog - BBSHIFT;
+
if (loginternal) {
/*
* Readjust the log size to fit within an AG if it was sized
}
if (logblocks > agsize - XFS_PREALLOC_BLOCKS(mp)) {
fprintf(stderr,
- "internal log size %lld too large, must fit in allocation group\n",
+ _("internal log size %lld too large, must fit in allocation group\n"),
(long long)logblocks);
usage();
}
if (laflag) {
if (logagno >= agcount) {
fprintf(stderr,
- "log ag number %d too large, must be less than %lld\n",
+ _("log ag number %d too large, must be less than %lld\n"),
logagno, (long long)agcount);
usage();
}
} else
logstart = 0;
+ if (!qflag || Nflag) {
+ printf(_(
+ "meta-data=%-22s isize=%-6d agcount=%lld, agsize=%lld blks\n"
+ " =%-22s sectsz=%-5u\n"
+ "data =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n"
+ " =%-22s sunit=%-6u swidth=%u blks, unwritten=%u\n"
+ "naming =version %-14u bsize=%-6u\n"
+ "log =%-22s bsize=%-6d blocks=%lld, version=%d\n"
+ " =%-22s sectsz=%-5u sunit=%d blks\n"
+ "realtime =%-22s extsz=%-6d blocks=%lld, rtextents=%lld\n"),
+ dfile, isize, (long long)agcount, (long long)agsize,
+ "", sectorsize,
+ "", blocksize, (long long)dblocks, sbp->sb_imax_pct,
+ "", dsunit, dswidth, extent_flagging,
+ dirversion, dirversion == 1 ? blocksize : dirblocksize,
+ logfile, 1 << blocklog, (long long)logblocks,
+ logversion, "", lsectorsize, lsunit,
+ rtfile, rtextblocks << blocklog,
+ (long long)rtblocks, (long long)rtextents);
+ if (Nflag)
+ exit(0);
+ }
+
if (label)
strncpy(sbp->sb_fname, label, sizeof(sbp->sb_fname));
sbp->sb_magicnum = XFS_SB_MAGIC;
sbp->sb_agcount = (xfs_agnumber_t)agcount;
sbp->sb_rbmblocks = nbmblocks;
sbp->sb_logblocks = (xfs_extlen_t)logblocks;
- sbp->sb_sectsize = 1 << sectlog;
+ sbp->sb_sectsize = (__uint16_t)sectorsize;
sbp->sb_inodesize = (__uint16_t)isize;
sbp->sb_inopblock = (__uint16_t)(blocksize / isize);
- sbp->sb_sectlog = (__uint8_t)sectlog;
+ sbp->sb_sectlog = (__uint8_t)sectorlog;
sbp->sb_inodelog = (__uint8_t)inodelog;
sbp->sb_inopblog = (__uint8_t)(blocklog - inodelog);
sbp->sb_rextslog =
iaflag = sbp->sb_inoalignmt != 0;
} else
sbp->sb_inoalignmt = 0;
+ if (lsectorsize != BBSIZE || sectorsize != BBSIZE) {
+ sbp->sb_logsectlog = (__uint8_t)lsectorlog;
+ sbp->sb_logsectsize = (__uint16_t)lsectorsize;
+ } else {
+ sbp->sb_logsectlog = 0;
+ sbp->sb_logsectsize = 0;
+ }
sbp->sb_versionnum =
XFS_SB_VERSION_MKFS(iaflag, dsunit != 0, extent_flagging,
- dirversion == 2, logversion == 2);
-
- if (!qflag || Nflag) {
- printf(
- "meta-data=%-22s isize=%-6d agcount=%lld, agsize=%lld blks\n"
- "data =%-22s bsize=%-6d blocks=%lld, imaxpct=%d\n"
- " =%-22s sunit=%-6d swidth=%d blks, unwritten=%d\n"
- "naming =version %-14d bsize=%-6d\n"
- "log =%-22s bsize=%-6d blocks=%lld, version=%d\n"
- " =%-22s sunit=%d blks\n"
- "realtime =%-22s extsz=%-6d blocks=%lld, rtextents=%lld\n",
- dfile, isize, (long long)agcount, (long long)agsize,
- "", blocksize, (long long)dblocks, sbp->sb_imax_pct,
- "", dsunit, dswidth, extent_flagging,
- dirversion, dirversion == 1 ? blocksize : dirblocksize,
- logfile, 1 << blocklog, (long long)logblocks,
- logversion, "", lsunit,
- rtfile, rtextblocks << blocklog,
- (long long)rtblocks, (long long)rtextents);
- if (Nflag)
- exit(0);
- }
+ dirversion == 2, logversion == 2,
+ (sectorsize != BBSIZE || lsectorsize != BBSIZE));
/*
* Zero out the first 68k in on the device, to obliterate any old
* filesystem signatures out there. This should take care of
* swap (somewhere around the page size), jfs (32k),
- * ext[2,3] and reiser (64k) - and hopefully all else.
+ * ext[2,3] and reiserfs (64k) - and hopefully all else.
*/
-
buf = libxfs_getbuf(xi.ddev, 0, 136);
bzero(XFS_BUF_PTR(buf), 136*BBSIZE);
- libxfs_writebuf(buf, 1);
+ libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
/* OK, now write the superblock */
- buf = libxfs_getbuf(xi.ddev, XFS_SB_DADDR, 1);
- bzero(XFS_BUF_PTR(buf), BBSIZE);
+ buf = libxfs_getbuf(xi.ddev, XFS_SB_DADDR, XFS_FSS_TO_BB(mp, 1));
+ bzero(XFS_BUF_PTR(buf), sectorsize);
libxfs_xlate_sb(XFS_BUF_PTR(buf), sbp, -1, ARCH_CONVERT,
XFS_SB_ALL_BITS);
- libxfs_writebuf(buf, 1);
+ libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
/*
* If the data area is a file, then grow it out to its final size
* will succeed.
*/
if (xi.disfile && ftruncate64(xi.dfd, dblocks * blocksize) < 0) {
- fprintf(stderr, "%s: Growing the data section file failed\n",
+ fprintf(stderr, _("%s: Growing the data section file failed\n"),
progname);
exit(1);
}
buf = libxfs_getbuf(xi.ddev, (xi.dsize - BTOBB(65536)),
BTOBB(65536));
bzero(XFS_BUF_PTR(buf), 65536);
- libxfs_writebuf(buf, 1);
+ libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
}
/*
if (loginternal)
xi.logdev = xi.ddev;
if (xi.logdev)
- libxfs_log_clear(
- xi.logdev,
- XFS_FSB_TO_DADDR(mp, logstart),
- (xfs_extlen_t)XFS_FSB_TO_BB(mp, logblocks),
- &sbp->sb_uuid,
- logversion, lsunit, XLOG_FMT);
+ libxfs_log_clear(xi.logdev, XFS_FSB_TO_DADDR(mp, logstart),
+ (xfs_extlen_t)XFS_FSB_TO_BB(mp, logblocks),
+ &sbp->sb_uuid, logversion, lsunit, XLOG_FMT);
mp = libxfs_mount(mp, sbp, xi.ddev, xi.logdev, xi.rtdev, 1);
if (mp == NULL) {
- fprintf(stderr, "%s: filesystem failed to initialize\n", progname);
+ fprintf(stderr, _("%s: filesystem failed to initialize\n"),
+ progname);
exit(1);
}
if (xi.logdev &&
XFS_FSB_TO_B(mp, logblocks) <
XFS_MIN_LOG_FACTOR * max_trans_res(mp)) {
- fprintf(stderr, "%s: log size (%lld) is too small for "
- "transaction reservations\n",
+ fprintf(stderr,
+ _("%s: log size (%lld) is too small for transaction reservations\n"),
progname, (long long)logblocks);
exit(1);
}
* Superblock.
*/
buf = libxfs_getbuf(xi.ddev,
- XFS_AG_DADDR(mp, agno, XFS_SB_DADDR), 1);
- bzero(XFS_BUF_PTR(buf), BBSIZE);
+ XFS_AG_DADDR(mp, agno, XFS_SB_DADDR),
+ XFS_FSS_TO_BB(mp, 1));
+ bzero(XFS_BUF_PTR(buf), sectorsize);
libxfs_xlate_sb(XFS_BUF_PTR(buf), sbp, -1, ARCH_CONVERT,
XFS_SB_ALL_BITS);
- libxfs_writebuf(buf, 1);
+ libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
/*
* AG header block: freespace
*/
buf = libxfs_getbuf(mp->m_dev,
- XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR), 1);
+ XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),
+ XFS_FSS_TO_BB(mp, 1));
agf = XFS_BUF_TO_AGF(buf);
- bzero(agf, BBSIZE);
+ bzero(agf, sectorsize);
if (agno == agcount - 1)
agsize = dblocks - (xfs_drfsbno_t)(agno * agsize);
INT_SET(agf->agf_magicnum, ARCH_CONVERT, XFS_AGF_MAGIC);
INT_SET(agf->agf_levels[XFS_BTNUM_BNOi], ARCH_CONVERT, 1);
INT_SET(agf->agf_levels[XFS_BTNUM_CNTi], ARCH_CONVERT, 1);
INT_SET(agf->agf_flfirst, ARCH_CONVERT, 0);
- INT_SET(agf->agf_fllast, ARCH_CONVERT, XFS_AGFL_SIZE - 1);
+ INT_SET(agf->agf_fllast, ARCH_CONVERT, XFS_AGFL_SIZE(mp) - 1);
INT_SET(agf->agf_flcount, ARCH_CONVERT, 0);
nbmblocks = (xfs_extlen_t)(agsize - XFS_PREALLOC_BLOCKS(mp));
INT_SET(agf->agf_freeblks, ARCH_CONVERT, nbmblocks);
}
if (XFS_MIN_FREELIST(agf, mp) > worst_freelist)
worst_freelist = XFS_MIN_FREELIST(agf, mp);
- libxfs_writebuf(buf, 1);
+ libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
/*
* AG header block: inodes
*/
buf = libxfs_getbuf(mp->m_dev,
- XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR), 1);
+ XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
+ XFS_FSS_TO_BB(mp, 1));
agi = XFS_BUF_TO_AGI(buf);
- bzero(agi, BBSIZE);
+ bzero(agi, sectorsize);
INT_SET(agi->agi_magicnum, ARCH_CONVERT, XFS_AGI_MAGIC);
INT_SET(agi->agi_versionnum, ARCH_CONVERT, XFS_AGI_VERSION);
INT_SET(agi->agi_seqno, ARCH_CONVERT, agno);
INT_SET(agi->agi_dirino, ARCH_CONVERT, NULLAGINO);
for (i = 0; i < XFS_AGI_UNLINKED_BUCKETS; i++)
INT_SET(agi->agi_unlinked[i], ARCH_CONVERT, NULLAGINO);
- libxfs_writebuf(buf, 1);
+ libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
/*
* BNO btree root block
INT_SET(arec->ar_blockcount, ARCH_CONVERT,
(xfs_extlen_t)(agsize -
INT_GET(arec->ar_startblock, ARCH_CONVERT)));
- libxfs_writebuf(buf, 1);
+ libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
/*
* CNT btree root block
}
INT_SET(arec->ar_blockcount, ARCH_CONVERT, (xfs_extlen_t)
(agsize - INT_GET(arec->ar_startblock, ARCH_CONVERT)));
- libxfs_writebuf(buf, 1);
+ libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
+
/*
* INO btree root block
*/
INT_SET(block->bb_numrecs, ARCH_CONVERT, 0);
INT_SET(block->bb_leftsib, ARCH_CONVERT, NULLAGBLOCK);
INT_SET(block->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK);
- libxfs_writebuf(buf, 1);
+ libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
}
/*
buf = libxfs_getbuf(mp->m_dev,
(xfs_daddr_t)XFS_FSB_TO_BB(mp, dblocks - 1LL), bsize);
bzero(XFS_BUF_PTR(buf), blocksize);
- libxfs_writebuf(buf, 1);
+ libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
/*
* Make sure we can write the last block in the realtime area.
buf = libxfs_getbuf(mp->m_rtdev,
XFS_FSB_TO_BB(mp, rtblocks - 1LL), bsize);
bzero(XFS_BUF_PTR(buf), blocksize);
- libxfs_writebuf(buf, 1);
+ libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
}
+
/*
* BNO, CNT free block list
*/
args.mp = mp;
args.agno = agno;
args.alignment = 1;
- args.minalignslop = UINT_MAX;
args.pag = &mp->m_perag[agno];
if ((i = libxfs_trans_reserve(tp, worst_freelist, 0, 0, 0, 0)))
res_failed(i);
libxfs_alloc_fix_freelist(&args, 0);
libxfs_trans_commit(tp, 0, NULL);
}
+
/*
* Allocate the root inode and anything else in the proto file.
*/
parseproto(mp, NULL, &protostring, NULL);
/*
- * protect ourselves against possible stupidity
+ * Protect ourselves against possible stupidity
*/
if (XFS_INO_TO_AGNO(mp, mp->m_sb.sb_rootino) != 0) {
- fprintf(stderr, "%s: root inode not created in AG 0, "
- "created in AG %u",
+ fprintf(stderr,
+ _("%s: root inode created in AG %u, not AG 0\n"),
progname, XFS_INO_TO_AGNO(mp, mp->m_sb.sb_rootino));
exit(1);
}
/*
- * write out multiple copies of superblocks with the rootinode field set
+ * Write out multiple secondary superblocks with rootinode field set
*/
if (mp->m_sb.sb_agcount > 1) {
/*
buf = libxfs_readbuf(mp->m_dev,
XFS_AGB_TO_DADDR(mp, mp->m_sb.sb_agcount-1,
XFS_SB_DADDR),
- BTOBB(mp->m_sb.sb_sectsize), 1);
+ XFS_FSS_TO_BB(mp, 1),
+ LIBXFS_EXIT_ON_FAILURE);
INT_SET((XFS_BUF_TO_SBP(buf))->sb_rootino,
ARCH_CONVERT, mp->m_sb.sb_rootino);
- libxfs_writebuf(buf, 1);
+ libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
/*
* and one in the middle for luck
*/
buf = libxfs_readbuf(mp->m_dev,
XFS_AGB_TO_DADDR(mp, (mp->m_sb.sb_agcount-1)/2,
XFS_SB_DADDR),
- BTOBB(mp->m_sb.sb_sectsize), 1);
+ XFS_FSS_TO_BB(mp, 1),
+ LIBXFS_EXIT_ON_FAILURE);
INT_SET((XFS_BUF_TO_SBP(buf))->sb_rootino,
ARCH_CONVERT, mp->m_sb.sb_rootino);
- libxfs_writebuf(buf, 1);
+ libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
}
}
/*
* Mark the filesystem ok.
*/
- buf = libxfs_getsb(mp, 1);
+ buf = libxfs_getsb(mp, LIBXFS_EXIT_ON_FAILURE);
(XFS_BUF_TO_SBP(buf))->sb_inprogress = 0;
- libxfs_writebuf(buf, 1);
+ libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
libxfs_umount(mp);
if (xi.rtdev)
return 0;
}
+static int
+max_trans_res(
+ xfs_mount_t *mp)
+{
+ uint *p;
+ int rval;
+ xfs_trans_reservations_t *tr;
+
+ tr = &mp->m_reservations;
+
+ for (rval = 0, p = (uint *)tr; p < (uint *)(tr + 1); p++) {
+ if ((int)*p > rval)
+ rval = (int)*p;
+ }
+ return rval;
+}
+
static void
conflict(
- char opt,
- char *tab[],
- int oldidx,
- int newidx)
+ char opt,
+ char *tab[],
+ int oldidx,
+ int newidx)
{
- fprintf(stderr, "Cannot specify both -%c %s and -%c %s\n",
+ fprintf(stderr, _("Cannot specify both -%c %s and -%c %s\n"),
opt, tab[oldidx], opt, tab[newidx]);
usage();
}
static void
illegal(
- char *value,
- char *opt)
+ char *value,
+ char *opt)
{
- fprintf(stderr, "Illegal value %s for -%s option\n", value, opt);
+ fprintf(stderr, _("Illegal value %s for -%s option\n"), value, opt);
usage();
}
static void
reqval(
- char opt,
- char *tab[],
- int idx)
+ char opt,
+ char *tab[],
+ int idx)
{
- fprintf(stderr, "-%c %s option requires a value\n", opt, tab[idx]);
+ fprintf(stderr, _("-%c %s option requires a value\n"), opt, tab[idx]);
usage();
}
static void
respec(
- char opt,
- char *tab[],
- int idx)
+ char opt,
+ char *tab[],
+ int idx)
{
fprintf(stderr, "-%c ", opt);
if (tab)
fprintf(stderr, "%s ", tab[idx]);
- fprintf(stderr, "option respecified\n");
+ fprintf(stderr, _("option respecified\n"));
usage();
}
static void
unknown(
- char opt,
- char *s)
+ char opt,
+ char *s)
{
- fprintf(stderr, "unknown option -%c %s\n", opt, s);
+ fprintf(stderr, _("unknown option -%c %s\n"), opt, s);
usage();
}
-static int
-max_trans_res(
- xfs_mount_t *mp)
-{
- uint *p;
- int rval;
- xfs_trans_reservations_t *tr;
-
- tr = &mp->m_reservations;
-
- for (rval = 0, p = (uint *)tr; p < (uint *)(tr + 1); p++) {
- if ((int)*p > rval)
- rval = (int)*p;
- }
- return rval;
-}
-
-/* returns 1 if string contains nothing but [0-9], 0 otherwise */
-
+/*
+ * isdigits -- returns 1 if string contains nothing but [0-9], 0 otherwise
+ */
int
-isdigits(char *str)
+isdigits(
+ char *str)
{
- int i;
- int n = strlen(str);
+ int i;
+ int n = strlen(str);
for (i = 0; i < n; i++) {
if (!isdigit(str[i]))
long long
cvtnum(
int blocksize,
+ int sectorsize,
char *s)
{
long long i;
char *sp;
- extern void usage(void);
i = strtoll(s, &sp, 0);
if (i == 0 && sp == s)
if (*sp == 'b' && sp[1] == '\0') {
if (blocksize)
return i * blocksize;
-
- fprintf(stderr, "blocksize not available yet.\n");
+ fprintf(stderr, _("blocksize not available yet.\n"));
usage();
}
-
- if (*sp == 's' && sp[1] == '\0')
- return 512LL * i;
+ if (*sp == 's' && sp[1] == '\0') {
+ if (sectorsize)
+ return i * sectorsize;
+ return i * BBSIZE;
+ }
if (*sp == 'k' && sp[1] == '\0')
return 1024LL * i;
if (*sp == 'm' && sp[1] == '\0')
}
void
-usage(void)
+usage( void )
{
- fprintf(stderr, "Usage: %s\n\
+ fprintf(stderr, _("Usage: %s\n\
/* blocksize */ [-b log=n|size=num]\n\
/* data subvol */ [-d agcount=n,agsize=n,file,name=xxx,size=num,\n\
(sunit=value,swidth=value|su=num,sw=num),\n\
/* inode size */ [-i log=n|perblock=n|size=num,maxpct=n]\n\
/* log subvol */ [-l agnum=n,internal,size=num,logdev=xxx\n\
version=n,sunit=value|su=num]\n\
-/* naming */ [-n log=n|size=num,version=n]\n\
/* label */ [-L label (maximum 12 characters)]\n\
+/* naming */ [-n log=n|size=num,version=n]\n\
/* prototype file */ [-p fname]\n\
/* quiet */ [-q]\n\
-/* version */ [-V]\n\
/* realtime subvol */ [-r extsize=num,size=num,rtdev=xxx]\n\
+/* sectorsize */ [-s log=n|size=num]\n\
+/* version */ [-V]\n\
devicename\n\
<devicename> is required unless -d name=xxx is given.\n\
Internal log by default, size is scaled from 1,000 blocks to 32,768 blocks\n\
based on the filesystem size. Default log reaches its largest size at 1TB.\n\
This can be overridden with the -l options or using a volume manager with a\n\
log subvolume.\n\
-<num> is xxx (bytes), xxxs (512 blocks), xxxb (fs blocks), xxxk (xxx KB),\n\
+<num> is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KB),\n\
or xxxm (xxx MB)\n\
-<value> is xxx (512 blocks).\n",
+<value> is xxx (512 blocks).\n"),
progname);
exit(1);
}
* inode number that we'll
* accept w/o warnings
*/
-extern void usage (void);
+
+/* xfs_mkfs.c */
+extern void usage (void);
extern int isdigits (char *str);
-extern long long cvtnum (int blocksize, char *s);
+extern long long cvtnum (int blocksize, int sectorsize, char *s);
+
+/* proto.c */
+extern char *setup_proto (char *fname);
+extern void parseproto (xfs_mount_t *mp, xfs_inode_t *pip, char **pp, char *n);
+extern void res_failed (int err);
+
+#define DFL_S (XFS_MAX_SECTORSIZE_LOG + 1 - XFS_MIN_SECTORSIZE_LOG) /* 7 */
+#define DFL_B (XFS_MAX_BLOCKSIZE_LOG + 1 - XFS_MIN_BLOCKSIZE_LOG) /* 8 */
+#define DFL_I (XFS_DINODE_MAX_LOG + 1 - XFS_DINODE_MIN_LOG) /* 4 */
+#define DFL_D (XFS_MAX_BLOCKSIZE_LOG + 1 - XFS_MIN_BLOCKSIZE_LOG) /* 8 */
+
+/* trtab.c */
+extern const int max_trres_v1[DFL_S][DFL_B][DFL_I];
+extern const int max_trres_v2[DFL_S][DFL_B][DFL_I][DFL_D];
#endif /* __XFS_MKFS_H__ */
--- /dev/null
+#
+# Copyright (c) 2001-2002 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://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+#
+
+TOPDIR = ..
+include $(TOPDIR)/include/builddefs
+
+# Currently LINGUAS is undefined, so buildmacros provides no targets.
+LINGUAS =
+LSRCFILES = $(LINGUAS:%=%.po)
+# LSRCFILES += $(PKG_NAME).pot
+
+# TODO: db/ logprint/ repair/
+XGETTEXTFILES = $(TOPDIR)/bmap/xfs_bmap.c \
+ $(TOPDIR)/imap/xfs_imap.c \
+ $(TOPDIR)/rtcp/xfs_rtcp.c \
+ $(TOPDIR)/growfs/explore.c \
+ $(TOPDIR)/growfs/xfs_growfs.c \
+ $(TOPDIR)/freeze/xfs_freeze.c \
+ $(TOPDIR)/mkfile/xfs_mkfile.c \
+ $(TOPDIR)/mkfs/proto.c \
+ $(TOPDIR)/mkfs/xfs_mkfs.c \
+ $(TOPDIR)/libxfs/$(PKG_PLATFORM).c \
+ $(TOPDIR)/libxfs/init.c \
+ $(TOPDIR)/libxfs/rdwr.c \
+ $(TOPDIR)/libxfs/util.c \
+ $(TOPDIR)/libxfs/trans.c \
+ $(TOPDIR)/libxlog/util.c \
+ $(TOPDIR)/libdisk/drivers.c \
+ $(TOPDIR)/libdisk/lvm.c \
+ $(TOPDIR)/libdisk/md.c
+
+default: $(LINGUAS:%=%.mo)
+
+include $(BUILDRULES)
+
+install: default
+ $(INSTALL_LINGUAS)
+
+install-dev install-lib:
* check first/last AGF fields. if need be, lose the free
* space in the AGFL, we'll reclaim it later.
*/
- if (INT_GET(agf->agf_flfirst, ARCH_CONVERT) >= XFS_AGFL_SIZE) {
+ if (INT_GET(agf->agf_flfirst, ARCH_CONVERT) >= XFS_AGFL_SIZE(mp)) {
do_warn("flfirst %d in agf %d too large (max = %d)\n",
- INT_GET(agf->agf_flfirst, ARCH_CONVERT), i, XFS_AGFL_SIZE);
+ INT_GET(agf->agf_flfirst, ARCH_CONVERT),
+ i, XFS_AGFL_SIZE(mp));
if (!no_modify)
INT_ZERO(agf->agf_flfirst, ARCH_CONVERT);
}
- if (INT_GET(agf->agf_fllast, ARCH_CONVERT) >= XFS_AGFL_SIZE) {
+ if (INT_GET(agf->agf_fllast, ARCH_CONVERT) >= XFS_AGFL_SIZE(mp)) {
do_warn("fllast %d in agf %d too large (max = %d)\n",
- INT_GET(agf->agf_fllast, ARCH_CONVERT), i, XFS_AGFL_SIZE);
+ INT_GET(agf->agf_fllast, ARCH_CONVERT),
+ i, XFS_AGFL_SIZE(mp));
if (!no_modify)
INT_ZERO(agf->agf_fllast, ARCH_CONVERT);
}
* zero and the shared version bit should be cleared for
* current mkfs's.
*
- * And everything else in the buffer beyond either sb_width
- * or sb_dirblklog (v2 dirs) should be zeroed.
+ * And everything else in the buffer beyond either sb_width,
+ * sb_dirblklog (v2 dirs), or sb_logsectsize can be zeroed.
+ *
+ * Note: contrary to the name, this routine is called for all
+ * superblocks, not just the secondary superblocks.
*/
int
secondary_sb_wack(xfs_mount_t *mp, xfs_buf_t *sbuf, xfs_sb_t *sb,
(sb->sb_versionnum & XR_GOOD_SECSB_VNMASK) == 0 ||
sb->sb_versionnum < XFS_SB_VERSION_4) {
/*
- * check for garbage beyond the last field set by the
- * pre-6.5 mkfs's. Don't blindly use sizeof(sb).
+ * Check for garbage beyond the last field.
* Use field addresses instead so this code will still
* work against older filesystems when the superblock
* gets rev'ed again with new fields appended.
if (XFS_SB_VERSION_HASLOGV2(sb))
size = (__psint_t)&sb->sb_logsunit
+ sizeof(sb->sb_logsunit) - (__psint_t)sb;
+ else if (XFS_SB_VERSION_HASSECTOR(sb))
+ size = (__psint_t)&sb->sb_logsectsize
+ + sizeof(sb->sb_logsectsize) - (__psint_t)sb;
else if (XFS_SB_VERSION_HASDIRV2(sb))
size = (__psint_t)&sb->sb_dirblklog
+ sizeof(sb->sb_dirblklog) - (__psint_t)sb;
rval |= XR_AG_SB_SEC;
if (!no_modify) {
do_warn(
- "zeroing unused portion of secondary superblock %d sector\n",
- i);
+ "zeroing unused portion of %s superblock (AG #%u)\n",
+ !i ? "primary" : "secondary", i);
bzero((void *)((__psint_t)sb + size),
mp->m_sb.sb_sectsize - size);
} else
do_warn(
- "would zero unused portion of secondary superblock %d sector\n",
- i);
+ "would zero unused portion of %s superblock (AG #%u)\n",
+ !i ? "primary" : "secondary", i);
}
}
int err = 0;
int agi_dirty = 0;
- bp = libxfs_readbuf(mp->m_dev, XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR),
- mp->m_sb.sb_sectsize/BBSIZE, 0);
+ bp = libxfs_readbuf(mp->m_dev,
+ XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
+ mp->m_sb.sb_sectsize/BBSIZE, 0);
if (!bp) {
do_error("cannot read agi block %lld for ag %u\n",
- XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR), agno);
+ XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)), agno);
exit(1);
}
* as they will be *after* accounting for the free space
* we've used up will need fewer blocks to to represent
* than we've allocated. We can use the AGFL to hold
- * XFS_AGFL_SIZE (128) blocks but that's it.
+ * XFS_AGFL_SIZE (sector/xfs_agfl_t) blocks but that's it.
* Thus we limit things to XFS_AGFL_SIZE/2 for each of the 2 btrees.
* if the number of extra blocks is more than that,
* we'll have to be called again.
int i;
agi_buf = libxfs_getbuf(mp->m_dev,
- XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR),
+ XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
mp->m_sb.sb_sectsize/BBSIZE);
agi = XFS_BUF_TO_AGI(agi_buf);
bzero(agi, mp->m_sb.sb_sectsize);
xfs_agf_t *agf;
agf_buf = libxfs_getbuf(mp->m_dev,
- XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR),
- mp->m_sb.sb_sectsize/BBSIZE);
+ XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),
+ mp->m_sb.sb_sectsize/BBSIZE);
agf = XFS_BUF_TO_AGF(agf_buf);
bzero(agf, mp->m_sb.sb_sectsize);
* yes - grab the AGFL buffer
*/
agfl_buf = libxfs_getbuf(mp->m_dev,
- XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR),
+ XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR(mp)),
mp->m_sb.sb_sectsize/BBSIZE);
agfl = XFS_BUF_TO_AGFL(agfl_buf);
bzero(agfl, mp->m_sb.sb_sectsize);
* ok, now grab as many blocks as we can
*/
i = j = 0;
- while (bno_bt->num_free_blocks > 0 && i < XFS_AGFL_SIZE) {
+ while (bno_bt->num_free_blocks > 0 && i < XFS_AGFL_SIZE(mp)) {
INT_SET(agfl->agfl_bno[i], ARCH_CONVERT,
get_next_blockaddr(agno, 0, bno_bt));
i++;
}
- while (bcnt_bt->num_free_blocks > 0 && i < XFS_AGFL_SIZE) {
+ while (bcnt_bt->num_free_blocks > 0 && i < XFS_AGFL_SIZE(mp)) {
INT_SET(agfl->agfl_bno[i], ARCH_CONVERT,
get_next_blockaddr(agno, 0, bcnt_bt));
i++;
libxfs_writebuf(agfl_buf, 0);
} else {
INT_ZERO(agf->agf_flfirst, ARCH_CONVERT);
- INT_SET(agf->agf_fllast, ARCH_CONVERT, XFS_AGFL_SIZE - 1);
+ INT_SET(agf->agf_fllast, ARCH_CONVERT, XFS_AGFL_SIZE(mp) - 1);
INT_ZERO(agf->agf_flcount, ARCH_CONVERT);
}
/*
* see if we can fit all the extra blocks into the AGFL
*/
- extra_blocks = (extra_blocks - XFS_AGFL_SIZE > 0)
- ? extra_blocks - XFS_AGFL_SIZE
+ extra_blocks = (extra_blocks - XFS_AGFL_SIZE(mp) > 0)
+ ? extra_blocks - XFS_AGFL_SIZE(mp)
: 0;
if (extra_blocks > 0) {
return;
agflbuf = libxfs_readbuf(mp->m_dev,
XFS_AG_DADDR(mp, INT_GET(agf->agf_seqno, ARCH_CONVERT),
- XFS_AGFL_DADDR), 1, 0);
+ XFS_AGFL_DADDR(mp)), XFS_FSS_TO_BB(mp, 1), 0);
if (!agflbuf) {
do_abort("can't read agfl block for ag %d\n",
INT_GET(agf->agf_seqno, ARCH_CONVERT));
count++;
if (i == INT_GET(agf->agf_fllast, ARCH_CONVERT))
break;
- if (++i == XFS_AGFL_SIZE)
+ if (++i == XFS_AGFL_SIZE(mp))
i = 0;
}
if (count != INT_GET(agf->agf_flcount, ARCH_CONVERT)) {
XFS_SB_ALL_BITS);
agfbuf = libxfs_readbuf(mp->m_dev,
- XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR), 1, 0);
+ XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),
+ XFS_FSS_TO_BB(mp, 1), 0);
if (!agfbuf) {
do_error("can't read agf block for ag %d\n", agno);
libxfs_putbuf(sbbuf);
agf = XFS_BUF_TO_AGF(agfbuf);
agibuf = libxfs_readbuf(mp->m_dev,
- XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR), 1, 0);
+ XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
+ XFS_FSS_TO_BB(mp, 1), 0);
if (!agibuf) {
do_error("can't read agi block for ag %d\n", agno);
libxfs_putbuf(agfbuf);
void
usage()
{
- fprintf(stderr, "%s [-e extsize] [-p] source target\n", progname);
+ fprintf(stderr, _("%s [-e extsize] [-p] source target\n"), progname);
exit(2);
}
main(int argc, char **argv)
{
register int c, i, r, errflg = 0;
- struct stat s2;
+ struct stat64 s2;
int eflag;
int extsize = - 1;
progname = basename(argv[0]);
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
while ((c = getopt(argc, argv, "pe:V")) != EOF) {
switch (c) {
pflag = 1;
break;
case 'V':
- printf("%s version %s\n", progname, VERSION);
+ printf(_("%s version %s\n"), progname, VERSION);
exit(0);
default:
errflg++;
argv = &argv[optind];
if (argc < 2) {
- fprintf(stderr, "%s: must specify files to copy\n", progname);
+ fprintf(stderr, _("%s: must specify files to copy\n"),
+ progname);
errflg++;
}
* which really exists.
*/
if (argc > 2) {
- if (stat(argv[argc-1], &s2) < 0) {
- fprintf(stderr, "%s: stat of %s failed\n",
+ if (stat64(argv[argc-1], &s2) < 0) {
+ fprintf(stderr, _("%s: stat64 of %s failed\n"),
progname, argv[argc-1]);
exit(2);
}
if (!S_ISDIR(s2.st_mode)) {
- fprintf(stderr, "%s: final argument is not directory\n",
+ fprintf(stderr,
+ _("%s: final argument is not directory\n"),
progname);
usage();
}
int remove = 0, rtextsize;
char *sp, *fbuf, *ptr;
char tbuf[ PATH_MAX ];
- struct stat s1, s2;
+ struct stat64 s1, s2;
struct fsxattr fsxattr;
struct dioattr dioattr;
*sp = '\0';
}
- if ( stat(source, &s1) ) {
- fprintf(stderr, "%s: failed stat on\n", progname);
- perror(source);
+ if ( stat64(source, &s1) ) {
+ fprintf(stderr, _("%s: failed stat64 on %s: %s\n"),
+ progname, source, strerror(errno));
return( -1);
}
* check for a realtime partition
*/
snprintf(tbuf, sizeof(tbuf), "%s", target);
- if ( stat(target, &s2) ) {
+ if ( stat64(target, &s2) ) {
if (!S_ISDIR(s2.st_mode)) {
/* take out target file name */
if ((ptr = strrchr(tbuf, '/')) != NULL)
}
if ( (rtextsize = xfsrtextsize( tbuf )) <= 0 ) {
- fprintf(stderr, "%s: %s filesystem has no realtime partition\n",
+ fprintf(stderr,
+ _("%s: %s filesystem has no realtime partition\n"),
progname, tbuf);
return( -1 );
}
* check if target is a directory
*/
snprintf(tbuf, sizeof(tbuf), "%s", target);
- if ( !stat(target, &s2) ) {
+ if ( !stat64(target, &s2) ) {
if (S_ISDIR(s2.st_mode)) {
snprintf(tbuf, sizeof(tbuf), "%s/%s", target,
basename(source));
}
}
- if ( stat(tbuf, &s2) ) {
+ if ( stat64(tbuf, &s2) ) {
/*
* create the file if it does not exist
*/
if ( (tofd = open(tbuf, O_RDWR|O_CREAT|O_DIRECT, 0666)) < 0 ) {
- fprintf(stderr, "%s: Open of %s failed.\n",
- progname, tbuf);
+ fprintf(stderr, _("%s: open of %s failed: %s\n"),
+ progname, tbuf, strerror(errno));
return( -1 );
}
remove = 1;
fsxattr.fsx_extsize = 0;
if ( ioctl( tofd, XFS_IOC_FSSETXATTR, &fsxattr) ) {
- fprintf(stderr, "%s: Set attributes on %s failed.\n",
- progname, tbuf);
+ fprintf(stderr,
+ _("%s: set attributes on %s failed: %s\n"),
+ progname, tbuf, strerror(errno));
close( tofd );
unlink( tbuf );
return( -1 );
* open existing file
*/
if ( (tofd = open(tbuf, O_RDWR|O_DIRECT)) < 0 ) {
- fprintf(stderr, "%s: Open of %s failed.\n",
- progname, tbuf);
+ fprintf(stderr, _("%s: open of %s failed: %s\n"),
+ progname, tbuf, strerror(errno));
return( -1 );
}
if ( ioctl( tofd, XFS_IOC_FSGETXATTR, &fsxattr) ) {
- fprintf(stderr, "%s: Get attributes of %s failed.\n",
- progname, tbuf);
+ fprintf(stderr,
+ _("%s: get attributes of %s failed: %s\n"),
+ progname, tbuf, strerror(errno));
close( tofd );
return( -1 );
}
* check if the existing file is already a realtime file
*/
if ( !(fsxattr.fsx_xflags & XFS_XFLAG_REALTIME) ) {
- fprintf(stderr, "%s: %s is not a realtime file.\n",
+ fprintf(stderr, _("%s: %s is not a realtime file.\n"),
progname, tbuf);
return( -1 );
}
* check for matching extent size
*/
if ( (fextsize != -1) && (fsxattr.fsx_extsize != fextsize) ) {
- fprintf(stderr, "%s: %s file extent size is %d, "
- "instead of %d.\n",
+ fprintf(stderr, _("%s: %s file extent size is %d, "
+ "instead of %d.\n"),
progname, tbuf, fsxattr.fsx_extsize, fextsize);
return( -1 );
}
*/
reopen = 0;
if ( (fromfd = open(source, O_RDONLY|O_DIRECT)) < 0 ) {
- fprintf(stderr, "%s: Open of %s source failed.\n",
- progname, source);
+ fprintf(stderr, _("%s: open of %s source failed: %s\n"),
+ progname, source, strerror(errno));
close( tofd );
if (remove)
unlink( tbuf );
reopen = 1;
} else {
if (! (fsxattr.fsx_xflags & XFS_XFLAG_REALTIME) ){
- fprintf(stderr, "%s: %s is not a realtime file.\n",
+ fprintf(stderr, _("%s: %s is not a realtime file.\n"),
progname, source);
reopen = 1;
}
if (reopen) {
close( fromfd );
if ( (fromfd = open(source, O_RDONLY )) < 0 ) {
- fprintf(stderr, "%s: Open of %s source failed.\n",
- progname, source);
+ fprintf(stderr, _("%s: open of %s source failed: %s\n"),
+ progname, source, strerror(errno));
close( tofd );
if (remove)
unlink( tbuf );
* get direct I/O parameters
*/
if ( ioctl( tofd, XFS_IOC_DIOINFO, &dioattr) ) {
- fprintf(stderr, "%s: Could not get direct I/O information.\n",
- progname);
+ fprintf(stderr,
+ _("%s: couldn't get direct I/O information: %s\n"),
+ progname, strerror(errno));
close( fromfd );
close( tofd );
if ( remove )
}
if ( rtextsize % dioattr.d_miniosz ) {
- fprintf(stderr, "%s: extent size %d not a multiple of %d.\n",
+ fprintf(stderr, _("%s: extent size %d not a multiple of %d.\n"),
progname, rtextsize, dioattr.d_miniosz);
close( fromfd );
close( tofd );
* file system block size.
*/
if ( s1.st_size % dioattr.d_miniosz ) {
- printf("The size of %s is not a multiple of %d.\n",
+ printf(_("The size of %s is not a multiple of %d.\n"),
source, dioattr.d_miniosz);
if ( pflag ) {
- printf("%s will be padded to %lld bytes.\n",
+ printf(_("%s will be padded to %lld bytes.\n"),
tbuf, (long long)
(((s1.st_size / dioattr.d_miniosz) + 1) *
dioattr.d_miniosz) );
} else {
- printf("Use the -p option to pad %s "
- "to a size which is a multiple of %d bytes.\n",
+ printf(_("Use the -p option to pad %s to a "
+ "size which is a multiple of %d bytes.\n"),
tbuf, dioattr.d_miniosz);
close( fromfd );
close( tofd );
writect = write( tofd, fbuf, readct);
if ( writect != readct ) {
- fprintf(stderr, "%s: Write error.\n", progname);
+ fprintf(stderr, _("%s: write error: %s\n"),
+ progname, strerror(errno));
close(fromfd);
close(tofd);
free( fbuf );
fd = open( path, O_RDONLY );
if ( fd < 0 ) {
- fprintf(stderr, "%s: Could not open ", progname);
- perror(path);
+ fprintf(stderr, _("%s: could not open %s: %s\n"),
+ progname, path, strerror(errno));
return -1;
}
rval = ioctl( fd, XFS_IOC_FSGEOMETRY_V1, &geo );