]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Flush out my xfsprogs backlog - bunch of I18N and sector size related
authorNathan Scott <nathans@sgi.com>
Thu, 19 Dec 2002 00:38:27 +0000 (00:38 +0000)
committerNathan Scott <nathans@sgi.com>
Thu, 19 Dec 2002 00:38:27 +0000 (00:38 +0000)
changes mainly, also some build minor build cleanups here and there.
Add in the po subdir for I18N support.

73 files changed:
Makefile
VERSION
bmap/xfs_bmap.c
configure.in
db/agf.c
db/agfl.c
db/agi.c
db/check.c
db/faddr.c
db/frag.c
db/freesp.c
db/sb.c
db/uuid.c
db/xfs_admin.sh
db/xfs_check.sh
db/xfs_check64.sh
db/xfs_ncheck.sh
db/xfs_ncheck64.sh
debian/changelog
debian/rules
doc/CHANGES
freeze/xfs_freeze.c
growfs/Makefile
growfs/explore.c
growfs/xfs_growfs.c
growfs/xfs_info.sh
imap/xfs_imap.c
include/Makefile
include/builddefs.in
include/buildmacros
include/buildrules
include/libxfs.h
include/platform_defs.h.in
include/swab.h [new file with mode: 0644]
include/xfs_ag.h
include/xfs_alloc.h
include/xfs_alloc_btree.h
include/xfs_bmap_btree.h
include/xfs_fs.h
include/xfs_mount.h
include/xfs_sb.h
include/xfs_trans.h
include/xfs_types.h
libdisk/Makefile
libdisk/drivers.c
libdisk/drivers.h
libdisk/lvm.c
libdisk/md.c
libxfs/Makefile
libxfs/init.c
libxfs/init.h [moved from mkfs/proto.h with 63% similarity]
libxfs/linux.c [new file with mode: 0644]
libxfs/rdwr.c
libxfs/trans.c
libxfs/util.c
libxfs/xfs_alloc.c
libxfs/xfs_ialloc.c
libxfs/xfs_mount.c
libxlog/util.c
man/man8/mkfs.xfs.8
mkfile/xfs_mkfile.c
mkfs/Makefile
mkfs/maxtrres.c
mkfs/proto.c
mkfs/trtab.c [new file with mode: 0644]
mkfs/xfs_mkfs.c
mkfs/xfs_mkfs.h
po/Makefile [new file with mode: 0644]
repair/agheader.c
repair/phase3.c
repair/phase5.c
repair/scan.c
rtcp/xfs_rtcp.c

index 728a9032a1822b47c58453f3911fcc7b4d0dc34f..28ba4ed6e0706fa03f3f3d499c4b7544840a1d0a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -45,7 +45,7 @@ LDIRT = config.log .dep config.status config.cache confdefs.h conftest* \
 
 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)
diff --git a/VERSION b/VERSION
index e684dab0d7a29f1aee555b1fd0bfe9264ca358e8..933ba1bb1124e525dc716e349045dabdc3b6731f 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -3,5 +3,5 @@
 #
 PKG_MAJOR=2
 PKG_MINOR=3
-PKG_REVISION=7
+PKG_REVISION=8
 PKG_BUILD=0
index 05c47a95908ea13f1aa7f0066550df179c5f58de..5db0fd41015e70cb6c0b91fef5fe5f658ccd168e 100644 (file)
@@ -57,6 +57,10 @@ main(int argc, char **argv)
        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':
@@ -81,11 +85,12 @@ main(int argc, char **argv)
                        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);
                }
        }
@@ -102,14 +107,14 @@ main(int argc, char **argv)
 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;
@@ -132,14 +137,14 @@ dofile(char *fname)
 
        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;
@@ -147,28 +152,30 @@ dofile(char *fname)
 
        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);
 
@@ -184,7 +191,7 @@ dofile(char *fname)
        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;
@@ -229,9 +236,9 @@ dofile(char *fname)
                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,
@@ -241,8 +248,8 @@ dofile(char *fname)
                            && !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);
@@ -259,8 +266,8 @@ dofile(char *fname)
                 */
                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);
@@ -270,7 +277,8 @@ dofile(char *fname)
                        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;
@@ -279,7 +287,7 @@ dofile(char *fname)
        } 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;
@@ -294,7 +302,7 @@ dofile(char *fname)
                                (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,
@@ -303,7 +311,8 @@ dofile(char *fname)
 
                        }
                        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");
                }
@@ -359,12 +368,12 @@ dofile(char *fname)
                }
                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,
@@ -374,7 +383,7 @@ dofile(char *fname)
                                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);
index f6a09472ee41fd17c5193bb0fcf80d3933890ec9..1b3da7b20c2b1e388ebb747c8a53c604b8cdaa19 100644 (file)
@@ -1,5 +1,7 @@
 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)
 
@@ -7,12 +9,14 @@ 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?
@@ -35,17 +39,18 @@ pkg_release=$PKG_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
@@ -71,6 +76,11 @@ test -z "$ZIP" && AC_PATH_PROG(ZIP, gzip, /bin/gzip)
 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
@@ -92,18 +102,7 @@ if test $rpm_version -ge 4; then
 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
@@ -119,6 +118,27 @@ test -z "$ECHO" && AC_PATH_PROG(ECHO, echo, /bin/echo)
 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
@@ -136,6 +156,13 @@ AC_ARG_ENABLE(shared,
        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
@@ -149,6 +176,7 @@ AC_CHECK_LIB(uuid, uuid_generate,, [
        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.
index f1eb718840fd2bc680232ba6d314b7fbea51ce9d..23dcbaaedaeeee8d3121209673619b5693d7cdbb 100644 (file)
--- a/db/agf.c
+++ b/db/agf.c
@@ -97,8 +97,8 @@ agf_help(void)
 "\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"
 );
@@ -122,8 +122,9 @@ agf_f(
        } 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;
 }
 
index ad13397e678ce3555733f817f7ddb64269c4ca93..9b3bdabeace41992f718ba71f21679a033c117c6 100644 (file)
--- a/db/agfl.c
+++ b/db/agfl.c
@@ -43,6 +43,7 @@
 #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);
 
@@ -50,18 +51,26 @@ static const cmdinfo_t agfl_cmd =
        { "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)
 {
@@ -73,7 +82,7 @@ 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"
@@ -100,8 +109,9 @@ agfl_f(
        } 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;
 }
 
index 1f44bfd3a21067b090d8d5eb4a5c432222c69e42..4f95fa34f8465ce53c3d888fcbeb2a19e5acc0a3 100644 (file)
--- a/db/agi.c
+++ b/db/agi.c
@@ -108,8 +108,9 @@ agi_f(
        } 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;
 }
 
index aaec90bd536bf7bd1cd5e94e6525c3041a152527..daa0acde13d1bb5fd785d216b338955078d2a5b0 100644 (file)
@@ -3821,8 +3821,9 @@ scan_ag(
        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);
@@ -3856,8 +3857,9 @@ scan_ag(
                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();
@@ -3885,8 +3887,9 @@ scan_ag(
                        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++;
@@ -3989,7 +3992,8 @@ scan_freelist(
                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++;
@@ -4004,7 +4008,7 @@ scan_freelist(
                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)) {
index 64209f29976a3b2bc19460e8376647604b449dd3..8b87723f92a7d5d34f56e71f13c24c8e35cf549d 100644 (file)
@@ -309,7 +309,7 @@ fa_dirblock(
        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);
 }
index 74fb3e016a4dde4b507916e9925a442bbf23ccb6..4f2eddfcc88451e1fd438d402859f7e57f7e5969 100644 (file)
--- a/db/frag.c
+++ b/db/frag.c
@@ -383,16 +383,18 @@ scan_ag(
        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();
@@ -499,7 +501,7 @@ scanfunc_ino(
                        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",
index edb84401b94bc4992ab29f38a2411ac632e2101d..3964fc9b6ed116e07758fe2bbc51dff915790e68 100644 (file)
@@ -223,8 +223,9 @@ scan_ag(
        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)
@@ -255,8 +256,8 @@ scan_freelist(
                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 (;;) {
@@ -264,7 +265,7 @@ scan_freelist(
                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();
diff --git a/db/sb.c b/db/sb.c
index ea471d6dcc15ee282a7dc892feb91dbd500094d7..a478a7cea45dfdc85da680979a768c453497d950 100644 (file)
--- a/db/sb.c
+++ b/db/sb.c
@@ -99,6 +99,8 @@ const field_t sb_flds[] = {
        { "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 }
 };
@@ -114,8 +116,8 @@ sb_help(void)
 "\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"
@@ -141,8 +143,9 @@ sb_f(
        } 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;
 }
 
index e26e1e1054857feb0880174fefba1ea33aa5d3f0..8a2b9ca35bb7857d57b75b448e0929e759d9fb13 100644 (file)
--- a/db/uuid.c
+++ b/db/uuid.c
@@ -105,8 +105,9 @@ static int
 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);
index cb8a6c4e1c12a0ab2d59879482c992bbed85513e..acf506d00d4f976d791874c351acaf27f7a7b3bc 100755 (executable)
@@ -32,9 +32,9 @@
 #
 
 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";;
@@ -42,6 +42,7 @@ do
        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
                ;;
index cb1c1f431a1c5646484cd607e8d97820bfc89895..f2d60c23a593d422170b813a66530f49954b1eb7 100755 (executable)
 # 
 # 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";;
index c4c28fd8b252190663266843b6c09004b1cbb3c6..fa3dc75e99912613691fdfba2ad4465553df3e3b 100755 (executable)
 # 
 # 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";;
index 193dfa32b161543e2da109e90d3b41be45a4bffb..42f53275d9b5a1c643a851212888c26d280b29e2 100755 (executable)
 # 
 # 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
index 05a6e5585e8de964c6f6b6019846a7f8f3bb84a3..8107b089284a63f087a05320cfdddad29cbd345e 100755 (executable)
 # 
 # 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
index e7a326dd73bac0978f58e55f6a93f5a0782ef8a0..a541f0751dee5ecf268c54ce55e677c062cd4d2b 100644 (file)
@@ -1,3 +1,9 @@
+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
index d4aab4dced819c46b6537b4af6a798d5e4caf322..8db48d9a4be3616faf4064a0c17ea13f2761fedf 100755 (executable)
@@ -13,7 +13,8 @@ pkgbfs = DIST_ROOT=`pwd`/$(dirbfs); export DIST_ROOT;
 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
 
index 1fc7f173cbaa108c6eaea2191dfc916d2d23ead5..f4b0691c5dd5feccf96fd8011a4a7c99e79107ae 100644 (file)
@@ -1,3 +1,25 @@
+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.
@@ -397,4 +419,3 @@ xfs-cmds-1.0.1 (5 July 2000)
 xfs-cmds-1.0.0 (16 June 2000)
        - initial release for USENIX CDs
        - early alpha code
-
index c946e073f7167c566737a9a24c12acf33ad217b4..aa5f03e4a8af31619a9081b51ae8f1f0293c6a9f 100644 (file)
@@ -38,11 +38,11 @@ char        *progname;
 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);
 }
@@ -58,6 +58,10 @@ main(int argc, char **argv)
 
        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':
@@ -83,17 +87,17 @@ main(int argc, char **argv)
        }
        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);
                }
@@ -101,8 +105,8 @@ main(int argc, char **argv)
 
        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);
                }
index 7bae9bf9c135dc7790b82d69580f58365bbb4d64..9d09a39e8d23e3d4ca13a05fbf2e6162236d0634 100644 (file)
@@ -35,7 +35,12 @@ include $(TOPDIR)/include/builddefs
 
 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)
index 27c184ec6604126237ef4851a49462becd89c41c..530d250f8533265363e4e5f448f1fbccecac21f3 100644 (file)
@@ -52,19 +52,19 @@ explore_mtab(char *mtab, char *mntpoint)
                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;
                }
@@ -72,7 +72,7 @@ explore_mtab(char *mtab, char *mntpoint)
                                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);
                }
@@ -81,7 +81,7 @@ explore_mtab(char *mtab, char *mntpoint)
 
        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);
        }
index 3ab380a32c1ea94daf9ddedb4ad44f10142117a1..da18f4575b937966a74f2ea8b6aacd95b13bfbb4 100644 (file)
@@ -50,7 +50,7 @@ char  *rtdev;         /*   RT device name */
 static void
 usage(void)
 {
-       fprintf(stderr,
+       fprintf(stderr, _(
 "Usage: %s [options] mountpoint\n\n\
 Options:\n\
         -d          grow data/metadata section\n\
@@ -66,7 +66,7 @@ Options:\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);
 }
@@ -80,23 +80,28 @@ report_info(
        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
@@ -131,6 +136,9 @@ main(int argc, char **argv)
        libxfs_init_t           xi;     /* libxfs structure */
 
        progname = basename(argv[0]);
+       setlocale(LC_ALL, "");
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       textdomain(PACKAGE);
 
        mtab = NULL;
        maxpct = esize = 0;
@@ -181,7 +189,7 @@ main(int argc, char **argv)
                        lflag = xflag = 1;
                        break;
                case 'V':
-                       printf("%s version %s\n", progname, VERSION);
+                       printf(_("%s version %s\n"), progname, VERSION);
                        exit(0);
                case '?':
                default:
@@ -211,11 +219,11 @@ main(int argc, char **argv)
                 * 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);
                }
@@ -247,17 +255,18 @@ main(int argc, char **argv)
 
        /* 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);
        }
@@ -290,8 +299,8 @@ main(int argc, char **argv)
                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;
@@ -301,29 +310,29 @@ main(int argc, char **argv)
                           + (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;
                        }
@@ -338,35 +347,35 @@ main(int argc, char **argv)
                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;
                        }
@@ -387,20 +396,21 @@ main(int argc, char **argv)
                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;
                        }
@@ -408,28 +418,28 @@ main(int argc, char **argv)
        }
 
        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);
 }
index 68eac10193ec9db28521ce59f511c24c9da143a6..c092ad641f6363e056489b1b662600274a4d8422 100755 (executable)
 #
 
 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
                ;;
index e929c211bf49ed99279fcdb62e148be3c3503fdc..20dd28386961f3de112bacf62c590078d4bb9cec 100644 (file)
@@ -51,6 +51,9 @@ int main(int argc, char **argv)
        struct statfs   buf;
 
        progname = basename(argv[0]);
+       setlocale(LC_ALL, "");
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       textdomain(PACKAGE);
 
        if (argc < 2)
                name = ".";
@@ -63,8 +66,8 @@ int main(int argc, char **argv)
        }
        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);
        }
@@ -85,7 +88,7 @@ int main(int argc, char **argv)
                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);
index 7a83872b3bc48015d4aa5eeeae63b5e56e302b92..18929aaa27a57aac58adbded610b38cec6df59b4 100644 (file)
@@ -33,7 +33,7 @@
 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 \
index 0a3dce6bead1fa498797e910d431063323f94f5f..a8caf6e0a2d590ca18a56e9d1cfc7a1633a22448 100644 (file)
@@ -45,47 +45,64 @@ LIBXLOG = $(TOPDIR)/libxlog/libxlog.la
 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
 
index 33b780c0c7a68355f9007787fddb3755ad722f8f..b9210af375e4bce96cce89961ea34571b46066f0 100644 (file)
@@ -42,8 +42,12 @@ LDLIBS = $(LLDLIBS) $(MALLOCLIB)
 
 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) \
@@ -137,6 +141,15 @@ INSTALL_MAN = \
                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 \
index a6a011611214bb2a78bc9083e4e6d6b537506def..6e186a7bfe1dec726a5ccff03c60f7c03ce5e5a8 100644 (file)
@@ -55,6 +55,17 @@ $(LTLIBRARY) : $(SUBDIRS) $(LTOBJECTS)
        $(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)
 
index f08d542b8250b45da6185c188d9a9d7b41525d15..61b7aa4d8b82b737749c0353d59016c4419cd313 100644 (file)
@@ -108,8 +108,9 @@ typedef struct {
        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 *);
@@ -144,6 +145,7 @@ typedef struct xfs_mount {
        __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 */
index d3e9aae4e2a737940888d3415b4312d3a4b90755..14f7ab97dd046052a76036c914e997eb5919d003 100644 (file)
 #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__)
@@ -114,8 +111,8 @@ typedef int __psint_t;
 #  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
@@ -132,8 +129,8 @@ typedef unsigned int __psunsigned_t;
 #  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
@@ -141,6 +138,17 @@ typedef unsigned long long __psunsigned_t;
 # 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
diff --git a/include/swab.h b/include/swab.h
new file mode 100644 (file)
index 0000000..f3ebd81
--- /dev/null
@@ -0,0 +1,156 @@
+#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 */
index 2bec8dd18c52c47fcf619e4423f28cc6e9c29ea4..9959c923d06c206d66deeae26df58c5955518b44 100644 (file)
@@ -109,12 +109,12 @@ typedef struct xfs_agf
 #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
 
 /*
@@ -164,29 +164,30 @@ typedef struct xfs_agi
 #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;
 
 /*
@@ -244,15 +245,15 @@ xfs_extlen_t xfs_ag_min_blocks(int bl);
 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);
@@ -320,7 +321,7 @@ xfs_agblock_t xfs_fsb_to_agbno(struct xfs_mount *mp, xfs_fsblock_t fsbno);
 
 #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) \
@@ -333,7 +334,8 @@ xfs_daddr_t xfs_agb_to_daddr(struct xfs_mount *mp, xfs_agnumber_t agno,
  */
 
 #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))
index 2ef859cb41e14fbec313f386bb56df59a440df10..8ab7ca03a7cc03d91c522131512f7e28fb026dfe 100644 (file)
@@ -130,16 +130,6 @@ void
 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.
index e19c3290dcd30e8403f4865df90a651281dd0b0a..e788103ba5e24dcdd6d879d042856d43208a35ca 100644 (file)
@@ -96,16 +96,22 @@ int xfs_alloc_block_minrecs(int lev, struct xfs_btree_cur *cur);
 #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);
index a9ec9c58252d20a79ce385f61274153e49e4841a..b29f6d978f9fa5907b3dc7c1eb894a1d45bc6dc5 100644 (file)
@@ -167,7 +167,7 @@ xfs_exntfmt_t xfs_extfmt_inode(struct xfs_inode *ip);
   (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.
index a50ee40bffc0ec1a384d4692db7cbba09366e064..c66ccc57e123d3dca404ec6b82f9e21da4c15016 100644 (file)
@@ -225,15 +225,16 @@ typedef struct xfs_fsop_resblks {
 
 #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    */
 
 
 /*
index e3e58604b2eaa4bb0a6445ef83b0eab660c7bd52..51e672e1eadad5d8a4161377e49ee3f2998e59ec 100644 (file)
@@ -232,6 +232,7 @@ typedef struct xfs_mount {
        __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 */
@@ -421,7 +422,7 @@ int         xfs_unmountfs_writesb(xfs_mount_t *);
 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);
index 729b61c814030da2d64ec4d9cd86911ba3d25722..bc05f8026871177f947809b41dee15a2e55baeff 100644 (file)
@@ -34,7 +34,7 @@
 
 /*
  * 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.
  */
 
@@ -57,6 +57,7 @@ struct xfs_mount;
 #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     \
@@ -69,7 +70,8 @@ struct xfs_mount;
         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 | \
@@ -78,14 +80,15 @@ struct xfs_mount;
        (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
@@ -140,7 +143,8 @@ 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;
 
@@ -159,7 +163,7 @@ typedef enum {
        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;
 
@@ -440,11 +444,20 @@ int xfs_sb_version_subextflgbit(xfs_sb_t *sbp);
                ((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)
@@ -474,6 +487,27 @@ xfs_daddr_t xfs_fsb_to_daddr(struct xfs_mount *mp, xfs_fsblock_t fsbno);
                         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.
  */
@@ -486,18 +520,10 @@ xfs_daddr_t xfs_fsb_to_daddr(struct xfs_mount *mp, xfs_fsblock_t fsbno);
 /*
  * 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__ */
index 1845dd874a4baf44fdb4dc483572f55f8ab06b99..b02ac92c56a2aee471813443fb0f81849634d18f 100644 (file)
@@ -378,7 +378,10 @@ typedef struct xfs_trans {
        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 */
@@ -1024,11 +1027,6 @@ xfs_log_busy_slot_t *xfs_trans_add_busy(xfs_trans_t *tp,
                                        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__ */
index d831799bf2e492e55b50c73838be9a93c5b611a6..302f91ecfa6329ff9ef08d24f9fcfaa6b050ccfb 100644 (file)
@@ -34,6 +34,8 @@
 
 #ifdef __KERNEL__
 
+#include <linux/types.h>
+
 /*
  * POSIX Extensions
  */
@@ -54,6 +56,9 @@ typedef unsigned int          __uint32_t;
 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 */
 
@@ -63,17 +68,11 @@ typedef __s64                       xfs_daddr_t;    /* <disk address> type */
 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)
index 948e4b6d477c28fb7d54396acec1b96dce80b892..2be10965871fd3642523deb1ab20382c23f60e7c 100644 (file)
@@ -38,7 +38,12 @@ LT_CURRENT = 0
 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)
index 724fe30292e67cd459306aab6e870316244ffb18..1942093520cae888d9c51085b1e085a4e1c7c772 100644 (file)
@@ -39,9 +39,10 @@ get_subvol_stripe_wrapper(char *dev, sv_type_t type, int *sunit, int *swidth)
 
        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);
        }
         
index 395f40579065259272d902fbe95eecc64d6af77a..f6487cf55fe9960e8fffcc566fc72b77194342e6 100644 (file)
  * 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>
 
index 8e1451fe93c8ad7ea9e612a8f44815117dfc05c5..579550a033116602aa4c4b91b9aaacb41fe60387 100644 (file)
  * 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
@@ -97,7 +89,7 @@ lvm_get_subvol_stripe(
 
        /* Open pipe */
        if (pipe(lvpipe) < 0) {
-               fprintf(stderr, "Could not open pipe\n");
+               fprintf(stderr, _("Could not open pipe\n"));
                exit(1);
        }
 
@@ -112,11 +104,11 @@ lvm_get_subvol_stripe(
 
                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:
index 5fe10cb5b9a8cfa5189e7706df215c085d818330..85dd3efa9e2ae3d2ce2befcecdf494ab1095a6db 100644 (file)
  * 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
@@ -68,7 +62,8 @@ md_get_subvol_stripe(
 
                /* 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);
                }
@@ -76,7 +71,7 @@ md_get_subvol_stripe(
 
                /* 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);
                }
index 36422ef0e9ba8259315ca6e3544487fe235ec14c..994afdbb247c66026bc42a9feeffb47717c31c5c 100644 (file)
@@ -38,7 +38,7 @@ LT_CURRENT = 0
 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 \
@@ -46,7 +46,9 @@ CFILES = bit.c init.c logitem.c rdwr.c trans.c util.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:
index a3b9dde1b707a5f02087524e168e3a1647a69141..bd3a3af1c2d01a2ca3a2acc3b214d716a81d9c55 100644 (file)
  * 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
@@ -55,28 +45,10 @@ char *progname = "libxfs";  /* default, changed by each tool */
 #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
@@ -88,95 +60,17 @@ check_ismounted(char *name, char *block)
 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
@@ -184,14 +78,14 @@ findsize(char *path)
 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);
 }
 
@@ -210,30 +104,19 @@ libxfs_device_open(char *path, int creat, int readonly, int setblksize)
                        (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);
        }
 
        /*
@@ -245,7 +128,7 @@ libxfs_device_open(char *path, int creat, int readonly, int setblksize)
 
        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);
                }
@@ -258,7 +141,8 @@ libxfs_device_open(char *path, int creat, int readonly, int setblksize)
                        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);
 }
 
@@ -275,15 +159,14 @@ libxfs_device_close(dev_t dev)
                        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);
 }
 
@@ -330,19 +213,19 @@ libxfs_init(libxfs_init_t *a)
                        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))
@@ -361,8 +244,8 @@ libxfs_init(libxfs_init_t *a)
                                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);
@@ -370,20 +253,20 @@ libxfs_init(libxfs_init_t *a)
                }
 #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;
                }
@@ -392,7 +275,7 @@ libxfs_init(libxfs_init_t *a)
                        (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;
                        }
@@ -403,7 +286,7 @@ libxfs_init(libxfs_init_t *a)
                        (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;
                        }
@@ -414,7 +297,7 @@ libxfs_init(libxfs_init_t *a)
                        (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;
                        }
@@ -432,22 +315,25 @@ voldone:
                        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))
@@ -469,22 +355,25 @@ voldone:
                        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))
@@ -506,22 +395,25 @@ voldone:
                        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))
@@ -535,17 +427,17 @@ voldone:
        } 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;
        }
@@ -629,7 +521,8 @@ rtmount_inodes(xfs_mount_t *mp)
                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;
        }
@@ -637,7 +530,8 @@ rtmount_inodes(xfs_mount_t *mp)
        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;
        }
@@ -660,7 +554,7 @@ rtmount_init(
        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;
        }
@@ -675,14 +569,16 @@ rtmount_init(
         */
        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);
@@ -759,9 +655,9 @@ libxfs_mount(
        /*
         * 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;
        }
 
@@ -777,18 +673,21 @@ libxfs_mount(
        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;
                }
@@ -797,14 +696,15 @@ libxfs_mount(
 
        /* 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);
        }
@@ -818,7 +718,7 @@ libxfs_mount(
                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;
                }
@@ -830,7 +730,7 @@ libxfs_mount(
 }
 
 /*
- * Release any resourse obtained during a mount.
+ * Release any resource obtained during a mount.
  */
 void
 libxfs_umount(xfs_mount_t *mp)
similarity index 63%
rename from mkfs/proto.h
rename to libxfs/init.h
index 9807ab44b12c5841326bb70a08c7a691d688a235..77c19a082a97490177733f42e40fac86e9f08d64 100644 (file)
@@ -1,35 +1,45 @@
 /*
- * 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 */
diff --git a/libxfs/linux.c b/libxfs/linux.c
new file mode 100644 (file)
index 0000000..d5d5ebf
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ * 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;
+}
index 68d3fa39c8ad13fe5e3beb2126c91cf4e0c64d58..128b57fb6fda9858c095818ea6e937f862df1349 100644 (file)
@@ -48,8 +48,9 @@ libxfs_device_zero(dev_t dev, xfs_daddr_t start, uint len)
 
        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);
@@ -60,8 +61,9 @@ libxfs_device_zero(dev_t dev, xfs_daddr_t start, uint len)
                        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;
@@ -184,7 +186,7 @@ libxfs_getbuf(dev_t device, xfs_daddr_t blkno, int len)
 
        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);
        }
@@ -202,7 +204,7 @@ libxfs_getbuf(dev_t device, xfs_daddr_t blkno, int len)
 }
 
 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);
 
@@ -211,9 +213,9 @@ libxfs_readbufr(dev_t dev, xfs_daddr_t blkno, xfs_buf_t *buf, int len, int die)
        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;
        }
@@ -225,13 +227,13 @@ libxfs_readbufr(dev_t dev, xfs_daddr_t blkno, xfs_buf_t *buf, int len, int die)
 }
 
 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;
@@ -240,14 +242,14 @@ libxfs_readbuf(dev_t dev, xfs_daddr_t blkno, int len, int die)
 }
 
 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);
@@ -258,17 +260,16 @@ libxfs_writebuf_int(xfs_buf_t *buf, int die)
 #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;
        }
@@ -276,9 +277,9 @@ libxfs_writebuf_int(xfs_buf_t *buf, int die)
 }
 
 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;
 }
@@ -314,7 +315,7 @@ libxfs_zone_init(int size, char *name)
        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);
        }
@@ -332,9 +333,8 @@ libxfs_zone_zalloc(xfs_zone_t *z)
 {
        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);
@@ -369,7 +369,7 @@ libxfs_malloc(size_t size)
        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);
        }
@@ -400,7 +400,7 @@ libxfs_realloc(void *ptr, size_t size)
        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);
        }
@@ -462,5 +462,5 @@ libxfs_mod_sb(xfs_trans_t *tp, __int64_t fields)
        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);
 }
index df2201c345ac64733d02bea42d8af287fc291f1f..38dcedbc249fa1592768796864883a95966f8921 100644 (file)
@@ -44,7 +44,7 @@ libxfs_trans_alloc(
        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);
        }
@@ -567,7 +567,7 @@ inode_item_done(
         */
        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;
        }
@@ -575,7 +575,7 @@ inode_item_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;
        }
@@ -656,7 +656,7 @@ trans_chunk_committed(
                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);
                }
@@ -740,7 +740,7 @@ xfs_trans_unlock_chunk(
                        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);
                }
index 116a0a2b4d7b155ba0c9ed6a909a1808b17e4ec2..84a4ed68630ea51e88ff593358ad90dc39e5fc10 100644 (file)
@@ -70,7 +70,7 @@ libxfs_inode_alloc(
                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);
                }
index 89421a34caefd2758ff453da40424a7c7f89d724..3ccb367c31cfdcccf6f0128055e087b4d8649d5e 100644 (file)
@@ -344,12 +344,14 @@ xfs_alloc_read_agfl(
        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));
@@ -439,13 +441,13 @@ xfs_alloc_trace_modagf(
                (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),
@@ -1939,7 +1941,7 @@ xfs_alloc_get_freelist(
        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);
@@ -2039,13 +2041,13 @@ xfs_alloc_put_freelist(
                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);
@@ -2084,15 +2086,17 @@ xfs_alloc_read_agf(
        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) {
@@ -2105,12 +2109,13 @@ xfs_alloc_read_agf(
        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);
@@ -2129,13 +2134,13 @@ xfs_alloc_read_agf(
                        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
index 27d982c02df14e1ab9f9a2f920f3124488aedad4..ad925522bb88c189aa4d55af5f129aed6783c45d 100644 (file)
@@ -1099,8 +1099,7 @@ xfs_ialloc_log_agi(
        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.
@@ -1125,26 +1124,26 @@ xfs_ialloc_read_agi(
        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);
@@ -1164,13 +1163,20 @@ xfs_ialloc_read_agi(
                 * 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;
index 2ebd16b3a1826becf326bbb9f8007d7bb6b140a0..372c395056774d2b86f7f3e5a7faafa4d6ef6b96 100644 (file)
@@ -46,6 +46,7 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp)
        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 -
@@ -156,7 +157,8 @@ static struct {
     { 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 }
 };
index aa3093de73e74191c759dcf56876e7cf482f7dbe..877043d9e72729ea0014de7cf98c19eb7a168242 100644 (file)
@@ -46,8 +46,8 @@ header_check_uuid(xfs_mount_t *mp, xlog_rec_header_t *head)
     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));
@@ -59,7 +59,7 @@ int
 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), 
@@ -67,7 +67,7 @@ xlog_header_check_recover(xfs_mount_t *mp, xlog_rec_header_t *head)
     
     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)) {
@@ -76,7 +76,7 @@ xlog_header_check_recover(xfs_mount_t *mp, xlog_rec_header_t *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 {
@@ -86,7 +86,7 @@ xlog_header_check_recover(xfs_mount_t *mp, xlog_rec_header_t *head)
     
     /* bail out now or just carry on regardless */
     if (print_exit)
-        xlog_exit("Bad log");
+        xlog_exit(_("Bad log"));
  
     return 0;   
 }
@@ -98,7 +98,7 @@ xlog_header_check_mount(xfs_mount_t *mp, xlog_rec_header_t *head)
     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;
 }
index c8439381df4be9e960c8c1d13871b2efe354b47f..2a6f2f56f8a2eba1992f4a289909b9967a58b20f 100644 (file)
@@ -4,7 +4,7 @@ mkfs.xfs \- construct an XFS filesystem
 .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
@@ -51,9 +51,9 @@ kilobytes, megabytes, or gigabytes.
 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).
@@ -586,6 +586,25 @@ This suboption is only needed if the real-time section of the
 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
@@ -602,6 +621,7 @@ manual entries for additional information.
 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),
index 0689492a58c80d69ecf8e4e30fda7ed95ebc71b9..5d1b31725710a1d4c2af0992c77f2211b15063bc 100644 (file)
@@ -46,7 +46,8 @@ static char *progname;
 static void
 usage(void)
 {
-       fprintf(stderr, "%s: [-npv] <size> <name1> [<name2>] ...\n", progname);
+       fprintf(stderr, _("%s: [-npv] <size> <name1> [<name2>] ...\n"),
+               progname);
        exit(2);
 }
 
@@ -64,8 +65,8 @@ openfd(char *name, int oflags)
 
        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;
        }
@@ -96,6 +97,10 @@ main(int argc, char **argv)
        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':
@@ -108,7 +113,7 @@ main(int argc, char **argv)
                                verbose++;
                                break;
                        case 'V':
-                               printf("%s version %s\n", progname, VERSION);
+                               printf(_("%s version %s\n"), progname, VERSION);
                                exit(0);
                        default:
                                errflg++;
@@ -145,7 +150,7 @@ main(int argc, char **argv)
                        mult *= 1024;
                        break;
                default:
-                       fprintf(stderr, "unknown size %s\n", argv[optind]);
+                       fprintf(stderr, _("unknown size %s\n"), argv[optind]);
                        usage();
                }
 
@@ -158,10 +163,10 @@ main(int argc, char **argv)
 
        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);
@@ -194,11 +199,7 @@ main(int argc, char **argv)
                }
 
                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]);
@@ -213,7 +214,7 @@ main(int argc, char **argv)
                        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;
 
index b24b15eec6015199cfc94d424d8465afd425223a..d9d5a15731eed531fe90c1c9d51af03293d9b501 100644 (file)
@@ -37,8 +37,8 @@ LTCOMMAND = mkfs.xfs
 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)
index cb714566e5dfe368b8ee2d23261e8378fd4223dc..a16c81fcb749e2841f3d95d09531ccbfcf307cbc 100644 (file)
@@ -137,14 +137,10 @@ max_trans_res(
 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) {
@@ -154,37 +150,53 @@ main(int argc, char **argv)
        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);
+                                       }
                                }
                        }
                }
index 5113620a06dc35f01daa0d58b53ee453fb5e6a0b..773d1a9ef5d66df489ad20a58aea7cb6e794601e 100644 (file)
 
 #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);
@@ -74,18 +74,18 @@ setup_proto(
        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);
        }
@@ -122,7 +122,7 @@ void
 res_failed(
        int     i)
 {
-       fail("cannot reserve space", i);
+       fail(_("cannot reserve space"), i);
 }
 
 static void
@@ -175,7 +175,7 @@ getstr(
                }
        }
        if (!c) {
-               fprintf(stderr, "%s: premature EOF in prototype file\n",
+               fprintf(stderr, _("%s: premature EOF in prototype file\n"),
                        progname);
                exit(1);
        }
@@ -194,7 +194,7 @@ rsvfile(
        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);
        }
 
@@ -263,10 +263,11 @@ newfile(
                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);
                }
@@ -279,7 +280,7 @@ newfile(
                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;
@@ -297,14 +298,14 @@ newregfile(
 
        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);
                }
@@ -335,7 +336,7 @@ newdirent(
                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
@@ -352,7 +353,7 @@ newdirectory(
        else
                error = libxfs_dir_init(tp, dp, pdp);
        if (error)
-               fail("directory create error", error);
+               fail(_("directory create error"), error);
 }
 
 void
@@ -416,7 +417,8 @@ parseproto(
                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;
@@ -427,7 +429,8 @@ parseproto(
                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]) {
@@ -437,13 +440,14 @@ parseproto(
                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);
                }
@@ -462,7 +466,7 @@ parseproto(
                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);
@@ -474,13 +478,13 @@ parseproto(
 
        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);
 
@@ -491,7 +495,7 @@ parseproto(
 
                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;
@@ -503,7 +507,7 @@ parseproto(
                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);
@@ -519,7 +523,7 @@ parseproto(
                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);
@@ -532,7 +536,7 @@ parseproto(
                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);
@@ -545,7 +549,7 @@ parseproto(
                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);
@@ -557,7 +561,7 @@ parseproto(
                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;
@@ -578,7 +582,7 @@ parseproto(
                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);
                /*
@@ -600,7 +604,8 @@ parseproto(
        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);
 }
@@ -638,7 +643,7 @@ rtinit(
        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,
@@ -656,7 +661,7 @@ rtinit(
        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;
@@ -682,7 +687,8 @@ rtinit(
                                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,
@@ -694,9 +700,10 @@ rtinit(
 
        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.
         */
@@ -716,7 +723,8 @@ rtinit(
                                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,
@@ -727,9 +735,10 @@ rtinit(
        }
        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.
@@ -743,11 +752,12 @@ rtinit(
                        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);
        }
diff --git a/mkfs/trtab.c b/mkfs/trtab.c
new file mode 100644 (file)
index 0000000..c9395e4
--- /dev/null
@@ -0,0 +1,851 @@
+/*
+ * 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 },
+        },
+    },
+};
index bd6ff68f2655d9d218de458956478071ddb99734..7be0c89448dc880ac6823d54976da2a65bb54038 100644 (file)
 #include <volume.h>
 #include <libxfs.h>
 #include <ctype.h>
-
 #include "xfs_mkfs.h"
-#include "maxtrres.h"
-#include "proto.h"
 
 /*
  * Prototypes for internal functions.
@@ -54,7 +51,7 @@ static int  max_trans_res(xfs_mount_t *mp);
 /*
  * option tables for getsubopt calls
  */
-char   *bopts[] = {
+char *bopts[] = {
 #define        B_LOG           0
        "log",
 #define        B_SIZE          1
@@ -115,10 +112,14 @@ char      *lopts[] = {
        "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
@@ -150,106 +151,20 @@ char     *ropts[] = {
        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)))
 
@@ -264,19 +179,29 @@ static const int max_trres_v2[DFL_B][DFL_I][DFL_D] = {
        (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();
                }
        }
@@ -284,19 +209,22 @@ calc_stripe_factors(int dsu, int dsw, int lsu, int *dsunit, int *dswidth, int *l
        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();
                }
 
@@ -306,8 +234,8 @@ calc_stripe_factors(int dsu, int dsw, int lsu, int *dsunit, int *dswidth, int *l
 
        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();
        }
 
@@ -316,7 +244,8 @@ calc_stripe_factors(int dsu, int dsw, int lsu, int *dsunit, int *dswidth, int *l
        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();
                }
        }
@@ -324,43 +253,46 @@ calc_stripe_factors(int dsu, int dsw, int lsu, int *dsunit, int *dswidth, int *l
        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,
@@ -392,24 +324,27 @@ fixup_log_stripe(
                        *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;
@@ -463,6 +398,8 @@ main(int argc, char **argv)
        int                     logversion;
        int                     lvflag;
        int                     lsflag;
+       int                     lsectorlog;
+       int                     lsectorsize;
        int                     lsu;
        int                     lsunit;
        int                     min_logblocks;
@@ -486,7 +423,10 @@ main(int argc, char **argv)
        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;
@@ -495,11 +435,18 @@ main(int argc, char **argv)
        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;
@@ -510,18 +457,18 @@ main(int argc, char **argv)
        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':
@@ -555,7 +502,8 @@ main(int argc, char **argv)
                                        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");
@@ -589,7 +537,8 @@ main(int argc, char **argv)
                                                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:
@@ -622,11 +571,11 @@ main(int argc, char **argv)
                                                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)
@@ -635,18 +584,19 @@ main(int argc, char **argv)
                                                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)
@@ -655,11 +605,11 @@ main(int argc, char **argv)
                                                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)
@@ -743,7 +693,7 @@ main(int argc, char **argv)
                                                         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);
@@ -772,7 +722,8 @@ main(int argc, char **argv)
                                        break;
                                case L_DEV:
                                        if (!value) {
-                                               fprintf (stderr, "Must specify log device\n");
+                                               fprintf(stderr,
+                                       _("Must specify log device\n"));
                                                usage();
                                        }
 
@@ -827,7 +778,8 @@ main(int argc, char **argv)
                                                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)
@@ -836,10 +788,10 @@ main(int argc, char **argv)
                                                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:
@@ -871,6 +823,29 @@ main(int argc, char **argv)
                                        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);
                                }
@@ -909,7 +884,8 @@ main(int argc, char **argv)
                                        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");
@@ -992,44 +968,122 @@ main(int argc, char **argv)
                                }
                        }
                        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();
                }
@@ -1039,7 +1093,7 @@ main(int argc, char **argv)
                        if (dirblocksize < blocksize ||
                            dirblocksize > XFS_MAX_BLOCKSIZE) {
                                fprintf(stderr,
-                                       "illegal directory block size %d\n",
+                                       _("illegal directory block size %d\n"),
                                        dirblocksize);
                                usage();
                        }
@@ -1055,7 +1109,7 @@ main(int argc, char **argv)
 
        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();
        }
 
@@ -1064,23 +1118,23 @@ main(int argc, char **argv)
 
        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));
        }
@@ -1094,48 +1148,48 @@ main(int argc, char **argv)
 #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));
        }
@@ -1145,22 +1199,22 @@ main(int argc, char **argv)
        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();
                }
@@ -1171,8 +1225,9 @@ main(int argc, char **argv)
                 * 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)
@@ -1201,30 +1256,29 @@ main(int argc, char **argv)
            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.
@@ -1232,7 +1286,7 @@ main(int argc, char **argv)
        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();
        }
 
@@ -1251,8 +1305,8 @@ main(int argc, char **argv)
                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);
                }
@@ -1263,62 +1317,71 @@ main(int argc, char **argv)
        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)
@@ -1342,32 +1405,33 @@ main(int argc, char **argv)
         } 
        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) {
@@ -1385,7 +1449,7 @@ main(int argc, char **argv)
                 */
                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();
                }
@@ -1398,7 +1462,7 @@ main(int argc, char **argv)
                 */
                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();
@@ -1406,7 +1470,7 @@ main(int argc, char **argv)
 
                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();
@@ -1414,7 +1478,7 @@ main(int argc, char **argv)
 
                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();
                }
@@ -1431,9 +1495,10 @@ main(int argc, char **argv)
        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)));
@@ -1455,10 +1520,11 @@ main(int argc, char **argv)
         */
        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)));
@@ -1508,7 +1574,7 @@ main(int argc, char **argv)
 
                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);
 
@@ -1516,7 +1582,7 @@ main(int argc, char **argv)
                        /*
                         * We're confused.
                         */
-                       fprintf(stderr, "%s: can't compute agsize/agcount\n",
+                       fprintf(stderr, _("%s: can't compute agsize/agcount\n"),
                                progname);
                        exit(1);
                }
@@ -1529,13 +1595,15 @@ main(int argc, char **argv)
        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 {
@@ -1579,14 +1647,14 @@ main(int argc, char **argv)
                                                (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);
                                }
@@ -1607,10 +1675,10 @@ main(int argc, char **argv)
                                }
                        }
                        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;
@@ -1632,8 +1700,9 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                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);
@@ -1647,7 +1716,7 @@ an AG size that is one stripe unit smaller, for example %llu\n",
        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);
                }
@@ -1660,7 +1729,7 @@ an AG size that is one stripe unit smaller, for example %llu\n",
 
        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);
        }
@@ -1671,8 +1740,11 @@ an AG size that is one stripe unit smaller, for example %llu\n",
        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
@@ -1684,14 +1756,14 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                }
                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();
                        }
@@ -1716,6 +1788,29 @@ an AG size that is one stripe unit smaller, for example %llu\n",
        } 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;
@@ -1732,10 +1827,10 @@ an AG size that is one stripe unit smaller, for example %llu\n",
        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 =
@@ -1763,48 +1858,34 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                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
@@ -1812,7 +1893,7 @@ an AG size that is one stripe unit smaller, for example %llu\n",
         * 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);
        }
@@ -1825,7 +1906,7 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                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);
        }
 
        /*
@@ -1834,23 +1915,21 @@ an AG size that is one stripe unit smaller, for example %llu\n",
        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);
        }
@@ -1860,19 +1939,21 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                 * 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);
@@ -1886,7 +1967,7 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                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);
@@ -1898,15 +1979,16 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                }
                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);
@@ -1919,7 +2001,7 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                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
@@ -1962,7 +2044,7 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                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
@@ -1999,7 +2081,8 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                }       
                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
                 */
@@ -2013,7 +2096,7 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                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);
        }
 
        /*
@@ -2022,7 +2105,7 @@ an AG size that is one stripe unit smaller, for example %llu\n",
        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.
@@ -2031,8 +2114,9 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                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
         */
@@ -2045,13 +2129,13 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                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.
         */
@@ -2059,17 +2143,17 @@ an AG size that is one stripe unit smaller, for example %llu\n",
        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) {
                /*
@@ -2078,10 +2162,11 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                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
                 */
@@ -2089,19 +2174,20 @@ an AG size that is one stripe unit smaller, for example %llu\n",
                        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)
@@ -2113,14 +2199,31 @@ an AG size that is one stripe unit smaller, for example %llu\n",
        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();
 }
@@ -2128,10 +2231,10 @@ conflict(
 
 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();
 }
 
@@ -2144,60 +2247,45 @@ ispow2(
 
 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]))
@@ -2209,11 +2297,11 @@ isdigits(char *str)
 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)
@@ -2224,13 +2312,14 @@ cvtnum(
        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')
@@ -2241,9 +2330,9 @@ cvtnum(
 }
 
 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\
@@ -2251,21 +2340,22 @@ usage(void)
 /* 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);
 }
index 87394b5e99da5e0ff3c8299ccd51dae38e57e112..99a18deb3dffe17641f003ba9efc50179ba5da36 100644 (file)
                                                 * 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__ */
diff --git a/po/Makefile b/po/Makefile
new file mode 100644 (file)
index 0000000..cd49a03
--- /dev/null
@@ -0,0 +1,68 @@
+#
+# 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:
index ad61bb73a4c18c0f9ce49ca56a8aa28b055ee637..b1e51d6a96bdc56a613adde65cf970f034b39691 100644 (file)
@@ -95,16 +95,18 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_t *agf, xfs_agnumber_t i)
         * 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);
        }
@@ -209,8 +211,11 @@ compare_sb(xfs_mount_t *mp, xfs_sb_t *sb)
  * 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,
@@ -235,8 +240,7 @@ 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.
@@ -244,6 +248,9 @@ secondary_sb_wack(xfs_mount_t *mp, xfs_buf_t *sbuf, xfs_sb_t *sb,
                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;
@@ -263,14 +270,14 @@ secondary_sb_wack(xfs_mount_t *mp, xfs_buf_t *sbuf, xfs_sb_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);
                }
        }
 
index c0e1207d2069c7e8264c89471cf6f1d8443433cb..39e135eadb9a3ddd7241dab14eee75a75e98c64a 100644 (file)
@@ -120,11 +120,12 @@ process_agi_unlinked(xfs_mount_t *mp, xfs_agnumber_t agno)
        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);
        }
 
index 99bbfcb538fb8f399088801664bac0433cdda229..e13d549af65530c550c17f807b0af216ebaad8c0 100644 (file)
@@ -445,7 +445,7 @@ calculate_freespace_cursor(xfs_mount_t *mp, xfs_agnumber_t agno,
         * 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.
@@ -1079,7 +1079,7 @@ build_agi(xfs_mount_t *mp, xfs_agnumber_t agno,
        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);
@@ -1258,8 +1258,8 @@ build_agf_agfl(xfs_mount_t        *mp,
        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);
 
@@ -1306,7 +1306,7 @@ build_agf_agfl(xfs_mount_t        *mp,
                 * 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);
@@ -1314,13 +1314,13 @@ build_agf_agfl(xfs_mount_t      *mp,
                 * 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++;
@@ -1357,7 +1357,7 @@ build_agf_agfl(xfs_mount_t        *mp,
                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);
        }
 
@@ -1553,8 +1553,8 @@ phase5(xfs_mount_t *mp)
                /*
                 * 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)  {
index ecd2b807ca80d4e0dce0053ecf73d60989b68c1f..875bb5aad2f3d8a6c73b139889400acdaf4adf7f 100644 (file)
@@ -1085,7 +1085,7 @@ scan_freelist(
                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));
@@ -1106,7 +1106,7 @@ scan_freelist(
                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)) {
@@ -1156,7 +1156,8 @@ scan_ag(
                        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);
@@ -1166,7 +1167,8 @@ scan_ag(
        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);
index 11f1e0fb7f7b0ea99fdeeae3cd9dd3651d6e90f9..353f3a480a387c996ed77ff3e87ee7425381fb26 100644 (file)
@@ -43,7 +43,7 @@ char *progname;
 void
 usage()
 {
-       fprintf(stderr, "%s [-e extsize] [-p] source target\n", progname);
+       fprintf(stderr, _("%s [-e extsize] [-p] source target\n"), progname);
        exit(2);
 }
 
@@ -51,11 +51,14 @@ int
 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) {
@@ -67,7 +70,7 @@ main(int argc, char **argv)
                        pflag = 1;
                        break;
                case 'V':
-                       printf("%s version %s\n", progname, VERSION);
+                       printf(_("%s version %s\n"), progname, VERSION);
                        exit(0);
                default:
                        errflg++;
@@ -81,7 +84,8 @@ main(int argc, char **argv)
        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++;
        }
 
@@ -94,14 +98,15 @@ main(int argc, char **argv)
         * 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();
                }
@@ -128,7 +133,7 @@ rtcp( char *source, char *target, int fextsize)
        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;
 
@@ -147,9 +152,9 @@ rtcp( char *source, char *target, int fextsize)
                        *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);
        }
 
@@ -157,7 +162,7 @@ rtcp( char *source, char *target, int fextsize)
         * 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)
@@ -168,7 +173,8 @@ rtcp( char *source, char *target, int fextsize)
        }
 
        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 );
        }
@@ -177,20 +183,20 @@ rtcp( char *source, char *target, int fextsize)
         * 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;
@@ -205,8 +211,9 @@ rtcp( char *source, char *target, int fextsize)
                        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 );
@@ -216,14 +223,15 @@ rtcp( char *source, char *target, int fextsize)
                 * 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 );
                }
@@ -232,7 +240,7 @@ rtcp( char *source, char *target, int fextsize)
                 * 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 );
                }
@@ -241,8 +249,8 @@ rtcp( char *source, char *target, int fextsize)
                 * 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 );
                }
@@ -253,8 +261,8 @@ rtcp( char *source, char *target, int fextsize)
         */
        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 );
@@ -267,7 +275,7 @@ rtcp( char *source, char *target, int fextsize)
                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;
                }
@@ -276,8 +284,8 @@ rtcp( char *source, char *target, int fextsize)
        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 );
@@ -289,8 +297,9 @@ rtcp( char *source, char *target, int fextsize)
         * 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 ) 
@@ -299,7 +308,7 @@ rtcp( char *source, char *target, int fextsize)
        }
 
        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 );
@@ -313,17 +322,17 @@ rtcp( char *source, char *target, int fextsize)
         * 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 );
@@ -364,7 +373,8 @@ rtcp( char *source, char *target, int fextsize)
                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 );
@@ -391,8 +401,8 @@ xfsrtextsize( char *path)
 
        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 );