xfsprogs-4.3.0+nmu1ubuntu1.1/ 0000775 0000000 0000000 00000000000 12625722130 012620 5 ustar xfsprogs-4.3.0+nmu1ubuntu1.1/.gitcensus 0000664 0000000 0000000 00000014677 12625722127 014652 0 ustar .gitignore
Makefile
README
VERSION
configure.ac
copy/Makefile
copy/xfs_copy.c
copy/xfs_copy.h
db/Makefile
db/addr.c
db/addr.h
db/agf.c
db/agf.h
db/agfl.c
db/agfl.h
db/agi.c
db/agi.h
db/attr.c
db/attr.h
db/attrset.c
db/attrset.h
db/attrshort.c
db/attrshort.h
db/bit.c
db/bit.h
db/block.c
db/block.h
db/bmap.c
db/bmap.h
db/bmroot.c
db/bmroot.h
db/btblock.c
db/btblock.h
db/check.c
db/check.h
db/command.c
db/command.h
db/convert.c
db/convert.h
db/debug.c
db/debug.h
db/dir2.c
db/dir2.h
db/dir2sf.c
db/dir2sf.h
db/dquot.c
db/dquot.h
db/echo.c
db/echo.h
db/faddr.c
db/faddr.h
db/field.c
db/field.h
db/flist.c
db/flist.h
db/fprint.c
db/fprint.h
db/frag.c
db/frag.h
db/freesp.c
db/freesp.h
db/hash.c
db/hash.h
db/help.c
db/help.h
db/init.c
db/init.h
db/inode.c
db/inode.h
db/input.c
db/input.h
db/io.c
db/io.h
db/malloc.c
db/malloc.h
db/metadump.c
db/metadump.h
db/output.c
db/output.h
db/print.c
db/print.h
db/quit.c
db/quit.h
db/sb.c
db/sb.h
db/sig.c
db/sig.h
db/strvec.c
db/strvec.h
db/symlink.c
db/symlink.h
db/text.c
db/text.h
db/type.c
db/type.h
db/write.c
db/write.h
db/xfs_admin.sh
db/xfs_metadump.sh
db/xfs_ncheck.sh
debian/Makefile
debian/changelog
debian/compat
debian/control
debian/copyright
debian/postinst
debian/rules
debian/watch
doc/CHANGES
doc/COPYING
doc/CREDITS
doc/INSTALL
doc/Makefile
doc/sparse.txt
estimate/Makefile
estimate/xfs_estimate.c
fsck/Makefile
fsck/xfs_fsck.sh
fsr/Makefile
fsr/xfs_fsr.c
growfs/Makefile
growfs/xfs_growfs.c
growfs/xfs_info.sh
include/Makefile
include/atomic.h
include/bitops.h
include/builddefs.in
include/buildmacros
include/buildrules
include/cache.h
include/command.h
include/darwin.h
include/freebsd.h
include/gnukfreebsd.h
include/handle.h
include/hlist.h
include/input.h
include/install-sh
include/irix.h
include/jdm.h
include/kmem.h
include/libxfs.h
include/libxlog.h
include/linux.h
include/list.h
include/parent.h
include/path.h
include/platform_defs.h.in
include/project.h
include/radix-tree.h
include/xfs.h
include/xfs_arch.h
include/xfs_btree_trace.h
include/xfs_inode.h
include/xfs_log_recover.h
include/xfs_metadump.h
include/xfs_mount.h
include/xfs_trace.h
include/xfs_trans.h
include/xqm.h
io/Makefile
io/attr.c
io/bmap.c
io/fadvise.c
io/fiemap.c
io/file.c
io/freeze.c
io/fsync.c
io/getrusage.c
io/imap.c
io/init.c
io/init.h
io/inject.c
io/io.h
io/link.c
io/madvise.c
io/mincore.c
io/mmap.c
io/open.c
io/parent.c
io/pread.c
io/prealloc.c
io/pwrite.c
io/readdir.c
io/reflink.c
io/resblks.c
io/seek.c
io/sendfile.c
io/shutdown.c
io/sync.c
io/sync_file_range.c
io/truncate.c
io/xfs_bmap.sh
io/xfs_freeze.sh
io/xfs_mkfile.sh
libhandle/Makefile
libhandle/handle.c
libhandle/jdm.c
libhandle/libhandle.sym
libxcmd/Makefile
libxcmd/command.c
libxcmd/help.c
libxcmd/input.c
libxcmd/paths.c
libxcmd/projects.c
libxcmd/quit.c
libxfs/Makefile
libxfs/cache.c
libxfs/crc32.c
libxfs/crc32defs.h
libxfs/darwin.c
libxfs/freebsd.c
libxfs/gen_crc32table.c
libxfs/init.c
libxfs/init.h
libxfs/irix.c
libxfs/kmem.c
libxfs/libxfs_api_defs.h
libxfs/libxfs_io.h
libxfs/libxfs_priv.h
libxfs/linux.c
libxfs/logitem.c
libxfs/radix-tree.c
libxfs/rdwr.c
libxfs/trans.c
libxfs/util.c
libxfs/xfs_alloc.c
libxfs/xfs_alloc.h
libxfs/xfs_alloc_btree.c
libxfs/xfs_alloc_btree.h
libxfs/xfs_attr.c
libxfs/xfs_attr_leaf.c
libxfs/xfs_attr_leaf.h
libxfs/xfs_attr_remote.c
libxfs/xfs_attr_remote.h
libxfs/xfs_attr_sf.h
libxfs/xfs_bit.c
libxfs/xfs_bit.h
libxfs/xfs_bmap.c
libxfs/xfs_bmap.h
libxfs/xfs_bmap_btree.c
libxfs/xfs_bmap_btree.h
libxfs/xfs_btree.c
libxfs/xfs_btree.h
libxfs/xfs_cksum.h
libxfs/xfs_da_btree.c
libxfs/xfs_da_btree.h
libxfs/xfs_da_format.c
libxfs/xfs_da_format.h
libxfs/xfs_dir2.c
libxfs/xfs_dir2.h
libxfs/xfs_dir2_block.c
libxfs/xfs_dir2_data.c
libxfs/xfs_dir2_leaf.c
libxfs/xfs_dir2_node.c
libxfs/xfs_dir2_priv.h
libxfs/xfs_dir2_sf.c
libxfs/xfs_dquot_buf.c
libxfs/xfs_format.h
libxfs/xfs_fs.h
libxfs/xfs_ialloc.c
libxfs/xfs_ialloc.h
libxfs/xfs_ialloc_btree.c
libxfs/xfs_ialloc_btree.h
libxfs/xfs_inode_buf.c
libxfs/xfs_inode_buf.h
libxfs/xfs_inode_fork.c
libxfs/xfs_inode_fork.h
libxfs/xfs_log_format.h
libxfs/xfs_log_rlimit.c
libxfs/xfs_quota_defs.h
libxfs/xfs_rtbitmap.c
libxfs/xfs_sb.c
libxfs/xfs_sb.h
libxfs/xfs_shared.h
libxfs/xfs_symlink_remote.c
libxfs/xfs_trans_resv.c
libxfs/xfs_trans_resv.h
libxfs/xfs_trans_space.h
libxfs/xfs_types.h
libxlog/Makefile
libxlog/util.c
libxlog/xfs_log_recover.c
logprint/Makefile
logprint/log_copy.c
logprint/log_dump.c
logprint/log_misc.c
logprint/log_print_all.c
logprint/log_print_trans.c
logprint/logprint.c
logprint/logprint.h
m4/Makefile
m4/manual_format.m4
m4/multilib.m4
m4/package_aiodev.m4
m4/package_blkid.m4
m4/package_globals.m4
m4/package_libcdev.m4
m4/package_pthread.m4
m4/package_types.m4
m4/package_utilies.m4
m4/package_uuiddev.m4
man/Makefile
man/man3/Makefile
man/man3/handle.3
man/man3/xfsctl.3
man/man5/Makefile
man/man5/projects.5
man/man5/projid.5
man/man5/xfs.5
man/man8/Makefile
man/man8/fsck.xfs.8
man/man8/mkfs.xfs.8
man/man8/xfs_admin.8
man/man8/xfs_bmap.8
man/man8/xfs_copy.8
man/man8/xfs_db.8
man/man8/xfs_estimate.8
man/man8/xfs_freeze.8
man/man8/xfs_fsr.8
man/man8/xfs_growfs.8
man/man8/xfs_io.8
man/man8/xfs_logprint.8
man/man8/xfs_mdrestore.8
man/man8/xfs_metadump.8
man/man8/xfs_mkfile.8
man/man8/xfs_ncheck.8
man/man8/xfs_quota.8
man/man8/xfs_repair.8
man/man8/xfs_rtcp.8
mdrestore/Makefile
mdrestore/xfs_mdrestore.c
mkfs/Makefile
mkfs/maxtrres.c
mkfs/proto.c
mkfs/xfs_mkfs.c
mkfs/xfs_mkfs.h
po/Makefile
po/de.po
po/pl.po
quota/Makefile
quota/darwin.c
quota/edit.c
quota/free.c
quota/freebsd.c
quota/init.c
quota/init.h
quota/irix.c
quota/linux.c
quota/path.c
quota/project.c
quota/quot.c
quota/quota.c
quota/quota.h
quota/report.c
quota/state.c
quota/util.c
release.sh
repair/Makefile
repair/README
repair/agheader.c
repair/agheader.h
repair/attr_repair.c
repair/attr_repair.h
repair/avl.c
repair/avl.h
repair/avl64.c
repair/avl64.h
repair/bmap.c
repair/bmap.h
repair/btree.c
repair/btree.h
repair/da_util.c
repair/da_util.h
repair/dino_chunks.c
repair/dinode.c
repair/dinode.h
repair/dir2.c
repair/dir2.h
repair/err_protos.h
repair/globals.c
repair/globals.h
repair/incore.c
repair/incore.h
repair/incore_bmc.c
repair/incore_ext.c
repair/incore_ino.c
repair/init.c
repair/phase1.c
repair/phase2.c
repair/phase3.c
repair/phase4.c
repair/phase5.c
repair/phase6.c
repair/phase7.c
repair/prefetch.c
repair/prefetch.h
repair/progress.c
repair/progress.h
repair/protos.h
repair/rt.c
repair/rt.h
repair/sb.c
repair/scan.c
repair/scan.h
repair/threads.c
repair/threads.h
repair/versions.c
repair/versions.h
repair/xfs_repair.c
rtcp/Makefile
rtcp/xfs_rtcp.c
tools/libxfs-apply
xfsprogs-4.3.0+nmu1ubuntu1.1/.gitignore 0000664 0000000 0000000 00000001627 12560572026 014623 0 ustar # object files
*.o
.dep
.ltdep
# build system
.census
.gitcensus
/include/platform_defs.h
/include/builddefs
/install-sh
# magic directory symlinks
/include/disk
/include/xfs
# packaging
/doc/CHANGES.gz
/xfsprogs-*
/xfsprogs_*
/xfslibs-dev_*
# autoconf generated files
/aclocal.m4
/m4/libtool.m4
/m4/ltoptions.m4
/m4/ltsugar.m4
/m4/ltversion.m4
/m4/lt~obsolete.m4
/autom4te.cache/
/config.guess
/config.log
/config.status
/config.sub
/configure
# libtool
/libtool
/ltmain.sh
*.lo
*.la
.libs
# gettext
/po/de.mo
/po/pl.mo
/po/xfsprogs.pot
# cscope stuff
cscope.*
# quilt stuff
/.pc/
/patches/
# binaries
/copy/xfs_copy
/db/xfs_db
/estimate/xfs_estimate
/fsr/xfs_fsr
/growfs/xfs_growfs
/io/xfs_io
/logprint/xfs_logprint
/mdrestore/xfs_mdrestore
/mkfs/fstyp
/mkfs/mkfs.xfs
/quota/xfs_quota
/repair/xfs_repair
/rtcp/xfs_rtcp
# generated crc files
/libxfs/crc32selftest
/libxfs/crc32table.h
/libxfs/gen_crc32table
xfsprogs-4.3.0+nmu1ubuntu1.1/Makefile 0000664 0000000 0000000 00000010441 12625713771 014273 0 ustar #
# Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
#
ifeq ("$(origin V)", "command line")
BUILD_VERBOSE = $(V)
endif
ifndef BUILD_VERBOSE
BUILD_VERBOSE = 0
endif
ifeq ($(BUILD_VERBOSE),1)
Q =
else
Q = @
endif
MAKEOPTS = --no-print-directory Q=$(Q)
TOPDIR = .
HAVE_BUILDDEFS = $(shell test -f $(TOPDIR)/include/builddefs && echo yes || echo no)
ifeq ($(HAVE_BUILDDEFS), yes)
include $(TOPDIR)/include/builddefs
endif
SRCDIR = $(PKG_NAME)-$(PKG_VERSION)
SRCTAR = $(PKG_NAME)-$(PKG_VERSION).tar.gz
CONFIGURE = aclocal.m4 configure config.guess config.sub install-sh ltmain.sh
LSRCFILES = configure.ac release.sh README VERSION $(CONFIGURE)
SRCTARINC = m4/libtool.m4 m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 \
m4/ltversion.m4 po/xfsprogs.pot .gitcensus $(CONFIGURE)
LDIRT = config.log .ltdep .dep config.status config.cache confdefs.h \
conftest* built .census install.* install-dev.* *.gz \
autom4te.cache/* libtool include/builddefs include/platform_defs.h
ifeq ($(HAVE_BUILDDEFS), yes)
LDIRDIRT = $(SRCDIR)
LDIRT += $(SRCTAR)
endif
# header install rules to populate include/xfs correctly
HDR_SUBDIRS = include libxfs
DLIB_SUBDIRS = libxlog libxcmd libhandle
LIB_SUBDIRS = libxfs $(DLIB_SUBDIRS)
TOOL_SUBDIRS = copy db estimate fsck fsr growfs io logprint mkfs quota \
mdrestore repair rtcp m4 man doc debian
ifneq ("$(XGETTEXT)","")
TOOL_SUBDIRS += po
endif
# If we are on OS X, use glibtoolize from MacPorts, as OS X doesn't have
# libtoolize binary itself.
LIBTOOLIZE_TEST=$(shell libtoolize --version >/dev/null 2>&1 && echo found)
LIBTOOLIZE_BIN=libtoolize
ifneq ("$(LIBTOOLIZE_TEST)","found")
LIBTOOLIZE_BIN=glibtoolize
endif
# include is listed last so it is processed last in clean rules.
SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) include
default: include/builddefs include/platform_defs.h
ifeq ($(HAVE_BUILDDEFS), no)
$(Q)$(MAKE) $(MAKEOPTS) -C . $@
else
$(Q)$(MAKE) $(MAKEOPTS) headers
$(Q)$(MAKE) $(MAKEOPTS) $(SUBDIRS)
endif
# tool/lib dependencies
# note: include/xfs is set up by libxfs, too, so everything is dependent on it.
$(LIB_SUBDIRS) $(TOOL_SUBDIRS): include
$(DLIB_SUBDIRS) $(TOOL_SUBDIRS): libxfs
db logprint: libxlog
fsr: libhandle
growfs: libxcmd
io: libxcmd libhandle
quota: libxcmd
repair: libxlog
copy: libxlog
ifeq ($(HAVE_BUILDDEFS), yes)
include $(BUILDRULES)
else
clean: # if configure hasn't run, nothing to clean
endif
# Recent versions of libtool require the -i option for copying auxiliary
# files (config.sub, config.guess, install-sh, ltmain.sh), while older
# versions will copy those files anyway, and don't understand -i.
LIBTOOLIZE_INSTALL = `$(LIBTOOLIZE_BIN) -n -i >/dev/null 2>/dev/null && echo -i`
configure:
$(LIBTOOLIZE_BIN) -c $(LIBTOOLIZE_INSTALL) -f
cp include/install-sh .
aclocal -I m4
autoconf
include/builddefs: configure
./configure $$LOCAL_CONFIGURE_OPTIONS
include/platform_defs.h: include/builddefs
## Recover from the removal of $@
@if test -f $@; then :; else \
rm -f include/builddefs; \
$(MAKE) $(MAKEOPTS) $(AM_MAKEFLAGS) include/builddefs; \
fi
install: $(addsuffix -install,$(SUBDIRS))
$(INSTALL) -m 755 -d $(PKG_DOC_DIR)
$(INSTALL) -m 644 README $(PKG_DOC_DIR)
install-dev: $(addsuffix -install-dev,$(SUBDIRS))
%-install:
@echo "Installing $@"
$(Q)$(MAKE) $(MAKEOPTS) -C $* install
%-install-dev:
@echo "Installing $@"
$(Q)$(MAKE) $(MAKEOPTS) -C $* install-dev
distclean: clean
$(Q)rm -f $(LDIRT)
realclean: distclean
$(Q)rm -f $(CONFIGURE) .gitcensus
#
# All this gunk is to allow for a make dist on an unconfigured tree
#
dist: include/builddefs include/platform_defs.h default
ifeq ($(HAVE_BUILDDEFS), no)
$(Q)$(MAKE) $(MAKEOPTS) -C . $@
else
$(Q)$(MAKE) $(MAKEOPTS) $(SRCTAR)
endif
deb: include/builddefs include/platform_defs.h
ifeq ($(HAVE_BUILDDEFS), no)
$(Q)$(MAKE) $(MAKEOPTS) -C . $@
else
# need to build translations before the source tarball
$(Q)$(MAKE) $(MAKEOPTS) -C po
$(Q)$(MAKE) $(MAKEOPTS) $(SRCDIR)
$(Q)cd $(SRCDIR) && dpkg-buildpackage
endif
$(SRCDIR) : $(_FORCE) $(SRCTAR)
rm -fr $@
$(Q)$(TAR) -zxvf $(SRCTAR)
$(SRCTAR) : default $(SRCTARINC) .gitcensus
$(Q)$(TAR) --transform "s,^,$(SRCDIR)/," -zcf $(SRCDIR).tar.gz \
`cat .gitcensus` $(SRCTARINC)
echo Wrote: $@
.gitcensus: $(_FORCE)
$(Q)if test -d .git; then \
git ls-files > .gitcensus && echo "new .gitcensus"; \
fi
xfsprogs-4.3.0+nmu1ubuntu1.1/README 0000664 0000000 0000000 00000000556 12560572026 013513 0 ustar XFS User Tools README
_____________________
See the file doc/INSTALL for build, installation and post-
install configuration steps.
Refer to the xfs(5) manual page for general XFS information
and references to other XFS manual pages.
For more information and details on how to contribute to the
XFS project see the web pages at:
http://oss.sgi.com/projects/xfs/
xfsprogs-4.3.0+nmu1ubuntu1.1/VERSION 0000664 0000000 0000000 00000000163 12625713771 013703 0 ustar #
# This file is used by configure to get version information
#
PKG_MAJOR=4
PKG_MINOR=3
PKG_REVISION=0
PKG_BUILD=1
xfsprogs-4.3.0+nmu1ubuntu1.1/aclocal.m4 0000664 0000000 0000000 00000002206 12574432016 014464 0 ustar # generated automatically by aclocal 1.15 -*- Autoconf -*-
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4])
m4_include([m4/ltversion.m4])
m4_include([m4/lt~obsolete.m4])
m4_include([m4/manual_format.m4])
m4_include([m4/multilib.m4])
m4_include([m4/package_aiodev.m4])
m4_include([m4/package_blkid.m4])
m4_include([m4/package_globals.m4])
m4_include([m4/package_libcdev.m4])
m4_include([m4/package_pthread.m4])
m4_include([m4/package_types.m4])
m4_include([m4/package_utilies.m4])
m4_include([m4/package_uuiddev.m4])
xfsprogs-4.3.0+nmu1ubuntu1.1/config.guess 0000775 0000000 0000000 00000123550 12560600054 015144 0 ustar #! /bin/sh
# Attempt to guess a canonical system name.
# Copyright 1992-2014 Free Software Foundation, Inc.
timestamp='2014-03-23'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see .
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
# Originally written by Per Bothner.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
#
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
Operation modes:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to ."
version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright 1992-2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help" >&2
exit 1 ;;
* )
break ;;
esac
done
if test $# != 0; then
echo "$me: too many arguments$help" >&2
exit 1
fi
trap 'exit 1' 1 2 15
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
# Portable tmp directory creation inspired by the Autoconf team.
set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int x;" > $dummy.c ;
for c in cc gcc c89 c99 ; do
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
CC_FOR_BUILD="$c"; break ;
fi ;
done ;
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac ; set_cc_for_build= ;'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_SYSTEM}" in
Linux|GNU|GNU/*)
# If the system lacks a compiler, then just pick glibc.
# We could probably try harder.
LIBC=gnu
eval $set_cc_for_build
cat <<-EOF > $dummy.c
#include
#if defined(__UCLIBC__)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
#else
LIBC=gnu
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
;;
esac
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
# compatibility and a consistent mechanism for selecting the
# object file format.
#
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
case "${UNAME_MACHINE_ARCH}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
os=netbsd
else
os=netbsdelf
fi
;;
*)
os=netbsd
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
case "${UNAME_VERSION}" in
Debian*)
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
*:SolidBSD:*:*)
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
exit ;;
macppc:MirBSD:*:*)
echo powerpc-unknown-mirbsd${UNAME_RELEASE}
exit ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
UNAME_MACHINE="alpha" ;;
"EV4.5 (21064)")
UNAME_MACHINE="alpha" ;;
"LCA4 (21066/21068)")
UNAME_MACHINE="alpha" ;;
"EV5 (21164)")
UNAME_MACHINE="alphaev5" ;;
"EV5.6 (21164A)")
UNAME_MACHINE="alphaev56" ;;
"EV5.6 (21164PC)")
UNAME_MACHINE="alphapca56" ;;
"EV5.7 (21164PC)")
UNAME_MACHINE="alphapca57" ;;
"EV6 (21264)")
UNAME_MACHINE="alphaev6" ;;
"EV6.7 (21264A)")
UNAME_MACHINE="alphaev67" ;;
"EV6.8CB (21264C)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8AL (21264B)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8CX (21264D)")
UNAME_MACHINE="alphaev68" ;;
"EV6.9A (21264/EV69A)")
UNAME_MACHINE="alphaev69" ;;
"EV7 (21364)")
UNAME_MACHINE="alphaev7" ;;
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
exit $exitcode ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
exit ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
exit ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
exit ;;
*:[Mm]orph[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-morphos
exit ;;
*:OS/390:*:*)
echo i370-ibm-openedition
exit ;;
*:z/VM:*:*)
echo s390-ibm-zvmoe
exit ;;
*:OS400:*:*)
echo powerpc-ibm-os400
exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit ;;
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit ;;
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
exit ;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
s390x:SunOS:*:*)
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
echo i386-pc-auroraux${UNAME_RELEASE}
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH="i386"
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH="x86_64"
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
;;
sun4)
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
exit ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus
#include /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c &&
dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
SYSTEM_NAME=`$dummy $dummyarg` &&
{ echo "$SYSTEM_NAME"; exit; }
echo mips-mips-riscos${UNAME_RELEASE}
exit ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
exit ;;
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
exit ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
echo powerpc-harris-powermax
exit ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
[ ${TARGET_BINARY_INTERFACE}x = x ]
then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
echo i386-ibm-aix
exit ;;
ia64:AIX:*:*)
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
exit ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
then
echo "$SYSTEM_NAME"
else
echo rs6000-ibm-aix3.2.5
fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit ;;
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
esac ;;
esac
fi
if [ "${HP_ARCH}" = "" ]; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#define _HPUX_SOURCE
#include
#include
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
then
eval $set_cc_for_build
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
# 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
# generating 64-bit code. GNU and HP use different nomenclature:
#
# $ CC_FOR_BUILD=cc ./config.guess
# => hppa2.0w-hp-hpux11.23
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
then
HP_ARCH="hppa2.0w"
else
HP_ARCH="hppa64"
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit ;;
ia64:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ia64-hp-hpux${HPUX_REV}
exit ;;
3050*:HI-UX:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2
exit ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit ;;
i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
exit ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
*:UNICOS/mp:*:*)
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p`
case ${UNAME_PROCESSOR} in
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
*:MINGW64*:*)
echo ${UNAME_MACHINE}-pc-mingw64
exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
*:Interix*:*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
8664:Windows_NT:*)
echo x86_64-pc-mks
exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
exit ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arc:Linux:*:* | arceb:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
cris:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:Linux:*:*)
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef ${UNAME_MACHINE}
#undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=${UNAME_MACHINE}
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
openrisc*:Linux:*:*)
echo or1k-unknown-linux-${LIBC}
exit ;;
or32:Linux:*:* | or1k*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-${LIBC}
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-${LIBC}
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
*) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-${LIBC}
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-${LIBC}
exit ;;
ppc64le:Linux:*:*)
echo powerpc64le-unknown-linux-${LIBC}
exit ;;
ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
echo i386-sequent-sysv4
exit ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit ;;
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
exit ;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
exit ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit ;;
paragon:*:*:*)
echo i860-intel-osf1
exit ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit ;;
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
exit ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
exit ;;
M68*:*:R3V[5678]*:*)
test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit ;;
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
exit ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says
echo i586-unisys-sysv4
exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes .
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit ;;
i*86:VOS:*:*)
# From Paul.Green@stratus.com.
echo ${UNAME_MACHINE}-stratus-vos
exit ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos
exit ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit ;;
news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
exit ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit ;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
x86_64:Haiku:*:*)
echo x86_64-unknown-haiku
exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
exit ;;
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit ;;
SX-7:SUPER-UX:*:*)
echo sx7-nec-superux${UNAME_RELEASE}
exit ;;
SX-8:SUPER-UX:*:*)
echo sx8-nec-superux${UNAME_RELEASE}
exit ;;
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
eval $set_cc_for_build
if test "$UNAME_PROCESSOR" = unknown ; then
UNAME_PROCESSOR=powerpc
fi
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
# Avoid executing cc on OS X 10.9, as it ships with a stub
# that puts up a graphical alert prompting to install
# developer tools. Any system running Mac OS X 10.7 or
# later (Darwin 11 and later) is required to have a 64-bit
# processor. This is not true of the ARM version of Darwin
# that Apple uses in portable devices.
UNAME_PROCESSOR=x86_64
fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
exit ;;
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
exit ;;
BS2000:POSIX*:*:*)
echo bs2000-siemens-sysv
exit ;;
DS/*:UNIX_System_V:*:*)
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
exit ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
if test "$cputype" = "386"; then
UNAME_MACHINE=i386
else
UNAME_MACHINE="$cputype"
fi
echo ${UNAME_MACHINE}-unknown-plan9
exit ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
exit ;;
*:TENEX:*:*)
echo pdp10-unknown-tenex
exit ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
echo pdp10-dec-tops20
exit ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
echo pdp10-xkl-tops20
exit ;;
*:TOPS-20:*:*)
echo pdp10-unknown-tops20
exit ;;
*:ITS:*:*)
echo pdp10-unknown-its
exit ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
V*) echo vax-dec-vms ; exit ;;
esac ;;
*:XENIX:*:SysV)
echo i386-pc-xenix
exit ;;
i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
exit ;;
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
esac
cat >&2 < in order to provide the needed
information to handle your system.
config.guess timestamp = $timestamp
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
hostinfo = `(hostinfo) 2>/dev/null`
/bin/universe = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
UNAME_MACHINE = ${UNAME_MACHINE}
UNAME_RELEASE = ${UNAME_RELEASE}
UNAME_SYSTEM = ${UNAME_SYSTEM}
UNAME_VERSION = ${UNAME_VERSION}
EOF
exit 1
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
xfsprogs-4.3.0+nmu1ubuntu1.1/config.sub 0000775 0000000 0000000 00000105775 12560600054 014620 0 ustar #! /bin/sh
# Configuration validation subroutine script.
# Copyright 1992-2014 Free Software Foundation, Inc.
timestamp='2014-09-11'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see .
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS
$0 [OPTION] ALIAS
Canonicalize a configuration name.
Operation modes:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to ."
version="\
GNU config.sub ($timestamp)
Copyright 1992-2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help"
exit 1 ;;
*local*)
# First pass through any local machine types.
echo $1
exit ;;
* )
break ;;
esac
done
case $# in
0) echo "$me: missing argument$help" >&2
exit 1;;
1) ;;
*) echo "$me: too many arguments$help" >&2
exit 1;;
esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
;;
esac
### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work. We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
-sun*os*)
# Prevent following clause from handling this invalid input.
;;
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray | -microblaze*)
os=
basic_machine=$1
;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
;;
-scout)
;;
-wrs)
os=-vxworks
basic_machine=$1
;;
-chorusos*)
os=-chorusos
basic_machine=$1
;;
-chorusrdb)
os=-chorusrdb
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
-sco6)
os=-sco5v6
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-udk*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*178)
os=-lynxos178
;;
-lynx*5)
os=-lynxos5
;;
-lynx*)
os=-lynxos
;;
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
-psos*)
os=-psos
;;
-mint | -mint[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
| aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| be32 | be64 \
| bfin \
| c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
| riscv32 | riscv64 \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu \
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| we32k \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
c54x)
basic_machine=tic54x-unknown
;;
c55x)
basic_machine=tic55x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
ms1)
basic_machine=mt-unknown
;;
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
xgate)
basic_machine=$basic_machine-unknown
os=-none
;;
xscaleeb)
basic_machine=armeb-unknown
;;
xscaleel)
basic_machine=armel-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i*86 | x86_64)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \
| mips64r5900-* | mips64r5900el-* \
| mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa32r6-* | mipsisa32r6el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64r6-* | mipsisa64r6el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| or1k*-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \
| rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
| tron-* \
| ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
basic_machine=i386-unknown
os=-bsd
;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
a29khif)
basic_machine=a29k-amd
os=-udi
;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
am29k)
basic_machine=a29k-none
os=-bsd
;;
amd64)
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
basic_machine=m68k-unknown
;;
amigaos | amigados)
basic_machine=m68k-unknown
os=-amigaos
;;
amigaunix | amix)
basic_machine=m68k-unknown
os=-sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=-sysv
;;
apollo68bsd)
basic_machine=m68k-apollo
os=-bsd
;;
aros)
basic_machine=i386-pc
os=-aros
;;
aux)
basic_machine=m68k-apple
os=-aux
;;
balance)
basic_machine=ns32k-sequent
os=-dynix
;;
blackfin)
basic_machine=bfin-unknown
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
bluegene*)
basic_machine=powerpc-ibm
os=-cnk
;;
c54x-*)
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c90)
basic_machine=c90-cray
os=-unicos
;;
cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
;;
convex-c2)
basic_machine=c2-convex
os=-bsd
;;
convex-c32)
basic_machine=c32-convex
os=-bsd
;;
convex-c34)
basic_machine=c34-convex
os=-bsd
;;
convex-c38)
basic_machine=c38-convex
os=-bsd
;;
cray | j90)
basic_machine=j90-cray
os=-unicos
;;
craynv)
basic_machine=craynv-cray
os=-unicosmp
;;
cr16 | cr16-*)
basic_machine=cr16-unknown
os=-elf
;;
crds | unos)
basic_machine=m68k-crds
;;
crisv32 | crisv32-* | etraxfs*)
basic_machine=crisv32-axis
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
decsystem10* | dec10*)
basic_machine=pdp10-dec
os=-tops10
;;
decsystem20* | dec20*)
basic_machine=pdp10-dec
os=-tops20
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
basic_machine=m68k-motorola
;;
delta88)
basic_machine=m88k-motorola
os=-sysv3
;;
dicos)
basic_machine=i686-pc
os=-dicos
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
;;
dpx2* | dpx2*-bull)
basic_machine=m68k-bull
os=-sysv3
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
;;
elxsi)
basic_machine=elxsi-elxsi
os=-bsd
;;
encore | umax | mmax)
basic_machine=ns32k-encore
;;
es1800 | OSE68k | ose68k | ose | OSE)
basic_machine=m68k-ericsson
os=-ose
;;
fx2800)
basic_machine=i860-alliant
;;
genix)
basic_machine=ns32k-ns
;;
gmicro)
basic_machine=tron-gmicro
os=-sysv
;;
go32)
basic_machine=i386-pc
os=-go32
;;
h3050r* | hiux*)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
h8300hms)
basic_machine=h8300-hitachi
os=-hms
;;
h8300xray)
basic_machine=h8300-hitachi
os=-xray
;;
h8500hms)
basic_machine=h8500-hitachi
os=-hms
;;
harris)
basic_machine=m88k-harris
os=-sysv3
;;
hp300-*)
basic_machine=m68k-hp
;;
hp300bsd)
basic_machine=m68k-hp
os=-bsd
;;
hp300hpux)
basic_machine=m68k-hp
os=-hpux
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
hp9k6[0-9][0-9] | hp6[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k7[0-79][0-9] | hp7[0-79][0-9])
basic_machine=hppa1.1-hp
;;
hp9k78[0-9] | hp78[0-9])
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][13679] | hp8[0-9][13679])
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hppa-next)
os=-nextstep3
;;
hppaosf)
basic_machine=hppa1.1-hp
os=-osf
;;
hppro)
basic_machine=hppa1.1-hp
os=-proelf
;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
;;
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i*86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i*86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i*86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
i386mach)
basic_machine=i386-mach
os=-mach
;;
i386-vsta | vsta)
basic_machine=i386-unknown
os=-vsta
;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
-irix*)
;;
*)
os=-irix4
;;
esac
;;
isi68 | isi)
basic_machine=m68k-isi
os=-sysv
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*)
basic_machine=m88k-omron
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
;;
merlin)
basic_machine=ns32k-utek
os=-sysv
;;
microblaze*)
basic_machine=microblaze-xilinx
;;
mingw64)
basic_machine=x86_64-pc
os=-mingw64
;;
mingw32)
basic_machine=i686-pc
os=-mingw32
;;
mingw32ce)
basic_machine=arm-unknown
os=-mingw32ce
;;
miniframe)
basic_machine=m68000-convergent
;;
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
;;
morphos)
basic_machine=powerpc-unknown
os=-morphos
;;
moxiebox)
basic_machine=moxie-unknown
os=-moxiebox
;;
msdos)
basic_machine=i386-pc
os=-msdos
;;
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=i686-pc
os=-msys
;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
nacl)
basic_machine=le32-unknown
os=-nacl
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
netbsd386)
basic_machine=i386-unknown
os=-netbsd
;;
netwinder)
basic_machine=armv4l-rebel
os=-linux
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
;;
news1000)
basic_machine=m68030-sony
os=-newsos
;;
news-3600 | risc-news)
basic_machine=mips-sony
os=-newsos
;;
necv70)
basic_machine=v70-nec
os=-sysv
;;
next | m*-next )
basic_machine=m68k-next
case $os in
-nextstep* )
;;
-ns2*)
os=-nextstep2
;;
*)
os=-nextstep3
;;
esac
;;
nh3000)
basic_machine=m68k-harris
os=-cxux
;;
nh[45]000)
basic_machine=m88k-harris
os=-cxux
;;
nindy960)
basic_machine=i960-intel
os=-nindy
;;
mon960)
basic_machine=i960-intel
os=-mon960
;;
nonstopux)
basic_machine=mips-compaq
os=-nonstopux
;;
np1)
basic_machine=np1-gould
;;
neo-tandem)
basic_machine=neo-tandem
;;
nse-tandem)
basic_machine=nse-tandem
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf
;;
openrisc | openrisc-*)
basic_machine=or32-unknown
;;
os400)
basic_machine=powerpc-ibm
os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
;;
os68k)
basic_machine=m68k-none
os=-os68k
;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
paragon)
basic_machine=i860-intel
os=-osf
;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
pbd)
basic_machine=sparc-tti
;;
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pc98)
basic_machine=i386-pc
;;
pc98-*)
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
pentiumpro | p6 | 6x86 | athlon | athlon_*)
basic_machine=i686-pc
;;
pentiumii | pentium2 | pentiumiii | pentium3)
basic_machine=i686-pc
;;
pentium4)
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium4-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
;;
power) basic_machine=power-ibm
;;
ppc | ppcbe) basic_machine=powerpc-unknown
;;
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64) basic_machine=powerpc64-unknown
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
basic_machine=powerpc64le-unknown
;;
ppc64le-* | powerpc64little-*)
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
;;
pw32)
basic_machine=i586-unknown
os=-pw32
;;
rdos | rdos64)
basic_machine=x86_64-pc
os=-rdos
;;
rdos32)
basic_machine=i386-pc
os=-rdos
;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
;;
rm[46]00)
basic_machine=mips-siemens
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
s390 | s390-*)
basic_machine=s390-ibm
;;
s390x | s390x-*)
basic_machine=s390x-ibm
;;
sa29200)
basic_machine=a29k-amd
os=-udi
;;
sb1)
basic_machine=mipsisa64sb1-unknown
;;
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
sde)
basic_machine=mipsisa32-sde
os=-elf
;;
sei)
basic_machine=mips-sei
os=-seiux
;;
sequent)
basic_machine=i386-sequent
;;
sh)
basic_machine=sh-hitachi
os=-hms
;;
sh5el)
basic_machine=sh5le-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
sparclite-wrs | simso-wrs)
basic_machine=sparclite-wrs
os=-vxworks
;;
sps7)
basic_machine=m68k-bull
os=-sysv2
;;
spur)
basic_machine=spur-unknown
;;
st2000)
basic_machine=m68k-tandem
;;
stratus)
basic_machine=i860-stratus
os=-sysv4
;;
strongarm-* | thumb-*)
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
sun2)
basic_machine=m68000-sun
;;
sun2os3)
basic_machine=m68000-sun
os=-sunos3
;;
sun2os4)
basic_machine=m68000-sun
os=-sunos4
;;
sun3os3)
basic_machine=m68k-sun
os=-sunos3
;;
sun3os4)
basic_machine=m68k-sun
os=-sunos4
;;
sun4os3)
basic_machine=sparc-sun
os=-sunos3
;;
sun4os4)
basic_machine=sparc-sun
os=-sunos4
;;
sun4sol2)
basic_machine=sparc-sun
os=-solaris2
;;
sun3 | sun3-*)
basic_machine=m68k-sun
;;
sun4)
basic_machine=sparc-sun
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
sv1)
basic_machine=sv1-cray
os=-unicos
;;
symmetry)
basic_machine=i386-sequent
os=-dynix
;;
t3e)
basic_machine=alphaev5-cray
os=-unicos
;;
t90)
basic_machine=t90-cray
os=-unicos
;;
tile*)
basic_machine=$basic_machine-unknown
os=-linux-gnu
;;
tx39)
basic_machine=mipstx39-unknown
;;
tx39el)
basic_machine=mipstx39el-unknown
;;
toad1)
basic_machine=pdp10-xkl
os=-tops20
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
tpf)
basic_machine=s390x-ibm
os=-tpf
;;
udi29k)
basic_machine=a29k-amd
os=-udi
;;
ultra3)
basic_machine=a29k-nyu
os=-sym1
;;
v810 | necv810)
basic_machine=v810-nec
os=-none
;;
vaxv)
basic_machine=vax-dec
os=-sysv
;;
vms)
basic_machine=vax-dec
os=-vms
;;
vpp*|vx|vx-*)
basic_machine=f301-fujitsu
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
;;
vxworks68)
basic_machine=m68k-wrs
os=-vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
os=-vxworks
;;
w65*)
basic_machine=w65-wdc
os=-none
;;
w89k-*)
basic_machine=hppa1.1-winbond
os=-proelf
;;
xbox)
basic_machine=i686-pc
os=-mingw32
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
xscale-* | xscalee[bl]-*)
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
;;
ymp)
basic_machine=ymp-cray
os=-unicos
;;
z8k-*-coff)
basic_machine=z8k-unknown
os=-sim
;;
z80-*-coff)
basic_machine=z80-unknown
os=-sim
;;
none)
basic_machine=none-none
os=-none
;;
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
w89k)
basic_machine=hppa1.1-winbond
;;
op50n)
basic_machine=hppa1.1-oki
;;
op60c)
basic_machine=hppa1.1-oki
;;
romp)
basic_machine=romp-ibm
;;
mmix)
basic_machine=mmix-knuth
;;
rs6000)
basic_machine=rs6000-ibm
;;
vax)
basic_machine=vax-dec
;;
pdp10)
# there are many clones, so DEC is not a safe bet
basic_machine=pdp10-unknown
;;
pdp11)
basic_machine=pdp11-dec
;;
we32k)
basic_machine=we32k-att
;;
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
basic_machine=sparc-sun
;;
cydra)
basic_machine=cydra-cydrome
;;
orion)
basic_machine=orion-highlevel
;;
orion105)
basic_machine=clipper-highlevel
;;
mac | mpw | mac-mpw)
basic_machine=m68k-apple
;;
pmac | pmac-mpw)
basic_machine=powerpc-apple
;;
*-unknown)
# Make sure to match an already-canonicalized machine name.
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
esac
# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
*-digital*)
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
;;
*-commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
;;
*)
;;
esac
# Decode manufacturer-specific aliases for certain operating systems.
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-auroraux)
os=-auroraux
;;
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
-solaris)
os=-solaris2
;;
-svr4*)
os=-sysv4
;;
-unixware*)
os=-sysv4.2uw
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First accept the basic system types.
# The portable systems comes first.
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -bitrig* | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
case $basic_machine in
x86-* | i*86-*)
;;
*)
os=-nto$os
;;
esac
;;
-nto-qnx*)
;;
-nto*)
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
-linux-dietlibc)
os=-linux-dietlibc
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'`
;;
-opened*)
os=-openedition
;;
-os400*)
os=-os400
;;
-wince*)
os=-wince
;;
-osfrose*)
os=-osfrose
;;
-osf*)
os=-osf
;;
-utek*)
os=-bsd
;;
-dynix*)
os=-bsd
;;
-acis*)
os=-aos
;;
-atheos*)
os=-atheos
;;
-syllable*)
os=-syllable
;;
-386bsd)
os=-bsd
;;
-ctix* | -uts*)
os=-sysv
;;
-nova*)
os=-rtmk-nova
;;
-ns2 )
os=-nextstep2
;;
-nsk*)
os=-nsk
;;
# Preserve the version number of sinix5.
-sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'`
;;
-sinix*)
os=-sysv4
;;
-tpf*)
os=-tpf
;;
-triton*)
os=-sysv3
;;
-oss*)
os=-sysv3
;;
-svr4)
os=-sysv4
;;
-svr3)
os=-sysv3
;;
-sysvr4)
os=-sysv4
;;
# This must come after -sysvr4.
-sysv*)
;;
-ose*)
os=-ose
;;
-es1800*)
os=-ose
;;
-xenix)
os=-xenix
;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint
;;
-aros*)
os=-aros
;;
-zvmoe)
os=-zvmoe
;;
-dicos*)
os=-dicos
;;
-nacl*)
;;
-none)
;;
*)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
exit 1
;;
esac
else
# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.
# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system. Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
case $basic_machine in
score-*)
os=-elf
;;
spu-*)
os=-elf
;;
*-acorn)
os=-riscix1.2
;;
arm*-rebel)
os=-linux
;;
arm*-semi)
os=-aout
;;
c4x-* | tic4x-*)
os=-coff
;;
c8051-*)
os=-elf
;;
hexagon-*)
os=-elf
;;
tic54x-*)
os=-coff
;;
tic55x-*)
os=-coff
;;
tic6x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
;;
pdp11-*)
os=-none
;;
*-dec | vax-*)
os=-ultrix4.2
;;
m68*-apollo)
os=-domain
;;
i386-sun)
os=-sunos4.0.2
;;
m68000-sun)
os=-sunos3
;;
m68*-cisco)
os=-aout
;;
mep-*)
os=-elf
;;
mips*-cisco)
os=-elf
;;
mips*-*)
os=-elf
;;
or32-*)
os=-coff
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
sparc-* | *-sun)
os=-sunos4.1.1
;;
*-be)
os=-beos
;;
*-haiku)
os=-haiku
;;
*-ibm)
os=-aix
;;
*-knuth)
os=-mmixware
;;
*-wec)
os=-proelf
;;
*-winbond)
os=-proelf
;;
*-oki)
os=-proelf
;;
*-hp)
os=-hpux
;;
*-hitachi)
os=-hiux
;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
os=-sysv
;;
*-cbm)
os=-amigaos
;;
*-dg)
os=-dgux
;;
*-dolphin)
os=-sysv3
;;
m68k-ccur)
os=-rtu
;;
m88k-omron*)
os=-luna
;;
*-next )
os=-nextstep
;;
*-sequent)
os=-ptx
;;
*-crds)
os=-unos
;;
*-ns)
os=-genix
;;
i370-*)
os=-mvs
;;
*-next)
os=-nextstep3
;;
*-gould)
os=-sysv
;;
*-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
*-sgi)
os=-irix
;;
*-siemens)
os=-sysv4
;;
*-masscomp)
os=-rtu
;;
f30[01]-fujitsu | f700-fujitsu)
os=-uxpv
;;
*-rom68k)
os=-coff
;;
*-*bug)
os=-coff
;;
*-apple)
os=-macos
;;
*-atari*)
os=-mint
;;
*)
os=-none
;;
esac
fi
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
*-unknown)
case $os in
-riscix*)
vendor=acorn
;;
-sunos*)
vendor=sun
;;
-cnk*|-aix*)
vendor=ibm
;;
-beos*)
vendor=be
;;
-hpux*)
vendor=hp
;;
-mpeix*)
vendor=hp
;;
-hiux*)
vendor=hitachi
;;
-unos*)
vendor=crds
;;
-dgux*)
vendor=dg
;;
-luna*)
vendor=omron
;;
-genix*)
vendor=ns
;;
-mvs* | -opened*)
vendor=ibm
;;
-os400*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-tpf*)
vendor=ibm
;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
-aux*)
vendor=apple
;;
-hms*)
vendor=hitachi
;;
-mpw* | -macos*)
vendor=apple
;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
vendor=atari
;;
-vos*)
vendor=stratus
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os
exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
xfsprogs-4.3.0+nmu1ubuntu1.1/configure 0000775 0000000 0000000 00001627227 12574432017 014555 0 ustar #! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for xfsprogs 4.2.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
&& (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='print -r --'
as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='printf %s\n'
as_echo_n='printf %s'
else
if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
as_echo_n='/usr/ucb/echo -n'
else
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
case $arg in #(
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
esac;
expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
'
export as_echo_n_body
as_echo_n='sh -c $as_echo_n_body as_echo'
fi
export as_echo_body
as_echo='sh -c $as_echo_body as_echo'
fi
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
PATH_SEPARATOR=';'
}
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there. '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# Use a proper internal environment variable to ensure we don't fall
# into an infinite loop, continuously re-executing ourselves.
if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
_as_can_reexec=no; export _as_can_reexec;
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
as_fn_exit 255
fi
# We don't want this to propagate to other subprocesses.
{ _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
# is contrary to our usage. Disable this feature.
alias -g '\${1+\"\$@\"}'='\"\$@\"'
setopt NO_GLOB_SUBST
else
case \`(set -o) 2>/dev/null\` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
"
as_required="as_fn_return () { (exit \$1); }
as_fn_success () { as_fn_return 0; }
as_fn_failure () { as_fn_return 1; }
as_fn_ret_success () { return 0; }
as_fn_ret_failure () { return 1; }
exitcode=0
as_fn_success || { exitcode=1; echo as_fn_success failed.; }
as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
test x\$exitcode = x0 || exit 1
test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
PATH=/empty FPATH=/empty; export PATH FPATH
test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
|| test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
test \$(( 1 + 1 )) = 2 || exit 1"
if (eval "$as_required") 2>/dev/null; then :
as_have_required=yes
else
as_have_required=no
fi
if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_found=false
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
as_found=:
case $as_dir in #(
/*)
for as_base in sh bash ksh sh5; do
# Try only shells that exist, to save several forks.
as_shell=$as_dir/$as_base
if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
CONFIG_SHELL=$as_shell as_have_required=yes
if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
break 2
fi
fi
done;;
esac
as_found=false
done
$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
CONFIG_SHELL=$SHELL as_have_required=yes
fi; }
IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
export CONFIG_SHELL
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi
if test x$as_have_required = xno; then :
$as_echo "$0: This script requires a shell more modern than all"
$as_echo "$0: the shells that I found on your system."
if test x${ZSH_VERSION+set} = xset ; then
$as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
$as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
$0: including any error possibly output before this
$0: message. Then install a modern shell, or manually run
$0: the script under such a shell if you do have one."
fi
exit 1
fi
fi
fi
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL
# Unset more variables known to interfere with behavior of common tools.
CLICOLOR_FORCE= GREP_OPTIONS=
unset CLICOLOR_FORCE GREP_OPTIONS
## --------------------- ##
## M4sh Shell Functions. ##
## --------------------- ##
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else
as_fn_append ()
{
eval $1=\$$1\$2
}
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
as_status=$1; test $as_status -eq 0 && as_status=1
if test "$4"; then
as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
$as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
$as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
as_lineno_1=$LINENO as_lineno_1a=$LINENO
as_lineno_2=$LINENO as_lineno_2a=$LINENO
eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
# Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
' <$as_myself |
sed '
s/[$]LINENO.*/&-/
t lineno
b
:lineno
N
:loop
s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
# If we had to re-execute with $CONFIG_SHELL, we're ensured to have
# already done that, so ensure we don't try to do so again and fall
# in an infinite loop. This has already happened in practice.
_as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
. "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
SHELL=${CONFIG_SHELL-/bin/sh}
test -n "$DJDIR" || exec 7<&0 &1
# Name of the host.
# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
#
# Initializations.
#
ac_default_prefix=/usr/local
ac_clean_files=
ac_config_libobj_dir=.
LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='xfsprogs'
PACKAGE_TARNAME='xfsprogs'
PACKAGE_VERSION='4.2.0'
PACKAGE_STRING='xfsprogs 4.2.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
ac_unique_file="include/libxfs.h"
ac_default_prefix=/usr
# Factoring default headers for most tests.
ac_includes_default="\
#include
#ifdef HAVE_SYS_TYPES_H
# include
#endif
#ifdef HAVE_SYS_STAT_H
# include
#endif
#ifdef STDC_HEADERS
# include
# include
#else
# ifdef HAVE_STDLIB_H
# include
# endif
#endif
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
# include
# endif
# include
#endif
#ifdef HAVE_STRINGS_H
# include
#endif
#ifdef HAVE_INTTYPES_H
# include
#endif
#ifdef HAVE_STDINT_H
# include
#endif
#ifdef HAVE_UNISTD_H
# include
#endif"
ac_subst_vars='LTLIBOBJS
LIBOBJS
have_zipped_manpages
have_readdir
libblkid
have_fls
have_mntent
have_sync_file_range
have_preadv
have_fiemap
have_fallocate
have_getmntinfo
have_getmntent
have_sendfile
have_mincore
have_madvise
have_fadvise
libpthread
libuuid
librt
libdirsuffix
rpmbuild
RPMBUILD
rpm_version
rpm
RPM
xgettext
XGETTEXT
msgmerge
MSGMERGE
msgfmt
MSGFMT
sort
SORT
echo
ECHO
sed
awk
makedepend
zip
ZIP
tar
TAR
make
MAKE
cc
pkg_platform
pkg_distribution
pkg_group
pkg_user
malloc_lib
opt_build
debug_build
pkg_release
pkg_version
pkg_name
LOCALIZED_FILES
root_libdir
root_sbindir
enable_lib64
libtermcap
enable_editline
libeditline
enable_readline
libreadline
enable_gettext
enable_shared
BUILD_CC
CPP
OTOOL64
OTOOL
LIPO
NMEDIT
DSYMUTIL
MANIFEST_TOOL
AWK
RANLIB
STRIP
ac_ct_AR
AR
DLLTOOL
OBJDUMP
LN_S
NM
ac_ct_DUMPBIN
DUMPBIN
LD
FGREP
EGREP
GREP
SED
OBJEXT
EXEEXT
ac_ct_CC
CPPFLAGS
LDFLAGS
CFLAGS
CC
host_os
host_vendor
host_cpu
host
build_os
build_vendor
build_cpu
build
LIBTOOL
target_alias
host_alias
build_alias
LIBS
ECHO_T
ECHO_N
ECHO_C
DEFS
mandir
localedir
libdir
psdir
pdfdir
dvidir
htmldir
infodir
docdir
oldincludedir
includedir
localstatedir
sharedstatedir
sysconfdir
datadir
datarootdir
libexecdir
sbindir
bindir
program_transform_name
prefix
exec_prefix
PACKAGE_URL
PACKAGE_BUGREPORT
PACKAGE_STRING
PACKAGE_VERSION
PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_shared
enable_static
with_pic
enable_fast_install
with_gnu_ld
with_sysroot
enable_libtool_lock
enable_gettext
enable_readline
enable_editline
enable_termcap
enable_lib64
'
ac_precious_vars='build_alias
host_alias
target_alias
CC
CFLAGS
LDFLAGS
LIBS
CPPFLAGS
CPP'
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
ac_unrecognized_opts=
ac_unrecognized_sep=
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datarootdir='${prefix}/share'
datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
infodir='${datarootdir}/info'
htmldir='${docdir}'
dvidir='${docdir}'
pdfdir='${docdir}'
psdir='${docdir}'
libdir='${exec_prefix}/lib'
localedir='${datarootdir}/locale'
mandir='${datarootdir}/man'
ac_prev=
ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval $ac_prev=\$ac_option
ac_prev=
continue
fi
case $ac_option in
*=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
*=) ac_optarg= ;;
*) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
case $ac_dashdash$ac_option in
--)
ac_dashdash=yes ;;
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=*)
datadir=$ac_optarg ;;
-datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
| --dataroo | --dataro | --datar)
ac_prev=datarootdir ;;
-datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
| --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
datarootdir=$ac_optarg ;;
-disable-* | --disable-*)
ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=no ;;
-docdir | --docdir | --docdi | --doc | --do)
ac_prev=docdir ;;
-docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
docdir=$ac_optarg ;;
-dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
ac_prev=dvidir ;;
-dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
dvidir=$ac_optarg ;;
-enable-* | --enable-*)
ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
-host | --host | --hos | --ho)
ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
-htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
ac_prev=htmldir ;;
-htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
| --ht=*)
htmldir=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
-localedir | --localedir | --localedi | --localed | --locale)
ac_prev=localedir ;;
-localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
localedir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst | --locals)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
-pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
ac_prev=pdfdir ;;
-pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
pdfdir=$ac_optarg ;;
-psdir | --psdir | --psdi | --psd | --ps)
ac_prev=psdir ;;
-psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
psdir=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
-with-* | --with-*)
ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=\$ac_optarg ;;
-without-* | --without-*)
ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=no ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
-*) as_fn_error $? "unrecognized option: \`$ac_option'
Try \`$0 --help' for more information"
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
case $ac_envvar in #(
'' | [0-9]* | *[!_$as_cr_alnum]* )
as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
esac
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
$as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
$as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
: "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
as_fn_error $? "missing argument to $ac_option"
fi
if test -n "$ac_unrecognized_opts"; then
case $enable_option_checking in
no) ;;
fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
*) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
fi
# Check all directory arguments for consistency.
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
case $ac_val in
*/ )
ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
eval $ac_var=\$ac_val;;
esac
# Be sure to have absolute directory names.
case $ac_val in
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: To remove some day.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
fi
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
as_fn_error $? "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
as_fn_error $? "pwd does not report name of working directory"
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then the parent directory.
ac_confdir=`$as_dirname -- "$as_myself" ||
$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_myself" : 'X\(//\)[^/]' \| \
X"$as_myself" : 'X\(//\)$' \| \
X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_myself" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
srcdir=.
fi
# Remove unnecessary trailing slashes from srcdir.
# Double slashes in file names in object file debugging info
# mess up M-x gdb in Emacs.
case $srcdir in
*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
esac
for ac_var in $ac_precious_vars; do
eval ac_env_${ac_var}_set=\${${ac_var}+set}
eval ac_env_${ac_var}_value=\$${ac_var}
eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
eval ac_cv_env_${ac_var}_value=\$${ac_var}
done
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures xfsprogs 4.2.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print \`checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/xfsprogs]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
_ACEOF
fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of xfsprogs 4.2.0:";;
esac
cat <<\_ACEOF
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-shared=yes/no Enable use of shared libraries default=yes
--enable-gettext=yes/no Enable alternate language support default=yes
--enable-readline=yes/no Enable readline command editing default=no
--enable-editline=yes/no Enable editline command editing default=no
--enable-termcap=yes/no Enable terminal capabilities library default=no
--enable-lib64=yes/no Enable lib64 support default=yes
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-sysroot=DIR Search for dependent libraries within DIR
(or the compiler's sysroot if not specified).
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
LIBS libraries to pass to the linker, e.g. -l
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if
you have headers in a nonstandard directory
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to the package provider.
_ACEOF
ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
test -d "$ac_dir" ||
{ cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
continue
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
cd "$ac_dir" || { ac_status=$?; continue; }
# Check for guested configure.
if test -f "$ac_srcdir/configure.gnu"; then
echo &&
$SHELL "$ac_srcdir/configure.gnu" --help=recursive
elif test -f "$ac_srcdir/configure"; then
echo &&
$SHELL "$ac_srcdir/configure" --help=recursive
else
$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi || ac_status=$?
cd "$ac_pwd" || { ac_status=$?; break; }
done
fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
xfsprogs configure 4.2.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
exit
fi
## ------------------------ ##
## Autoconf initialization. ##
## ------------------------ ##
# ac_fn_c_try_compile LINENO
# --------------------------
# Try to compile conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext
if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_compile
# ac_fn_c_try_link LINENO
# -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_link ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext conftest$ac_exeext
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
test -x conftest$ac_exeext
}; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_link
# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists and can be compiled using the include files in
# INCLUDES, setting the cache variable VAR accordingly.
ac_fn_c_check_header_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_compile
# ac_fn_c_try_cpp LINENO
# ----------------------
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_cpp ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } > conftest.i && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_cpp
# ac_fn_c_try_run LINENO
# ----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
# that executables *can* be run.
ac_fn_c_try_run ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then :
ac_retval=0
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_run
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
ac_fn_c_check_func ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Define $2 to an innocuous variant, in case declares $2.
For example, HP-UX 11i declares gettimeofday. */
#define $2 innocuous_$2
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $2 (); below.
Prefer to if __STDC__ is defined, since
exists even on freestanding compilers. */
#ifdef __STDC__
# include
#else
# include
#endif
#undef $2
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $2 ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$2 || defined __stub___$2
choke me
#endif
int
main ()
{
return $2 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists, giving a warning if it cannot be compiled using
# the include files in INCLUDES and setting the cache variable VAR
# accordingly.
ac_fn_c_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if eval \${$3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
else
# Is the header compilable?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
$as_echo_n "checking $2 usability... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_header_compiler=yes
else
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }
# Is the header present?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
$as_echo_n "checking $2 presence... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <$2>
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
ac_header_preproc=yes
else
ac_header_preproc=no
fi
rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
yes:no: )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
;;
no:yes:* )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=\$ac_header_compiler"
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_mongrel
# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
# ---------------------------------------------
# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
# accordingly.
ac_fn_c_check_decl ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
as_decl_name=`echo $2|sed 's/ *(.*//'`
as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
#ifndef $as_decl_name
#ifdef __cplusplus
(void) $as_decl_use;
#else
(void) $as_decl_name;
#endif
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_decl
# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
# --------------------------------------------
# Tries to find the compile-time value of EXPR in a program that includes
# INCLUDES, setting VAR accordingly. Returns whether the value could be
# computed
ac_fn_c_compute_int ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if test "$cross_compiling" = yes; then
# Depending upon the size, compute the lo and hi bounds.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) >= 0)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_lo=0 ac_mid=0
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_hi=$ac_mid; break
else
as_fn_arith $ac_mid + 1 && ac_lo=$as_val
if test $ac_lo -le $ac_mid; then
ac_lo= ac_hi=
break
fi
as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) < 0)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_hi=-1 ac_mid=-1
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) >= $ac_mid)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_lo=$ac_mid; break
else
as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
if test $ac_mid -le $ac_hi; then
ac_lo= ac_hi=
break
fi
as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
ac_lo= ac_hi=
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do
as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_hi=$ac_mid
else
as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in #((
?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
'') ac_retval=1 ;;
esac
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
static long int longval () { return $2; }
static unsigned long int ulongval () { return $2; }
#include
#include
int
main ()
{
FILE *f = fopen ("conftest.val", "w");
if (! f)
return 1;
if (($2) < 0)
{
long int i = longval ();
if (i != ($2))
return 1;
fprintf (f, "%ld", i);
}
else
{
unsigned long int i = ulongval ();
if (i != ($2))
return 1;
fprintf (f, "%lu", i);
}
/* Do not output a trailing newline, as this causes \r\n confusion
on some platforms. */
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
echo >>conftest.val; read $3 config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by xfsprogs $as_me 4.2.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
_ACEOF
exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##
hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
_ASUNAME
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
$as_echo "PATH: $as_dir"
done
IFS=$as_save_IFS
} >&5
cat >&5 <<_ACEOF
## ----------- ##
## Core tests. ##
## ----------- ##
_ACEOF
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
ac_must_keep_next=false
for ac_pass in 1 2
do
for ac_arg
do
case $ac_arg in
-no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*\'*)
ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
2)
as_fn_append ac_configure_args1 " '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
fi
as_fn_append ac_configure_args " '$ac_arg'"
;;
esac
done
done
{ ac_configure_args0=; unset ac_configure_args0;}
{ ac_configure_args1=; unset ac_configure_args1;}
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
# WARNING: Use '\'' to represent an apostrophe within the trap.
# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
echo
$as_echo "## ---------------- ##
## Cache variables. ##
## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
(
for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
*) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
sed -n \
"s/'\''/'\''\\\\'\'''\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
;; #(
*)
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
)
echo
$as_echo "## ----------------- ##
## Output variables. ##
## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
$as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
$as_echo "## ------------------- ##
## File substitutions. ##
## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
$as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
$as_echo "## ----------- ##
## confdefs.h. ##
## ----------- ##"
echo
cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
$as_echo "$as_me: caught signal $ac_signal"
$as_echo "$as_me: exit $exit_status"
} >&5
rm -f core *.core core.conftest.* &&
rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h
$as_echo "/* confdefs.h */" > confdefs.h
# Predefined preprocessor variables.
cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_URL "$PACKAGE_URL"
_ACEOF
# Let the site file select an alternate cache file if it wants to.
# Prefer an explicitly selected file to automatically selected ones.
ac_site_file1=NONE
ac_site_file2=NONE
if test -n "$CONFIG_SITE"; then
# We do not want a PATH search for config.site.
case $CONFIG_SITE in #((
-*) ac_site_file1=./$CONFIG_SITE;;
*/*) ac_site_file1=$CONFIG_SITE;;
*) ac_site_file1=./$CONFIG_SITE;;
esac
elif test "x$prefix" != xNONE; then
ac_site_file1=$prefix/share/config.site
ac_site_file2=$prefix/etc/config.site
else
ac_site_file1=$ac_default_prefix/share/config.site
ac_site_file2=$ac_default_prefix/etc/config.site
fi
for ac_site_file in "$ac_site_file1" "$ac_site_file2"
do
test "x$ac_site_file" = xNONE && continue
if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file" \
|| { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "failed to load site script $ac_site_file
See \`config.log' for more details" "$LINENO" 5; }
fi
done
if test -r "$cache_file"; then
# Some versions of bash will fail to source /dev/null (special files
# actually), so we avoid doing that. DJGPP emulates it as a regular file.
if test /dev/null != "$cache_file" && test -f "$cache_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
$as_echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . "$cache_file";;
*) . "./$cache_file";;
esac
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
$as_echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
for ac_var in $ac_precious_vars; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val=\$ac_cv_env_${ac_var}_value
eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
# differences in whitespace do not lead to failure.
ac_old_val_w=`echo x $ac_old_val`
ac_new_val_w=`echo x $ac_new_val`
if test "$ac_old_val_w" != "$ac_new_val_w"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
ac_cache_corrupted=:
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
eval $ac_var=\$ac_old_val
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
*\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
*) as_fn_append ac_configure_args " '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
fi
## -------------------- ##
## Main body of script. ##
## -------------------- ##
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_aux_dir=
for ac_dir in . "$srcdir"/.; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
as_fn_error $? "cannot find install-sh, install.sh, or shtool in . \"$srcdir\"/." "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
# and are intended to be withdrawn in a future Autoconf release.
# They can cause serious problems if a builder's source tree is in a directory
# whose full name contains unusual characters.
ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
ac_config_headers="$ac_config_headers include/platform_defs.h"
case `pwd` in
*\ * | *\ *)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
esac
macro_version='2.4.2'
macro_revision='1.3337'
ltmain="$ac_aux_dir/ltmain.sh"
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
$as_echo_n "checking build system type... " >&6; }
if ${ac_cv_build+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
test "x$ac_build_alias" = x &&
as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
$as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_build
shift
build_cpu=$1
build_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
build_os=$*
IFS=$ac_save_IFS
case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
$as_echo_n "checking host system type... " >&6; }
if ${ac_cv_host+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "x$host_alias" = x; then
ac_cv_host=$ac_cv_build
else
ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
$as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_host
shift
host_cpu=$1
host_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
host_os=$*
IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
# Backslashify metacharacters that are still active within
# double-quoted strings.
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
# Same as above, but do not quote variable references.
double_quote_subst='s/\(["`\\]\)/\\\1/g'
# Sed substitution to delay expansion of an escaped shell variable in a
# double_quote_subst'ed string.
delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
# Sed substitution to delay expansion of an escaped single quote.
delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
# Sed substitution to avoid accidental globbing in evaled expressions
no_glob_subst='s/\*/\\\*/g'
ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
$as_echo_n "checking how to print strings... " >&6; }
# Test print first, because it will be a builtin if present.
if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
ECHO='print -r --'
elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
ECHO='printf %s\n'
else
# Use this function as a fallback that always works.
func_fallback_echo ()
{
eval 'cat <<_LTECHO_EOF
$1
_LTECHO_EOF'
}
ECHO='func_fallback_echo'
fi
# func_echo_all arg...
# Invoke $ECHO with all args, space-separated.
func_echo_all ()
{
$ECHO ""
}
case "$ECHO" in
printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
$as_echo "printf" >&6; } ;;
print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
$as_echo "print -r" >&6; } ;;
*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
$as_echo "cat" >&6; } ;;
esac
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=no
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_CC" && break
done
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
fi
fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "no acceptable C compiler found in \$PATH
See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
{ { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
$as_echo_n "checking whether the C compiler works... " >&6; }
ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
# The possible output files:
ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
ac_rmfiles=
for ac_file in $ac_files
do
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
* ) ac_rmfiles="$ac_rmfiles $ac_file";;
esac
done
rm -f $ac_rmfiles
if { { ac_try="$ac_link_default"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link_default") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
# Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
# in a Makefile. We should not override ac_cv_exeext if it was cached,
# so that the user can short-circuit this test for compilers unknown to
# Autoconf.
for ac_file in $ac_files ''
do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
then :; else
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
fi
# We set ac_cv_exeext here because the later test for it is not
# safe: cross compilers may not add the suffix if given an `-o'
# argument, so we may need to know it at that point already.
# Even if this section looks crufty: it has the advantage of
# actually working.
break;;
* )
break;;
esac
done
test "$ac_cv_exeext" = no && ac_cv_exeext=
else
ac_file=''
fi
if test -z "$ac_file"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "C compiler cannot create executables
See \`config.log' for more details" "$LINENO" 5; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
$as_echo_n "checking for C compiler default output file name... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
$as_echo "$ac_file" >&6; }
ac_exeext=$ac_cv_exeext
rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
$as_echo_n "checking for suffix of executables... " >&6; }
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
# If both `conftest.exe' and `conftest' are `present' (well, observable)
# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
# work properly (i.e., refer to `conftest.exe'), while it won't with
# `rm'.
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
break;;
* ) break;;
esac
done
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
$as_echo "$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
FILE *f = fopen ("conftest.out", "w");
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
ac_clean_files="$ac_clean_files conftest.out"
# Check that the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
$as_echo_n "checking whether we are cross compiling... " >&6; }
if test "$cross_compiling" != yes; then
{ { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
if { ac_try='./conftest$ac_cv_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then
cross_compiling=no
else
if test "$cross_compiling" = maybe; then
cross_compiling=yes
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details" "$LINENO" 5; }
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
$as_echo "$cross_compiling" >&6; }
rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
if ${ac_cv_objext+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.o conftest.obj
if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
for ac_file in conftest.o conftest.obj conftest.*; do
test -f "$ac_file" || continue;
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of object files: cannot compile
See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
$as_echo "$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
$as_echo "$ac_cv_c_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GCC=yes
else
GCC=
fi
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
if ${ac_cv_prog_cc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
ac_cv_prog_cc_g=no
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
else
CFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
$as_echo "$ac_cv_prog_cc_g" >&6; }
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
as 'x'. The following induces an error, until -std is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
that's true only with -std. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
inside strings and character constants. */
#define FOO(x) 'x'
int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
_ACEOF
for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_c89=$ac_arg
fi
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC
fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
x)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
$as_echo "none needed" >&6; } ;;
xno)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
$as_echo "unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c89"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
esac
if test "x$ac_cv_prog_cc_c89" != xno; then :
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
$as_echo_n "checking for a sed that does not truncate output... " >&6; }
if ${ac_cv_path_SED+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
for ac_i in 1 2 3 4 5 6 7; do
ac_script="$ac_script$as_nl$ac_script"
done
echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
{ ac_script=; unset ac_script;}
if test -z "$SED"; then
ac_path_SED_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in sed gsed; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_SED" || continue
# Check for GNU ac_path_SED and select it if it is found.
# Check for GNU $ac_path_SED
case `"$ac_path_SED" --version 2>&1` in
*GNU*)
ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo '' >> "conftest.nl"
"$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_SED_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_SED="$ac_path_SED"
ac_path_SED_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_SED_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_SED"; then
as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
fi
else
ac_cv_path_SED=$SED
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
$as_echo "$ac_cv_path_SED" >&6; }
SED="$ac_cv_path_SED"
rm -f conftest.sed
test -z "$SED" && SED=sed
Xsed="$SED -e 1s/^X//"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
if ${ac_cv_path_GREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$GREP"; then
ac_path_GREP_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
*GNU*)
ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo 'GREP' >> "conftest.nl"
"$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_GREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_GREP="$ac_path_GREP"
ac_path_GREP_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_GREP_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_GREP"; then
as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_GREP=$GREP
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
$as_echo "$ac_cv_path_GREP" >&6; }
GREP="$ac_cv_path_GREP"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
if ${ac_cv_path_EGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
then ac_cv_path_EGREP="$GREP -E"
else
if test -z "$EGREP"; then
ac_path_EGREP_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
*GNU*)
ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo 'EGREP' >> "conftest.nl"
"$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_EGREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_EGREP="$ac_path_EGREP"
ac_path_EGREP_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_EGREP_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_EGREP"; then
as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_EGREP=$EGREP
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
$as_echo "$ac_cv_path_EGREP" >&6; }
EGREP="$ac_cv_path_EGREP"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
$as_echo_n "checking for fgrep... " >&6; }
if ${ac_cv_path_FGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
then ac_cv_path_FGREP="$GREP -F"
else
if test -z "$FGREP"; then
ac_path_FGREP_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in fgrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_FGREP" || continue
# Check for GNU ac_path_FGREP and select it if it is found.
# Check for GNU $ac_path_FGREP
case `"$ac_path_FGREP" --version 2>&1` in
*GNU*)
ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo 'FGREP' >> "conftest.nl"
"$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_FGREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_FGREP="$ac_path_FGREP"
ac_path_FGREP_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_FGREP_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_FGREP"; then
as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_FGREP=$FGREP
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
$as_echo "$ac_cv_path_FGREP" >&6; }
FGREP="$ac_cv_path_FGREP"
test -z "$GREP" && GREP=grep
# Check whether --with-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then :
withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
else
with_gnu_ld=no
fi
ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
$as_echo_n "checking for ld used by $CC... " >&6; }
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
*)
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
esac
case $ac_prog in
# Accept absolute paths.
[\\/]* | ?:[\\/]*)
re_direlt='/[^/][^/]*/\.\./'
# Canonicalize the pathname of ld
ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
$as_echo_n "checking for GNU ld... " >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
$as_echo_n "checking for non-GNU ld... " >&6; }
fi
if ${lt_cv_path_LD+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$LD"; then
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
for ac_dir in $PATH; do
IFS="$lt_save_ifs"
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
lt_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some variants of GNU ld only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
case `"$lt_cv_path_LD" -v 2>&1 &5
$as_echo "$LD" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
if ${lt_cv_prog_gnu_ld+:} false; then :
$as_echo_n "(cached) " >&6
else
# I'd rather use --version here, but apparently some GNU lds only accept -v.
case `$LD -v 2>&1 &5
$as_echo "$lt_cv_prog_gnu_ld" >&6; }
with_gnu_ld=$lt_cv_prog_gnu_ld
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
if ${lt_cv_path_NM+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$NM"; then
# Let the user override the test.
lt_cv_path_NM="$NM"
else
lt_nm_to_check="${ac_tool_prefix}nm"
if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
lt_nm_to_check="$lt_nm_to_check nm"
fi
for lt_tmp_nm in $lt_nm_to_check; do
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
IFS="$lt_save_ifs"
test -z "$ac_dir" && ac_dir=.
tmp_nm="$ac_dir/$lt_tmp_nm"
if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
# Tru64's nm complains that /dev/null is an invalid object file
case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
*/dev/null* | *'Invalid file or object type'*)
lt_cv_path_NM="$tmp_nm -B"
break
;;
*)
case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
*/dev/null*)
lt_cv_path_NM="$tmp_nm -p"
break
;;
*)
lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
;;
esac
;;
esac
fi
done
IFS="$lt_save_ifs"
done
: ${lt_cv_path_NM=no}
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
$as_echo "$lt_cv_path_NM" >&6; }
if test "$lt_cv_path_NM" != "no"; then
NM="$lt_cv_path_NM"
else
# Didn't find any BSD compatible name lister, look for dumpbin.
if test -n "$DUMPBIN"; then :
# Let the user override the test.
else
if test -n "$ac_tool_prefix"; then
for ac_prog in dumpbin "link -dump"
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_DUMPBIN+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$DUMPBIN"; then
ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
DUMPBIN=$ac_cv_prog_DUMPBIN
if test -n "$DUMPBIN"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
$as_echo "$DUMPBIN" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$DUMPBIN" && break
done
fi
if test -z "$DUMPBIN"; then
ac_ct_DUMPBIN=$DUMPBIN
for ac_prog in dumpbin "link -dump"
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_DUMPBIN"; then
ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
if test -n "$ac_ct_DUMPBIN"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
$as_echo "$ac_ct_DUMPBIN" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_DUMPBIN" && break
done
if test "x$ac_ct_DUMPBIN" = x; then
DUMPBIN=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
DUMPBIN=$ac_ct_DUMPBIN
fi
fi
case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
*COFF*)
DUMPBIN="$DUMPBIN -symbols"
;;
*)
DUMPBIN=:
;;
esac
fi
if test "$DUMPBIN" != ":"; then
NM="$DUMPBIN"
fi
fi
test -z "$NM" && NM=nm
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
$as_echo_n "checking the name lister ($NM) interface... " >&6; }
if ${lt_cv_nm_interface+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
(eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
(eval echo "\"\$as_me:$LINENO: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
fi
rm -f conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
$as_echo "$lt_cv_nm_interface" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
$as_echo_n "checking whether ln -s works... " >&6; }
LN_S=$as_ln_s
if test "$LN_S" = "ln -s"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
$as_echo "no, using $LN_S" >&6; }
fi
# find the maximum length of command line arguments
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
$as_echo_n "checking the maximum length of command line arguments... " >&6; }
if ${lt_cv_sys_max_cmd_len+:} false; then :
$as_echo_n "(cached) " >&6
else
i=0
teststring="ABCD"
case $build_os in
msdosdjgpp*)
# On DJGPP, this test can blow up pretty badly due to problems in libc
# (any single argument exceeding 2000 bytes causes a buffer overrun
# during glob expansion). Even if it were fixed, the result of this
# check would be larger than it should be.
lt_cv_sys_max_cmd_len=12288; # 12K is about right
;;
gnu*)
# Under GNU Hurd, this test is not required because there is
# no limit to the length of command line arguments.
# Libtool will interpret -1 as no limit whatsoever
lt_cv_sys_max_cmd_len=-1;
;;
cygwin* | mingw* | cegcc*)
# On Win9x/ME, this test blows up -- it succeeds, but takes
# about 5 minutes as the teststring grows exponentially.
# Worse, since 9x/ME are not pre-emptively multitasking,
# you end up with a "frozen" computer, even though with patience
# the test eventually succeeds (with a max line length of 256k).
# Instead, let's just punt: use the minimum linelength reported by
# all of the supported platforms: 8192 (on NT/2K/XP).
lt_cv_sys_max_cmd_len=8192;
;;
mint*)
# On MiNT this can take a long time and run out of memory.
lt_cv_sys_max_cmd_len=8192;
;;
amigaos*)
# On AmigaOS with pdksh, this test takes hours, literally.
# So we just punt and use a minimum line length of 8192.
lt_cv_sys_max_cmd_len=8192;
;;
netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
# This has been around since 386BSD, at least. Likely further.
if test -x /sbin/sysctl; then
lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
elif test -x /usr/sbin/sysctl; then
lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
else
lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
fi
# And add a safety zone
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
;;
interix*)
# We know the value 262144 and hardcode it with a safety zone (like BSD)
lt_cv_sys_max_cmd_len=196608
;;
os2*)
# The test takes a long time on OS/2.
lt_cv_sys_max_cmd_len=8192
;;
osf*)
# Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
# due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
# nice to cause kernel panics so lets avoid the loop below.
# First set a reasonable default.
lt_cv_sys_max_cmd_len=16384
#
if test -x /sbin/sysconfig; then
case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
*1*) lt_cv_sys_max_cmd_len=-1 ;;
esac
fi
;;
sco3.2v5*)
lt_cv_sys_max_cmd_len=102400
;;
sysv5* | sco5v6* | sysv4.2uw2*)
kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
if test -n "$kargmax"; then
lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
else
lt_cv_sys_max_cmd_len=32768
fi
;;
*)
lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
if test -n "$lt_cv_sys_max_cmd_len" && \
test undefined != "$lt_cv_sys_max_cmd_len"; then
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
else
# Make teststring a little bigger before we do anything with it.
# a 1K string should be a reasonable start.
for i in 1 2 3 4 5 6 7 8 ; do
teststring=$teststring$teststring
done
SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
# If test is not a shell built-in, we'll probably end up computing a
# maximum length that is only half of the actual maximum length, but
# we can't tell.
while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
= "X$teststring$teststring"; } >/dev/null 2>&1 &&
test $i != 17 # 1/2 MB should be enough
do
i=`expr $i + 1`
teststring=$teststring$teststring
done
# Only check the string length outside the loop.
lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
teststring=
# Add a significant safety factor because C++ compilers can tack on
# massive amounts of additional arguments before passing them to the
# linker. It appears as though 1/2 is a usable value.
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
fi
;;
esac
fi
if test -n $lt_cv_sys_max_cmd_len ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
$as_echo "none" >&6; }
fi
max_cmd_len=$lt_cv_sys_max_cmd_len
: ${CP="cp -f"}
: ${MV="mv -f"}
: ${RM="rm -f"}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
# Try some XSI features
xsi_shell=no
( _lt_dummy="a/b/c"
test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
= c,a/b,b/c, \
&& eval 'test $(( 1 + 1 )) -eq 2 \
&& test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
&& xsi_shell=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
$as_echo "$xsi_shell" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
lt_shell_append=no
( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
>/dev/null 2>&1 \
&& lt_shell_append=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
$as_echo "$lt_shell_append" >&6; }
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
lt_unset=unset
else
lt_unset=false
fi
# test EBCDIC or ASCII
case `echo X|tr X '\101'` in
A) # ASCII based system
# \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
lt_SP2NL='tr \040 \012'
lt_NL2SP='tr \015\012 \040\040'
;;
*) # EBCDIC based system
lt_SP2NL='tr \100 \n'
lt_NL2SP='tr \r\n \100\100'
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
if ${lt_cv_to_host_file_cmd+:} false; then :
$as_echo_n "(cached) " >&6
else
case $host in
*-*-mingw* )
case $build in
*-*-mingw* ) # actually msys
lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
;;
*-*-cygwin* )
lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
;;
* ) # otherwise, assume *nix
lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
;;
esac
;;
*-*-cygwin* )
case $build in
*-*-mingw* ) # actually msys
lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
;;
*-*-cygwin* )
lt_cv_to_host_file_cmd=func_convert_file_noop
;;
* ) # otherwise, assume *nix
lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
;;
esac
;;
* ) # unhandled hosts (and "normal" native builds)
lt_cv_to_host_file_cmd=func_convert_file_noop
;;
esac
fi
to_host_file_cmd=$lt_cv_to_host_file_cmd
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
$as_echo "$lt_cv_to_host_file_cmd" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
if ${lt_cv_to_tool_file_cmd+:} false; then :
$as_echo_n "(cached) " >&6
else
#assume ordinary cross tools, or native build.
lt_cv_to_tool_file_cmd=func_convert_file_noop
case $host in
*-*-mingw* )
case $build in
*-*-mingw* ) # actually msys
lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
;;
esac
;;
esac
fi
to_tool_file_cmd=$lt_cv_to_tool_file_cmd
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
$as_echo_n "checking for $LD option to reload object files... " >&6; }
if ${lt_cv_ld_reload_flag+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_ld_reload_flag='-r'
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
$as_echo "$lt_cv_ld_reload_flag" >&6; }
reload_flag=$lt_cv_ld_reload_flag
case $reload_flag in
"" | " "*) ;;
*) reload_flag=" $reload_flag" ;;
esac
reload_cmds='$LD$reload_flag -o $output$reload_objs'
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
if test "$GCC" != yes; then
reload_cmds=false
fi
;;
darwin*)
if test "$GCC" = yes; then
reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
else
reload_cmds='$LD$reload_flag -o $output$reload_objs'
fi
;;
esac
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
set dummy ${ac_tool_prefix}objdump; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_OBJDUMP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$OBJDUMP"; then
ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
OBJDUMP=$ac_cv_prog_OBJDUMP
if test -n "$OBJDUMP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
$as_echo "$OBJDUMP" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_OBJDUMP"; then
ac_ct_OBJDUMP=$OBJDUMP
# Extract the first word of "objdump", so it can be a program name with args.
set dummy objdump; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_OBJDUMP"; then
ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_OBJDUMP="objdump"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
if test -n "$ac_ct_OBJDUMP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
$as_echo "$ac_ct_OBJDUMP" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_OBJDUMP" = x; then
OBJDUMP="false"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
OBJDUMP=$ac_ct_OBJDUMP
fi
else
OBJDUMP="$ac_cv_prog_OBJDUMP"
fi
test -z "$OBJDUMP" && OBJDUMP=objdump
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
$as_echo_n "checking how to recognize dependent libraries... " >&6; }
if ${lt_cv_deplibs_check_method+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_file_magic_cmd='$MAGIC_CMD'
lt_cv_file_magic_test_file=
lt_cv_deplibs_check_method='unknown'
# Need to set the preceding variable on all platforms that support
# interlibrary dependencies.
# 'none' -- dependencies not supported.
# `unknown' -- same as none, but documents that we really don't know.
# 'pass_all' -- all dependencies passed with no checks.
# 'test_compile' -- check by making test program.
# 'file_magic [[regex]]' -- check by looking for files in library path
# which responds to the $file_magic_cmd with a given extended regex.
# If you have `file' or equivalent on your system and you're not sure
# whether `pass_all' will *always* work, you probably want this one.
case $host_os in
aix[4-9]*)
lt_cv_deplibs_check_method=pass_all
;;
beos*)
lt_cv_deplibs_check_method=pass_all
;;
bsdi[45]*)
lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
lt_cv_file_magic_cmd='/usr/bin/file -L'
lt_cv_file_magic_test_file=/shlib/libc.so
;;
cygwin*)
# func_win32_libid is a shell function defined in ltmain.sh
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
;;
mingw* | pw32*)
# Base MSYS/MinGW do not provide the 'file' command needed by
# func_win32_libid shell function, so use a weaker test based on 'objdump',
# unless we find 'file', for example because we are cross-compiling.
# func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
else
# Keep this pattern in sync with the one in func_win32_libid.
lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
lt_cv_file_magic_cmd='$OBJDUMP -f'
fi
;;
cegcc*)
# use the weaker test based on 'objdump'. See mingw*.
lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
lt_cv_file_magic_cmd='$OBJDUMP -f'
;;
darwin* | rhapsody*)
lt_cv_deplibs_check_method=pass_all
;;
freebsd* | dragonfly*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
case $host_cpu in
i*86 )
# Not sure whether the presence of OpenBSD here was a mistake.
# Let's accept both of them until this is cleared up.
lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
lt_cv_file_magic_cmd=/usr/bin/file
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
;;
esac
else
lt_cv_deplibs_check_method=pass_all
fi
;;
haiku*)
lt_cv_deplibs_check_method=pass_all
;;
hpux10.20* | hpux11*)
lt_cv_file_magic_cmd=/usr/bin/file
case $host_cpu in
ia64*)
lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
;;
hppa*64*)
lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
;;
*)
lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
lt_cv_file_magic_test_file=/usr/lib/libc.sl
;;
esac
;;
interix[3-9]*)
# PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
;;
irix5* | irix6* | nonstopux*)
case $LD in
*-32|*"-32 ") libmagic=32-bit;;
*-n32|*"-n32 ") libmagic=N32;;
*-64|*"-64 ") libmagic=64-bit;;
*) libmagic=never-match;;
esac
lt_cv_deplibs_check_method=pass_all
;;
# This must be glibc/ELF.
linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
lt_cv_deplibs_check_method=pass_all
;;
netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
else
lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
fi
;;
newos6*)
lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
lt_cv_file_magic_cmd=/usr/bin/file
lt_cv_file_magic_test_file=/usr/lib/libnls.so
;;
*nto* | *qnx*)
lt_cv_deplibs_check_method=pass_all
;;
openbsd*)
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
else
lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
fi
;;
osf3* | osf4* | osf5*)
lt_cv_deplibs_check_method=pass_all
;;
rdos*)
lt_cv_deplibs_check_method=pass_all
;;
solaris*)
lt_cv_deplibs_check_method=pass_all
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
lt_cv_deplibs_check_method=pass_all
;;
sysv4 | sysv4.3*)
case $host_vendor in
motorola)
lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
;;
ncr)
lt_cv_deplibs_check_method=pass_all
;;
sequent)
lt_cv_file_magic_cmd='/bin/file'
lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
;;
sni)
lt_cv_file_magic_cmd='/bin/file'
lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
lt_cv_file_magic_test_file=/lib/libc.so
;;
siemens)
lt_cv_deplibs_check_method=pass_all
;;
pc)
lt_cv_deplibs_check_method=pass_all
;;
esac
;;
tpf*)
lt_cv_deplibs_check_method=pass_all
;;
esac
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
$as_echo "$lt_cv_deplibs_check_method" >&6; }
file_magic_glob=
want_nocaseglob=no
if test "$build" = "$host"; then
case $host_os in
mingw* | pw32*)
if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
want_nocaseglob=yes
else
file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
fi
;;
esac
fi
file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
test -z "$deplibs_check_method" && deplibs_check_method=unknown
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
set dummy ${ac_tool_prefix}dlltool; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_DLLTOOL+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$DLLTOOL"; then
ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
DLLTOOL=$ac_cv_prog_DLLTOOL
if test -n "$DLLTOOL"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
$as_echo "$DLLTOOL" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_DLLTOOL"; then
ac_ct_DLLTOOL=$DLLTOOL
# Extract the first word of "dlltool", so it can be a program name with args.
set dummy dlltool; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_DLLTOOL"; then
ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_DLLTOOL="dlltool"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
if test -n "$ac_ct_DLLTOOL"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
$as_echo "$ac_ct_DLLTOOL" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_DLLTOOL" = x; then
DLLTOOL="false"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
DLLTOOL=$ac_ct_DLLTOOL
fi
else
DLLTOOL="$ac_cv_prog_DLLTOOL"
fi
test -z "$DLLTOOL" && DLLTOOL=dlltool
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_sharedlib_from_linklib_cmd='unknown'
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
# two different shell functions defined in ltmain.sh
# decide which to use based on capabilities of $DLLTOOL
case `$DLLTOOL --help 2>&1` in
*--identify-strict*)
lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
;;
*)
lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
;;
esac
;;
*)
# fallback: assume linklib IS sharedlib
lt_cv_sharedlib_from_linklib_cmd="$ECHO"
;;
esac
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
if test -n "$ac_tool_prefix"; then
for ac_prog in ar
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_AR+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AR"; then
ac_cv_prog_AR="$AR" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
AR=$ac_cv_prog_AR
if test -n "$AR"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
$as_echo "$AR" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$AR" && break
done
fi
if test -z "$AR"; then
ac_ct_AR=$AR
for ac_prog in ar
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_AR+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_AR"; then
ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
$as_echo "$ac_ct_AR" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_AR" && break
done
if test "x$ac_ct_AR" = x; then
AR="false"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
AR=$ac_ct_AR
fi
fi
: ${AR=ar}
: ${AR_FLAGS=cru}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
$as_echo_n "checking for archiver @FILE support... " >&6; }
if ${lt_cv_ar_at_file+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_ar_at_file=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
echo conftest.$ac_objext > conftest.lst
lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
(eval $lt_ar_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
if test "$ac_status" -eq 0; then
# Ensure the archiver fails upon bogus file names.
rm -f conftest.$ac_objext libconftest.a
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
(eval $lt_ar_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
if test "$ac_status" -ne 0; then
lt_cv_ar_at_file=@
fi
fi
rm -f conftest.* libconftest.a
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
$as_echo "$lt_cv_ar_at_file" >&6; }
if test "x$lt_cv_ar_at_file" = xno; then
archiver_list_spec=
else
archiver_list_spec=$lt_cv_ar_at_file
fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$STRIP"; then
ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
STRIP=$ac_cv_prog_STRIP
if test -n "$STRIP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
$as_echo "$STRIP" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_STRIP"; then
ac_ct_STRIP=$STRIP
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_STRIP"; then
ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_STRIP="strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
if test -n "$ac_ct_STRIP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
$as_echo "$ac_ct_STRIP" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_STRIP" = x; then
STRIP=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
STRIP=$ac_ct_STRIP
fi
else
STRIP="$ac_cv_prog_STRIP"
fi
test -z "$STRIP" && STRIP=:
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_RANLIB+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
$as_echo "$RANLIB" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_RANLIB"; then
ac_ct_RANLIB=$RANLIB
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_RANLIB"; then
ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
if test -n "$ac_ct_RANLIB"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
$as_echo "$ac_ct_RANLIB" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_RANLIB" = x; then
RANLIB=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
RANLIB=$ac_ct_RANLIB
fi
else
RANLIB="$ac_cv_prog_RANLIB"
fi
test -z "$RANLIB" && RANLIB=:
# Determine commands to create old-style static archives.
old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
old_postinstall_cmds='chmod 644 $oldlib'
old_postuninstall_cmds=
if test -n "$RANLIB"; then
case $host_os in
openbsd*)
old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
;;
*)
old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
;;
esac
old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
fi
case $host_os in
darwin*)
lock_old_archive_extraction=yes ;;
*)
lock_old_archive_extraction=no ;;
esac
for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_AWK+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AWK"; then
ac_cv_prog_AWK="$AWK" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AWK="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
AWK=$ac_cv_prog_AWK
if test -n "$AWK"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
$as_echo "$AWK" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$AWK" && break
done
# If no C compiler was specified, use CC.
LTCC=${LTCC-"$CC"}
# If no C compiler flags were specified, use CFLAGS.
LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
# Allow CC to be a program name with arguments.
compiler=$CC
# Check for command to grab the raw symbol name followed by C symbol from nm.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
if ${lt_cv_sys_global_symbol_pipe+:} false; then :
$as_echo_n "(cached) " >&6
else
# These are sane defaults that work on at least a few old systems.
# [They come from Ultrix. What could be older than Ultrix?!! ;)]
# Character class describing NM global symbol codes.
symcode='[BCDEGRST]'
# Regexp to match symbols that can be accessed directly from C.
sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
# Define system-specific variables.
case $host_os in
aix*)
symcode='[BCDT]'
;;
cygwin* | mingw* | pw32* | cegcc*)
symcode='[ABCDGISTW]'
;;
hpux*)
if test "$host_cpu" = ia64; then
symcode='[ABCDEGRST]'
fi
;;
irix* | nonstopux*)
symcode='[BCDEGRST]'
;;
osf*)
symcode='[BCDEGQRST]'
;;
solaris*)
symcode='[BDRT]'
;;
sco3.2v5*)
symcode='[DT]'
;;
sysv4.2uw2*)
symcode='[DT]'
;;
sysv5* | sco5v6* | unixware* | OpenUNIX*)
symcode='[ABDT]'
;;
sysv4)
symcode='[DFNSTU]'
;;
esac
# If we're using GNU nm, then use its standard symbol codes.
case `$NM -V 2>&1` in
*GNU* | *'with BFD'*)
symcode='[ABCDGIRSTW]' ;;
esac
# Transform an extracted symbol line into a proper C declaration.
# Some systems (esp. on ia64) link data and code symbols differently,
# so use this general approach.
lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
# Transform an extracted symbol line into symbol name and symbol address
lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
# Handle CRLF in mingw tool chain
opt_cr=
case $build_os in
mingw*)
opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
;;
esac
# Try without a prefix underscore, then with it.
for ac_symprfx in "" "_"; do
# Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
symxfrm="\\1 $ac_symprfx\\2 \\2"
# Write the raw and C identifiers.
if test "$lt_cv_nm_interface" = "MS dumpbin"; then
# Fake it for dumpbin and say T for any non-static function
# and D for any global variable.
# Also find C++ and __fastcall symbols from MSVC++,
# which start with @ or ?.
lt_cv_sys_global_symbol_pipe="$AWK '"\
" {last_section=section; section=\$ 3};"\
" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
" \$ 0!~/External *\|/{next};"\
" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
" {if(hide[section]) next};"\
" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
" s[1]~/^[@?]/{print s[1], s[1]; next};"\
" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
" ' prfx=^$ac_symprfx"
else
lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
fi
lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
# Check to see that the pipe works correctly.
pipe_works=no
rm -f conftest*
cat > conftest.$ac_ext <<_LT_EOF
#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
void nm_test_func(void);
void nm_test_func(void){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func();return(0);}
_LT_EOF
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
# Now try to grab the symbols.
nlist=conftest.nm
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
(eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && test -s "$nlist"; then
# Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then
mv -f "$nlist"T "$nlist"
else
rm -f "$nlist"T
fi
# Make sure that we snagged all the symbols we need.
if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
cat <<_LT_EOF > conftest.$ac_ext
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
/* DATA imports from DLLs on WIN32 con't be const, because runtime
relocations are performed -- see ld's documentation on pseudo-relocs. */
# define LT_DLSYM_CONST
#elif defined(__osf__)
/* This system does not cope well with relocations in const data. */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif
#ifdef __cplusplus
extern "C" {
#endif
_LT_EOF
# Now generate the symbol file.
eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
cat <<_LT_EOF >> conftest.$ac_ext
/* The mapping between symbol names and symbols. */
LT_DLSYM_CONST struct {
const char *name;
void *address;
}
lt__PROGRAM__LTX_preloaded_symbols[] =
{
{ "@PROGRAM@", (void *) 0 },
_LT_EOF
$SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
cat <<\_LT_EOF >> conftest.$ac_ext
{0, (void *) 0}
};
/* This works around a problem in FreeBSD linker */
#ifdef FREEBSD_WORKAROUND
static const void *lt_preloaded_setup() {
return lt__PROGRAM__LTX_preloaded_symbols;
}
#endif
#ifdef __cplusplus
}
#endif
_LT_EOF
# Now try linking the two files.
mv conftest.$ac_objext conftstm.$ac_objext
lt_globsym_save_LIBS=$LIBS
lt_globsym_save_CFLAGS=$CFLAGS
LIBS="conftstm.$ac_objext"
CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
(eval $ac_link) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && test -s conftest${ac_exeext}; then
pipe_works=yes
fi
LIBS=$lt_globsym_save_LIBS
CFLAGS=$lt_globsym_save_CFLAGS
else
echo "cannot find nm_test_func in $nlist" >&5
fi
else
echo "cannot find nm_test_var in $nlist" >&5
fi
else
echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
fi
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -rf conftest* conftst*
# Do not use the global_symbol_pipe unless it works.
if test "$pipe_works" = yes; then
break
else
lt_cv_sys_global_symbol_pipe=
fi
done
fi
if test -z "$lt_cv_sys_global_symbol_pipe"; then
lt_cv_sys_global_symbol_to_cdecl=
fi
if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
$as_echo "failed" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
$as_echo "ok" >&6; }
fi
# Response file support.
if test "$lt_cv_nm_interface" = "MS dumpbin"; then
nm_file_list_spec='@'
elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
nm_file_list_spec='@'
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
$as_echo_n "checking for sysroot... " >&6; }
# Check whether --with-sysroot was given.
if test "${with_sysroot+set}" = set; then :
withval=$with_sysroot;
else
with_sysroot=no
fi
lt_sysroot=
case ${with_sysroot} in #(
yes)
if test "$GCC" = yes; then
lt_sysroot=`$CC --print-sysroot 2>/dev/null`
fi
;; #(
/*)
lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
;; #(
no|'')
;; #(
*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
$as_echo "${with_sysroot}" >&6; }
as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
$as_echo "${lt_sysroot:-no}" >&6; }
# Check whether --enable-libtool-lock was given.
if test "${enable_libtool_lock+set}" = set; then :
enableval=$enable_libtool_lock;
fi
test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case $host in
ia64-*-hpux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
case `/usr/bin/file conftest.$ac_objext` in
*ELF-32*)
HPUX_IA64_MODE="32"
;;
*ELF-64*)
HPUX_IA64_MODE="64"
;;
esac
fi
rm -rf conftest*
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line '$LINENO' "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
if test "$lt_cv_prog_gnu_ld" = yes; then
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -melf32bsmip"
;;
*N32*)
LD="${LD-ld} -melf32bmipn32"
;;
*64-bit*)
LD="${LD-ld} -melf64bmip"
;;
esac
else
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
;;
*N32*)
LD="${LD-ld} -n32"
;;
*64-bit*)
LD="${LD-ld} -64"
;;
esac
fi
fi
rm -rf conftest*
;;
x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
case `/usr/bin/file conftest.o` in
*32-bit*)
case $host in
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
x86_64-*linux*)
case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
;;
*)
LD="${LD-ld} -m elf_i386"
;;
esac
;;
powerpc64le-*)
LD="${LD-ld} -m elf32lppclinux"
;;
powerpc64-*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
LD="${LD-ld} -m elf_s390"
;;
sparc64-*linux*)
LD="${LD-ld} -m elf32_sparc"
;;
esac
;;
*64-bit*)
case $host in
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*)
LD="${LD-ld} -m elf64lppc"
;;
powerpc-*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
LD="${LD-ld} -m elf64_s390"
;;
sparc*-*linux*)
LD="${LD-ld} -m elf64_sparc"
;;
esac
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
if ${lt_cv_cc_needs_belf+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
lt_cv_cc_needs_belf=yes
else
lt_cv_cc_needs_belf=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
$as_echo "$lt_cv_cc_needs_belf" >&6; }
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
CFLAGS="$SAVE_CFLAGS"
fi
;;
*-*solaris*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
case `/usr/bin/file conftest.o` in
*64-bit*)
case $lt_cv_prog_gnu_ld in
yes*)
case $host in
i?86-*-solaris*)
LD="${LD-ld} -m elf_x86_64"
;;
sparc*-*-solaris*)
LD="${LD-ld} -m elf64_sparc"
;;
esac
# GNU ld 2.21 introduced _sol2 emulations. Use them if available.
if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
LD="${LD-ld}_sol2"
fi
;;
*)
if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
LD="${LD-ld} -64"
fi
;;
esac
;;
esac
fi
rm -rf conftest*
;;
esac
need_locks="$enable_libtool_lock"
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
set dummy ${ac_tool_prefix}mt; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$MANIFEST_TOOL"; then
ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
if test -n "$MANIFEST_TOOL"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
$as_echo "$MANIFEST_TOOL" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
# Extract the first word of "mt", so it can be a program name with args.
set dummy mt; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_MANIFEST_TOOL"; then
ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
if test -n "$ac_ct_MANIFEST_TOOL"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_MANIFEST_TOOL" = x; then
MANIFEST_TOOL=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
fi
else
MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
fi
test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
if ${lt_cv_path_mainfest_tool+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_path_mainfest_tool=no
echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
$MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
cat conftest.err >&5
if $GREP 'Manifest Tool' conftest.out > /dev/null; then
lt_cv_path_mainfest_tool=yes
fi
rm -f conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
$as_echo "$lt_cv_path_mainfest_tool" >&6; }
if test "x$lt_cv_path_mainfest_tool" != xyes; then
MANIFEST_TOOL=:
fi
case $host_os in
rhapsody* | darwin*)
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_DSYMUTIL+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$DSYMUTIL"; then
ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
DSYMUTIL=$ac_cv_prog_DSYMUTIL
if test -n "$DSYMUTIL"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
$as_echo "$DSYMUTIL" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_DSYMUTIL"; then
ac_ct_DSYMUTIL=$DSYMUTIL
# Extract the first word of "dsymutil", so it can be a program name with args.
set dummy dsymutil; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_DSYMUTIL"; then
ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
if test -n "$ac_ct_DSYMUTIL"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
$as_echo "$ac_ct_DSYMUTIL" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_DSYMUTIL" = x; then
DSYMUTIL=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
DSYMUTIL=$ac_ct_DSYMUTIL
fi
else
DSYMUTIL="$ac_cv_prog_DSYMUTIL"
fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
set dummy ${ac_tool_prefix}nmedit; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_NMEDIT+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$NMEDIT"; then
ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
NMEDIT=$ac_cv_prog_NMEDIT
if test -n "$NMEDIT"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
$as_echo "$NMEDIT" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_NMEDIT"; then
ac_ct_NMEDIT=$NMEDIT
# Extract the first word of "nmedit", so it can be a program name with args.
set dummy nmedit; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_NMEDIT"; then
ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_NMEDIT="nmedit"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
if test -n "$ac_ct_NMEDIT"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
$as_echo "$ac_ct_NMEDIT" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_NMEDIT" = x; then
NMEDIT=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
NMEDIT=$ac_ct_NMEDIT
fi
else
NMEDIT="$ac_cv_prog_NMEDIT"
fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
set dummy ${ac_tool_prefix}lipo; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_LIPO+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$LIPO"; then
ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
LIPO=$ac_cv_prog_LIPO
if test -n "$LIPO"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
$as_echo "$LIPO" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_LIPO"; then
ac_ct_LIPO=$LIPO
# Extract the first word of "lipo", so it can be a program name with args.
set dummy lipo; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_LIPO"; then
ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_LIPO="lipo"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
if test -n "$ac_ct_LIPO"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
$as_echo "$ac_ct_LIPO" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_LIPO" = x; then
LIPO=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
LIPO=$ac_ct_LIPO
fi
else
LIPO="$ac_cv_prog_LIPO"
fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
set dummy ${ac_tool_prefix}otool; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_OTOOL+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$OTOOL"; then
ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
OTOOL=$ac_cv_prog_OTOOL
if test -n "$OTOOL"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
$as_echo "$OTOOL" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_OTOOL"; then
ac_ct_OTOOL=$OTOOL
# Extract the first word of "otool", so it can be a program name with args.
set dummy otool; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_OTOOL"; then
ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_OTOOL="otool"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
if test -n "$ac_ct_OTOOL"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
$as_echo "$ac_ct_OTOOL" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_OTOOL" = x; then
OTOOL=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
OTOOL=$ac_ct_OTOOL
fi
else
OTOOL="$ac_cv_prog_OTOOL"
fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
set dummy ${ac_tool_prefix}otool64; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_OTOOL64+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$OTOOL64"; then
ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
OTOOL64=$ac_cv_prog_OTOOL64
if test -n "$OTOOL64"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
$as_echo "$OTOOL64" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_OTOOL64"; then
ac_ct_OTOOL64=$OTOOL64
# Extract the first word of "otool64", so it can be a program name with args.
set dummy otool64; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_OTOOL64"; then
ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_OTOOL64="otool64"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
if test -n "$ac_ct_OTOOL64"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
$as_echo "$ac_ct_OTOOL64" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_OTOOL64" = x; then
OTOOL64=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
OTOOL64=$ac_ct_OTOOL64
fi
else
OTOOL64="$ac_cv_prog_OTOOL64"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
$as_echo_n "checking for -single_module linker flag... " >&6; }
if ${lt_cv_apple_cc_single_mod+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_apple_cc_single_mod=no
if test -z "${LT_MULTI_MODULE}"; then
# By default we will add the -single_module flag. You can override
# by either setting the environment variable LT_MULTI_MODULE
# non-empty at configure time, or by adding -multi_module to the
# link flags.
rm -rf libconftest.dylib*
echo "int foo(void){return 1;}" > conftest.c
echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-dynamiclib -Wl,-single_module conftest.c" >&5
$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-dynamiclib -Wl,-single_module conftest.c 2>conftest.err
_lt_result=$?
# If there is a non-empty error log, and "single_module"
# appears in it, assume the flag caused a linker warning
if test -s conftest.err && $GREP single_module conftest.err; then
cat conftest.err >&5
# Otherwise, if the output was created with a 0 exit code from
# the compiler, it worked.
elif test -f libconftest.dylib && test $_lt_result -eq 0; then
lt_cv_apple_cc_single_mod=yes
else
cat conftest.err >&5
fi
rm -rf libconftest.dylib*
rm -f conftest.*
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
if ${lt_cv_ld_exported_symbols_list+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_ld_exported_symbols_list=no
save_LDFLAGS=$LDFLAGS
echo "_main" > conftest.sym
LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
lt_cv_ld_exported_symbols_list=yes
else
lt_cv_ld_exported_symbols_list=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS="$save_LDFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
$as_echo_n "checking for -force_load linker flag... " >&6; }
if ${lt_cv_ld_force_load+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_ld_force_load=no
cat > conftest.c << _LT_EOF
int forced_loaded() { return 2;}
_LT_EOF
echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
$LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
echo "$AR cru libconftest.a conftest.o" >&5
$AR cru libconftest.a conftest.o 2>&5
echo "$RANLIB libconftest.a" >&5
$RANLIB libconftest.a 2>&5
cat > conftest.c << _LT_EOF
int main() { return 0;}
_LT_EOF
echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
_lt_result=$?
if test -s conftest.err && $GREP force_load conftest.err; then
cat conftest.err >&5
elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
lt_cv_ld_force_load=yes
else
cat conftest.err >&5
fi
rm -f conftest.err libconftest.a conftest conftest.c
rm -rf conftest.dSYM
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
$as_echo "$lt_cv_ld_force_load" >&6; }
case $host_os in
rhapsody* | darwin1.[012])
_lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
darwin1.*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
darwin*) # darwin 5.x on
# if running on 10.5 or later, the deployment target defaults
# to the OS version, if on x86, and 10.4, the deployment
# target defaults to 10.4. Don't you love it?
case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
10.0,*86*-darwin8*|10.0,*-darwin[91]*)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
10.[012]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
10.*)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
esac
;;
esac
if test "$lt_cv_apple_cc_single_mod" = "yes"; then
_lt_dar_single_mod='$single_module'
fi
if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
_lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
else
_lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
fi
if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
_lt_dsymutil='~$DSYMUTIL $lib || :'
else
_lt_dsymutil=
fi
;;
esac
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
$as_echo_n "checking how to run the C preprocessor... " >&6; }
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
if ${ac_cv_prog_CPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
do
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
else
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
else
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
done
ac_cv_prog_CPP=$CPP
fi
CPP=$ac_cv_prog_CPP
else
ac_cv_prog_CPP=$CPP
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
$as_echo "$CPP" >&6; }
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
else
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
else
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details" "$LINENO" 5; }
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#include
#include
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_header_stdc=yes
else
ac_cv_header_stdc=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "memchr" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "free" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then :
:
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
return 2;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
else
ac_cv_header_stdc=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
$as_echo "$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
$as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
# On IRIX 5.3, sys/types and inttypes.h are conflicting.
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
inttypes.h stdint.h unistd.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_header in dlfcn.h
do :
ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
"
if test "x$ac_cv_header_dlfcn_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_DLFCN_H 1
_ACEOF
fi
done
# Set options
enable_dlopen=no
enable_win32_dll=no
# Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then :
enableval=$enable_shared; p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$lt_save_ifs"
;;
esac
else
enable_shared=yes
fi
# Check whether --enable-static was given.
if test "${enable_static+set}" = set; then :
enableval=$enable_static; p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$lt_save_ifs"
;;
esac
else
enable_static=yes
fi
# Check whether --with-pic was given.
if test "${with_pic+set}" = set; then :
withval=$with_pic; lt_p=${PACKAGE-default}
case $withval in
yes|no) pic_mode=$withval ;;
*)
pic_mode=default
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for lt_pkg in $withval; do
IFS="$lt_save_ifs"
if test "X$lt_pkg" = "X$lt_p"; then
pic_mode=yes
fi
done
IFS="$lt_save_ifs"
;;
esac
else
pic_mode=default
fi
test -z "$pic_mode" && pic_mode=default
# Check whether --enable-fast-install was given.
if test "${enable_fast_install+set}" = set; then :
enableval=$enable_fast_install; p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS="$lt_save_ifs"
;;
esac
else
enable_fast_install=yes
fi
# This can be used to rebuild libtool when needed
LIBTOOL_DEPS="$ltmain"
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
test -z "$LN_S" && LN_S="ln -s"
if test -n "${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
$as_echo_n "checking for objdir... " >&6; }
if ${lt_cv_objdir+:} false; then :
$as_echo_n "(cached) " >&6
else
rm -f .libs 2>/dev/null
mkdir .libs 2>/dev/null
if test -d .libs; then
lt_cv_objdir=.libs
else
# MS-DOS does not allow filenames that begin with a dot.
lt_cv_objdir=_libs
fi
rmdir .libs 2>/dev/null
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
$as_echo "$lt_cv_objdir" >&6; }
objdir=$lt_cv_objdir
cat >>confdefs.h <<_ACEOF
#define LT_OBJDIR "$lt_cv_objdir/"
_ACEOF
case $host_os in
aix3*)
# AIX sometimes has problems with the GCC collect2 program. For some
# reason, if we set the COLLECT_NAMES environment variable, the problems
# vanish in a puff of smoke.
if test "X${COLLECT_NAMES+set}" != Xset; then
COLLECT_NAMES=
export COLLECT_NAMES
fi
;;
esac
# Global variables:
ofile=libtool
can_build_shared=yes
# All known linkers require a `.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
with_gnu_ld="$lt_cv_prog_gnu_ld"
old_CC="$CC"
old_CFLAGS="$CFLAGS"
# Set sane defaults for various variables
test -z "$CC" && CC=cc
test -z "$LTCC" && LTCC=$CC
test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
test -z "$LD" && LD=ld
test -z "$ac_objext" && ac_objext=o
for cc_temp in $compiler""; do
case $cc_temp in
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
\-*) ;;
*) break;;
esac
done
cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
# Only perform the check for file, if the check method requires it
test -z "$MAGIC_CMD" && MAGIC_CMD=file
case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
if ${lt_cv_path_MAGIC_CMD+:} false; then :
$as_echo_n "(cached) " >&6
else
case $MAGIC_CMD in
[\\/*] | ?:[\\/]*)
lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
;;
*)
lt_save_MAGIC_CMD="$MAGIC_CMD"
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
for ac_dir in $ac_dummy; do
IFS="$lt_save_ifs"
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/${ac_tool_prefix}file; then
lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
if test -n "$file_magic_test_file"; then
case $deplibs_check_method in
"file_magic "*)
file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
$EGREP "$file_magic_regex" > /dev/null; then
:
else
cat <<_LT_EOF 1>&2
*** Warning: the command libtool uses to detect shared libraries,
*** $file_magic_cmd, produces output that libtool cannot recognize.
*** The result is that libtool may fail to recognize shared libraries
*** as such. This will affect the creation of libtool libraries that
*** depend on shared libraries, but programs linked with such libtool
*** libraries will work regardless of this problem. Nevertheless, you
*** may want to report the problem to your system manager and/or to
*** bug-libtool@gnu.org
_LT_EOF
fi ;;
esac
fi
break
fi
done
IFS="$lt_save_ifs"
MAGIC_CMD="$lt_save_MAGIC_CMD"
;;
esac
fi
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if test -n "$MAGIC_CMD"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
$as_echo "$MAGIC_CMD" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
$as_echo_n "checking for file... " >&6; }
if ${lt_cv_path_MAGIC_CMD+:} false; then :
$as_echo_n "(cached) " >&6
else
case $MAGIC_CMD in
[\\/*] | ?:[\\/]*)
lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
;;
*)
lt_save_MAGIC_CMD="$MAGIC_CMD"
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
for ac_dir in $ac_dummy; do
IFS="$lt_save_ifs"
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/file; then
lt_cv_path_MAGIC_CMD="$ac_dir/file"
if test -n "$file_magic_test_file"; then
case $deplibs_check_method in
"file_magic "*)
file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
$EGREP "$file_magic_regex" > /dev/null; then
:
else
cat <<_LT_EOF 1>&2
*** Warning: the command libtool uses to detect shared libraries,
*** $file_magic_cmd, produces output that libtool cannot recognize.
*** The result is that libtool may fail to recognize shared libraries
*** as such. This will affect the creation of libtool libraries that
*** depend on shared libraries, but programs linked with such libtool
*** libraries will work regardless of this problem. Nevertheless, you
*** may want to report the problem to your system manager and/or to
*** bug-libtool@gnu.org
_LT_EOF
fi ;;
esac
fi
break
fi
done
IFS="$lt_save_ifs"
MAGIC_CMD="$lt_save_MAGIC_CMD"
;;
esac
fi
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if test -n "$MAGIC_CMD"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
$as_echo "$MAGIC_CMD" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
else
MAGIC_CMD=:
fi
fi
fi
;;
esac
# Use C for the default configuration in the libtool script
lt_save_CC="$CC"
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Source file extension for C test sources.
ac_ext=c
# Object file extension for compiled C test sources.
objext=o
objext=$objext
# Code to be used in simple compile tests
lt_simple_compile_test_code="int some_variable = 0;"
# Code to be used in simple link tests
lt_simple_link_test_code='int main(){return(0);}'
# If no C compiler was specified, use CC.
LTCC=${LTCC-"$CC"}
# If no C compiler flags were specified, use CFLAGS.
LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
# Allow CC to be a program name with arguments.
compiler=$CC
# Save the default compiler, since it gets overwritten when the other
# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
compiler_DEFAULT=$CC
# save warnings/boilerplate of simple test code
ac_outfile=conftest.$ac_objext
echo "$lt_simple_compile_test_code" >conftest.$ac_ext
eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
_lt_compiler_boilerplate=`cat conftest.err`
$RM conftest*
ac_outfile=conftest.$ac_objext
echo "$lt_simple_link_test_code" >conftest.$ac_ext
eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
_lt_linker_boilerplate=`cat conftest.err`
$RM -r conftest*
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
if test -n "$compiler"; then
lt_prog_compiler_no_builtin_flag=
if test "$GCC" = yes; then
case $cc_basename in
nvcc*)
lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
*)
lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_rtti_exceptions=no
ac_outfile=conftest.$ac_objext
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="-fno-rtti -fno-exceptions"
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
# Note that $ac_compile itself does not contain backslashes and begins
# with a dollar sign (not a hyphen), so the echo should work correctly.
# The option is referenced via a variable to avoid confusing sed.
lt_compile=`echo "$ac_compile" | $SED \
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
$ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
lt_cv_prog_compiler_rtti_exceptions=yes
fi
fi
$RM conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
else
:
fi
fi
lt_prog_compiler_wl=
lt_prog_compiler_pic=
lt_prog_compiler_static=
if test "$GCC" = yes; then
lt_prog_compiler_wl='-Wl,'
lt_prog_compiler_static='-static'
case $host_os in
aix*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
lt_prog_compiler_static='-Bstatic'
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
lt_prog_compiler_pic='-fPIC'
;;
m68k)
# FIXME: we need at least 68020 code to build shared libraries, but
# adding the `-m68020' flag to GCC prevents building anything better,
# like `-m68040'.
lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
;;
esac
;;
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
# (--disable-auto-import) libraries
lt_prog_compiler_pic='-DDLL_EXPORT'
;;
darwin* | rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
lt_prog_compiler_pic='-fno-common'
;;
haiku*)
# PIC is the default for Haiku.
# The "-static" flag exists, but is broken.
lt_prog_compiler_static=
;;
hpux*)
# PIC is the default for 64-bit PA HP-UX, but not for 32-bit
# PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
# sets the default TLS model and affects inlining.
case $host_cpu in
hppa*64*)
# +Z the default
;;
*)
lt_prog_compiler_pic='-fPIC'
;;
esac
;;
interix[3-9]*)
# Interix 3.x gcc -fpic/-fPIC options generate broken code.
# Instead, we relocate shared libraries at runtime.
;;
msdosdjgpp*)
# Just because we use GCC doesn't mean we suddenly get shared libraries
# on systems that don't support them.
lt_prog_compiler_can_build_shared=no
enable_shared=no
;;
*nto* | *qnx*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
# it will coredump.
lt_prog_compiler_pic='-fPIC -shared'
;;
sysv4*MP*)
if test -d /usr/nec; then
lt_prog_compiler_pic=-Kconform_pic
fi
;;
*)
lt_prog_compiler_pic='-fPIC'
;;
esac
case $cc_basename in
nvcc*) # Cuda Compiler Driver 2.2
lt_prog_compiler_wl='-Xlinker '
if test -n "$lt_prog_compiler_pic"; then
lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
fi
;;
esac
else
# PORTME Check for flag to pass linker flags through the system compiler.
case $host_os in
aix*)
lt_prog_compiler_wl='-Wl,'
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
lt_prog_compiler_static='-Bstatic'
else
lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
fi
;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
lt_prog_compiler_pic='-DDLL_EXPORT'
;;
hpux9* | hpux10* | hpux11*)
lt_prog_compiler_wl='-Wl,'
# PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
# not for PA HP-UX.
case $host_cpu in
hppa*64*|ia64*)
# +Z the default
;;
*)
lt_prog_compiler_pic='+Z'
;;
esac
# Is there a better lt_prog_compiler_static that works with the bundled CC?
lt_prog_compiler_static='${wl}-a ${wl}archive'
;;
irix5* | irix6* | nonstopux*)
lt_prog_compiler_wl='-Wl,'
# PIC (with -KPIC) is the default.
lt_prog_compiler_static='-non_shared'
;;
linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
case $cc_basename in
# old Intel for x86_64 which still supported -KPIC.
ecc*)
lt_prog_compiler_wl='-Wl,'
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-static'
;;
# icc used to be incompatible with GCC.
# ICC 10 doesn't accept -KPIC any more.
icc* | ifort*)
lt_prog_compiler_wl='-Wl,'
lt_prog_compiler_pic='-fPIC'
lt_prog_compiler_static='-static'
;;
# Lahey Fortran 8.1.
lf95*)
lt_prog_compiler_wl='-Wl,'
lt_prog_compiler_pic='--shared'
lt_prog_compiler_static='--static'
;;
nagfor*)
# NAG Fortran compiler
lt_prog_compiler_wl='-Wl,-Wl,,'
lt_prog_compiler_pic='-PIC'
lt_prog_compiler_static='-Bstatic'
;;
pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
# Portland Group compilers (*not* the Pentium gcc compiler,
# which looks to be a dead project)
lt_prog_compiler_wl='-Wl,'
lt_prog_compiler_pic='-fpic'
lt_prog_compiler_static='-Bstatic'
;;
ccc*)
lt_prog_compiler_wl='-Wl,'
# All Alpha code is PIC.
lt_prog_compiler_static='-non_shared'
;;
xl* | bgxl* | bgf* | mpixl*)
# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
lt_prog_compiler_wl='-Wl,'
lt_prog_compiler_pic='-qpic'
lt_prog_compiler_static='-qstaticlink'
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
# Sun Fortran 8.3 passes all unrecognized flags to the linker
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-Bstatic'
lt_prog_compiler_wl=''
;;
*Sun\ F* | *Sun*Fortran*)
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-Bstatic'
lt_prog_compiler_wl='-Qoption ld '
;;
*Sun\ C*)
# Sun C 5.9
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-Bstatic'
lt_prog_compiler_wl='-Wl,'
;;
*Intel*\ [CF]*Compiler*)
lt_prog_compiler_wl='-Wl,'
lt_prog_compiler_pic='-fPIC'
lt_prog_compiler_static='-static'
;;
*Portland\ Group*)
lt_prog_compiler_wl='-Wl,'
lt_prog_compiler_pic='-fpic'
lt_prog_compiler_static='-Bstatic'
;;
esac
;;
esac
;;
newsos6)
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-Bstatic'
;;
*nto* | *qnx*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
# it will coredump.
lt_prog_compiler_pic='-fPIC -shared'
;;
osf3* | osf4* | osf5*)
lt_prog_compiler_wl='-Wl,'
# All OSF/1 code is PIC.
lt_prog_compiler_static='-non_shared'
;;
rdos*)
lt_prog_compiler_static='-non_shared'
;;
solaris*)
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-Bstatic'
case $cc_basename in
f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
lt_prog_compiler_wl='-Qoption ld ';;
*)
lt_prog_compiler_wl='-Wl,';;
esac
;;
sunos4*)
lt_prog_compiler_wl='-Qoption ld '
lt_prog_compiler_pic='-PIC'
lt_prog_compiler_static='-Bstatic'
;;
sysv4 | sysv4.2uw2* | sysv4.3*)
lt_prog_compiler_wl='-Wl,'
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-Bstatic'
;;
sysv4*MP*)
if test -d /usr/nec ;then
lt_prog_compiler_pic='-Kconform_pic'
lt_prog_compiler_static='-Bstatic'
fi
;;
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
lt_prog_compiler_wl='-Wl,'
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-Bstatic'
;;
unicos*)
lt_prog_compiler_wl='-Wl,'
lt_prog_compiler_can_build_shared=no
;;
uts4*)
lt_prog_compiler_pic='-pic'
lt_prog_compiler_static='-Bstatic'
;;
*)
lt_prog_compiler_can_build_shared=no
;;
esac
fi
case $host_os in
# For platforms which do not support PIC, -DPIC is meaningless:
*djgpp*)
lt_prog_compiler_pic=
;;
*)
lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
if ${lt_cv_prog_compiler_pic+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
$as_echo "$lt_cv_prog_compiler_pic" >&6; }
lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
#
# Check to make sure the PIC flag actually works.
#
if test -n "$lt_prog_compiler_pic"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
if ${lt_cv_prog_compiler_pic_works+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_pic_works=no
ac_outfile=conftest.$ac_objext
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
# Note that $ac_compile itself does not contain backslashes and begins
# with a dollar sign (not a hyphen), so the echo should work correctly.
# The option is referenced via a variable to avoid confusing sed.
lt_compile=`echo "$ac_compile" | $SED \
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
$ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
lt_cv_prog_compiler_pic_works=yes
fi
fi
$RM conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
case $lt_prog_compiler_pic in
"" | " "*) ;;
*) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
esac
else
lt_prog_compiler_pic=
lt_prog_compiler_can_build_shared=no
fi
fi
#
# Check to make sure the static flag actually works.
#
wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
if ${lt_cv_prog_compiler_static_works+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_static_works=no
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
echo "$lt_simple_link_test_code" > conftest.$ac_ext
if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
# The linker can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s conftest.err; then
# Append any errors to the config.log.
cat conftest.err 1>&5
$ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if diff conftest.exp conftest.er2 >/dev/null; then
lt_cv_prog_compiler_static_works=yes
fi
else
lt_cv_prog_compiler_static_works=yes
fi
fi
$RM -r conftest*
LDFLAGS="$save_LDFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
if test x"$lt_cv_prog_compiler_static_works" = xyes; then
:
else
lt_prog_compiler_static=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
if ${lt_cv_prog_compiler_c_o+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_c_o=no
$RM -r conftest 2>/dev/null
mkdir conftest
cd conftest
mkdir out
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="-o out/conftest2.$ac_objext"
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
# Note that $ac_compile itself does not contain backslashes and begins
# with a dollar sign (not a hyphen), so the echo should work correctly.
lt_compile=`echo "$ac_compile" | $SED \
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
$ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
$SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
lt_cv_prog_compiler_c_o=yes
fi
fi
chmod u+w . 2>&5
$RM conftest*
# SGI C++ compiler will create directory out/ii_files/ for
# template instantiation
test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
$RM out/* && rmdir out
cd ..
$RM -r conftest
$RM conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
if ${lt_cv_prog_compiler_c_o+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_c_o=no
$RM -r conftest 2>/dev/null
mkdir conftest
cd conftest
mkdir out
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="-o out/conftest2.$ac_objext"
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
# Note that $ac_compile itself does not contain backslashes and begins
# with a dollar sign (not a hyphen), so the echo should work correctly.
lt_compile=`echo "$ac_compile" | $SED \
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
$ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
$SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
lt_cv_prog_compiler_c_o=yes
fi
fi
chmod u+w . 2>&5
$RM conftest*
# SGI C++ compiler will create directory out/ii_files/ for
# template instantiation
test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
$RM out/* && rmdir out
cd ..
$RM -r conftest
$RM conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
hard_links="nottested"
if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
# do not overwrite the value of need_locks provided by the user
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
$as_echo_n "checking if we can lock with hard links... " >&6; }
hard_links=yes
$RM conftest*
ln conftest.a conftest.b 2>/dev/null && hard_links=no
touch conftest.a
ln conftest.a conftest.b 2>&5 || hard_links=no
ln conftest.a conftest.b 2>/dev/null && hard_links=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
$as_echo "$hard_links" >&6; }
if test "$hard_links" = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
need_locks=warn
fi
else
need_locks=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
runpath_var=
allow_undefined_flag=
always_export_symbols=no
archive_cmds=
archive_expsym_cmds=
compiler_needs_object=no
enable_shared_with_static_runtimes=no
export_dynamic_flag_spec=
export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
hardcode_automatic=no
hardcode_direct=no
hardcode_direct_absolute=no
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_minus_L=no
hardcode_shlibpath_var=unsupported
inherit_rpath=no
link_all_deplibs=unknown
module_cmds=
module_expsym_cmds=
old_archive_from_new_cmds=
old_archive_from_expsyms_cmds=
thread_safe_flag_spec=
whole_archive_flag_spec=
# include_expsyms should be a list of space-separated symbols to be *always*
# included in the symbol list
include_expsyms=
# exclude_expsyms can be an extended regexp of symbols to exclude
# it will be wrapped by ` (' and `)$', so one must not match beginning or
# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
# as well as any symbol that contains `d'.
exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
# platforms (ab)use it in PIC code, but their linkers get confused if
# the symbol is explicitly referenced. Since portable code cannot
# rely on this symbol name, it's probably fine to never include it in
# preloaded symbol tables.
# Exclude shared library initialization/finalization symbols.
extract_expsyms_cmds=
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++)
with_gnu_ld=yes
;;
openbsd*)
with_gnu_ld=no
;;
linux* | k*bsd*-gnu | gnu*)
link_all_deplibs=no
;;
esac
ld_shlibs=yes
# On some targets, GNU ld is compatible enough with the native linker
# that we're better off using the native interface for both.
lt_use_gnu_ld_interface=no
if test "$with_gnu_ld" = yes; then
case $host_os in
aix*)
# The AIX port of GNU ld has always aspired to compatibility
# with the native linker. However, as the warning in the GNU ld
# block says, versions before 2.19.5* couldn't really create working
# shared libraries, regardless of the interface used.
case `$LD -v 2>&1` in
*\ \(GNU\ Binutils\)\ 2.19.5*) ;;
*\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
*\ \(GNU\ Binutils\)\ [3-9]*) ;;
*)
lt_use_gnu_ld_interface=yes
;;
esac
;;
*)
lt_use_gnu_ld_interface=yes
;;
esac
fi
if test "$lt_use_gnu_ld_interface" = yes; then
# If archive_cmds runs LD, not CC, wlarc should be empty
wlarc='${wl}'
# Set some defaults for GNU ld with shared library support. These
# are reset later if shared libraries are not supported. Putting them
# here allows them to be overridden if necessary.
runpath_var=LD_RUN_PATH
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
export_dynamic_flag_spec='${wl}--export-dynamic'
# ancient GNU ld didn't support --whole-archive et. al.
if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
else
whole_archive_flag_spec=
fi
supports_anon_versioning=no
case `$LD -v 2>&1` in
*GNU\ gold*) supports_anon_versioning=yes ;;
*\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
*\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
*\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
*\ 2.11.*) ;; # other 2.11 versions
*) supports_anon_versioning=yes ;;
esac
# See if GNU ld supports shared libraries.
case $host_os in
aix[3-9]*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
cat <<_LT_EOF 1>&2
*** Warning: the GNU linker, at least up to release 2.19, is reported
*** to be unable to reliably create shared libraries on AIX.
*** Therefore, libtool is disabling shared libraries support. If you
*** really care for shared libraries, you may want to install binutils
*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
*** You will then need to restart the configuration process.
_LT_EOF
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds=''
;;
m68k)
archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
esac
;;
beos*)
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
allow_undefined_flag=unsupported
# Joseph Beckenbach says some releases of gcc
# support --undefined. This deserves some investigation. FIXME
archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
else
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32* | cegcc*)
# _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
# as there is no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
export_dynamic_flag_spec='${wl}--export-all-symbols'
allow_undefined_flag=unsupported
always_export_symbols=no
enable_shared_with_static_runtimes=yes
export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
# If the export-symbols file already is a .def file (1st line
# is EXPORTS), use it as is; otherwise, prepend...
archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
cp $export_symbols $output_objdir/$soname.def;
else
echo EXPORTS > $output_objdir/$soname.def;
cat $export_symbols >> $output_objdir/$soname.def;
fi~
$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
else
ld_shlibs=no
fi
;;
haiku*)
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
link_all_deplibs=yes
;;
interix[3-9]*)
hardcode_direct=no
hardcode_shlibpath_var=no
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
export_dynamic_flag_spec='${wl}-E'
# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
# Instead, shared libraries are loaded at an image base (0x10000000 by
# default) and relocated if they conflict, which is a slow very memory
# consuming and fragmenting process. To avoid this, we pick a random,
# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
# time. Moving up from 0x10000000 also allows more sbrk(2) space.
archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
;;
gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
tmp_diet=no
if test "$host_os" = linux-dietlibc; then
case $cc_basename in
diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
esac
fi
if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
&& test "$tmp_diet" = no
then
tmp_addflag=' $pic_flag'
tmp_sharedflag='-shared'
case $cc_basename,$host_cpu in
pgcc*) # Portland Group C compiler
whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_addflag=' $pic_flag'
;;
pgf77* | pgf90* | pgf95* | pgfortran*)
# Portland Group f77 and f90 compilers
whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_addflag=' $pic_flag -Mnomain' ;;
ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
tmp_addflag=' -i_dynamic' ;;
efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
tmp_addflag=' -i_dynamic -nofor_main' ;;
ifc* | ifort*) # Intel Fortran compiler
tmp_addflag=' -nofor_main' ;;
lf95*) # Lahey Fortran 8.1
whole_archive_flag_spec=
tmp_sharedflag='--shared' ;;
xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
tmp_sharedflag='-qmkshrobj'
tmp_addflag= ;;
nvcc*) # Cuda Compiler Driver 2.2
whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
compiler_needs_object=yes
;;
esac
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*) # Sun C 5.9
whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
compiler_needs_object=yes
tmp_sharedflag='-G' ;;
*Sun\ F*) # Sun Fortran 8.3
tmp_sharedflag='-G' ;;
esac
archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
if test "x$supports_anon_versioning" = xyes; then
archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
fi
case $cc_basename in
xlf* | bgf* | bgxlf* | mpixlf*)
# IBM XL Fortran 10.1 on PPC cannot create shared libs itself
whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
if test "x$supports_anon_versioning" = xyes; then
archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
$LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
fi
;;
esac
else
ld_shlibs=no
fi
;;
netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
else
archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
fi
;;
solaris*)
if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
cat <<_LT_EOF 1>&2
*** Warning: The releases 2.8.* of the GNU linker cannot reliably
*** create shared libraries on Solaris systems. Therefore, libtool
*** is disabling shared libraries support. We urge you to upgrade GNU
*** binutils to release 2.9.1 or newer. Another option is to modify
*** your PATH or compiler configuration so that the native linker is
*** used, and then restart.
_LT_EOF
elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
ld_shlibs=no
cat <<_LT_EOF 1>&2
*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
*** reliably create shared libraries on SCO systems. Therefore, libtool
*** is disabling shared libraries support. We urge you to upgrade GNU
*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
*** your PATH or compiler configuration so that the native linker is
*** used, and then restart.
_LT_EOF
;;
*)
# For security reasons, it is highly recommended that you always
# use absolute paths for naming shared libraries, and exclude the
# DT_RUNPATH tag from executables and libraries. But doing so
# requires that you compile everything twice, which is a pain.
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
esac
;;
sunos4*)
archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
wlarc=
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
*)
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = no; then
runpath_var=
hardcode_libdir_flag_spec=
export_dynamic_flag_spec=
whole_archive_flag_spec=
fi
else
# PORTME fill in a description of your system's linker (not GNU ld)
case $host_os in
aix3*)
allow_undefined_flag=unsupported
always_export_symbols=yes
archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix[4-9]*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
exp_sym_flag='-Bexport'
no_entry_flag=""
else
# If we're using GNU nm, then we don't want the "-C" option.
# -C means demangle to AIX nm, but means don't demangle with GNU nm
# Also, AIX nm treats weak defined symbols like other global
# defined symbols, whereas GNU nm marks them as "W".
if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
else
export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
fi
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
;;
esac
exp_sym_flag='-bexport'
no_entry_flag='-bnoentry'
fi
# When large executables or shared objects are built, AIX ld can
# have problems creating the table of contents. If linking a library
# or program results in "error TOC overflow" add -mminimal-toc to
# CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
# enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
archive_cmds=''
hardcode_direct=yes
hardcode_direct_absolute=yes
hardcode_libdir_separator=':'
link_all_deplibs=yes
file_list_spec='${wl}-f,'
if test "$GCC" = yes; then
case $host_os in aix4.[012]|aix4.[012].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" &&
strings "$collect2name" | $GREP resolve_lib_name >/dev/null
then
# We have reworked collect2
:
else
# We have old collect2
hardcode_direct=unsupported
# It fails to find uninstalled libraries when the uninstalled
# path is not listed in the libpath. Setting hardcode_minus_L
# to unsupported forces relinking
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
;;
esac
shared_flag='-shared'
if test "$aix_use_runtimelinking" = yes; then
shared_flag="$shared_flag "'${wl}-G'
fi
link_all_deplibs=no
else
# not using gcc
if test "$host_cpu" = ia64; then
# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
# chokes on -Wl,-G. The following line is correct:
shared_flag='-G'
else
if test "$aix_use_runtimelinking" = yes; then
shared_flag='${wl}-G'
else
shared_flag='${wl}-bM:SRE'
fi
fi
fi
export_dynamic_flag_spec='${wl}-bexpall'
# It seems that -bexpall does not export symbols beginning with
# underscore (_), so it is better to generate a list of symbols to export.
always_export_symbols=yes
if test "$aix_use_runtimelinking" = yes; then
# Warning - without using the other runtime loading flags (-brtl),
# -berok will link without error, but may produce a broken library.
allow_undefined_flag='-berok'
# Determine the default libpath from the value encoded in an
# empty executable.
if test "${lt_cv_aix_libpath+set}" = set; then
aix_libpath=$lt_cv_aix_libpath
else
if ${lt_cv_aix_libpath_+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
lt_aix_libpath_sed='
/Import File Strings/,/^$/ {
/^0/ {
s/^0 *\([^ ]*\) *$/\1/
p
}
}'
lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
# Check for a 64-bit object if we didn't find anything.
if test -z "$lt_cv_aix_libpath_"; then
lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
fi
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test -z "$lt_cv_aix_libpath_"; then
lt_cv_aix_libpath_="/usr/lib:/lib"
fi
fi
aix_libpath=$lt_cv_aix_libpath_
fi
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
allow_undefined_flag="-z nodefs"
archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
else
# Determine the default libpath from the value encoded in an
# empty executable.
if test "${lt_cv_aix_libpath+set}" = set; then
aix_libpath=$lt_cv_aix_libpath
else
if ${lt_cv_aix_libpath_+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
lt_aix_libpath_sed='
/Import File Strings/,/^$/ {
/^0/ {
s/^0 *\([^ ]*\) *$/\1/
p
}
}'
lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
# Check for a 64-bit object if we didn't find anything.
if test -z "$lt_cv_aix_libpath_"; then
lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
fi
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test -z "$lt_cv_aix_libpath_"; then
lt_cv_aix_libpath_="/usr/lib:/lib"
fi
fi
aix_libpath=$lt_cv_aix_libpath_
fi
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
# Warning - without using the other run time loading flags,
# -berok will link without error, but may produce a broken library.
no_undefined_flag=' ${wl}-bernotok'
allow_undefined_flag=' ${wl}-berok'
if test "$with_gnu_ld" = yes; then
# We only use this code for GNU lds that support --whole-archive.
whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
else
# Exported symbols can be pulled into shared objects from archives
whole_archive_flag_spec='$convenience'
fi
archive_cmds_need_lc=yes
# This is similar to how AIX traditionally builds its shared libraries.
archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
fi
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds=''
;;
m68k)
archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
esac
;;
bsdi[45]*)
export_dynamic_flag_spec=-rdynamic
;;
cygwin* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
case $cc_basename in
cl*)
# Native MSVC
hardcode_libdir_flag_spec=' '
allow_undefined_flag=unsupported
always_export_symbols=yes
file_list_spec='@'
# Tell ltmain to make .lib files, not .a files.
libext=lib
# Tell ltmain to make .dll files, not .so files.
shrext_cmds=".dll"
# FIXME: Setting linknames here is a bad hack.
archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
else
sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
fi~
$CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
linknames='
# The linker will not automatically build a static lib if we build a DLL.
# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
enable_shared_with_static_runtimes=yes
exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
# Don't use ranlib
old_postinstall_cmds='chmod 644 $oldlib'
postlink_cmds='lt_outputfile="@OUTPUT@"~
lt_tool_outputfile="@TOOL_OUTPUT@"~
case $lt_outputfile in
*.exe|*.EXE) ;;
*)
lt_outputfile="$lt_outputfile.exe"
lt_tool_outputfile="$lt_tool_outputfile.exe"
;;
esac~
if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
$MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
$RM "$lt_outputfile.manifest";
fi'
;;
*)
# Assume MSVC wrapper
hardcode_libdir_flag_spec=' '
allow_undefined_flag=unsupported
# Tell ltmain to make .lib files, not .a files.
libext=lib
# Tell ltmain to make .dll files, not .so files.
shrext_cmds=".dll"
# FIXME: Setting linknames here is a bad hack.
archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
# The linker will automatically build a .lib file if we build a DLL.
old_archive_from_new_cmds='true'
# FIXME: Should let the user specify the lib program.
old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
enable_shared_with_static_runtimes=yes
;;
esac
;;
darwin* | rhapsody*)
archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
hardcode_shlibpath_var=unsupported
if test "$lt_cv_ld_force_load" = "yes"; then
whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
else
whole_archive_flag_spec=''
fi
link_all_deplibs=yes
allow_undefined_flag="$_lt_dar_allow_undefined"
case $cc_basename in
ifort*) _lt_dar_can_shared=yes ;;
*) _lt_dar_can_shared=$GCC ;;
esac
if test "$_lt_dar_can_shared" = "yes"; then
output_verbose_link_cmd=func_echo_all
archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
else
ld_shlibs=no
fi
;;
dgux*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_shlibpath_var=no
;;
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
# support. Future versions do this automatically, but an explicit c++rt0.o
# does not break anything, and helps significantly (at the cost of a little
# extra space).
freebsd2.2*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
hardcode_shlibpath_var=no
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
freebsd* | dragonfly*)
archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
hpux9*)
if test "$GCC" = yes; then
archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
else
archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
fi
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
export_dynamic_flag_spec='${wl}-E'
;;
hpux10*)
if test "$GCC" = yes && test "$with_gnu_ld" = no; then
archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
else
archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
fi
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
hardcode_direct_absolute=yes
export_dynamic_flag_spec='${wl}-E'
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
fi
;;
hpux11*)
if test "$GCC" = yes && test "$with_gnu_ld" = no; then
case $host_cpu in
hppa*64*)
archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
else
case $host_cpu in
hppa*64*)
archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
# Older versions of the 11.00 compiler do not understand -b yet
# (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
$as_echo_n "checking if $CC understands -b... " >&6; }
if ${lt_cv_prog_compiler__b+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler__b=no
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -b"
echo "$lt_simple_link_test_code" > conftest.$ac_ext
if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
# The linker can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s conftest.err; then
# Append any errors to the config.log.
cat conftest.err 1>&5
$ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if diff conftest.exp conftest.er2 >/dev/null; then
lt_cv_prog_compiler__b=yes
fi
else
lt_cv_prog_compiler__b=yes
fi
fi
$RM -r conftest*
LDFLAGS="$save_LDFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
$as_echo "$lt_cv_prog_compiler__b" >&6; }
if test x"$lt_cv_prog_compiler__b" = xyes; then
archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
else
archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
fi
;;
esac
fi
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
case $host_cpu in
hppa*64*|ia64*)
hardcode_direct=no
hardcode_shlibpath_var=no
;;
*)
hardcode_direct=yes
hardcode_direct_absolute=yes
export_dynamic_flag_spec='${wl}-E'
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
if test "$GCC" = yes; then
archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
# Try to use the -exported_symbol ld option, if it does not
# work, assume that -exports_file does not work either and
# implicitly export all symbols.
# This should be the same for all languages, so no per-tag cache variable.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
if ${lt_cv_irix_exported_symbol+:} false; then :
$as_echo_n "(cached) " >&6
else
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int foo (void) { return 0; }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
lt_cv_irix_exported_symbol=yes
else
lt_cv_irix_exported_symbol=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS="$save_LDFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
$as_echo "$lt_cv_irix_exported_symbol" >&6; }
if test "$lt_cv_irix_exported_symbol" = yes; then
archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
fi
else
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
fi
archive_cmds_need_lc='no'
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
inherit_rpath=yes
link_all_deplibs=yes
;;
netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
fi
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
newsos6)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_shlibpath_var=no
;;
*nto* | *qnx*)
;;
openbsd*)
if test -f /usr/libexec/ld.so; then
hardcode_direct=yes
hardcode_shlibpath_var=no
hardcode_direct_absolute=yes
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
export_dynamic_flag_spec='${wl}-E'
else
case $host_os in
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_libdir_flag_spec='-R$libdir'
;;
*)
archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
fi
else
ld_shlibs=no
fi
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
allow_undefined_flag=unsupported
archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
;;
osf3*)
if test "$GCC" = yes; then
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
else
allow_undefined_flag=' -expect_unresolved \*'
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
fi
archive_cmds_need_lc='no'
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*) # as osf3* with the addition of -msym flag
if test "$GCC" = yes; then
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
allow_undefined_flag=' -expect_unresolved \*'
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
# Both c and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
archive_cmds_need_lc='no'
hardcode_libdir_separator=:
;;
solaris*)
no_undefined_flag=' -z defs'
if test "$GCC" = yes; then
wlarc='${wl}'
archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
else
case `$CC -V 2>&1` in
*"Compilers 5.0"*)
wlarc=''
archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
;;
*)
wlarc='${wl}'
archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
;;
esac
fi
hardcode_libdir_flag_spec='-R$libdir'
hardcode_shlibpath_var=no
case $host_os in
solaris2.[0-5] | solaris2.[0-5].*) ;;
*)
# The compiler driver will combine and reorder linker options,
# but understands `-z linker_flag'. GCC discards it without `$wl',
# but is careful enough not to reorder.
# Supported since Solaris 2.6 (maybe 2.5.1?)
if test "$GCC" = yes; then
whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
else
whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
fi
;;
esac
link_all_deplibs=yes
;;
sunos4*)
if test "x$host_vendor" = xsequent; then
# Use $CC to link under sequent, because it throws in some extra .o
# files that make .init and .fini sections work.
archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
else
archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
fi
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
hardcode_shlibpath_var=no
;;
sysv4)
case $host_vendor in
sni)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes # is this really true???
;;
siemens)
## LD is ld it makes a PLAMLIB
## CC just makes a GrossModule.
archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
reload_cmds='$CC -r -o $output$reload_objs'
hardcode_direct=no
;;
motorola)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
esac
runpath_var='LD_RUN_PATH'
hardcode_shlibpath_var=no
;;
sysv4.3*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_shlibpath_var=no
export_dynamic_flag_spec='-Bexport'
;;
sysv4*MP*)
if test -d /usr/nec; then
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_shlibpath_var=no
runpath_var=LD_RUN_PATH
hardcode_runpath_var=yes
ld_shlibs=yes
fi
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
no_undefined_flag='${wl}-z,text'
archive_cmds_need_lc=no
hardcode_shlibpath_var=no
runpath_var='LD_RUN_PATH'
if test "$GCC" = yes; then
archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
else
archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
sysv5* | sco3.2v5* | sco5v6*)
# Note: We can NOT use -z defs as we might desire, because we do not
# link with -lc, and that would cause any symbols used from libc to
# always be unresolved, which means just about no library would
# ever link correctly. If we're not using GNU ld we use -z text
# though, which does catch some bad symbols but isn't as heavy-handed
# as -z defs.
no_undefined_flag='${wl}-z,text'
allow_undefined_flag='${wl}-z,nodefs'
archive_cmds_need_lc=no
hardcode_shlibpath_var=no
hardcode_libdir_flag_spec='${wl}-R,$libdir'
hardcode_libdir_separator=':'
link_all_deplibs=yes
export_dynamic_flag_spec='${wl}-Bexport'
runpath_var='LD_RUN_PATH'
if test "$GCC" = yes; then
archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
else
archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
uts4*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_shlibpath_var=no
;;
*)
ld_shlibs=no
;;
esac
if test x$host_vendor = xsni; then
case $host in
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
export_dynamic_flag_spec='${wl}-Blargedynsym'
;;
esac
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
$as_echo "$ld_shlibs" >&6; }
test "$ld_shlibs" = no && can_build_shared=no
with_gnu_ld=$with_gnu_ld
#
# Do we need to explicitly link libc?
#
case "x$archive_cmds_need_lc" in
x|xyes)
# Assume -lc should be added
archive_cmds_need_lc=yes
if test "$enable_shared" = yes && test "$GCC" = yes; then
case $archive_cmds in
*'~'*)
# FIXME: we may have to deal with multi-command sequences.
;;
'$CC '*)
# Test whether the compiler implicitly links with -lc since on some
# systems, -lgcc has to come before -lc. If gcc already passes -lc
# to ld, don't add -lc before -lgcc.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
if ${lt_cv_archive_cmds_need_lc+:} false; then :
$as_echo_n "(cached) " >&6
else
$RM conftest*
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } 2>conftest.err; then
soname=conftest
lib=conftest
libobjs=conftest.$ac_objext
deplibs=
wl=$lt_prog_compiler_wl
pic_flag=$lt_prog_compiler_pic
compiler_flags=-v
linker_flags=-v
verstring=
output_objdir=.
libname=conftest
lt_save_allow_undefined_flag=$allow_undefined_flag
allow_undefined_flag=
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
(eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
then
lt_cv_archive_cmds_need_lc=no
else
lt_cv_archive_cmds_need_lc=yes
fi
allow_undefined_flag=$lt_save_allow_undefined_flag
else
cat conftest.err 1>&5
fi
$RM conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
;;
esac
fi
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
$as_echo_n "checking dynamic linker characteristics... " >&6; }
if test "$GCC" = yes; then
case $host_os in
darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
*) lt_awk_arg="/^libraries:/" ;;
esac
case $host_os in
mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
*) lt_sed_strip_eq="s,=/,/,g" ;;
esac
lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
case $lt_search_path_spec in
*\;*)
# if the path contains ";" then we assume it to be the separator
# otherwise default to the standard path separator (i.e. ":") - it is
# assumed that no part of a normal pathname contains ";" but that should
# okay in the real world where ";" in dirpaths is itself problematic.
lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
;;
*)
lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
;;
esac
# Ok, now we have the path, separated by spaces, we can step through it
# and add multilib dir if necessary.
lt_tmp_lt_search_path_spec=
lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
for lt_sys_path in $lt_search_path_spec; do
if test -d "$lt_sys_path/$lt_multi_os_dir"; then
lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
else
test -d "$lt_sys_path" && \
lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
fi
done
lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
BEGIN {RS=" "; FS="/|\n";} {
lt_foo="";
lt_count=0;
for (lt_i = NF; lt_i > 0; lt_i--) {
if ($lt_i != "" && $lt_i != ".") {
if ($lt_i == "..") {
lt_count++;
} else {
if (lt_count == 0) {
lt_foo="/" $lt_i lt_foo;
} else {
lt_count--;
}
}
}
}
if (lt_foo != "") { lt_freq[lt_foo]++; }
if (lt_freq[lt_foo] == 1) { print lt_foo; }
}'`
# AWK program above erroneously prepends '/' to C:/dos/paths
# for these hosts.
case $host_os in
mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
$SED 's,/\([A-Za-z]:\),\1,g'` ;;
esac
sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
else
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
fi
library_names_spec=
libname_spec='lib$name'
soname_spec=
shrext_cmds=".so"
postinstall_cmds=
postuninstall_cmds=
finish_cmds=
finish_eval=
shlibpath_var=
shlibpath_overrides_runpath=unknown
version_type=none
dynamic_linker="$host_os ld.so"
sys_lib_dlsearch_path_spec="/lib /usr/lib"
need_lib_prefix=unknown
hardcode_into_libs=no
# when you set need_version to no, make sure it does not cause -set_version
# flags to be left without arguments
need_version=unknown
case $host_os in
aix3*)
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
shlibpath_var=LIBPATH
# AIX 3 has no versioning support, so we append a major version to the name.
soname_spec='${libname}${release}${shared_ext}$major'
;;
aix[4-9]*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
hardcode_into_libs=yes
if test "$host_cpu" = ia64; then
# AIX 5 supports IA64
library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
else
# With GCC up to 2.95.x, collect2 would create an import file
# for dependence libraries. The import file would start with
# the line `#! .'. This would cause the generated library to
# depend on `.', always an invalid library. This was fixed in
# development snapshots of GCC prior to 3.0.
case $host_os in
aix4 | aix4.[01] | aix4.[01].*)
if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
echo ' yes '
echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
:
else
can_build_shared=no
fi
;;
esac
# AIX (on Power*) has no versioning support, so currently we can not hardcode correct
# soname into executable. Probably we can add versioning support to
# collect2, so additional links can be useful in future.
if test "$aix_use_runtimelinking" = yes; then
# If using run time linking (on AIX 4.2 or later) use lib.so
# instead of lib.a to let people know that these are not
# typical AIX shared libraries.
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
else
# We preserve .a as extension for shared libraries through AIX4.2
# and later when we are not doing run time linking.
library_names_spec='${libname}${release}.a $libname.a'
soname_spec='${libname}${release}${shared_ext}$major'
fi
shlibpath_var=LIBPATH
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# Since July 2007 AmigaOS4 officially supports .so libraries.
# When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
;;
m68k)
library_names_spec='$libname.ixlibrary $libname.a'
# Create ${libname}_ixlibrary.a entries in /sys/libs.
finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
;;
esac
;;
beos*)
library_names_spec='${libname}${shared_ext}'
dynamic_linker="$host_os ld.so"
shlibpath_var=LIBRARY_PATH
;;
bsdi[45]*)
version_type=linux # correct to gnu/linux during the next big refactor
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
# the default ld.so.conf also contains /usr/contrib/lib and
# /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
# libtool to hard-code these into programs
;;
cygwin* | mingw* | pw32* | cegcc*)
version_type=windows
shrext_cmds=".dll"
need_version=no
need_lib_prefix=no
case $GCC,$cc_basename in
yes,*)
# gcc
library_names_spec='$libname.dll.a'
# DLL is installed to $(libdir)/../bin by postinstall_cmds
postinstall_cmds='base_file=`basename \${file}`~
dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
dldir=$destdir/`dirname \$dlpath`~
test -d \$dldir || mkdir -p \$dldir~
$install_prog $dir/$dlname \$dldir/$dlname~
chmod a+x \$dldir/$dlname~
if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
fi'
postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
dlpath=$dir/\$dldll~
$RM \$dlpath'
shlibpath_overrides_runpath=yes
case $host_os in
cygwin*)
# Cygwin DLLs use 'cyg' prefix rather than 'lib'
soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
;;
mingw* | cegcc*)
# MinGW DLLs use traditional 'lib' prefix
soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
;;
pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib'
library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
;;
esac
dynamic_linker='Win32 ld.exe'
;;
*,cl*)
# Native MSVC
libname_spec='$name'
soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
library_names_spec='${libname}.dll.lib'
case $build_os in
mingw*)
sys_lib_search_path_spec=
lt_save_ifs=$IFS
IFS=';'
for lt_path in $LIB
do
IFS=$lt_save_ifs
# Let DOS variable expansion print the short 8.3 style file name.
lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
done
IFS=$lt_save_ifs
# Convert to MSYS style.
sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
;;
cygwin*)
# Convert to unix form, then to dos form, then back to unix form
# but this time dos style (no spaces!) so that the unix form looks
# like /cygdrive/c/PROGRA~1:/cygdr...
sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
;;
*)
sys_lib_search_path_spec="$LIB"
if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
# It is most probably a Windows format PATH.
sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
else
sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
fi
# FIXME: find the short name or the path components, as spaces are
# common. (e.g. "Program Files" -> "PROGRA~1")
;;
esac
# DLL is installed to $(libdir)/../bin by postinstall_cmds
postinstall_cmds='base_file=`basename \${file}`~
dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
dldir=$destdir/`dirname \$dlpath`~
test -d \$dldir || mkdir -p \$dldir~
$install_prog $dir/$dlname \$dldir/$dlname'
postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
dlpath=$dir/\$dldll~
$RM \$dlpath'
shlibpath_overrides_runpath=yes
dynamic_linker='Win32 link.exe'
;;
*)
# Assume MSVC wrapper
library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
dynamic_linker='Win32 ld.exe'
;;
esac
# FIXME: first we should search . and the directory the executable is in
shlibpath_var=PATH
;;
darwin* | rhapsody*)
dynamic_linker="$host_os dyld"
version_type=darwin
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
soname_spec='${libname}${release}${major}$shared_ext'
shlibpath_overrides_runpath=yes
shlibpath_var=DYLD_LIBRARY_PATH
shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
;;
dgux*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
;;
freebsd* | dragonfly*)
# DragonFly does not have aout. When/if they implement a new
# versioning mechanism, adjust this.
if test -x /usr/bin/objformat; then
objformat=`/usr/bin/objformat`
else
case $host_os in
freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
version_type=freebsd-$objformat
case $version_type in
freebsd-elf*)
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
need_version=no
need_lib_prefix=no
;;
freebsd-*)
library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
need_version=yes
;;
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
*) # from 4.6 on, and DragonFly
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
esac
;;
haiku*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
dynamic_linker="$host_os runtime_loader"
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LIBRARY_PATH
shlibpath_overrides_runpath=yes
sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
hardcode_into_libs=yes
;;
hpux9* | hpux10* | hpux11*)
# Give a soname corresponding to the major version so that dld.sl refuses to
# link against other versions.
version_type=sunos
need_lib_prefix=no
need_version=no
case $host_cpu in
ia64*)
shrext_cmds='.so'
hardcode_into_libs=yes
dynamic_linker="$host_os dld.so"
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
if test "X$HPUX_IA64_MODE" = X32; then
sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
else
sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
fi
sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
;;
hppa*64*)
shrext_cmds='.sl'
hardcode_into_libs=yes
dynamic_linker="$host_os dld.sl"
shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
;;
*)
shrext_cmds='.sl'
dynamic_linker="$host_os dld.sl"
shlibpath_var=SHLIB_PATH
shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
;;
esac
# HP-UX runs *really* slowly unless shared libraries are mode 555, ...
postinstall_cmds='chmod 555 $lib'
# or fails outright, so override atomically:
install_override_mode=555
;;
interix[3-9]*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
irix5* | irix6* | nonstopux*)
case $host_os in
nonstopux*) version_type=nonstopux ;;
*)
if test "$lt_cv_prog_gnu_ld" = yes; then
version_type=linux # correct to gnu/linux during the next big refactor
else
version_type=irix
fi ;;
esac
need_lib_prefix=no
need_version=no
soname_spec='${libname}${release}${shared_ext}$major'
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
case $host_os in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in # libtool.m4 will add one of these switches to LD
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
libsuff= shlibsuff= libmagic=32-bit;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
libsuff=32 shlibsuff=N32 libmagic=N32;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
libsuff=64 shlibsuff=64 libmagic=64-bit;;
*) libsuff= shlibsuff= libmagic=never-match;;
esac
;;
esac
shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
shlibpath_overrides_runpath=no
sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
hardcode_into_libs=yes
;;
# No shared lib support for Linux oldld, aout, or coff.
linux*oldld* | linux*aout* | linux*coff*)
dynamic_linker=no
;;
# This must be glibc/ELF.
linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
# Some binutils ld are patched to set DT_RUNPATH
if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
$as_echo_n "(cached) " >&6
else
lt_cv_shlibpath_overrides_runpath=no
save_LDFLAGS=$LDFLAGS
save_libdir=$libdir
eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
lt_cv_shlibpath_overrides_runpath=yes
fi
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$save_LDFLAGS
libdir=$save_libdir
fi
shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
# This implies no fast_install, which is unacceptable.
# Some rework will be needed to allow for fast_install
# before this can be enabled.
hardcode_into_libs=yes
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
# powerpc, because MkLinux only supported shared libraries with the
# GNU dynamic linker. Since this was broken with cross compilers,
# most powerpc-linux boxes support dynamic linking these days and
# people can always --disable-shared, the test was removed, and we
# assume the GNU/Linux dynamic linker is in use.
dynamic_linker='GNU/Linux ld.so'
;;
netbsdelf*-gnu)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
dynamic_linker='NetBSD ld.elf_so'
;;
netbsd*)
version_type=sunos
need_lib_prefix=no
need_version=no
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
dynamic_linker='NetBSD (a.out) ld.so'
else
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
dynamic_linker='NetBSD ld.elf_so'
fi
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
newsos6)
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
;;
*nto* | *qnx*)
version_type=qnx
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
dynamic_linker='ldqnx.so'
;;
openbsd*)
version_type=sunos
sys_lib_dlsearch_path_spec="/usr/lib"
need_lib_prefix=no
# Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
case $host_os in
openbsd3.3 | openbsd3.3.*) need_version=yes ;;
*) need_version=no ;;
esac
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
case $host_os in
openbsd2.[89] | openbsd2.[89].*)
shlibpath_overrides_runpath=no
;;
*)
shlibpath_overrides_runpath=yes
;;
esac
else
shlibpath_overrides_runpath=yes
fi
;;
os2*)
libname_spec='$name'
shrext_cmds=".dll"
need_lib_prefix=no
library_names_spec='$libname${shared_ext} $libname.a'
dynamic_linker='OS/2 ld.exe'
shlibpath_var=LIBPATH
;;
osf3* | osf4* | osf5*)
version_type=osf
need_lib_prefix=no
need_version=no
soname_spec='${libname}${release}${shared_ext}$major'
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
;;
rdos*)
dynamic_linker=no
;;
solaris*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
# ldd complains unless libraries are executable
postinstall_cmds='chmod +x $lib'
;;
sunos4*)
version_type=sunos
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
if test "$with_gnu_ld" = yes; then
need_lib_prefix=no
fi
need_version=yes
;;
sysv4 | sysv4.3*)
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
case $host_vendor in
sni)
shlibpath_overrides_runpath=no
need_lib_prefix=no
runpath_var=LD_RUN_PATH
;;
siemens)
need_lib_prefix=no
;;
motorola)
need_lib_prefix=no
need_version=no
shlibpath_overrides_runpath=no
sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
;;
esac
;;
sysv4*MP*)
if test -d /usr/nec ;then
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
soname_spec='$libname${shared_ext}.$major'
shlibpath_var=LD_LIBRARY_PATH
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
version_type=freebsd-elf
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
if test "$with_gnu_ld" = yes; then
sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
else
sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
case $host_os in
sco3.2v5*)
sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
;;
esac
fi
sys_lib_dlsearch_path_spec='/usr/lib'
;;
tpf*)
# TPF is a cross-target only. Preferred cross-host = GNU/Linux.
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
uts4*)
version_type=linux # correct to gnu/linux during the next big refactor
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
;;
*)
dynamic_linker=no
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
$as_echo "$dynamic_linker" >&6; }
test "$dynamic_linker" = no && can_build_shared=no
variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
if test "$GCC" = yes; then
variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
fi
if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
fi
if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
hardcode_action=
if test -n "$hardcode_libdir_flag_spec" ||
test -n "$runpath_var" ||
test "X$hardcode_automatic" = "Xyes" ; then
# We can hardcode non-existent directories.
if test "$hardcode_direct" != no &&
# If the only mechanism to avoid hardcoding is shlibpath_var, we
# have to relink, otherwise we might link with an installed library
# when we should be linking with a yet-to-be-installed one
## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
test "$hardcode_minus_L" != no; then
# Linking always hardcodes the temporary library directory.
hardcode_action=relink
else
# We can link without hardcoding, and we can hardcode nonexisting dirs.
hardcode_action=immediate
fi
else
# We cannot hardcode anything, or else we can only hardcode existing
# directories.
hardcode_action=unsupported
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
$as_echo "$hardcode_action" >&6; }
if test "$hardcode_action" = relink ||
test "$inherit_rpath" = yes; then
# Fast installation is not supported
enable_fast_install=no
elif test "$shlibpath_overrides_runpath" = yes ||
test "$enable_shared" = no; then
# Fast installation is not necessary
enable_fast_install=needless
fi
if test "x$enable_dlopen" != xyes; then
enable_dlopen=unknown
enable_dlopen_self=unknown
enable_dlopen_self_static=unknown
else
lt_cv_dlopen=no
lt_cv_dlopen_libs=
case $host_os in
beos*)
lt_cv_dlopen="load_add_on"
lt_cv_dlopen_libs=
lt_cv_dlopen_self=yes
;;
mingw* | pw32* | cegcc*)
lt_cv_dlopen="LoadLibrary"
lt_cv_dlopen_libs=
;;
cygwin*)
lt_cv_dlopen="dlopen"
lt_cv_dlopen_libs=
;;
darwin*)
# if libdl is installed we need to link against it
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
$as_echo_n "checking for dlopen in -ldl... " >&6; }
if ${ac_cv_lib_dl_dlopen+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char dlopen ();
int
main ()
{
return dlopen ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_dl_dlopen=yes
else
ac_cv_lib_dl_dlopen=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
lt_cv_dlopen="dyld"
lt_cv_dlopen_libs=
lt_cv_dlopen_self=yes
fi
;;
*)
ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
if test "x$ac_cv_func_shl_load" = xyes; then :
lt_cv_dlopen="shl_load"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
$as_echo_n "checking for shl_load in -ldld... " >&6; }
if ${ac_cv_lib_dld_shl_load+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldld $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char shl_load ();
int
main ()
{
return shl_load ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_dld_shl_load=yes
else
ac_cv_lib_dld_shl_load=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
else
ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
if test "x$ac_cv_func_dlopen" = xyes; then :
lt_cv_dlopen="dlopen"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
$as_echo_n "checking for dlopen in -ldl... " >&6; }
if ${ac_cv_lib_dl_dlopen+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char dlopen ();
int
main ()
{
return dlopen ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_dl_dlopen=yes
else
ac_cv_lib_dl_dlopen=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
$as_echo_n "checking for dlopen in -lsvld... " >&6; }
if ${ac_cv_lib_svld_dlopen+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsvld $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char dlopen ();
int
main ()
{
return dlopen ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_svld_dlopen=yes
else
ac_cv_lib_svld_dlopen=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
$as_echo_n "checking for dld_link in -ldld... " >&6; }
if ${ac_cv_lib_dld_dld_link+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldld $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char dld_link ();
int
main ()
{
return dld_link ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_dld_dld_link=yes
else
ac_cv_lib_dld_dld_link=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
fi
fi
fi
fi
fi
fi
;;
esac
if test "x$lt_cv_dlopen" != xno; then
enable_dlopen=yes
else
enable_dlopen=no
fi
case $lt_cv_dlopen in
dlopen)
save_CPPFLAGS="$CPPFLAGS"
test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
save_LDFLAGS="$LDFLAGS"
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
save_LIBS="$LIBS"
LIBS="$lt_cv_dlopen_libs $LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
$as_echo_n "checking whether a program can dlopen itself... " >&6; }
if ${lt_cv_dlopen_self+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
lt_cv_dlopen_self=cross
else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line $LINENO "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
#include
#endif
#include
#ifdef RTLD_GLOBAL
# define LT_DLGLOBAL RTLD_GLOBAL
#else
# ifdef DL_GLOBAL
# define LT_DLGLOBAL DL_GLOBAL
# else
# define LT_DLGLOBAL 0
# endif
#endif
/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
find out it does not work in some platform. */
#ifndef LT_DLLAZY_OR_NOW
# ifdef RTLD_LAZY
# define LT_DLLAZY_OR_NOW RTLD_LAZY
# else
# ifdef DL_LAZY
# define LT_DLLAZY_OR_NOW DL_LAZY
# else
# ifdef RTLD_NOW
# define LT_DLLAZY_OR_NOW RTLD_NOW
# else
# ifdef DL_NOW
# define LT_DLLAZY_OR_NOW DL_NOW
# else
# define LT_DLLAZY_OR_NOW 0
# endif
# endif
# endif
# endif
#endif
/* When -fvisbility=hidden is used, assume the code has been annotated
correspondingly for the symbols needed. */
#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
int fnord () __attribute__((visibility("default")));
#endif
int fnord () { return 42; }
int main ()
{
void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
int status = $lt_dlunknown;
if (self)
{
if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
else
{
if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
else puts (dlerror ());
}
/* dlclose (self); */
}
else
puts (dlerror ());
return status;
}
_LT_EOF
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
(eval $ac_link) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
(./conftest; exit; ) >&5 2>/dev/null
lt_status=$?
case x$lt_status in
x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
esac
else :
# compilation failed
lt_cv_dlopen_self=no
fi
fi
rm -fr conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
$as_echo "$lt_cv_dlopen_self" >&6; }
if test "x$lt_cv_dlopen_self" = xyes; then
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
if ${lt_cv_dlopen_self_static+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
lt_cv_dlopen_self_static=cross
else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line $LINENO "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
#include
#endif
#include
#ifdef RTLD_GLOBAL
# define LT_DLGLOBAL RTLD_GLOBAL
#else
# ifdef DL_GLOBAL
# define LT_DLGLOBAL DL_GLOBAL
# else
# define LT_DLGLOBAL 0
# endif
#endif
/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
find out it does not work in some platform. */
#ifndef LT_DLLAZY_OR_NOW
# ifdef RTLD_LAZY
# define LT_DLLAZY_OR_NOW RTLD_LAZY
# else
# ifdef DL_LAZY
# define LT_DLLAZY_OR_NOW DL_LAZY
# else
# ifdef RTLD_NOW
# define LT_DLLAZY_OR_NOW RTLD_NOW
# else
# ifdef DL_NOW
# define LT_DLLAZY_OR_NOW DL_NOW
# else
# define LT_DLLAZY_OR_NOW 0
# endif
# endif
# endif
# endif
#endif
/* When -fvisbility=hidden is used, assume the code has been annotated
correspondingly for the symbols needed. */
#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
int fnord () __attribute__((visibility("default")));
#endif
int fnord () { return 42; }
int main ()
{
void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
int status = $lt_dlunknown;
if (self)
{
if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
else
{
if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
else puts (dlerror ());
}
/* dlclose (self); */
}
else
puts (dlerror ());
return status;
}
_LT_EOF
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
(eval $ac_link) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
(./conftest; exit; ) >&5 2>/dev/null
lt_status=$?
case x$lt_status in
x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
esac
else :
# compilation failed
lt_cv_dlopen_self_static=no
fi
fi
rm -fr conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
$as_echo "$lt_cv_dlopen_self_static" >&6; }
fi
CPPFLAGS="$save_CPPFLAGS"
LDFLAGS="$save_LDFLAGS"
LIBS="$save_LIBS"
;;
esac
case $lt_cv_dlopen_self in
yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
*) enable_dlopen_self=unknown ;;
esac
case $lt_cv_dlopen_self_static in
yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
*) enable_dlopen_self_static=unknown ;;
esac
fi
striplib=
old_striplib=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
$as_echo_n "checking whether stripping libraries is possible... " >&6; }
if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
test -z "$striplib" && striplib="$STRIP --strip-unneeded"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
# FIXME - insert some real tests, host_os isn't really good enough
case $host_os in
darwin*)
if test -n "$STRIP" ; then
striplib="$STRIP -x"
old_striplib="$STRIP -S"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
;;
*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
;;
esac
fi
# Report which library types will actually be built
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
$as_echo_n "checking if libtool supports shared libraries... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
$as_echo "$can_build_shared" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
$as_echo_n "checking whether to build shared libraries... " >&6; }
test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
case $host_os in
aix3*)
test "$enable_shared" = yes && enable_static=no
if test -n "$RANLIB"; then
archive_cmds="$archive_cmds~\$RANLIB \$lib"
postinstall_cmds='$RANLIB $lib'
fi
;;
aix[4-9]*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
$as_echo "$enable_shared" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
$as_echo_n "checking whether to build static libraries... " >&6; }
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
$as_echo "$enable_static" >&6; }
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
CC="$lt_save_CC"
ac_config_commands="$ac_config_commands libtool"
# Only expand once:
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=no
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_CC" && break
done
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
fi
fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "no acceptable C compiler found in \$PATH
See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
{ { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
$as_echo "$ac_cv_c_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GCC=yes
else
GCC=
fi
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
if ${ac_cv_prog_cc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
ac_cv_prog_cc_g=no
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
else
CFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
$as_echo "$ac_cv_prog_cc_g" >&6; }
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
as 'x'. The following induces an error, until -std is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
that's true only with -std. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
inside strings and character constants. */
#define FOO(x) 'x'
int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
_ACEOF
for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_c89=$ac_arg
fi
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC
fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
x)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
$as_echo "none needed" >&6; } ;;
xno)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
$as_echo "unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c89"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
esac
if test "x$ac_cv_prog_cc_c89" != xno; then :
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test $cross_compiling = no; then
BUILD_CC="$CC"
else
for ac_prog in gcc cc
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_BUILD_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$BUILD_CC"; then
ac_cv_prog_BUILD_CC="$BUILD_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_BUILD_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
BUILD_CC=$ac_cv_prog_BUILD_CC
if test -n "$BUILD_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_CC" >&5
$as_echo "$BUILD_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$BUILD_CC" && break
done
fi
# Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then :
enableval=$enable_shared;
else
enable_shared=yes
fi
# Check whether --enable-gettext was given.
if test "${enable_gettext+set}" = set; then :
enableval=$enable_gettext;
else
enable_gettext=yes
fi
# Check whether --enable-readline was given.
if test "${enable_readline+set}" = set; then :
enableval=$enable_readline; test $enable_readline = yes && libreadline="-lreadline"
else
enable_readline=no
fi
# Check whether --enable-editline was given.
if test "${enable_editline+set}" = set; then :
enableval=$enable_editline; test $enable_editline = yes && libeditline="-ledit"
else
enable_editline=no
fi
# Check whether --enable-termcap was given.
if test "${enable_termcap+set}" = set; then :
enableval=$enable_termcap; test $enable_termcap = yes && libtermcap="-ltermcap"
fi
# Check whether --enable-lib64 was given.
if test "${enable_lib64+set}" = set; then :
enableval=$enable_lib64;
else
enable_lib64=yes
fi
#
# If the user specified a libdir ending in lib64 do not append another
# 64 to the library names.
#
base_libdir=`basename "$libdir"`
case $base_libdir in
lib64)
enable_lib64=no
esac
#
# Some important tools should be installed into the root partitions.
#
# Check whether exec_prefix=/usr: and install them to /sbin in that
# case. If the user choses a different prefix assume he just wants
# a local install for testing and not a system install.
#
case $exec_prefix:$prefix in
NONE:NONE | NONE:/usr | /usr:*)
root_sbindir='/sbin'
root_libdir="/${base_libdir}"
;;
*)
root_sbindir="${sbindir}"
root_libdir="${libdir}"
;;
esac
# Find localized files. Don't descend into any "dot directories"
# (like .git or .pc from quilt). Strangely, the "-print" argument
# to "find" is required, to avoid including such directories in the
# list.
LOCALIZED_FILES=""
for lfile in `find ${srcdir} -path './.??*' -prune -o -name '*.c' -type f -print || exit 1`; do
LOCALIZED_FILES="$LOCALIZED_FILES \$(TOPDIR)/$lfile"
done
pkg_name="xfsprogs"
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=no
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_CC" && break
done
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
fi
fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "no acceptable C compiler found in \$PATH
See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
{ { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
$as_echo "$ac_cv_c_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GCC=yes
else
GCC=
fi
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
if ${ac_cv_prog_cc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
ac_cv_prog_cc_g=no
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
else
CFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
$as_echo "$ac_cv_prog_cc_g" >&6; }
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
as 'x'. The following induces an error, until -std is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
that's true only with -std. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
inside strings and character constants. */
#define FOO(x) 'x'
int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
_ACEOF
for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_c89=$ac_arg
fi
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC
fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
x)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
$as_echo "none needed" >&6; } ;;
xno)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
$as_echo "unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c89"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
esac
if test "x$ac_cv_prog_cc_c89" != xno; then :
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
. ./VERSION
pkg_version=${PKG_MAJOR}.${PKG_MINOR}.${PKG_REVISION}
pkg_release=$PKG_BUILD
test -z "$BUILD_VERSION" || pkg_release="$BUILD_VERSION"
DEBUG=${DEBUG:-'-DDEBUG'} debug_build="$DEBUG"
OPTIMIZER=${OPTIMIZER:-'-g -O2'}
opt_build="$OPTIMIZER"
MALLOCLIB=${MALLOCLIB:-''} malloc_lib="$MALLOCLIB"
pkg_user=`id -u -n`
test -z "$INSTALL_USER" || pkg_user="$INSTALL_USER"
pkg_group=`id -g -n`
test -z "$INSTALL_GROUP" || pkg_group="$INSTALL_GROUP"
pkg_distribution=`uname -s`
test -z "$DISTRIBUTION" || pkg_distribution="$DISTRIBUTION"
pkg_platform=`uname -s | tr 'A-Z' 'a-z' | tr -d / | sed -e 's/irix64/irix/'`
test -z "$PLATFORM" || pkg_platform="$PLATFORM"
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=no
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $ac_cv_prog_CC
shift
if test $# != 0; then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
$as_echo "$ac_ct_CC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_CC" && break
done
if test "x$ac_ct_CC" = x; then
CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
fi
fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "no acceptable C compiler found in \$PATH
See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
{ { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
$as_echo "$ac_cv_c_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GCC=yes
else
GCC=
fi
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
if ${ac_cv_prog_cc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
ac_cv_prog_cc_g=no
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
else
CFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
$as_echo "$ac_cv_prog_cc_g" >&6; }
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
as 'x'. The following induces an error, until -std is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
that's true only with -std. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
inside strings and character constants. */
#define FOO(x) 'x'
int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
;
return 0;
}
_ACEOF
for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_c89=$ac_arg
fi
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC
fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
x)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
$as_echo "none needed" >&6; } ;;
xno)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
$as_echo "unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c89"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
esac
if test "x$ac_cv_prog_cc_c89" != xno; then :
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
cc="$CC"
if test -z ""$cc""; then
echo
echo FATAL ERROR: cc does not seem to be installed.
echo xfsprogs cannot be built without a working C compiler installation.
exit 1
fi
if test -z "$MAKE"; then
# Extract the first word of "gmake", so it can be a program name with args.
set dummy gmake; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_MAKE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $MAKE in
[\\/]* | ?:[\\/]*)
ac_cv_path_MAKE="$MAKE" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_MAKE="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
MAKE=$ac_cv_path_MAKE
if test -n "$MAKE"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKE" >&5
$as_echo "$MAKE" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$MAKE"; then
# Extract the first word of "make", so it can be a program name with args.
set dummy make; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_MAKE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $MAKE in
[\\/]* | ?:[\\/]*)
ac_cv_path_MAKE="$MAKE" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_MAKE="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
MAKE=$ac_cv_path_MAKE
if test -n "$MAKE"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKE" >&5
$as_echo "$MAKE" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
make=$MAKE
if test -z ""$make""; then
echo
echo FATAL ERROR: make does not seem to be installed.
echo xfsprogs cannot be built without a working GNU make installation.
exit 1
fi
if test -z "$TAR"; then
# Extract the first word of "tar", so it can be a program name with args.
set dummy tar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_TAR+:} false; then :
$as_echo_n "(cached) " >&6
else
case $TAR in
[\\/]* | ?:[\\/]*)
ac_cv_path_TAR="$TAR" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_TAR="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
TAR=$ac_cv_path_TAR
if test -n "$TAR"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5
$as_echo "$TAR" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
tar=$TAR
if test -z "$ZIP"; then
# Extract the first word of "gzip", so it can be a program name with args.
set dummy gzip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ZIP+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ZIP in
[\\/]* | ?:[\\/]*)
ac_cv_path_ZIP="$ZIP" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_ZIP="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
ZIP=$ac_cv_path_ZIP
if test -n "$ZIP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP" >&5
$as_echo "$ZIP" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
zip=$ZIP
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc -MM is supported" >&5
$as_echo_n "checking whether gcc -MM is supported... " >&6; }
if ${ac_cv_gcc_nodeps+:} false; then :
$as_echo_n "(cached) " >&6
else
cat > conftest.c <
int main() { exit(0); }
EOF
ac_cv_gcc_nodeps=no
if ${CC} -MM conftest.c >/dev/null 2>&1; then
ac_cv_gcc_nodeps=yes
fi
rm -f conftest.c a.out
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_nodeps" >&5
$as_echo "$ac_cv_gcc_nodeps" >&6; }
makedepend="$cc -MM"
if test $ac_cv_gcc_nodeps = no; then
makedepend=/bin/true
fi
if test -z "$AWK"; then
# Extract the first word of "awk", so it can be a program name with args.
set dummy awk; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_AWK+:} false; then :
$as_echo_n "(cached) " >&6
else
case $AWK in
[\\/]* | ?:[\\/]*)
ac_cv_path_AWK="$AWK" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_dummy="/bin:/usr/bin"
for as_dir in $as_dummy
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_AWK="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
AWK=$ac_cv_path_AWK
if test -n "$AWK"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
$as_echo "$AWK" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
awk=$AWK
if test -z "$SED"; then
# Extract the first word of "sed", so it can be a program name with args.
set dummy sed; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_SED+:} false; then :
$as_echo_n "(cached) " >&6
else
case $SED in
[\\/]* | ?:[\\/]*)
ac_cv_path_SED="$SED" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_dummy="/bin:/usr/bin"
for as_dir in $as_dummy
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
SED=$ac_cv_path_SED
if test -n "$SED"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5
$as_echo "$SED" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
sed=$SED
if test -z "$ECHO"; then
# Extract the first word of "echo", so it can be a program name with args.
set dummy echo; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ECHO+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ECHO in
[\\/]* | ?:[\\/]*)
ac_cv_path_ECHO="$ECHO" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_dummy="/bin:/usr/bin"
for as_dir in $as_dummy
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_ECHO="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
ECHO=$ac_cv_path_ECHO
if test -n "$ECHO"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ECHO" >&5
$as_echo "$ECHO" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
echo=$ECHO
if test -z "$SORT"; then
# Extract the first word of "sort", so it can be a program name with args.
set dummy sort; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_SORT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $SORT in
[\\/]* | ?:[\\/]*)
ac_cv_path_SORT="$SORT" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_dummy="/bin:/usr/bin"
for as_dir in $as_dummy
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_SORT="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
SORT=$ac_cv_path_SORT
if test -n "$SORT"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SORT" >&5
$as_echo "$SORT" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
sort=$SORT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
$as_echo_n "checking whether ln -s works... " >&6; }
LN_S=$as_ln_s
if test "$LN_S" = "ln -s"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
$as_echo "no, using $LN_S" >&6; }
fi
if test "$enable_gettext" = yes; then
if test -z "$MSGFMT"; then
# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_MSGFMT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $MSGFMT in
[\\/]* | ?:[\\/]*)
ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_MSGFMT="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
MSGFMT=$ac_cv_path_MSGFMT
if test -n "$MSGFMT"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5
$as_echo "$MSGFMT" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
msgfmt=$MSGFMT
if test -z ""$msgfmt""; then
echo
echo FATAL ERROR: msgfmt does not seem to be installed.
echo xfsprogs cannot be built without a working gettext installation.
exit 1
fi
if test -z "$MSGMERGE"; then
# Extract the first word of "msgmerge", so it can be a program name with args.
set dummy msgmerge; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_MSGMERGE+:} false; then :
$as_echo_n "(cached) " >&6
else
case $MSGMERGE in
[\\/]* | ?:[\\/]*)
ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_MSGMERGE="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
MSGMERGE=$ac_cv_path_MSGMERGE
if test -n "$MSGMERGE"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5
$as_echo "$MSGMERGE" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
msgmerge=$MSGMERGE
if test -z ""$msgmerge""; then
echo
echo FATAL ERROR: msgmerge does not seem to be installed.
echo xfsprogs cannot be built without a working gettext installation.
exit 1
fi
if test -z "$XGETTEXT"; then
# Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_XGETTEXT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $XGETTEXT in
[\\/]* | ?:[\\/]*)
ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_XGETTEXT="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
XGETTEXT=$ac_cv_path_XGETTEXT
if test -n "$XGETTEXT"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5
$as_echo "$XGETTEXT" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
xgettext=$XGETTEXT
if test -z ""$xgettext""; then
echo
echo FATAL ERROR: xgettext does not seem to be installed.
echo xfsprogs cannot be built without a working gettext installation.
exit 1
fi
fi
if test -z "$RPM"; then
# Extract the first word of "rpm", so it can be a program name with args.
set dummy rpm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_RPM+:} false; then :
$as_echo_n "(cached) " >&6
else
case $RPM in
[\\/]* | ?:[\\/]*)
ac_cv_path_RPM="$RPM" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_RPM="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
RPM=$ac_cv_path_RPM
if test -n "$RPM"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $RPM" >&5
$as_echo "$RPM" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
rpm=$RPM
rpm_version=0
test -n "$RPM" && test -x "$RPM" && rpm_version=`$RPM --version \
| awk '{print $NF}' | awk -F. '{V=1; print $V}'`
if test $rpm_version -ge 4; then
# Extract the first word of "rpmbuild", so it can be a program name with args.
set dummy rpmbuild; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_RPMBUILD+:} false; then :
$as_echo_n "(cached) " >&6
else
case $RPMBUILD in
[\\/]* | ?:[\\/]*)
ac_cv_path_RPMBUILD="$RPMBUILD" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_RPMBUILD="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
RPMBUILD=$ac_cv_path_RPMBUILD
if test -n "$RPMBUILD"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $RPMBUILD" >&5
$as_echo "$RPMBUILD" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rpmbuild=$RPMBUILD
else
rpmbuild=$RPM
fi
enable_lib64="$enable_lib64"
libdirsuffix=""
searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
if test "$enable_lib64" = "yes" -a -n "$searchpath"; then
save_IFS="${IFS= }"; IFS=":"
for searchdir in $searchpath; do
if test -d "$searchdir"; then
case "$searchdir" in
*/lib64/ | */lib64 ) libdirsuffix=64 ;;
*) searchdir=`cd "$searchdir" && pwd`
case "$searchdir" in
*/lib64 ) libdirsuffix=64 ;;
esac ;;
esac
fi
done
IFS="$save_IFS"
fi
for ac_header in aio.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "aio.h" "ac_cv_header_aio_h" "$ac_includes_default"
if test "x$ac_cv_header_aio_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_AIO_H 1
_ACEOF
fi
done
if test $ac_cv_header_aio_h = no; then
echo
echo 'FATAL ERROR: could not find a valid header.'
exit 1
fi
for ac_func in lio_listio
do :
ac_fn_c_check_func "$LINENO" "lio_listio" "ac_cv_func_lio_listio"
if test "x$ac_cv_func_lio_listio" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIO_LISTIO 1
_ACEOF
fi
done
if test $ac_cv_func_lio_listio = yes; then
librt=""
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lio_listio in -lrt" >&5
$as_echo_n "checking for lio_listio in -lrt... " >&6; }
if ${ac_cv_lib_rt_lio_listio+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lrt -lpthread $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char lio_listio ();
int
main ()
{
return lio_listio ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_rt_lio_listio=yes
else
ac_cv_lib_rt_lio_listio=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_lio_listio" >&5
$as_echo "$ac_cv_lib_rt_lio_listio" >&6; }
if test "x$ac_cv_lib_rt_lio_listio" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBRT 1
_ACEOF
LIBS="-lrt $LIBS"
else
echo
echo 'FATAL ERROR: could not find a library with lio_listio.'
exit 1
fi
librt="-lrt"
fi
for ac_header in uuid.h sys/uuid.h uuid/uuid.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
if test $ac_cv_header_uuid_h = no -a \
$ac_cv_header_sys_uuid_h = no -a \
$ac_cv_header_uuid_uuid_h = no; then
echo
echo 'FATAL ERROR: could not find a valid UUID header.'
echo 'Install the Universally Unique Identifiers development package.'
exit 1
fi
for ac_func in uuid_compare
do :
ac_fn_c_check_func "$LINENO" "uuid_compare" "ac_cv_func_uuid_compare"
if test "x$ac_cv_func_uuid_compare" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UUID_COMPARE 1
_ACEOF
fi
done
if test $ac_cv_func_uuid_compare = yes; then
libuuid=""
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_compare in -luuid" >&5
$as_echo_n "checking for uuid_compare in -luuid... " >&6; }
if ${ac_cv_lib_uuid_uuid_compare+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-luuid $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char uuid_compare ();
int
main ()
{
return uuid_compare ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_uuid_uuid_compare=yes
else
ac_cv_lib_uuid_uuid_compare=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_compare" >&5
$as_echo "$ac_cv_lib_uuid_uuid_compare" >&6; }
if test "x$ac_cv_lib_uuid_uuid_compare" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBUUID 1
_ACEOF
LIBS="-luuid $LIBS"
else
echo
echo 'FATAL ERROR: could not find a valid UUID library.'
echo 'Install the Universally Unique Identifiers library package.'
exit 1
fi
libuuid="-luuid"
fi
for ac_header in pthread.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
if test "x$ac_cv_header_pthread_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PTHREAD_H 1
_ACEOF
fi
done
if test $ac_cv_header_pthread_h = no; then
for ac_header in pthread.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
if test "x$ac_cv_header_pthread_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PTHREAD_H 1
_ACEOF
else
echo
echo 'FATAL ERROR: could not find a valid pthread header.'
exit 1
fi
done
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lpthread" >&5
$as_echo_n "checking for pthread_mutex_init in -lpthread... " >&6; }
if ${ac_cv_lib_pthread_pthread_mutex_init+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpthread $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char pthread_mutex_init ();
int
main ()
{
return pthread_mutex_init ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_pthread_pthread_mutex_init=yes
else
ac_cv_lib_pthread_pthread_mutex_init=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5
$as_echo "$ac_cv_lib_pthread_pthread_mutex_init" >&6; }
if test "x$ac_cv_lib_pthread_pthread_mutex_init" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBPTHREAD 1
_ACEOF
LIBS="-lpthread $LIBS"
else
echo
echo 'FATAL ERROR: could not find a valid pthread library.'
exit 1
fi
libpthread=-lpthread
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fadvise " >&5
$as_echo_n "checking for fadvise ... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
#include
int
main ()
{
posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
have_fadvise=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for madvise " >&5
$as_echo_n "checking for madvise ... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
#include
int
main ()
{
posix_madvise(0, 0, MADV_NORMAL);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
have_madvise=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for mincore " >&5
$as_echo_n "checking for mincore ... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
#include
int
main ()
{
mincore(0, 0, 0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
have_mincore=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sendfile " >&5
$as_echo_n "checking for sendfile ... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
#include
int
main ()
{
sendfile(0, 0, 0, 0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
have_sendfile=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getmntent " >&5
$as_echo_n "checking for getmntent ... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
getmntent(0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
have_getmntent=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getmntinfo " >&5
$as_echo_n "checking for getmntinfo ... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#include
int
main ()
{
getmntinfo(0, 0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
have_getmntinfo=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fallocate" >&5
$as_echo_n "checking for fallocate... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
#include
#include
int
main ()
{
fallocate(0, 0, 0, 0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
have_fallocate=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fiemap" >&5
$as_echo_n "checking for fiemap... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
#include
#include
int
main ()
{
struct fiemap *fiemap;
ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
have_fiemap=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for preadv" >&5
$as_echo_n "checking for preadv... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _FILE_OFFSET_BITS 64
#define _BSD_SOURCE
#include
int
main ()
{
preadv(0, 0, 0, 0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
have_preadv=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sync_file_range" >&5
$as_echo_n "checking for sync_file_range... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
#include
int
main ()
{
sync_file_range(0, 0, 0, 0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
have_sync_file_range=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
for ac_header in mntent.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "mntent.h" "ac_cv_header_mntent_h" "$ac_includes_default"
if test "x$ac_cv_header_mntent_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_MNTENT_H 1
_ACEOF
have_mntent=yes
fi
done
ac_fn_c_check_decl "$LINENO" "fls" "ac_cv_have_decl_fls" "#include
"
if test "x$ac_cv_have_decl_fls" = xyes; then :
have_fls=yes
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing blkid_probe_all" >&5
$as_echo_n "checking for library containing blkid_probe_all... " >&6; }
if ${ac_cv_search_blkid_probe_all+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char blkid_probe_all ();
int
main ()
{
return blkid_probe_all ();
;
return 0;
}
_ACEOF
for ac_lib in '' blkid; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_blkid_probe_all=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_blkid_probe_all+:} false; then :
break
fi
done
if ${ac_cv_search_blkid_probe_all+:} false; then :
else
ac_cv_search_blkid_probe_all=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_blkid_probe_all" >&5
$as_echo "$ac_cv_search_blkid_probe_all" >&6; }
ac_res=$ac_cv_search_blkid_probe_all
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
for ac_func in blkid_probe_get_topology
do :
ac_fn_c_check_func "$LINENO" "blkid_probe_get_topology" "ac_cv_func_blkid_probe_get_topology"
if test "x$ac_cv_func_blkid_probe_get_topology" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_BLKID_PROBE_GET_TOPOLOGY 1
_ACEOF
fi
done
if test $ac_cv_func_blkid_probe_get_topology = yes; then
libblkid="-lblkid"
else
echo
echo 'FATAL ERROR: could not find a valid BLKID header.'
echo 'Install the Block device ID development package.'
exit 1
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for readdir" >&5
$as_echo_n "checking for readdir... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
readdir(0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
have_readdir=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
$as_echo_n "checking size of long... " >&6; }
if ${ac_cv_sizeof_long+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
else
if test "$ac_cv_type_long" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (long)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_long=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
$as_echo "$ac_cv_sizeof_long" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_LONG $ac_cv_sizeof_long
_ACEOF
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char *" >&5
$as_echo_n "checking size of char *... " >&6; }
if ${ac_cv_sizeof_char_p+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char *))" "ac_cv_sizeof_char_p" "$ac_includes_default"; then :
else
if test "$ac_cv_type_char_p" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (char *)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_char_p=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char_p" >&5
$as_echo "$ac_cv_sizeof_char_p" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_CHAR_P $ac_cv_sizeof_char_p
_ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for umode_t" >&5
$as_echo_n "checking for umode_t... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
umode_t umode;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
$as_echo "#define HAVE_UMODE_T 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
have_zipped_manpages=false
for d in ${prefix}/share/man ${prefix}/man ; do
if test -f $d/man1/man.1.gz
then
have_zipped_manpages=true
break
fi
done
ac_config_files="$ac_config_files include/builddefs"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
_ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(
for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
*) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space=' '; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
# `set' does not quote correctly, so add quotes: double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \.
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;; #(
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
) |
sed '
/^ac_cv_env_/b end
t clear
:clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
if test "x$cache_file" != "x/dev/null"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
$as_echo "$as_me: updating cache $cache_file" >&6;}
if test ! -f "$cache_file" || test -h "$cache_file"; then
cat confcache >"$cache_file"
else
case $cache_file in #(
*/* | ?:*)
mv -f confcache "$cache_file"$$ &&
mv -f "$cache_file"$$ "$cache_file" ;; #(
*)
mv -f confcache "$cache_file" ;;
esac
fi
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
# 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
# will be set to the directory where LIBOBJS objects are built.
as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
as_write_fail=0
cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.
debug=false
ac_cs_recheck=false
ac_cs_silent=false
SHELL=\${CONFIG_SHELL-$SHELL}
export SHELL
_ASEOF
cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
&& (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='print -r --'
as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='printf %s\n'
as_echo_n='printf %s'
else
if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
as_echo_n='/usr/ucb/echo -n'
else
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
case $arg in #(
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
esac;
expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
'
export as_echo_n_body
as_echo_n='sh -c $as_echo_n_body as_echo'
fi
export as_echo_body
as_echo='sh -c $as_echo_body as_echo'
fi
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
PATH_SEPARATOR=';'
}
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there. '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
as_status=$1; test $as_status -eq 0 && as_status=1
if test "$4"; then
as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
$as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
$as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else
as_fn_append ()
{
eval $1=\$$1\$2
}
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 6>&1
## ----------------------------------- ##
## Main body of $CONFIG_STATUS script. ##
## ----------------------------------- ##
_ASEOF
test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by xfsprogs $as_me 4.2.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
on `(hostname || uname -n) 2>/dev/null | sed 1q`
"
_ACEOF
case $ac_config_files in *"
"*) set x $ac_config_files; shift; ac_config_files=$*;;
esac
case $ac_config_headers in *"
"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
config_commands="$ac_config_commands"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
ac_cs_usage="\
\`$as_me' instantiates files and other configuration actions
from templates according to the current configuration. Unless the files
and actions are specified as TAGs, all are instantiated by default.
Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
--config print configuration, then exit
-q, --quiet, --silent
do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
Configuration files:
$config_files
Configuration headers:
$config_headers
Configuration commands:
$config_commands
Report bugs to the package provider."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
xfsprogs config.status 4.2.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
ac_pwd='$ac_pwd'
srcdir='$srcdir'
AWK='$AWK'
test -n "\$AWK" || AWK=awk
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# The default lists apply if the user does not specify any file.
ac_need_defaults=:
while test $# != 0
do
case $1 in
--*=?*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
--*=)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=
ac_shift=:
;;
*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
esac
case $ac_option in
# Handling of the options.
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
$as_echo "$ac_cs_version"; exit ;;
--config | --confi | --conf | --con | --co | --c )
$as_echo "$ac_cs_config"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
'') as_fn_error $? "missing file argument" ;;
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
--header | --heade | --head | --hea )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
as_fn_append CONFIG_HEADERS " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
--help | --hel | -h )
$as_echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
-*) as_fn_error $? "unrecognized option: \`$1'
Try \`$0 --help' for more information." ;;
*) as_fn_append ac_config_targets " $1"
ac_need_defaults=false ;;
esac
shift
done
ac_configure_extra_args=
if $ac_cs_silent; then
exec 6>/dev/null
ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
export CONFIG_SHELL
exec "\$@"
fi
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
$as_echo "$ac_log"
} >&5
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
#
# INIT-COMMANDS
#
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
sed_quote_subst='$sed_quote_subst'
double_quote_subst='$double_quote_subst'
delay_variable_subst='$delay_variable_subst'
macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
LTCC='$LTCC'
LTCFLAGS='$LTCFLAGS'
compiler='$compiler_DEFAULT'
# A function that is used when there is no print builtin or printf.
func_fallback_echo ()
{
eval 'cat <<_LTECHO_EOF
\$1
_LTECHO_EOF'
}
# Quote evaled strings.
for var in SHELL \
ECHO \
PATH_SEPARATOR \
SED \
GREP \
EGREP \
FGREP \
LD \
NM \
LN_S \
lt_SP2NL \
lt_NL2SP \
reload_flag \
OBJDUMP \
deplibs_check_method \
file_magic_cmd \
file_magic_glob \
want_nocaseglob \
DLLTOOL \
sharedlib_from_linklib_cmd \
AR \
AR_FLAGS \
archiver_list_spec \
STRIP \
RANLIB \
CC \
CFLAGS \
compiler \
lt_cv_sys_global_symbol_pipe \
lt_cv_sys_global_symbol_to_cdecl \
lt_cv_sys_global_symbol_to_c_name_address \
lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
nm_file_list_spec \
lt_prog_compiler_no_builtin_flag \
lt_prog_compiler_pic \
lt_prog_compiler_wl \
lt_prog_compiler_static \
lt_cv_prog_compiler_c_o \
need_locks \
MANIFEST_TOOL \
DSYMUTIL \
NMEDIT \
LIPO \
OTOOL \
OTOOL64 \
shrext_cmds \
export_dynamic_flag_spec \
whole_archive_flag_spec \
compiler_needs_object \
with_gnu_ld \
allow_undefined_flag \
no_undefined_flag \
hardcode_libdir_flag_spec \
hardcode_libdir_separator \
exclude_expsyms \
include_expsyms \
file_list_spec \
variables_saved_for_relink \
libname_spec \
library_names_spec \
soname_spec \
install_override_mode \
finish_eval \
old_striplib \
striplib; do
case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
*[\\\\\\\`\\"\\\$]*)
eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
;;
*)
eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
;;
esac
done
# Double-quote double-evaled strings.
for var in reload_cmds \
old_postinstall_cmds \
old_postuninstall_cmds \
old_archive_cmds \
extract_expsyms_cmds \
old_archive_from_new_cmds \
old_archive_from_expsyms_cmds \
archive_cmds \
archive_expsym_cmds \
module_cmds \
module_expsym_cmds \
export_symbols_cmds \
prelink_cmds \
postlink_cmds \
postinstall_cmds \
postuninstall_cmds \
finish_cmds \
sys_lib_search_path_spec \
sys_lib_dlsearch_path_spec; do
case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
*[\\\\\\\`\\"\\\$]*)
eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
;;
*)
eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
;;
esac
done
ac_aux_dir='$ac_aux_dir'
xsi_shell='$xsi_shell'
lt_shell_append='$lt_shell_append'
# See if we are running on zsh, and set the options which allow our
# commands through without removal of \ escapes INIT.
if test -n "\${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
fi
PACKAGE='$PACKAGE'
VERSION='$VERSION'
TIMESTAMP='$TIMESTAMP'
RM='$RM'
ofile='$ofile'
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Handling of arguments.
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"include/platform_defs.h") CONFIG_HEADERS="$CONFIG_HEADERS include/platform_defs.h" ;;
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"include/builddefs") CONFIG_FILES="$CONFIG_FILES include/builddefs" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
fi
# Have a temporary directory for convenience. Make it in the build tree
# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Hook for its removal unless debugging.
# Note that there is a small window in which the directory will not be cleaned:
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
tmp= ac_tmp=
trap 'exit_status=$?
: "${ac_tmp:=$tmp}"
{ test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
trap 'as_fn_exit 1' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
ac_tmp=$tmp
# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
# This happens for instance with `./config.status config.h'.
if test -n "$CONFIG_FILES"; then
ac_cr=`echo X | tr X '\015'`
# On cygwin, bash can eat \r inside `` if the user requested igncr.
# But we know of no other shell where ac_cr would be empty at this
# point, so we can use a bashism as a fallback.
if test "x$ac_cr" = x; then
eval ac_cr=\$\'\\r\'
fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
ac_cs_awk_cr='\\r'
else
ac_cs_awk_cr=$ac_cr
fi
echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF
{
echo "cat >conf$$subs.awk <<_ACEOF" &&
echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
echo "_ACEOF"
} >conf$$subs.sh ||
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
. ./conf$$subs.sh ||
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
if test $ac_delim_n = $ac_delim_num; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
rm -f conf$$subs.sh
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
_ACEOF
sed -n '
h
s/^/S["/; s/!.*/"]=/
p
g
s/^[^!]*!//
:repl
t repl
s/'"$ac_delim"'$//
t delim
:nl
h
s/\(.\{148\}\)..*/\1/
t more1
s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
p
n
b repl
:more1
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t nl
:delim
h
s/\(.\{148\}\)..*/\1/
t more2
s/["\\]/\\&/g; s/^/"/; s/$/"/
p
b
:more2
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t delim
' >$CONFIG_STATUS || ac_write_fail=1
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
}
{
line = $ 0
nfields = split(line, field, "@")
substed = 0
len = length(field[1])
for (i = 2; i < nfields; i++) {
key = field[i]
keylen = length(key)
if (S_is_set[key]) {
value = S[key]
line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
len += length(value) + length(field[++i])
substed = 1
} else
len += 1 + keylen
}
print line
}
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
cat
fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
|| as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
h
s///
s/^/:/
s/[ ]*$/:/
s/:\$(srcdir):/:/g
s/:\${srcdir}:/:/g
s/:@srcdir@:/:/g
s/^:*//
s/:*$//
x
s/\(=[ ]*\).*/\1/
G
s/\n//
s/^[^=]*=[ ]*$//
}'
fi
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"
# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF
# Transform confdefs.h into an awk script `defines.awk', embedded as
# here-document in config.status, that substitutes the proper values into
# config.h.in to produce config.h.
# Create a delimiter string that does not exist in confdefs.h, to ease
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
if test -z "$ac_tt"; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
# For the awk script, D is an array of macro values keyed by name,
# likewise P contains macro parameters if any. Preserve backslash
# newline sequences.
ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
sed -n '
s/.\{148\}/&'"$ac_delim"'/g
t rset
:rset
s/^[ ]*#[ ]*define[ ][ ]*/ /
t def
d
:def
s/\\$//
t bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3"/p
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
d
:bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3\\\\\\n"\\/p
t cont
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
t cont
d
:cont
n
s/.\{148\}/&'"$ac_delim"'/g
t clear
:clear
s/\\$//
t bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/"/p
d
:bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
b cont
' >$CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
for (key in D) D_is_set[key] = 1
FS = ""
}
/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
line = \$ 0
split(line, arg, " ")
if (arg[1] == "#") {
defundef = arg[2]
mac1 = arg[3]
} else {
defundef = substr(arg[1], 2)
mac1 = arg[2]
}
split(mac1, mac2, "(") #)
macro = mac2[1]
prefix = substr(line, 1, index(line, defundef) - 1)
if (D_is_set[macro]) {
# Preserve the white space surrounding the "#".
print prefix "define", macro P[macro] D[macro]
next
} else {
# Replace #undef with comments. This is necessary, for example,
# in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
if (defundef == "undef") {
print "/*", prefix defundef, macro, "*/"
next
}
}
}
{ print }
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
fi # test -n "$CONFIG_HEADERS"
eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
shift
for ac_tag
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
:L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
ac_save_IFS=$IFS
IFS=:
set x $ac_tag
IFS=$ac_save_IFS
shift
ac_file=$1
shift
case $ac_mode in
:L) ac_source=$1;;
:[FH])
ac_file_inputs=
for ac_f
do
case $ac_f in
-) ac_f="$ac_tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
test -f "$ac_f" ||
case $ac_f in
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
esac
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
as_fn_append ac_file_inputs " '$ac_f'"
done
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
configure_input='Generated from '`
$as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
`' by configure.'
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
$as_echo "$as_me: creating $ac_file" >&6;}
fi
# Neutralize special characters interpreted by sed in replacement strings.
case $configure_input in #(
*\&* | *\|* | *\\* )
ac_sed_conf_input=`$as_echo "$configure_input" |
sed 's/[\\\\&|]/\\\\&/g'`;; #(
*) ac_sed_conf_input=$configure_input;;
esac
case $ac_tag in
*:-:* | *:-) cat >"$ac_tmp/stdin" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
as_dir="$ac_dir"; as_fn_mkdir_p
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
case $ac_mode in
:F)
#
# CONFIG_FILE
#
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
ac_sed_dataroot='
/datarootdir/ {
p
q
}
/@datadir@/p
/@docdir@/p
/@infodir@/p
/@localedir@/p
/@mandir@/p'
case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_datarootdir_hack='
s&@datadir@&$datadir&g
s&@docdir@&$docdir&g
s&@infodir@&$infodir&g
s&@localedir@&$localedir&g
s&@mandir@&$mandir&g
s&\\\${datarootdir}&$datarootdir&g' ;;
esac
_ACEOF
# Neutralize VPATH when `$srcdir' = `.'.
# Shell code in configure.ac might set extrasub.
# FIXME: do we really want to maintain this feature?
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_sed_extra="$ac_vpsub
$extrasub
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s|@configure_input@|$ac_sed_conf_input|;t t
s&@top_builddir@&$ac_top_builddir_sub&;t t
s&@top_build_prefix@&$ac_top_build_prefix&;t t
s&@srcdir@&$ac_srcdir&;t t
s&@abs_srcdir@&$ac_abs_srcdir&;t t
s&@top_srcdir@&$ac_top_srcdir&;t t
s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
s&@builddir@&$ac_builddir&;t t
s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
$ac_datarootdir_hack
"
eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
>$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
{ ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
{ ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
"$ac_tmp/out"`; test -z "$ac_out"; } &&
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&5
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&2;}
rm -f "$ac_tmp/stdin"
case $ac_file in
-) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
*) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
esac \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
:H)
#
# CONFIG_HEADER
#
if test x"$ac_file" != x-; then
{
$as_echo "/* $configure_input */" \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
} >"$ac_tmp/config.h" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
$as_echo "$as_me: $ac_file is unchanged" >&6;}
else
rm -f "$ac_file"
mv "$ac_tmp/config.h" "$ac_file" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
$as_echo "/* $configure_input */" \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
|| as_fn_error $? "could not create -" "$LINENO" 5
fi
;;
:C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
$as_echo "$as_me: executing $ac_file commands" >&6;}
;;
esac
case $ac_file$ac_mode in
"libtool":C)
# See if we are running on zsh, and set the options which allow our
# commands through without removal of \ escapes.
if test -n "${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
fi
cfgfile="${ofile}T"
trap "$RM \"$cfgfile\"; exit 1" 1 2 15
$RM "$cfgfile"
cat <<_LT_EOF >> "$cfgfile"
#! $SHELL
# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
#
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# Written by Gordon Matzigkeit, 1996
#
# This file is part of GNU Libtool.
#
# GNU Libtool is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# As a special exception to the GNU General Public License,
# if you distribute this file as part of a program or library that
# is built using GNU Libtool, you may include this file under the
# same distribution terms that you use for the rest of that program.
#
# GNU Libtool is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Libtool; see the file COPYING. If not, a copy
# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
# obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# The names of the tagged configurations supported by this script.
available_tags=""
# ### BEGIN LIBTOOL CONFIG
# Which release of libtool.m4 was used?
macro_version=$macro_version
macro_revision=$macro_revision
# Whether or not to build shared libraries.
build_libtool_libs=$enable_shared
# Whether or not to build static libraries.
build_old_libs=$enable_static
# What type of objects to build.
pic_mode=$pic_mode
# Whether or not to optimize for fast installation.
fast_install=$enable_fast_install
# Shell to use when invoking shell scripts.
SHELL=$lt_SHELL
# An echo program that protects backslashes.
ECHO=$lt_ECHO
# The PATH separator for the build system.
PATH_SEPARATOR=$lt_PATH_SEPARATOR
# The host system.
host_alias=$host_alias
host=$host
host_os=$host_os
# The build system.
build_alias=$build_alias
build=$build
build_os=$build_os
# A sed program that does not truncate output.
SED=$lt_SED
# Sed that helps us avoid accidentally triggering echo(1) options like -n.
Xsed="\$SED -e 1s/^X//"
# A grep program that handles long lines.
GREP=$lt_GREP
# An ERE matcher.
EGREP=$lt_EGREP
# A literal string matcher.
FGREP=$lt_FGREP
# A BSD- or MS-compatible name lister.
NM=$lt_NM
# Whether we need soft or hard links.
LN_S=$lt_LN_S
# What is the maximum length of a command?
max_cmd_len=$max_cmd_len
# Object file suffix (normally "o").
objext=$ac_objext
# Executable file suffix (normally "").
exeext=$exeext
# whether the shell understands "unset".
lt_unset=$lt_unset
# turn spaces into newlines.
SP2NL=$lt_lt_SP2NL
# turn newlines into spaces.
NL2SP=$lt_lt_NL2SP
# convert \$build file names to \$host format.
to_host_file_cmd=$lt_cv_to_host_file_cmd
# convert \$build files to toolchain format.
to_tool_file_cmd=$lt_cv_to_tool_file_cmd
# An object symbol dumper.
OBJDUMP=$lt_OBJDUMP
# Method to check whether dependent libraries are shared objects.
deplibs_check_method=$lt_deplibs_check_method
# Command to use when deplibs_check_method = "file_magic".
file_magic_cmd=$lt_file_magic_cmd
# How to find potential files when deplibs_check_method = "file_magic".
file_magic_glob=$lt_file_magic_glob
# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
want_nocaseglob=$lt_want_nocaseglob
# DLL creation program.
DLLTOOL=$lt_DLLTOOL
# Command to associate shared and link libraries.
sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
# The archiver.
AR=$lt_AR
# Flags to create an archive.
AR_FLAGS=$lt_AR_FLAGS
# How to feed a file listing to the archiver.
archiver_list_spec=$lt_archiver_list_spec
# A symbol stripping program.
STRIP=$lt_STRIP
# Commands used to install an old-style archive.
RANLIB=$lt_RANLIB
old_postinstall_cmds=$lt_old_postinstall_cmds
old_postuninstall_cmds=$lt_old_postuninstall_cmds
# Whether to use a lock for old archive extraction.
lock_old_archive_extraction=$lock_old_archive_extraction
# A C compiler.
LTCC=$lt_CC
# LTCC compiler flags.
LTCFLAGS=$lt_CFLAGS
# Take the output of nm and produce a listing of raw symbols and C names.
global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
# Transform the output of nm in a proper C declaration.
global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
# Transform the output of nm in a C name address pair.
global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
# Transform the output of nm in a C name address pair when lib prefix is needed.
global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
# Specify filename containing input files for \$NM.
nm_file_list_spec=$lt_nm_file_list_spec
# The root where to search for dependent libraries,and in which our libraries should be installed.
lt_sysroot=$lt_sysroot
# The name of the directory that contains temporary libtool files.
objdir=$objdir
# Used to examine libraries when file_magic_cmd begins with "file".
MAGIC_CMD=$MAGIC_CMD
# Must we lock files when doing compilation?
need_locks=$lt_need_locks
# Manifest tool.
MANIFEST_TOOL=$lt_MANIFEST_TOOL
# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
DSYMUTIL=$lt_DSYMUTIL
# Tool to change global to local symbols on Mac OS X.
NMEDIT=$lt_NMEDIT
# Tool to manipulate fat objects and archives on Mac OS X.
LIPO=$lt_LIPO
# ldd/readelf like tool for Mach-O binaries on Mac OS X.
OTOOL=$lt_OTOOL
# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
OTOOL64=$lt_OTOOL64
# Old archive suffix (normally "a").
libext=$libext
# Shared library suffix (normally ".so").
shrext_cmds=$lt_shrext_cmds
# The commands to extract the exported symbol list from a shared archive.
extract_expsyms_cmds=$lt_extract_expsyms_cmds
# Variables whose values should be saved in libtool wrapper scripts and
# restored at link time.
variables_saved_for_relink=$lt_variables_saved_for_relink
# Do we need the "lib" prefix for modules?
need_lib_prefix=$need_lib_prefix
# Do we need a version for libraries?
need_version=$need_version
# Library versioning type.
version_type=$version_type
# Shared library runtime path variable.
runpath_var=$runpath_var
# Shared library path variable.
shlibpath_var=$shlibpath_var
# Is shlibpath searched before the hard-coded library search path?
shlibpath_overrides_runpath=$shlibpath_overrides_runpath
# Format of library name prefix.
libname_spec=$lt_libname_spec
# List of archive names. First name is the real one, the rest are links.
# The last name is the one that the linker finds with -lNAME
library_names_spec=$lt_library_names_spec
# The coded name of the library, if different from the real name.
soname_spec=$lt_soname_spec
# Permission mode override for installation of shared libraries.
install_override_mode=$lt_install_override_mode
# Command to use after installation of a shared archive.
postinstall_cmds=$lt_postinstall_cmds
# Command to use after uninstallation of a shared archive.
postuninstall_cmds=$lt_postuninstall_cmds
# Commands used to finish a libtool library installation in a directory.
finish_cmds=$lt_finish_cmds
# As "finish_cmds", except a single script fragment to be evaled but
# not shown.
finish_eval=$lt_finish_eval
# Whether we should hardcode library paths into libraries.
hardcode_into_libs=$hardcode_into_libs
# Compile-time system search path for libraries.
sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
# Run-time system search path for libraries.
sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
# Whether dlopen is supported.
dlopen_support=$enable_dlopen
# Whether dlopen of programs is supported.
dlopen_self=$enable_dlopen_self
# Whether dlopen of statically linked programs is supported.
dlopen_self_static=$enable_dlopen_self_static
# Commands to strip libraries.
old_striplib=$lt_old_striplib
striplib=$lt_striplib
# The linker used to build libraries.
LD=$lt_LD
# How to create reloadable object files.
reload_flag=$lt_reload_flag
reload_cmds=$lt_reload_cmds
# Commands used to build an old-style archive.
old_archive_cmds=$lt_old_archive_cmds
# A language specific compiler.
CC=$lt_compiler
# Is the compiler the GNU compiler?
with_gcc=$GCC
# Compiler flag to turn off builtin functions.
no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
# Additional compiler flags for building library objects.
pic_flag=$lt_lt_prog_compiler_pic
# How to pass a linker flag through the compiler.
wl=$lt_lt_prog_compiler_wl
# Compiler flag to prevent dynamic linking.
link_static_flag=$lt_lt_prog_compiler_static
# Does compiler simultaneously support -c and -o options?
compiler_c_o=$lt_lt_cv_prog_compiler_c_o
# Whether or not to add -lc for building shared libraries.
build_libtool_need_lc=$archive_cmds_need_lc
# Whether or not to disallow shared libs when runtime libs are static.
allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
# Compiler flag to allow reflexive dlopens.
export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
# Compiler flag to generate shared objects directly from archives.
whole_archive_flag_spec=$lt_whole_archive_flag_spec
# Whether the compiler copes with passing no objects directly.
compiler_needs_object=$lt_compiler_needs_object
# Create an old-style archive from a shared archive.
old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
# Create a temporary old-style archive to link instead of a shared archive.
old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
# Commands used to build a shared archive.
archive_cmds=$lt_archive_cmds
archive_expsym_cmds=$lt_archive_expsym_cmds
# Commands used to build a loadable module if different from building
# a shared archive.
module_cmds=$lt_module_cmds
module_expsym_cmds=$lt_module_expsym_cmds
# Whether we are building with GNU ld or not.
with_gnu_ld=$lt_with_gnu_ld
# Flag that allows shared libraries with undefined symbols to be built.
allow_undefined_flag=$lt_allow_undefined_flag
# Flag that enforces no undefined symbols.
no_undefined_flag=$lt_no_undefined_flag
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist
hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
# Whether we need a single "-rpath" flag with a separated argument.
hardcode_libdir_separator=$lt_hardcode_libdir_separator
# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
# DIR into the resulting binary.
hardcode_direct=$hardcode_direct
# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
# DIR into the resulting binary and the resulting library dependency is
# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
# library is relocated.
hardcode_direct_absolute=$hardcode_direct_absolute
# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
# into the resulting binary.
hardcode_minus_L=$hardcode_minus_L
# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
# into the resulting binary.
hardcode_shlibpath_var=$hardcode_shlibpath_var
# Set to "yes" if building a shared library automatically hardcodes DIR
# into the library and all subsequent libraries and executables linked
# against it.
hardcode_automatic=$hardcode_automatic
# Set to yes if linker adds runtime paths of dependent libraries
# to runtime path list.
inherit_rpath=$inherit_rpath
# Whether libtool must link a program against all its dependency libraries.
link_all_deplibs=$link_all_deplibs
# Set to "yes" if exported symbols are required.
always_export_symbols=$always_export_symbols
# The commands to list exported symbols.
export_symbols_cmds=$lt_export_symbols_cmds
# Symbols that should not be listed in the preloaded symbols.
exclude_expsyms=$lt_exclude_expsyms
# Symbols that must always be exported.
include_expsyms=$lt_include_expsyms
# Commands necessary for linking programs (against libraries) with templates.
prelink_cmds=$lt_prelink_cmds
# Commands necessary for finishing linking programs.
postlink_cmds=$lt_postlink_cmds
# Specify filename containing input files.
file_list_spec=$lt_file_list_spec
# How to hardcode a shared library path into an executable.
hardcode_action=$hardcode_action
# ### END LIBTOOL CONFIG
_LT_EOF
case $host_os in
aix3*)
cat <<\_LT_EOF >> "$cfgfile"
# AIX sometimes has problems with the GCC collect2 program. For some
# reason, if we set the COLLECT_NAMES environment variable, the problems
# vanish in a puff of smoke.
if test "X${COLLECT_NAMES+set}" != Xset; then
COLLECT_NAMES=
export COLLECT_NAMES
fi
_LT_EOF
;;
esac
ltmain="$ac_aux_dir/ltmain.sh"
# We use sed instead of cat because bash on DJGPP gets confused if
# if finds mixed CR/LF and LF-only lines. Since sed operates in
# text mode, it properly converts lines to CR/LF. This bash problem
# is reportedly fixed, but why not run on old versions too?
sed '$q' "$ltmain" >> "$cfgfile" \
|| (rm -f "$cfgfile"; exit 1)
if test x"$xsi_shell" = xyes; then
sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
func_dirname ()\
{\
\ case ${1} in\
\ */*) func_dirname_result="${1%/*}${2}" ;;\
\ * ) func_dirname_result="${3}" ;;\
\ esac\
} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
sed -e '/^func_basename ()$/,/^} # func_basename /c\
func_basename ()\
{\
\ func_basename_result="${1##*/}"\
} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
func_dirname_and_basename ()\
{\
\ case ${1} in\
\ */*) func_dirname_result="${1%/*}${2}" ;;\
\ * ) func_dirname_result="${3}" ;;\
\ esac\
\ func_basename_result="${1##*/}"\
} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
func_stripname ()\
{\
\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
\ # positional parameters, so assign one to ordinary parameter first.\
\ func_stripname_result=${3}\
\ func_stripname_result=${func_stripname_result#"${1}"}\
\ func_stripname_result=${func_stripname_result%"${2}"}\
} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
func_split_long_opt ()\
{\
\ func_split_long_opt_name=${1%%=*}\
\ func_split_long_opt_arg=${1#*=}\
} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
func_split_short_opt ()\
{\
\ func_split_short_opt_arg=${1#??}\
\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
func_lo2o ()\
{\
\ case ${1} in\
\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
\ *) func_lo2o_result=${1} ;;\
\ esac\
} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
sed -e '/^func_xform ()$/,/^} # func_xform /c\
func_xform ()\
{\
func_xform_result=${1%.*}.lo\
} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
sed -e '/^func_arith ()$/,/^} # func_arith /c\
func_arith ()\
{\
func_arith_result=$(( $* ))\
} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
sed -e '/^func_len ()$/,/^} # func_len /c\
func_len ()\
{\
func_len_result=${#1}\
} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
fi
if test x"$lt_shell_append" = xyes; then
sed -e '/^func_append ()$/,/^} # func_append /c\
func_append ()\
{\
eval "${1}+=\\${2}"\
} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
func_append_quoted ()\
{\
\ func_quote_for_eval "${2}"\
\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
# Save a `func_append' function call where possible by direct use of '+='
sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
else
# Save a `func_append' function call even when '+=' is not available
sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
&& mv -f "$cfgfile.tmp" "$cfgfile" \
|| (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
test 0 -eq $? || _lt_function_replace_fail=:
fi
if test x"$_lt_function_replace_fail" = x":"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
fi
mv -f "$cfgfile" "$ofile" ||
(rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
chmod +x "$ofile"
;;
esac
done # for ac_tag
as_fn_exit 0
_ACEOF
ac_clean_files=$ac_clean_files_save
test $ac_write_fail = 0 ||
as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
# Unfortunately, on DOS this fails, as config.log is still kept open
# by configure, so config.status won't be able to write to it; its
# output is simply discarded. So we exec the FD to /dev/null,
# effectively closing config.log, so it can be properly (re)opened and
# appended to by config.status. When coming back to configure, we
# need to make the FD available again.
if test "$no_create" != yes; then
ac_cs_success=:
ac_config_status_args=
test "$silent" = yes &&
ac_config_status_args="$ac_config_status_args --quiet"
exec 5>/dev/null
$SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
$ac_cs_success || as_fn_exit 1
fi
if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
xfsprogs-4.3.0+nmu1ubuntu1.1/configure.ac 0000664 0000000 0000000 00000006413 12625713771 015125 0 ustar AC_INIT([xfsprogs], [4.3.0])
AC_PREREQ(2.50)
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([include/libxfs.h])
AC_CONFIG_HEADER(include/platform_defs.h)
AC_PREFIX_DEFAULT(/usr)
AC_PROG_LIBTOOL
AC_PROG_CC
if test $cross_compiling = no; then
BUILD_CC="$CC"
AC_SUBST(BUILD_CC)
else
AC_CHECK_PROGS(BUILD_CC, gcc cc)
fi
AC_ARG_ENABLE(shared,
[ --enable-shared=[yes/no] Enable use of shared libraries [default=yes]],,
enable_shared=yes)
AC_SUBST(enable_shared)
AC_ARG_ENABLE(gettext,
[ --enable-gettext=[yes/no] Enable alternate language support [default=yes]],,
enable_gettext=yes)
AC_SUBST(enable_gettext)
AC_ARG_ENABLE(blkid,
[ --enable-blkid=[yes/no] Enable use of block device id library [default=yes]],,
enable_blkid=yes)
AC_SUBST(enable_blkid)
AC_ARG_ENABLE(readline,
[ --enable-readline=[yes/no] Enable readline command editing [default=no]],
test $enable_readline = yes && libreadline="-lreadline",
enable_readline=no)
AC_SUBST(libreadline)
AC_SUBST(enable_readline)
AC_ARG_ENABLE(editline,
[ --enable-editline=[yes/no] Enable editline command editing [default=no]],
test $enable_editline = yes && libeditline="-ledit",
enable_editline=no)
AC_SUBST(libeditline)
AC_SUBST(enable_editline)
AC_ARG_ENABLE(termcap,
[ --enable-termcap=[yes/no] Enable terminal capabilities library [default=no]],
test $enable_termcap = yes && libtermcap="-ltermcap",)
AC_SUBST(libtermcap)
AC_ARG_ENABLE(lib64,
[ --enable-lib64=[yes/no] Enable lib64 support [default=yes]],,
enable_lib64=yes)
AC_SUBST(enable_lib64)
#
# If the user specified a libdir ending in lib64 do not append another
# 64 to the library names.
#
base_libdir=`basename "$libdir"`
case $base_libdir in
lib64)
enable_lib64=no
esac
#
# Some important tools should be installed into the root partitions.
#
# Check whether exec_prefix=/usr: and install them to /sbin in that
# case. If the user choses a different prefix assume he just wants
# a local install for testing and not a system install.
#
case $exec_prefix:$prefix in
NONE:NONE | NONE:/usr | /usr:*)
root_sbindir='/sbin'
root_libdir="/${base_libdir}"
;;
*)
root_sbindir="${sbindir}"
root_libdir="${libdir}"
;;
esac
AC_SUBST([root_sbindir])
AC_SUBST([root_libdir])
# Find localized files. Don't descend into any "dot directories"
# (like .git or .pc from quilt). Strangely, the "-print" argument
# to "find" is required, to avoid including such directories in the
# list.
LOCALIZED_FILES=""
for lfile in `find ${srcdir} -path './.??*' -prune -o -name '*.c' -type f -print || exit 1`; do
LOCALIZED_FILES="$LOCALIZED_FILES \$(TOPDIR)/$lfile"
done
AC_SUBST(LOCALIZED_FILES)
AC_PACKAGE_GLOBALS(xfsprogs)
AC_PACKAGE_UTILITIES(xfsprogs)
AC_MULTILIB($enable_lib64)
AC_PACKAGE_NEED_AIO_H
AC_PACKAGE_NEED_LIO_LISTIO
AC_PACKAGE_NEED_UUID_H
AC_PACKAGE_NEED_UUIDCOMPARE
AC_PACKAGE_NEED_PTHREAD_H
AC_PACKAGE_NEED_PTHREADMUTEXINIT
AC_HAVE_FADVISE
AC_HAVE_MADVISE
AC_HAVE_MINCORE
AC_HAVE_SENDFILE
AC_HAVE_GETMNTENT
AC_HAVE_GETMNTINFO
AC_HAVE_FALLOCATE
AC_HAVE_FIEMAP
AC_HAVE_PREADV
AC_HAVE_SYNC_FILE_RANGE
AC_HAVE_MNTENT
AC_HAVE_FLS
AC_HAVE_READDIR
AC_HAVE_FSETXATTR
AC_HAVE_MREMAP
if test "$enable_blkid" = yes; then
AC_HAVE_BLKID_TOPO
fi
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([char *])
AC_TYPE_UMODE_T
AC_MANUAL_FORMAT
AC_CONFIG_FILES([include/builddefs])
AC_OUTPUT
xfsprogs-4.3.0+nmu1ubuntu1.1/copy/ 0000775 0000000 0000000 00000000000 13153553735 013604 5 ustar xfsprogs-4.3.0+nmu1ubuntu1.1/copy/Makefile 0000664 0000000 0000000 00000000775 12625713771 015256 0 ustar #
# Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
#
TOPDIR = ..
include $(TOPDIR)/include/builddefs
LTCOMMAND = xfs_copy
CFILES = xfs_copy.c
HFILES = xfs_copy.h
LLDLIBS = $(LIBXFS) $(LIBXLOG) $(LIBUUID) $(LIBPTHREAD) $(LIBRT)
LTDEPENDENCIES = $(LIBXFS) $(LIBXLOG)
LLDFLAGS = -static-libtool-libs
default: depend $(LTCOMMAND)
include $(BUILDRULES)
install: default
$(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
$(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
install-dev:
-include .dep
xfsprogs-4.3.0+nmu1ubuntu1.1/copy/xfs_copy.c 0000664 0000000 0000000 00000100701 13153553735 015601 0 ustar /*
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include
#include
#include
#include
#include
#include "xfs_copy.h"
#include "libxlog.h"
#define rounddown(x, y) (((x)/(y))*(y))
#define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0)
extern int platform_check_ismounted(char *, char *, struct stat64 *, int);
int logfd;
char *logfile_name;
FILE *logerr;
char LOGFILE_NAME[] = "/var/tmp/xfs_copy.log.XXXXXX";
char *source_name;
int source_fd;
unsigned int source_blocksize; /* source filesystem blocksize */
unsigned int source_sectorsize; /* source disk sectorsize */
xfs_agblock_t first_agbno;
__uint64_t barcount[11];
unsigned int num_targets;
target_control *target;
wbuf w_buf;
wbuf btree_buf;
pid_t parent_pid;
unsigned int kids;
thread_control glob_masks;
thread_args *targ;
pthread_mutex_t mainwait;
#define ACTIVE 1
#define INACTIVE 2
xfs_off_t write_log_trailer(int fd, wbuf *w, xfs_mount_t *mp);
xfs_off_t write_log_header(int fd, wbuf *w, xfs_mount_t *mp);
static int format_logs(struct xfs_mount *);
/* general purpose message reporting routine */
#define OUT 0x01 /* use stdout stream */
#define ERR 0x02 /* use stderr stream */
#define LOG 0x04 /* use logerr stream */
#define PRE 0x08 /* append strerror string */
#define LAST 0x10 /* final message we print */
void
do_message(int flags, int code, const char *fmt, ...)
{
va_list ap;
int eek = 0;
if (flags & LOG) {
va_start(ap, fmt);
if (vfprintf(logerr, fmt, ap) <= 0)
eek = 1;
va_end(ap);
}
if (eek)
flags |= ERR; /* failed, force stderr */
if (flags & ERR) {
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
} else if (flags & OUT) {
va_start(ap, fmt);
vfprintf(stdout, fmt, ap);
va_end(ap);
}
if (flags & PRE) {
do_message(flags & ~PRE, 0, ": %s\n", strerror(code));
if (flags & LAST)
fprintf(stderr,
_("Check logfile \"%s\" for more details\n"),
logfile_name);
}
/* logfile is broken, force a write to stderr */
if (eek) {
fprintf(stderr, _("%s: could not write to logfile \"%s\".\n"),
progname, logfile_name);
fprintf(stderr,
_("Aborting XFS copy -- logfile error -- reason: %s\n"),
strerror(errno));
pthread_exit(NULL);
}
}
#define do_out(args...) do_message(OUT|LOG, 0, ## args)
#define do_log(args...) do_message(ERR|LOG, 0, ## args)
#define do_warn(args...) do_message(LOG, 0, ## args)
#define do_error(e,s) do_message(ERR|LOG|PRE, e, s)
#define do_fatal(e,s) do_message(ERR|LOG|PRE|LAST, e, s)
#define do_vfatal(e,s,args...) do_message(ERR|LOG|PRE|LAST, e, s, ## args)
#define die_perror() \
do { \
do_message(ERR|LOG|PRE|LAST, errno, \
_("Aborting XFS copy - reason")); \
exit(1); \
} while (0)
/* workaround craziness in the xlog routines */
int xlog_recover_do_trans(struct xlog *log, struct xlog_recover *t, int p)
{
return 0;
}
void
check_errors(void)
{
int i, first_error = 0;
for (i = 0; i < num_targets; i++) {
if (target[i].state == INACTIVE) {
if (first_error == 0) {
first_error++;
do_log(
_("THE FOLLOWING COPIES FAILED TO COMPLETE\n"));
}
do_log(" %s -- ", target[i].name);
if (target[i].err_type == 0)
do_log(_("write error"));
else
do_log(_("lseek64 error"));
do_log(_(" at offset %lld\n"), target[i].position);
}
}
if (first_error == 0) {
fprintf(stdout, _("All copies completed.\n"));
fflush(NULL);
} else {
fprintf(stderr, _("See \"%s\" for more details.\n"),
logfile_name);
exit(1);
}
}
/*
* don't have to worry about alignment and mins because those
* are taken care of when the buffer's read in
*/
int
do_write(
thread_args *args,
wbuf *buf)
{
int res;
int error = 0;
if (!buf)
buf = &w_buf;
if (target[args->id].position != buf->position) {
if (lseek64(args->fd, buf->position, SEEK_SET) < 0) {
error = target[args->id].err_type = 1;
} else {
target[args->id].position = buf->position;
}
}
if ((res = write(target[args->id].fd, buf->data,
buf->length)) == buf->length) {
target[args->id].position += res;
} else {
error = 2;
}
if (error) {
target[args->id].error = errno;
target[args->id].position = buf->position;
}
return error;
}
void *
begin_reader(void *arg)
{
thread_args *args = arg;
for (;;) {
pthread_mutex_lock(&args->wait);
if (do_write(args, NULL))
goto handle_error;
pthread_mutex_lock(&glob_masks.mutex);
if (--glob_masks.num_working == 0)
pthread_mutex_unlock(&mainwait);
pthread_mutex_unlock(&glob_masks.mutex);
}
/* NOTREACHED */
handle_error:
/* error will be logged by primary thread */
pthread_mutex_lock(&glob_masks.mutex);
target[args->id].state = INACTIVE;
if (--glob_masks.num_working == 0)
pthread_mutex_unlock(&mainwait);
pthread_mutex_unlock(&glob_masks.mutex);
pthread_exit(NULL);
return NULL;
}
void
handler(int sig)
{
pid_t pid;
int status, i;
pid = wait(&status);
kids--;
for (i = 0; i < num_targets; i++) {
if (target[i].pid == pid) {
if (target[i].state == INACTIVE) {
/* thread got an I/O error */
if (target[i].err_type == 0) {
do_warn(
_("%s: write error on target %d \"%s\" at offset %lld\n"),
progname, i, target[i].name,
target[i].position);
} else {
do_warn(
_("%s: lseek64 error on target %d \"%s\" at offset %lld\n"),
progname, i, target[i].name,
target[i].position);
}
do_vfatal(target[i].error,
_("Aborting target %d - reason"), i);
if (kids == 0) {
do_log(
_("Aborting XFS copy - no more targets.\n"));
check_errors();
pthread_exit(NULL);
}
signal(SIGCHLD, handler);
return;
} else {
/* it just croaked it bigtime, log it */
do_warn(
_("%s: thread %d died unexpectedly, target \"%s\" incomplete\n"),
progname, i, target[i].name);
do_warn(_("%s: offset was probably %lld\n"),
progname, target[i].position);
do_fatal(target[i].error,
_("Aborting XFS copy - reason"));
pthread_exit(NULL);
}
}
}
/* unknown child -- something very wrong */
do_warn(_("%s: Unknown child died (should never happen!)\n"), progname);
die_perror();
pthread_exit(NULL);
signal(SIGCHLD, handler);
}
void
usage(void)
{
fprintf(stderr,
_("Usage: %s [-bdV] [-L logfile] source target [target ...]\n"),
progname);
exit(1);
}
void
init_bar(__uint64_t source_blocks)
{
int i;
for (i = 0; i < 11; i++)
barcount[i] = (source_blocks/10)*i;
}
int
bump_bar(int tenths, __uint64_t numblocks)
{
static char *bar[11] = {
" 0% ",
" ... 10% ",
" ... 20% ",
" ... 30% ",
" ... 40% ",
" ... 50% ",
" ... 60% ",
" ... 70% ",
" ... 80% ",
" ... 90% ",
" ... 100%\n\n",
};
if (tenths > 10) {
printf("%s", bar[10]);
fflush(stdout);
} else {
while (tenths < 10 && numblocks > barcount[tenths]) {
printf("%s", bar[tenths]);
fflush(stdout);
tenths++;
}
}
return tenths;
}
static xfs_off_t source_position = -1;
wbuf *
wbuf_init(wbuf *buf, int data_size, int data_align, int min_io_size, int id)
{
ASSERT(data_size % BBSIZE == 0);
while ((buf->data = memalign(data_align, data_size)) == NULL) {
data_size >>= 1;
if (data_size < min_io_size)
return NULL;
}
ASSERT(min_io_size % BBSIZE == 0);
buf->data_align = data_align;
buf->min_io_size = min_io_size;
buf->size = data_size;
buf->id = id;
return buf;
}
void
read_wbuf(int fd, wbuf *buf, xfs_mount_t *mp)
{
int res = 0;
xfs_off_t lres = 0;
xfs_off_t newpos;
size_t diff;
newpos = rounddown(buf->position, (xfs_off_t) buf->min_io_size);
if (newpos != buf->position) {
diff = buf->position - newpos;
buf->position = newpos;
buf->length += diff;
}
if (source_position != buf->position) {
lres = lseek64(fd, buf->position, SEEK_SET);
if (lres < 0LL) {
do_warn(_("%s: lseek64 failure at offset %lld\n"),
progname, source_position);
die_perror();
}
source_position = buf->position;
}
ASSERT(source_position % source_sectorsize == 0);
/* round up length for direct I/O if necessary */
if (buf->length % buf->min_io_size != 0)
buf->length = roundup(buf->length, buf->min_io_size);
if (buf->length > buf->size) {
do_warn(_("assert error: buf->length = %d, buf->size = %d\n"),
buf->length, buf->size);
exit(1);
}
if ((res = read(fd, buf->data, buf->length)) < 0) {
do_warn(_("%s: read failure at offset %lld\n"),
progname, source_position);
die_perror();
}
if (res < buf->length &&
source_position + res == mp->m_sb.sb_dblocks * source_blocksize)
res = buf->length;
else
ASSERT(res == buf->length);
source_position += res;
buf->length = res;
}
void
read_ag_header(int fd, xfs_agnumber_t agno, wbuf *buf, ag_header_t *ag,
xfs_mount_t *mp, int blocksize, int sectorsize)
{
xfs_daddr_t off;
int length;
xfs_off_t newpos;
size_t diff;
/* initial settings */
diff = 0;
off = XFS_AG_DADDR(mp, agno, XFS_SB_DADDR);
buf->position = (xfs_off_t) off * (xfs_off_t) BBSIZE;
length = buf->length = first_agbno * blocksize;
if (length == 0) {
do_log(_("ag header buffer invalid!\n"));
exit(1);
}
/* handle alignment stuff */
newpos = rounddown(buf->position, (xfs_off_t) buf->min_io_size);
if (newpos != buf->position) {
diff = buf->position - newpos;
buf->position = newpos;
buf->length += diff;
}
/* round up length for direct I/O if necessary */
if (buf->length % buf->min_io_size != 0)
buf->length = roundup(buf->length, buf->min_io_size);
read_wbuf(fd, buf, mp);
ASSERT(buf->length >= length);
ag->xfs_sb = (xfs_dsb_t *) (buf->data + diff);
ASSERT(be32_to_cpu(ag->xfs_sb->sb_magicnum) == XFS_SB_MAGIC);
ag->xfs_agf = (xfs_agf_t *) (buf->data + diff + sectorsize);
ASSERT(be32_to_cpu(ag->xfs_agf->agf_magicnum) == XFS_AGF_MAGIC);
ag->xfs_agi = (xfs_agi_t *) (buf->data + diff + 2 * sectorsize);
ASSERT(be32_to_cpu(ag->xfs_agi->agi_magicnum) == XFS_AGI_MAGIC);
ag->xfs_agfl = (xfs_agfl_t *) (buf->data + diff + 3 * sectorsize);
}
void
write_wbuf(void)
{
int i;
/* verify target threads */
for (i = 0; i < num_targets; i++)
if (target[i].state != INACTIVE)
glob_masks.num_working++;
/* release target threads */
for (i = 0; i < num_targets; i++)
if (target[i].state != INACTIVE)
pthread_mutex_unlock(&targ[i].wait); /* wake up */
sigrelse(SIGCHLD);
pthread_mutex_lock(&mainwait);
sighold(SIGCHLD);
}
void
sb_update_uuid(
xfs_sb_t *sb, /* Original fs superblock */
ag_header_t *ag_hdr, /* AG hdr to update for this copy */
thread_args *tcarg) /* Args for this thread, with UUID */
{
/*
* If this filesystem has CRCs, the original UUID is stamped into
* all metadata. If we don't have an existing meta_uuid field in the
* the original filesystem and we are changing the UUID in this copy,
* we must copy the original sb_uuid to the sb_meta_uuid slot and set
* the incompat flag for the feature on this copy.
*/
if (xfs_sb_version_hascrc(sb) && !xfs_sb_version_hasmetauuid(sb) &&
!uuid_equal(&tcarg->uuid, &sb->sb_uuid)) {
__be32 feat;
feat = be32_to_cpu(ag_hdr->xfs_sb->sb_features_incompat);
feat |= XFS_SB_FEAT_INCOMPAT_META_UUID;
ag_hdr->xfs_sb->sb_features_incompat = cpu_to_be32(feat);
platform_uuid_copy(&ag_hdr->xfs_sb->sb_meta_uuid,
&sb->sb_uuid);
}
/* Copy the (possibly new) fs-identifier UUID into sb_uuid */
platform_uuid_copy(&ag_hdr->xfs_sb->sb_uuid, &tcarg->uuid);
/* We may have changed the UUID, so update the superblock CRC */
if (xfs_sb_version_hascrc(sb))
xfs_update_cksum((char *)ag_hdr->xfs_sb, sb->sb_sectsize,
XFS_SB_CRC_OFF);
}
int
main(int argc, char **argv)
{
int i, j;
int howfar = 0;
int open_flags;
xfs_off_t pos;
size_t length;
int c;
__uint64_t size, sizeb;
__uint64_t numblocks = 0;
int wblocks = 0;
int num_threads = 0;
struct dioattr d;
int wbuf_size;
int wbuf_align;
int wbuf_miniosize;
int source_is_file = 0;
int buffered_output = 0;
int duplicate = 0;
uint btree_levels, current_level;
ag_header_t ag_hdr;
xfs_mount_t *mp;
xfs_mount_t mbuf;
struct xlog xlog;
xfs_buf_t *sbp;
xfs_sb_t *sb;
xfs_agnumber_t num_ags, agno;
xfs_agblock_t bno;
xfs_daddr_t begin, next_begin, ag_begin, new_begin, ag_end;
struct xfs_btree_block *block;
xfs_alloc_ptr_t *ptr;
xfs_alloc_rec_t *rec_ptr;
extern char *optarg;
extern int optind;
libxfs_init_t xargs;
thread_args *tcarg;
struct stat64 statbuf;
progname = basename(argv[0]);
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
while ((c = getopt(argc, argv, "bdL:V")) != EOF) {
switch (c) {
case 'b':
buffered_output = 1;
break;
case 'd':
duplicate = 1;
break;
case 'L':
logfile_name = optarg;
break;
case 'V':
printf(_("%s version %s\n"), progname, VERSION);
exit(0);
case '?':
usage();
}
}
if (argc - optind < 2)
usage();
if (logfile_name) {
logfd = open(logfile_name, O_CREAT|O_WRONLY|O_EXCL, 0600);
} else {
logfile_name = LOGFILE_NAME;
logfd = mkstemp(logfile_name);
}
if (logfd < 0) {
fprintf(stderr, _("%s: couldn't open log file \"%s\"\n"),
progname, logfile_name);
perror(_("Aborting XFS copy - reason"));
exit(1);
}
if ((logerr = fdopen(logfd, "w")) == NULL) {
fprintf(stderr, _("%s: couldn't set up logfile stream\n"),
progname);
perror(_("Aborting XFS copy - reason"));
exit(1);
}
source_name = argv[optind];
source_fd = -1;
optind++;
num_targets = argc - optind;
if ((target = malloc(sizeof(target_control) * num_targets)) == NULL) {
do_log(_("Couldn't allocate target array\n"));
die_perror();
}
for (i = 0; optind < argc; i++, optind++) {
target[i].name = argv[optind];
target[i].fd = -1;
target[i].position = -1;
target[i].state = INACTIVE;
target[i].error = 0;
target[i].err_type = 0;
}
parent_pid = getpid();
/* open up source -- is it a file? */
open_flags = O_RDONLY;
if ((source_fd = open(source_name, open_flags)) < 0) {
do_log(_("%s: couldn't open source \"%s\"\n"),
progname, source_name);
die_perror();
}
if (fstat64(source_fd, &statbuf) < 0) {
do_log(_("%s: couldn't stat source \"%s\"\n"),
progname, source_name);
die_perror();
}
if (S_ISREG(statbuf.st_mode))
source_is_file = 1;
if (source_is_file && platform_test_xfs_fd(source_fd)) {
if (fcntl(source_fd, F_SETFL, open_flags | O_DIRECT) < 0) {
do_log(_("%s: Cannot set direct I/O flag on \"%s\".\n"),
progname, source_name);
die_perror();
}
if (xfsctl(source_name, source_fd, XFS_IOC_DIOINFO, &d) < 0) {
do_log(_("%s: xfsctl on file \"%s\" failed.\n"),
progname, source_name);
die_perror();
}
wbuf_align = d.d_mem;
wbuf_size = MIN(d.d_maxiosz, 1 * 1024 * 1024);
wbuf_miniosize = d.d_miniosz;
} else {
/* set arbitrary I/O params, miniosize at least 1 disk block */
wbuf_align = getpagesize();
wbuf_size = 1 * 1024 * 1024;
wbuf_miniosize = -1; /* set after mounting source fs */
}
if (!source_is_file) {
/*
* check to make sure a filesystem isn't mounted
* on the device
*/
if (platform_check_ismounted(source_name, NULL, &statbuf, 0)) {
do_log(
_("%s: Warning -- a filesystem is mounted on the source device.\n"),
progname);
do_log(
_("\t\tGenerated copies may be corrupt unless the source is\n"));
do_log(
_("\t\tunmounted or mounted read-only. Copy proceeding...\n"));
}
}
/* prepare the libxfs_init structure */
memset(&xargs, 0, sizeof(xargs));
xargs.isdirect = LIBXFS_DIRECT;
xargs.isreadonly = LIBXFS_ISREADONLY;
if (source_is_file) {
xargs.dname = source_name;
xargs.disfile = 1;
} else
xargs.volname = source_name;
if (!libxfs_init(&xargs)) {
do_log(_("%s: couldn't initialize XFS library\n"
"%s: Aborting.\n"), progname, progname);
exit(1);
}
memset(&mbuf, 0, sizeof(xfs_mount_t));
/* We don't yet know the sector size, so read maximal size */
libxfs_buftarg_init(&mbuf, xargs.ddev, xargs.logdev, xargs.rtdev);
sbp = libxfs_readbuf(mbuf.m_ddev_targp, XFS_SB_DADDR,
1 << (XFS_MAX_SECTORSIZE_LOG - BBSHIFT), 0, NULL);
sb = &mbuf.m_sb;
libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbp));
/* Do it again, now with proper length and verifier */
libxfs_putbuf(sbp);
libxfs_purgebuf(sbp);
sbp = libxfs_readbuf(mbuf.m_ddev_targp, XFS_SB_DADDR,
1 << (sb->sb_sectlog - BBSHIFT),
0, &xfs_sb_buf_ops);
libxfs_putbuf(sbp);
mp = libxfs_mount(&mbuf, sb, xargs.ddev, xargs.logdev, xargs.rtdev, 0);
if (mp == NULL) {
do_log(_("%s: %s filesystem failed to initialize\n"
"%s: Aborting.\n"), progname, source_name, progname);
exit(1);
} else if (mp->m_sb.sb_inprogress) {
do_log(_("%s %s filesystem failed to initialize\n"
"%s: Aborting.\n"), progname, source_name, progname);
exit(1);
} else if (mp->m_sb.sb_logstart == 0) {
do_log(_("%s: %s has an external log.\n%s: Aborting.\n"),
progname, source_name, progname);
exit(1);
} else if (mp->m_sb.sb_rextents != 0) {
do_log(_("%s: %s has a real-time section.\n"
"%s: Aborting.\n"), progname, source_name, progname);
exit(1);
}
/*
* Set up the mount pointer to access the log and check whether the log
* is clean. Fail on a dirty or corrupt log in non-duplicate mode
* because the log is formatted as part of the copy and we don't want to
* destroy data. We also need the current log cycle to format v5
* superblock logs correctly.
*/
memset(&xlog, 0, sizeof(struct xlog));
mp->m_log = &xlog;
c = xlog_is_dirty(mp, mp->m_log, &xargs, 0);
if (!duplicate) {
if (c == 1) {
do_log(_(
"Error: source filesystem log is dirty. Mount the filesystem to replay the\n"
"log, unmount and retry xfs_copy.\n"));
exit(1);
} else if (c < 0) {
do_log(_(
"Error: could not determine the log head or tail of the source filesystem.\n"
"Mount the filesystem to replay the log or run xfs_repair.\n"));
exit(1);
}
}
source_blocksize = mp->m_sb.sb_blocksize;
source_sectorsize = mp->m_sb.sb_sectsize;
if (wbuf_miniosize == -1)
wbuf_miniosize = source_sectorsize;
ASSERT(source_blocksize % source_sectorsize == 0);
ASSERT(source_sectorsize % BBSIZE == 0);
if (source_blocksize < source_sectorsize) {
do_log(_("Error: filesystem block size is smaller than the"
" disk sectorsize.\nAborting XFS copy now.\n"));
exit(1);
}
first_agbno = XFS_AGFL_BLOCK(mp) + 1;
/* now open targets */
open_flags = O_RDWR;
for (i = 0; i < num_targets; i++) {
int write_last_block = 0;
if (stat64(target[i].name, &statbuf) < 0) {
/* ok, assume it's a file and create it */
do_out(_("Creating file %s\n"), target[i].name);
open_flags |= O_CREAT;
if (!buffered_output)
open_flags |= O_DIRECT;
write_last_block = 1;
} else if (S_ISREG(statbuf.st_mode)) {
open_flags |= O_TRUNC;
if (!buffered_output)
open_flags |= O_DIRECT;
write_last_block = 1;
} else {
/*
* check to make sure a filesystem isn't mounted
* on the device
*/
if (platform_check_ismounted(target[i].name,
NULL, &statbuf, 0)) {
do_log(_("%s: a filesystem is mounted "
"on target device \"%s\".\n"
"%s cannot copy to mounted filesystems."
" Aborting\n"),
progname, target[i].name, progname);
exit(1);
}
}
target[i].fd = open(target[i].name, open_flags, 0644);
if (target[i].fd < 0) {
do_log(_("%s: couldn't open target \"%s\"\n"),
progname, target[i].name);
die_perror();
}
if (write_last_block) {
/* ensure regular files are correctly sized */
if (ftruncate64(target[i].fd, mp->m_sb.sb_dblocks *
source_blocksize)) {
do_log(_("%s: cannot grow data section.\n"),
progname);
die_perror();
}
if (platform_test_xfs_fd(target[i].fd)) {
if (xfsctl(target[i].name, target[i].fd,
XFS_IOC_DIOINFO, &d) < 0) {
do_log(
_("%s: xfsctl on \"%s\" failed.\n"),
progname, target[i].name);
die_perror();
} else {
wbuf_align = MAX(wbuf_align, d.d_mem);
wbuf_size = MIN(d.d_maxiosz, wbuf_size);
wbuf_miniosize = MAX(d.d_miniosz,
wbuf_miniosize);
}
}
} else {
char *lb[XFS_MAX_SECTORSIZE] = { NULL };
off64_t off;
/* ensure device files are sufficiently large */
off = mp->m_sb.sb_dblocks * source_blocksize;
off -= sizeof(lb);
if (pwrite64(target[i].fd, lb, sizeof(lb), off) < 0) {
do_log(_("%s: failed to write last block\n"),
progname);
do_log(_("\tIs target \"%s\" too small?\n"),
target[i].name);
die_perror();
}
}
}
/* initialize locks and bufs */
if (pthread_mutex_init(&glob_masks.mutex, NULL) != 0) {
do_log(_("Couldn't initialize global thread mask\n"));
die_perror();
}
glob_masks.num_working = 0;
if (wbuf_init(&w_buf, wbuf_size, wbuf_align,
wbuf_miniosize, 0) == NULL) {
do_log(_("Error initializing wbuf 0\n"));
die_perror();
}
wblocks = wbuf_size / BBSIZE;
if (wbuf_init(&btree_buf, MAX(source_blocksize, wbuf_miniosize),
wbuf_align, wbuf_miniosize, 1) == NULL) {
do_log(_("Error initializing btree buf 1\n"));
die_perror();
}
if (pthread_mutex_init(&mainwait,NULL) != 0) {
do_log(_("Error creating first semaphore.\n"));
die_perror();
exit(1);
}
/* need to start out blocking */
pthread_mutex_lock(&mainwait);
/* set up sigchild signal handler */
signal(SIGCHLD, handler);
sighold(SIGCHLD);
/* make children */
if ((targ = malloc(num_targets * sizeof(thread_args))) == NULL) {
do_log(_("Couldn't malloc space for thread args\n"));
die_perror();
exit(1);
}
for (i = 0, tcarg = targ; i < num_targets; i++, tcarg++) {
if (!duplicate)
platform_uuid_generate(&tcarg->uuid);
else
platform_uuid_copy(&tcarg->uuid, &mp->m_sb.sb_uuid);
if (pthread_mutex_init(&tcarg->wait, NULL) != 0) {
do_log(_("Error creating thread mutex %d\n"), i);
die_perror();
exit(1);
}
/* need to start out blocking */
pthread_mutex_lock(&tcarg->wait);
}
for (i = 0, tcarg = targ; i < num_targets; i++, tcarg++) {
tcarg->id = i;
tcarg->fd = target[i].fd;
target[i].state = ACTIVE;
num_threads++;
if (pthread_create(&target[i].pid, NULL,
begin_reader, (void *)tcarg)) {
do_log(_("Error creating thread for target %d\n"), i);
die_perror();
}
}
ASSERT(num_targets == num_threads);
/* set up statistics */
num_ags = mp->m_sb.sb_agcount;
init_bar(mp->m_sb.sb_blocksize / BBSIZE
* ((__uint64_t)mp->m_sb.sb_dblocks
- (__uint64_t)mp->m_sb.sb_fdblocks + 10 * num_ags));
kids = num_targets;
for (agno = 0; agno < num_ags && kids > 0; agno++) {
/* read in first blocks of the ag */
read_ag_header(source_fd, agno, &w_buf, &ag_hdr, mp,
source_blocksize, source_sectorsize);
/* set the in_progress bit for the first AG */
if (agno == 0)
ag_hdr.xfs_sb->sb_inprogress = 1;
/* save what we need (agf) in the btree buffer */
memmove(btree_buf.data, ag_hdr.xfs_agf, source_sectorsize);
ag_hdr.xfs_agf = (xfs_agf_t *) btree_buf.data;
btree_buf.length = source_blocksize;
/* write the ag header out */
write_wbuf();
/* traverse btree until we get to the leftmost leaf node */
bno = be32_to_cpu(ag_hdr.xfs_agf->agf_roots[XFS_BTNUM_BNOi]);
current_level = 0;
btree_levels = be32_to_cpu(ag_hdr.xfs_agf->
agf_levels[XFS_BTNUM_BNOi]);
ag_end = XFS_AGB_TO_DADDR(mp, agno,
be32_to_cpu(ag_hdr.xfs_agf->agf_length) - 1)
+ source_blocksize / BBSIZE;
for (;;) {
/* none of this touches the w_buf buffer */
if (current_level >= btree_levels) {
do_log(
_("Error: current level %d >= btree levels %d\n"),
current_level, btree_levels);
exit(1);
}
current_level++;
btree_buf.position = pos = (xfs_off_t)
XFS_AGB_TO_DADDR(mp,agno,bno) << BBSHIFT;
btree_buf.length = source_blocksize;
read_wbuf(source_fd, &btree_buf, mp);
block = (struct xfs_btree_block *)
((char *)btree_buf.data +
pos - btree_buf.position);
if (be32_to_cpu(block->bb_magic) !=
(xfs_sb_version_hascrc(&mp->m_sb) ?
XFS_ABTB_CRC_MAGIC : XFS_ABTB_MAGIC)) {
do_log(_("Bad btree magic 0x%x\n"),
be32_to_cpu(block->bb_magic));
exit(1);
}
if (be16_to_cpu(block->bb_level) == 0)
break;
ptr = XFS_ALLOC_PTR_ADDR(mp, block, 1,
mp->m_alloc_mxr[1]);
bno = be32_to_cpu(ptr[0]);
}
/* align first data copy but don't overwrite ag header */
pos = w_buf.position >> BBSHIFT;
length = w_buf.length >> BBSHIFT;
next_begin = pos + length;
ag_begin = next_begin;
ASSERT(w_buf.position % source_sectorsize == 0);
/* handle the rest of the ag */
for (;;) {
if (be16_to_cpu(block->bb_level) != 0) {
do_log(
_("WARNING: source filesystem inconsistent.\n"));
do_log(
_(" A leaf btree rec isn't a leaf. Aborting now.\n"));
exit(1);
}
rec_ptr = XFS_ALLOC_REC_ADDR(mp, block, 1);
for (i = 0; i < be16_to_cpu(block->bb_numrecs);
i++, rec_ptr++) {
/* calculate in daddr's */
begin = next_begin;
/*
* protect against pathological case of a
* hole right after the ag header in a
* mis-aligned case
*/
if (begin < ag_begin)
begin = ag_begin;
/*
* round size up to ensure we copy a
* range bigger than required
*/
sizeb = XFS_AGB_TO_DADDR(mp, agno,
be32_to_cpu(rec_ptr->ar_startblock)) -
begin;
size = roundup(sizeb < 0) {
/* copy extent */
w_buf.position = (xfs_off_t)
begin << BBSHIFT;
while (size > 0) {
/*
* let lower layer do alignment
*/
if (size > w_buf.size) {
w_buf.length = w_buf.size;
size -= w_buf.size;
sizeb -= wblocks;
numblocks += wblocks;
} else {
w_buf.length = size;
numblocks += sizeb;
size = 0;
}
read_wbuf(source_fd, &w_buf, mp);
write_wbuf();
w_buf.position += w_buf.length;
howfar = bump_bar(
howfar, numblocks);
}
}
/* round next starting point down */
new_begin = XFS_AGB_TO_DADDR(mp, agno,
be32_to_cpu(rec_ptr->ar_startblock) +
be32_to_cpu(rec_ptr->ar_blockcount));
next_begin = rounddown(new_begin,
w_buf.min_io_size >> BBSHIFT);
}
if (be32_to_cpu(block->bb_u.s.bb_rightsib) == NULLAGBLOCK)
break;
/* read in next btree record block */
btree_buf.position = pos = (xfs_off_t)
XFS_AGB_TO_DADDR(mp, agno, be32_to_cpu(
block->bb_u.s.bb_rightsib)) << BBSHIFT;
btree_buf.length = source_blocksize;
/* let read_wbuf handle alignment */
read_wbuf(source_fd, &btree_buf, mp);
block = (struct xfs_btree_block *)
((char *) btree_buf.data +
pos - btree_buf.position);
ASSERT(be32_to_cpu(block->bb_magic) == XFS_ABTB_MAGIC);
}
/*
* write out range of used blocks after last range
* of free blocks in AG
*/
if (next_begin < ag_end) {
begin = next_begin;
sizeb = ag_end - begin;
size = roundup(sizeb << BBSHIFT, wbuf_miniosize);
if (size > 0) {
/* copy extent */
w_buf.position = (xfs_off_t) begin << BBSHIFT;
while (size > 0) {
/*
* let lower layer do alignment
*/
if (size > w_buf.size) {
w_buf.length = w_buf.size;
size -= w_buf.size;
sizeb -= wblocks;
numblocks += wblocks;
} else {
w_buf.length = size;
numblocks += sizeb;
size = 0;
}
read_wbuf(source_fd, &w_buf, mp);
write_wbuf();
w_buf.position += w_buf.length;
howfar = bump_bar(howfar, numblocks);
}
}
}
}
if (kids > 0) {
if (!duplicate)
/* write a clean log using the specified UUID */
format_logs(mp);
else
num_ags = 1;
/* reread and rewrite superblocks (UUID and in-progress) */
/* [backwards, so inprogress bit only updated when done] */
for (i = num_ags - 1; i >= 0; i--) {
read_ag_header(source_fd, i, &w_buf, &ag_hdr, mp,
source_blocksize, source_sectorsize);
if (i == 0)
ag_hdr.xfs_sb->sb_inprogress = 0;
/* do each thread in turn, each has its own UUID */
for (j = 0, tcarg = targ; j < num_targets; j++) {
sb_update_uuid(sb, &ag_hdr, tcarg);
do_write(tcarg, NULL);
tcarg++;
}
}
bump_bar(100, 0);
}
check_errors();
libxfs_umount(mp);
return 0;
}
char *
next_log_chunk(char *p, int offset, void *private)
{
wbuf *buf = (wbuf *)private;
if (buf->length < (int)(p - buf->data) + offset) {
/* need to flush this one, then start afresh */
do_write(buf->owner, NULL);
memset(buf->data, 0, buf->length);
return buf->data;
}
return p + offset;
}
/*
* Writes a log header at the start of the log (with the real
* filesystem UUID embedded into it), and writes to all targets.
*
* Returns the next buffer-length-aligned disk address.
*/
xfs_off_t
write_log_header(int fd, wbuf *buf, xfs_mount_t *mp)
{
char *p = buf->data;
xfs_off_t logstart;
int offset;
logstart = XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart) << BBSHIFT;
buf->position = rounddown(logstart, (xfs_off_t)buf->length);
memset(p, 0, buf->size);
if (logstart % buf->length) { /* unaligned */
read_wbuf(fd, buf, mp);
offset = logstart - buf->position;
p += offset;
memset(p, 0, buf->length - offset);
}
offset = libxfs_log_header(p, &buf->owner->uuid,
xfs_sb_version_haslogv2(&mp->m_sb) ? 2 : 1,
mp->m_sb.sb_logsunit, XLOG_FMT, NULLCOMMITLSN,
NULLCOMMITLSN, next_log_chunk, buf);
do_write(buf->owner, NULL);
return roundup(logstart + offset, buf->length);
}
/*
* May do an aligned read of the last buffer in the log (& zero
* the start of that buffer). Returns the disk address at the
* end of last aligned buffer in the log.
*/
xfs_off_t
write_log_trailer(int fd, wbuf *buf, xfs_mount_t *mp)
{
xfs_off_t logend;
int offset;
logend = XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart) << BBSHIFT;
logend += XFS_FSB_TO_B(mp, mp->m_sb.sb_logblocks);
buf->position = rounddown(logend, (xfs_off_t)buf->length);
if (logend % buf->length) { /* unaligned */
read_wbuf(fd, buf, mp);
offset = (int)(logend - buf->position);
memset(buf->data, 0, offset);
do_write(buf->owner, NULL);
}
return buf->position;
}
/*
* Clear a log by writing a record at the head, the tail and zeroing everything
* in between.
*/
static void
clear_log(
struct xfs_mount *mp,
thread_args *tcarg)
{
xfs_off_t pos;
xfs_off_t end_pos;
w_buf.owner = tcarg;
w_buf.length = rounddown(w_buf.size, w_buf.min_io_size);
pos = write_log_header(source_fd, &w_buf, mp);
end_pos = write_log_trailer(source_fd, &w_buf, mp);
w_buf.position = pos;
memset(w_buf.data, 0, w_buf.length);
while (w_buf.position < end_pos) {
do_write(tcarg, NULL);
w_buf.position += w_buf.length;
}
}
/*
* Format the log to a particular cycle number. This is required for version 5
* superblock filesystems to provide metadata LSN validity guarantees.
*/
static void
format_log(
struct xfs_mount *mp,
thread_args *tcarg,
wbuf *buf)
{
int logstart;
int length;
int cycle = XLOG_INIT_CYCLE;
buf->owner = tcarg;
buf->length = buf->size;
buf->position = XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart) << BBSHIFT;
logstart = XFS_FSB_TO_BB(mp, mp->m_sb.sb_logstart);
length = XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
/*
* Bump the cycle number on v5 superblock filesystems to guarantee that
* all existing metadata LSNs are valid (behind the current LSN) on the
* target fs.
*/
if (xfs_sb_version_hascrc(&mp->m_sb))
cycle = mp->m_log->l_curr_cycle + 1;
/*
* Format the entire log into the memory buffer and write it out. If the
* write fails, mark the target inactive so the failure is reported.
*/
libxfs_log_clear(NULL, buf->data, logstart, length, &buf->owner->uuid,
xfs_sb_version_haslogv2(&mp->m_sb) ? 2 : 1,
mp->m_sb.sb_logsunit, XLOG_FMT, cycle);
if (do_write(buf->owner, buf))
target[tcarg->id].state = INACTIVE;
}
static int
format_logs(
struct xfs_mount *mp)
{
thread_args *tcarg;
int i;
wbuf logbuf;
int logsize;
if (xfs_sb_version_hascrc(&mp->m_sb)) {
logsize = XFS_FSB_TO_B(mp, mp->m_sb.sb_logblocks);
if (!wbuf_init(&logbuf, logsize, w_buf.data_align,
w_buf.min_io_size, w_buf.id))
return -ENOMEM;
}
for (i = 0, tcarg = targ; i < num_targets; i++) {
if (xfs_sb_version_hascrc(&mp->m_sb))
format_log(mp, tcarg, &logbuf);
else
clear_log(mp, tcarg);
tcarg++;
}
if (xfs_sb_version_hascrc(&mp->m_sb))
free(logbuf.data);
return 0;
}
xfsprogs-4.3.0+nmu1ubuntu1.1/copy/xfs_copy.h 0000664 0000000 0000000 00000005723 12625713771 015617 0 ustar /*
* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* An on-disk allocation group header is composed of 4 structures,
* each of which is 1 disk sector long where the sector size is at
* least 512 bytes long (BBSIZE).
*
* There's one ag_header per ag and the superblock in the first ag
* is the contains the real data for the entire filesystem (although
* most of the relevant data won't change anyway even on a growfs).
*
* The filesystem superblock specifies the number of AG's and
* the AG size. That splits the filesystem up into N pieces,
* each of which is an AG and has an ag_header at the beginning.
*/
typedef struct ag_header {
xfs_dsb_t *xfs_sb; /* superblock for filesystem or AG */
xfs_agf_t *xfs_agf; /* free space info */
xfs_agi_t *xfs_agi; /* free inode info */
xfs_agfl_t *xfs_agfl; /* AG freelist */
char *residue;
int residue_length;
} ag_header_t;
/*
* The position/buf_position, length/buf_length, data/buffer pairs
* exist because of alignment constraints for direct I/O and dealing
* with scenarios where either the source or target or both is a file
* and the blocksize of the filesystem where file resides is different
* from that of the filesystem image being duplicated. You can get
* alignment problems resulting from things like AG's starting on
* non-aligned points in the filesystem. So you have to be able
* to read from points "before" the requested starting point and
* read in more data than requested.
*/
struct t_args;
typedef struct {
int id; /* buffer ID */
size_t size; /* size of buffer -- fixed */
size_t min_io_size; /* for direct I/O */
int data_align; /* data buffer alignment */
xfs_off_t position; /* requested position (bytes) */
size_t length; /* requested length (bytes) */
char *data; /* pointer to data buffer */
struct t_args *owner; /* for non-parallel writes */
} wbuf;
typedef struct t_args {
int id;
uuid_t uuid;
pthread_mutex_t wait;
int fd;
} thread_args;
typedef struct {
pthread_mutex_t mutex;
int num_working;
wbuf *buffer;
} thread_control;
typedef int thread_id;
typedef int tm_index; /* index into thread mask array */
typedef __uint32_t thread_mask; /* a thread mask */
typedef struct {
char *name;
int fd;
xfs_off_t position;
pthread_t pid;
int state;
int error;
int err_type;
} target_control;
xfsprogs-4.3.0+nmu1ubuntu1.1/db/ 0000775 0000000 0000000 00000000000 12625722130 013205 5 ustar xfsprogs-4.3.0+nmu1ubuntu1.1/db/Makefile 0000664 0000000 0000000 00000002442 12560572026 014654 0 ustar #
# Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
#
TOPDIR = ..
include $(TOPDIR)/include/builddefs
LTCOMMAND = xfs_db
HFILES = addr.h agf.h agfl.h agi.h attr.h attrshort.h bit.h block.h bmap.h \
btblock.h bmroot.h check.h command.h convert.h debug.h \
dir2.h dir2sf.h dquot.h echo.h faddr.h field.h \
flist.h fprint.h frag.h freesp.h hash.h help.h init.h inode.h input.h \
io.h malloc.h metadump.h output.h print.h quit.h sb.h sig.h strvec.h \
text.h type.h write.h attrset.h symlink.h
CFILES = $(HFILES:.h=.c)
LSRCFILES = xfs_admin.sh xfs_ncheck.sh xfs_metadump.sh
LLDLIBS = $(LIBXFS) $(LIBXLOG) $(LIBUUID) $(LIBRT) $(LIBPTHREAD)
LTDEPENDENCIES = $(LIBXFS) $(LIBXLOG)
LLDFLAGS += -static-libtool-libs
ifeq ($(ENABLE_READLINE),yes)
LLDLIBS += $(LIBREADLINE) $(LIBTERMCAP)
CFLAGS += -DENABLE_READLINE
endif
ifeq ($(ENABLE_EDITLINE),yes)
LLDLIBS += $(LIBEDITLINE) $(LIBTERMCAP)
CFLAGS += -DENABLE_EDITLINE
endif
default: depend $(LTCOMMAND)
include $(BUILDRULES)
install: default
$(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
$(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
$(INSTALL) -m 755 xfs_admin.sh $(PKG_SBIN_DIR)/xfs_admin
$(INSTALL) -m 755 xfs_ncheck.sh $(PKG_SBIN_DIR)/xfs_ncheck
$(INSTALL) -m 755 xfs_metadump.sh $(PKG_SBIN_DIR)/xfs_metadump
install-dev:
-include .dep
xfsprogs-4.3.0+nmu1ubuntu1.1/db/addr.c 0000664 0000000 0000000 00000005411 12574431650 014273 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "addr.h"
#include "command.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "io.h"
#include "flist.h"
#include "inode.h"
#include "output.h"
static int addr_f(int argc, char **argv);
static void addr_help(void);
static const cmdinfo_t addr_cmd =
{ "addr", "a", addr_f, 0, 1, 1, N_("[field-expression]"),
N_("set current address"), addr_help };
static void
addr_help(void)
{
dbprintf(_(
"\n"
" 'addr' uses the given field to set the filesystem address and type\n"
"\n"
" Examples:\n"
"\n"
" sb\n"
" a rootino - set the type to inode and set position to the root inode\n"
" a u.bmx[0].startblock (for inode with blockmap)\n"
"\n"
));
}
static int
addr_f(
int argc,
char **argv)
{
adfnc_t adf;
const ftattr_t *fa;
flist_t *fl;
const field_t *fld;
typnm_t next;
flist_t *tfl;
if (argc == 1) {
print_iocur("current", iocur_top);
return 0;
}
if (cur_typ == NULL) {
dbprintf(_("no current type\n"));
return 0;
}
fld = cur_typ->fields;
if (fld != NULL && fld->name[0] == '\0') {
fa = &ftattrtab[fld->ftyp];
ASSERT(fa->ftyp == fld->ftyp);
fld = fa->subfld;
}
if (fld == NULL) {
dbprintf(_("no fields for type %s\n"), cur_typ->name);
return 0;
}
fl = flist_scan(argv[1]);
if (fl == NULL)
return 0;
if (!flist_parse(fld, fl, iocur_top->data, 0))
goto out;
flist_print(fl);
for (tfl = fl; tfl->child != NULL; tfl = tfl->child) {
if ((tfl->flags & FL_OKLOW) && tfl->low < tfl->high) {
dbprintf(_("array not allowed for addr command\n"));
goto out;
}
}
fld = tfl->fld;
next = fld->next;
if (next == TYP_INODATA)
next = inode_next_type();
if (next == TYP_NONE) {
dbprintf(_("no next type for field %s\n"), fld->name);
goto out;
}
fa = &ftattrtab[fld->ftyp];
ASSERT(fa->ftyp == fld->ftyp);
adf = fa->adfunc;
if (adf == NULL) {
dbprintf(_("no addr function for field %s (type %s)\n"),
fld->name, fa->name);
goto out;
}
(*adf)(iocur_top->data, tfl->offset, next);
out:
flist_free(fl);
return 0;
}
void
addr_init(void)
{
add_command(&addr_cmd);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/addr.h 0000664 0000000 0000000 00000001365 12560572026 014302 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void addr_init(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/agf.c 0000664 0000000 0000000 00000007600 12574431650 014120 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "command.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "io.h"
#include "bit.h"
#include "output.h"
#include "init.h"
#include "agf.h"
static int agf_f(int argc, char **argv);
static void agf_help(void);
static const cmdinfo_t agf_cmd =
{ "agf", NULL, agf_f, 0, 1, 1, N_("[agno]"),
N_("set address to agf header"), agf_help };
const field_t agf_hfld[] = {
{ "", FLDT_AGF, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
#define OFF(f) bitize(offsetof(xfs_agf_t, agf_ ## f))
#define SZ(f) bitszof(xfs_agf_t, agf_ ## f)
const field_t agf_flds[] = {
{ "magicnum", FLDT_UINT32X, OI(OFF(magicnum)), C1, 0, TYP_NONE },
{ "versionnum", FLDT_UINT32D, OI(OFF(versionnum)), C1, 0, TYP_NONE },
{ "seqno", FLDT_AGNUMBER, OI(OFF(seqno)), C1, 0, TYP_NONE },
{ "length", FLDT_AGBLOCK, OI(OFF(length)), C1, 0, TYP_NONE },
{ "roots", FLDT_AGBLOCK, OI(OFF(roots)), CI(XFS_BTNUM_AGF),
FLD_ARRAY|FLD_SKIPALL, TYP_NONE },
{ "bnoroot", FLDT_AGBLOCK,
OI(OFF(roots) + XFS_BTNUM_BNO * SZ(roots[XFS_BTNUM_BNO])), C1, 0,
TYP_BNOBT },
{ "cntroot", FLDT_AGBLOCK,
OI(OFF(roots) + XFS_BTNUM_CNT * SZ(roots[XFS_BTNUM_CNT])), C1, 0,
TYP_CNTBT },
{ "levels", FLDT_UINT32D, OI(OFF(levels)), CI(XFS_BTNUM_AGF),
FLD_ARRAY|FLD_SKIPALL, TYP_NONE },
{ "bnolevel", FLDT_UINT32D,
OI(OFF(levels) + XFS_BTNUM_BNO * SZ(levels[XFS_BTNUM_BNO])), C1, 0,
TYP_NONE },
{ "cntlevel", FLDT_UINT32D,
OI(OFF(levels) + XFS_BTNUM_CNT * SZ(levels[XFS_BTNUM_CNT])), C1, 0,
TYP_NONE },
{ "flfirst", FLDT_UINT32D, OI(OFF(flfirst)), C1, 0, TYP_NONE },
{ "fllast", FLDT_UINT32D, OI(OFF(fllast)), C1, 0, TYP_NONE },
{ "flcount", FLDT_UINT32D, OI(OFF(flcount)), C1, 0, TYP_NONE },
{ "freeblks", FLDT_EXTLEN, OI(OFF(freeblks)), C1, 0, TYP_NONE },
{ "longest", FLDT_EXTLEN, OI(OFF(longest)), C1, 0, TYP_NONE },
{ "btreeblks", FLDT_UINT32D, OI(OFF(btreeblks)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(uuid)), C1, 0, TYP_NONE },
{ "lsn", FLDT_UINT64X, OI(OFF(lsn)), C1, 0, TYP_NONE },
{ "crc", FLDT_CRC, OI(OFF(crc)), C1, 0, TYP_NONE },
{ NULL }
};
static void
agf_help(void)
{
dbprintf(_(
"\n"
" set allocation group free block list\n"
"\n"
" Example:\n"
"\n"
" agf 2 - move location to AGF in 2nd filesystem allocation group\n"
"\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"
));
}
static int
agf_f(
int argc,
char **argv)
{
xfs_agnumber_t agno;
char *p;
if (argc > 1) {
agno = (xfs_agnumber_t)strtoul(argv[1], &p, 0);
if (*p != '\0' || agno >= mp->m_sb.sb_agcount) {
dbprintf(_("bad allocation group number %s\n"), argv[1]);
return 0;
}
cur_agno = agno;
} 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(mp)),
XFS_FSS_TO_BB(mp, 1), DB_RING_ADD, NULL);
return 0;
}
void
agf_init(void)
{
add_command(&agf_cmd);
}
int
agf_size(
void *obj,
int startoff,
int idx)
{
return bitize(mp->m_sb.sb_sectsize);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/agf.h 0000664 0000000 0000000 00000001570 12560572026 014123 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern const struct field agf_flds[];
extern const struct field agf_hfld[];
extern void agf_init(void);
extern int agf_size(void *obj, int startoff, int idx);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/agfl.c 0000664 0000000 0000000 00000006176 12574431650 014303 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "command.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "io.h"
#include "bit.h"
#include "output.h"
#include "init.h"
#include "agfl.h"
static int agfl_bno_size(void *obj, int startoff);
static int agfl_f(int argc, char **argv);
static void agfl_help(void);
static const cmdinfo_t agfl_cmd =
{ "agfl", NULL, agfl_f, 0, 1, 1, N_("[agno]"),
N_("set address to agfl block"), agfl_help };
const field_t agfl_hfld[] = { {
"", FLDT_AGFL, OI(0), C1, 0, TYP_NONE, },
{ NULL }
};
const field_t agfl_crc_hfld[] = { {
"", FLDT_AGFL_CRC, 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(magicnum)), agfl_bno_size,
FLD_ARRAY|FLD_COUNT, TYP_DATA },
{ NULL }
};
const field_t agfl_crc_flds[] = {
{ "magicnum", FLDT_UINT32X, OI(OFF(magicnum)), C1, 0, TYP_NONE },
{ "seqno", FLDT_AGNUMBER, OI(OFF(seqno)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(uuid)), C1, 0, TYP_NONE },
{ "lsn", FLDT_UINT64X, OI(OFF(lsn)), C1, 0, TYP_NONE },
{ "crc", FLDT_CRC, OI(OFF(crc)), C1, 0, TYP_NONE },
{ "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)
{
dbprintf(_(
"\n"
" set allocation group freelist\n"
"\n"
" Example:\n"
"\n"
" agfl 5"
"\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"
"\n"
));
}
static int
agfl_f(
int argc,
char **argv)
{
xfs_agnumber_t agno;
char *p;
if (argc > 1) {
agno = (xfs_agnumber_t)strtoul(argv[1], &p, 0);
if (*p != '\0' || agno >= mp->m_sb.sb_agcount) {
dbprintf(_("bad allocation group number %s\n"), argv[1]);
return 0;
}
cur_agno = agno;
} 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(mp)),
XFS_FSS_TO_BB(mp, 1), DB_RING_ADD, NULL);
return 0;
}
void
agfl_init(void)
{
add_command(&agfl_cmd);
}
/*ARGSUSED*/
int
agfl_size(
void *obj,
int startoff,
int idx)
{
return bitize(mp->m_sb.sb_sectsize);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/agfl.h 0000664 0000000 0000000 00000001722 12560572026 014276 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern const struct field agfl_flds[];
extern const struct field agfl_hfld[];
extern const struct field agfl_crc_flds[];
extern const struct field agfl_crc_hfld[];
extern void agfl_init(void);
extern int agfl_size(void *obj, int startoff, int idx);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/agi.c 0000664 0000000 0000000 00000006615 12574431650 014130 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "command.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "io.h"
#include "bit.h"
#include "output.h"
#include "init.h"
#include "agi.h"
static int agi_f(int argc, char **argv);
static void agi_help(void);
static const cmdinfo_t agi_cmd =
{ "agi", NULL, agi_f, 0, 1, 1, N_("[agno]"),
N_("set address to agi header"), agi_help };
const field_t agi_hfld[] = {
{ "", FLDT_AGI, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
#define OFF(f) bitize(offsetof(xfs_agi_t, agi_ ## f))
const field_t agi_flds[] = {
{ "magicnum", FLDT_UINT32X, OI(OFF(magicnum)), C1, 0, TYP_NONE },
{ "versionnum", FLDT_UINT32D, OI(OFF(versionnum)), C1, 0, TYP_NONE },
{ "seqno", FLDT_AGNUMBER, OI(OFF(seqno)), C1, 0, TYP_NONE },
{ "length", FLDT_AGBLOCK, OI(OFF(length)), C1, 0, TYP_NONE },
{ "count", FLDT_AGINO, OI(OFF(count)), C1, 0, TYP_NONE },
{ "root", FLDT_AGBLOCK, OI(OFF(root)), C1, 0, TYP_INOBT },
{ "level", FLDT_UINT32D, OI(OFF(level)), C1, 0, TYP_NONE },
{ "freecount", FLDT_AGINO, OI(OFF(freecount)), C1, 0, TYP_NONE },
{ "newino", FLDT_AGINO, OI(OFF(newino)), C1, 0, TYP_INODE },
{ "dirino", FLDT_AGINO, OI(OFF(dirino)), C1, 0, TYP_INODE },
{ "unlinked", FLDT_AGINONN, OI(OFF(unlinked)),
CI(XFS_AGI_UNLINKED_BUCKETS), FLD_ARRAY, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(uuid)), C1, 0, TYP_NONE },
{ "lsn", FLDT_UINT64X, OI(OFF(lsn)), C1, 0, TYP_NONE },
{ "crc", FLDT_CRC, OI(OFF(crc)), C1, 0, TYP_NONE },
{ "free_root", FLDT_AGBLOCK, OI(OFF(free_root)), C1, 0, TYP_INOBT },
{ "free_level", FLDT_UINT32D, OI(OFF(free_level)), C1, 0, TYP_NONE },
{ NULL }
};
static void
agi_help(void)
{
dbprintf(_(
"\n"
" set allocation group inode btree\n"
"\n"
" Example:\n"
"\n"
" agi 3 (set location to 3rd allocation group inode btree and type to 'agi')\n"
"\n"
" Located in the 3rd 512 byte block of each allocation group,\n"
" the agi inode btree tracks all used/free inodes in the allocation group.\n"
" Inodes are allocated in 16k 'chunks', each btree entry tracks a 'chunk'.\n"
"\n"
));
}
static int
agi_f(
int argc,
char **argv)
{
xfs_agnumber_t agno;
char *p;
if (argc > 1) {
agno = (xfs_agnumber_t)strtoul(argv[1], &p, 0);
if (*p != '\0' || agno >= mp->m_sb.sb_agcount) {
dbprintf(_("bad allocation group number %s\n"), argv[1]);
return 0;
}
cur_agno = agno;
} 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(mp)),
XFS_FSS_TO_BB(mp, 1), DB_RING_ADD, NULL);
return 0;
}
void
agi_init(void)
{
add_command(&agi_cmd);
}
/*ARGSUSED*/
int
agi_size(
void *obj,
int startoff,
int idx)
{
return bitize(mp->m_sb.sb_sectsize);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/agi.h 0000664 0000000 0000000 00000001570 12560572026 014126 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern const struct field agi_flds[];
extern const struct field agi_hfld[];
extern void agi_init(void);
extern int agi_size(void *obj, int startoff, int idx);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/attr.c 0000664 0000000 0000000 00000036301 12625713771 014341 0 ustar /*
* Copyright (c) 2000-2001,2004-2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "bit.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "attr.h"
#include "io.h"
#include "init.h"
#include "output.h"
static int attr_leaf_entries_count(void *obj, int startoff);
static int attr_leaf_hdr_count(void *obj, int startoff);
static int attr_leaf_name_local_count(void *obj, int startoff);
static int attr_leaf_name_local_name_count(void *obj, int startoff);
static int attr_leaf_name_local_value_count(void *obj, int startoff);
static int attr_leaf_name_local_value_offset(void *obj, int startoff,
int idx);
static int attr_leaf_name_remote_count(void *obj, int startoff);
static int attr_leaf_name_remote_name_count(void *obj, int startoff);
static int attr_leaf_nvlist_count(void *obj, int startoff);
static int attr_leaf_nvlist_offset(void *obj, int startoff, int idx);
static int attr_node_btree_count(void *obj, int startoff);
static int attr_node_hdr_count(void *obj, int startoff);
const field_t attr_hfld[] = {
{ "", FLDT_ATTR, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
#define LOFF(f) bitize(offsetof(xfs_attr_leafblock_t, f))
#define NOFF(f) bitize(offsetof(xfs_da_intnode_t, f))
const field_t attr_flds[] = {
{ "hdr", FLDT_ATTR_LEAF_HDR, OI(LOFF(hdr)), attr_leaf_hdr_count,
FLD_COUNT, TYP_NONE },
{ "hdr", FLDT_ATTR_NODE_HDR, OI(NOFF(hdr)), attr_node_hdr_count,
FLD_COUNT, TYP_NONE },
{ "entries", FLDT_ATTR_LEAF_ENTRY, OI(LOFF(entries)),
attr_leaf_entries_count, FLD_ARRAY|FLD_COUNT, TYP_NONE },
{ "btree", FLDT_ATTR_NODE_ENTRY, OI(NOFF(__btree)), attr_node_btree_count,
FLD_ARRAY|FLD_COUNT, TYP_NONE },
{ "nvlist", FLDT_ATTR_LEAF_NAME, attr_leaf_nvlist_offset,
attr_leaf_nvlist_count, FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ NULL }
};
#define BOFF(f) bitize(offsetof(xfs_da_blkinfo_t, f))
const field_t attr_blkinfo_flds[] = {
{ "forw", FLDT_ATTRBLOCK, OI(BOFF(forw)), C1, 0, TYP_ATTR },
{ "back", FLDT_ATTRBLOCK, OI(BOFF(back)), C1, 0, TYP_ATTR },
{ "magic", FLDT_UINT16X, OI(BOFF(magic)), C1, 0, TYP_NONE },
{ "pad", FLDT_UINT16X, OI(BOFF(pad)), C1, FLD_SKIPALL, TYP_NONE },
{ NULL }
};
#define LEOFF(f) bitize(offsetof(xfs_attr_leaf_entry_t, f))
const field_t attr_leaf_entry_flds[] = {
{ "hashval", FLDT_UINT32X, OI(LEOFF(hashval)), C1, 0, TYP_NONE },
{ "nameidx", FLDT_UINT16D, OI(LEOFF(nameidx)), C1, 0, TYP_NONE },
{ "flags", FLDT_UINT8X, OI(LEOFF(flags)), C1, FLD_SKIPALL, TYP_NONE },
{ "incomplete", FLDT_UINT1,
OI(LEOFF(flags) + bitsz(__uint8_t) - XFS_ATTR_INCOMPLETE_BIT - 1), C1,
0, TYP_NONE },
{ "root", FLDT_UINT1,
OI(LEOFF(flags) + bitsz(__uint8_t) - XFS_ATTR_ROOT_BIT - 1), C1, 0,
TYP_NONE },
{ "secure", FLDT_UINT1,
OI(LEOFF(flags) + bitsz(__uint8_t) - XFS_ATTR_SECURE_BIT - 1), C1, 0,
TYP_NONE },
{ "local", FLDT_UINT1,
OI(LEOFF(flags) + bitsz(__uint8_t) - XFS_ATTR_LOCAL_BIT - 1), C1, 0,
TYP_NONE },
{ "pad2", FLDT_UINT8X, OI(LEOFF(pad2)), C1, FLD_SKIPALL, TYP_NONE },
{ NULL }
};
#define LHOFF(f) bitize(offsetof(xfs_attr_leaf_hdr_t, f))
const field_t attr_leaf_hdr_flds[] = {
{ "info", FLDT_ATTR_BLKINFO, OI(LHOFF(info)), C1, 0, TYP_NONE },
{ "count", FLDT_UINT16D, OI(LHOFF(count)), C1, 0, TYP_NONE },
{ "usedbytes", FLDT_UINT16D, OI(LHOFF(usedbytes)), C1, 0, TYP_NONE },
{ "firstused", FLDT_UINT16D, OI(LHOFF(firstused)), C1, 0, TYP_NONE },
{ "holes", FLDT_UINT8D, OI(LHOFF(holes)), C1, 0, TYP_NONE },
{ "pad1", FLDT_UINT8X, OI(LHOFF(pad1)), C1, FLD_SKIPALL, TYP_NONE },
{ "freemap", FLDT_ATTR_LEAF_MAP, OI(LHOFF(freemap)),
CI(XFS_ATTR_LEAF_MAPSIZE), FLD_ARRAY, TYP_NONE },
{ NULL }
};
#define LMOFF(f) bitize(offsetof(xfs_attr_leaf_map_t, f))
const field_t attr_leaf_map_flds[] = {
{ "base", FLDT_UINT16D, OI(LMOFF(base)), C1, 0, TYP_NONE },
{ "size", FLDT_UINT16D, OI(LMOFF(size)), C1, 0, TYP_NONE },
{ NULL }
};
#define LNOFF(f) bitize(offsetof(xfs_attr_leaf_name_local_t, f))
#define LVOFF(f) bitize(offsetof(xfs_attr_leaf_name_remote_t, f))
const field_t attr_leaf_name_flds[] = {
{ "valuelen", FLDT_UINT16D, OI(LNOFF(valuelen)),
attr_leaf_name_local_count, FLD_COUNT, TYP_NONE },
{ "namelen", FLDT_UINT8D, OI(LNOFF(namelen)),
attr_leaf_name_local_count, FLD_COUNT, TYP_NONE },
{ "name", FLDT_CHARNS, OI(LNOFF(nameval)),
attr_leaf_name_local_name_count, FLD_COUNT, TYP_NONE },
{ "value", FLDT_CHARNS, attr_leaf_name_local_value_offset,
attr_leaf_name_local_value_count, FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "valueblk", FLDT_UINT32X, OI(LVOFF(valueblk)),
attr_leaf_name_remote_count, FLD_COUNT, TYP_NONE },
{ "valuelen", FLDT_UINT32D, OI(LVOFF(valuelen)),
attr_leaf_name_remote_count, FLD_COUNT, TYP_NONE },
{ "namelen", FLDT_UINT8D, OI(LVOFF(namelen)),
attr_leaf_name_remote_count, FLD_COUNT, TYP_NONE },
{ "name", FLDT_CHARNS, OI(LVOFF(name)),
attr_leaf_name_remote_name_count, FLD_COUNT, TYP_NONE },
{ NULL }
};
#define EOFF(f) bitize(offsetof(xfs_da_node_entry_t, f))
const field_t attr_node_entry_flds[] = {
{ "hashval", FLDT_UINT32X, OI(EOFF(hashval)), C1, 0, TYP_NONE },
{ "before", FLDT_ATTRBLOCK, OI(EOFF(before)), C1, 0, TYP_ATTR },
{ NULL }
};
#define HOFF(f) bitize(offsetof(xfs_da_node_hdr_t, f))
const field_t attr_node_hdr_flds[] = {
{ "info", FLDT_ATTR_BLKINFO, OI(HOFF(info)), C1, 0, TYP_NONE },
{ "count", FLDT_UINT16D, OI(HOFF(__count)), C1, 0, TYP_NONE },
{ "level", FLDT_UINT16D, OI(HOFF(__level)), C1, 0, TYP_NONE },
{ NULL }
};
static int
attr_leaf_entries_count(
void *obj,
int startoff)
{
struct xfs_attr_leafblock *leaf = obj;
ASSERT(startoff == 0);
if (be16_to_cpu(leaf->hdr.info.magic) != XFS_ATTR_LEAF_MAGIC)
return 0;
return be16_to_cpu(leaf->hdr.count);
}
static int
attr3_leaf_entries_count(
void *obj,
int startoff)
{
struct xfs_attr3_leafblock *leaf = obj;
ASSERT(startoff == 0);
if (be16_to_cpu(leaf->hdr.info.hdr.magic) != XFS_ATTR3_LEAF_MAGIC)
return 0;
return be16_to_cpu(leaf->hdr.count);
}
static int
attr_leaf_hdr_count(
void *obj,
int startoff)
{
struct xfs_attr_leafblock *leaf = obj;
ASSERT(startoff == 0);
return be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC;
}
static int
attr3_leaf_hdr_count(
void *obj,
int startoff)
{
struct xfs_attr3_leafblock *leaf = obj;
ASSERT(startoff == 0);
return be16_to_cpu(leaf->hdr.info.hdr.magic) == XFS_ATTR3_LEAF_MAGIC;
}
typedef int (*attr_leaf_entry_walk_f)(struct xfs_attr_leafblock *,
struct xfs_attr_leaf_entry *, int);
static int
attr_leaf_entry_walk(
void *obj,
int startoff,
attr_leaf_entry_walk_f func)
{
struct xfs_attr_leafblock *leaf = obj;
struct xfs_attr3_icleaf_hdr leafhdr;
struct xfs_attr_leaf_entry *entries;
struct xfs_attr_leaf_entry *e;
int i;
int off;
ASSERT(bitoffs(startoff) == 0);
if (be16_to_cpu(leaf->hdr.info.magic) != XFS_ATTR_LEAF_MAGIC &&
be16_to_cpu(leaf->hdr.info.magic) != XFS_ATTR3_LEAF_MAGIC)
return 0;
off = byteize(startoff);
xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &leafhdr, leaf);
entries = xfs_attr3_leaf_entryp(leaf);
for (i = 0; i < leafhdr.count; i++) {
e = &entries[i];
if (be16_to_cpu(e->nameidx) == off)
return func(leaf, e, i);
}
return 0;
}
static int
__attr_leaf_name_local_count(
struct xfs_attr_leafblock *leaf,
struct xfs_attr_leaf_entry *e,
int i)
{
return (e->flags & XFS_ATTR_LOCAL) != 0;
}
static int
attr_leaf_name_local_count(
void *obj,
int startoff)
{
return attr_leaf_entry_walk(obj, startoff,
__attr_leaf_name_local_count);
}
static int
__attr_leaf_name_local_name_count(
struct xfs_attr_leafblock *leaf,
struct xfs_attr_leaf_entry *e,
int i)
{
struct xfs_attr_leaf_name_local *l;
if (!(e->flags & XFS_ATTR_LOCAL))
return 0;
l = xfs_attr3_leaf_name_local(leaf, i);
return l->namelen;
}
static int
attr_leaf_name_local_name_count(
void *obj,
int startoff)
{
return attr_leaf_entry_walk(obj, startoff,
__attr_leaf_name_local_name_count);
}
static int
__attr_leaf_name_local_value_count(
struct xfs_attr_leafblock *leaf,
struct xfs_attr_leaf_entry *e,
int i)
{
struct xfs_attr_leaf_name_local *l;
if (!(e->flags & XFS_ATTR_LOCAL))
return 0;
l = xfs_attr3_leaf_name_local(leaf, i);
return be16_to_cpu(l->valuelen);
}
static int
attr_leaf_name_local_value_count(
void *obj,
int startoff)
{
return attr_leaf_entry_walk(obj, startoff,
__attr_leaf_name_local_value_count);
}
static int
__attr_leaf_name_local_value_offset(
struct xfs_attr_leafblock *leaf,
struct xfs_attr_leaf_entry *e,
int i)
{
struct xfs_attr_leaf_name_local *l;
char *vp;
l = xfs_attr3_leaf_name_local(leaf, i);
vp = (char *)&l->nameval[l->namelen];
return (int)bitize(vp - (char *)l);
}
static int
attr_leaf_name_local_value_offset(
void *obj,
int startoff,
int idx)
{
return attr_leaf_entry_walk(obj, startoff,
__attr_leaf_name_local_value_offset);
}
static int
__attr_leaf_name_remote_count(
struct xfs_attr_leafblock *leaf,
struct xfs_attr_leaf_entry *e,
int i)
{
return (e->flags & XFS_ATTR_LOCAL) == 0;
}
static int
attr_leaf_name_remote_count(
void *obj,
int startoff)
{
return attr_leaf_entry_walk(obj, startoff,
__attr_leaf_name_remote_count);
}
static int
__attr_leaf_name_remote_name_count(
struct xfs_attr_leafblock *leaf,
struct xfs_attr_leaf_entry *e,
int i)
{
struct xfs_attr_leaf_name_remote *r;
if (e->flags & XFS_ATTR_LOCAL)
return 0;
r = xfs_attr3_leaf_name_remote(leaf, i);
return r->namelen;
}
static int
attr_leaf_name_remote_name_count(
void *obj,
int startoff)
{
return attr_leaf_entry_walk(obj, startoff,
__attr_leaf_name_remote_name_count);
}
int
attr_leaf_name_size(
void *obj,
int startoff,
int idx)
{
struct xfs_attr_leafblock *leaf = obj;
struct xfs_attr_leaf_entry *e;
struct xfs_attr_leaf_name_local *l;
struct xfs_attr_leaf_name_remote *r;
ASSERT(startoff == 0);
if (be16_to_cpu(leaf->hdr.info.magic) != XFS_ATTR_LEAF_MAGIC &&
be16_to_cpu(leaf->hdr.info.magic) != XFS_ATTR3_LEAF_MAGIC)
return 0;
e = &xfs_attr3_leaf_entryp(leaf)[idx];
if (e->flags & XFS_ATTR_LOCAL) {
l = xfs_attr3_leaf_name_local(leaf, idx);
return (int)bitize(xfs_attr_leaf_entsize_local(l->namelen,
be16_to_cpu(l->valuelen)));
} else {
r = xfs_attr3_leaf_name_remote(leaf, idx);
return (int)bitize(xfs_attr_leaf_entsize_remote(r->namelen));
}
}
static int
attr_leaf_nvlist_count(
void *obj,
int startoff)
{
struct xfs_attr_leafblock *leaf = obj;
ASSERT(startoff == 0);
if (be16_to_cpu(leaf->hdr.info.magic) != XFS_ATTR_LEAF_MAGIC)
return 0;
return be16_to_cpu(leaf->hdr.count);
}
static int
attr3_leaf_nvlist_count(
void *obj,
int startoff)
{
struct xfs_attr3_leafblock *leaf = obj;
ASSERT(startoff == 0);
if (be16_to_cpu(leaf->hdr.info.hdr.magic) != XFS_ATTR3_LEAF_MAGIC)
return 0;
return be16_to_cpu(leaf->hdr.count);
}
static int
attr_leaf_nvlist_offset(
void *obj,
int startoff,
int idx)
{
struct xfs_attr_leafblock *leaf = obj;
struct xfs_attr_leaf_entry *e;
ASSERT(startoff == 0);
e = &xfs_attr3_leaf_entryp(leaf)[idx];
return bitize(be16_to_cpu(e->nameidx));
}
static int
attr_node_btree_count(
void *obj,
int startoff)
{
struct xfs_da_intnode *node = obj;
ASSERT(startoff == 0); /* this is a base structure */
if (be16_to_cpu(node->hdr.info.magic) != XFS_DA_NODE_MAGIC)
return 0;
return be16_to_cpu(node->hdr.__count);
}
static int
attr3_node_btree_count(
void *obj,
int startoff)
{
struct xfs_da3_intnode *node = obj;
ASSERT(startoff == 0);
if (be16_to_cpu(node->hdr.info.hdr.magic) != XFS_DA3_NODE_MAGIC)
return 0;
return be16_to_cpu(node->hdr.__count);
}
static int
attr_node_hdr_count(
void *obj,
int startoff)
{
struct xfs_da_intnode *node = obj;
ASSERT(startoff == 0);
return be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC;
}
static int
attr3_node_hdr_count(
void *obj,
int startoff)
{
struct xfs_da3_intnode *node = obj;
ASSERT(startoff == 0);
return be16_to_cpu(node->hdr.info.hdr.magic) == XFS_DA3_NODE_MAGIC;
}
int
attr_size(
void *obj,
int startoff,
int idx)
{
return bitize(mp->m_sb.sb_blocksize);
}
/*
* CRC enabled attribute block field definitions
*/
const field_t attr3_hfld[] = {
{ "", FLDT_ATTR3, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
#define L3OFF(f) bitize(offsetof(struct xfs_attr3_leafblock, f))
#define N3OFF(f) bitize(offsetof(struct xfs_da3_intnode, f))
const field_t attr3_flds[] = {
{ "hdr", FLDT_ATTR3_LEAF_HDR, OI(L3OFF(hdr)), attr3_leaf_hdr_count,
FLD_COUNT, TYP_NONE },
{ "hdr", FLDT_DA3_NODE_HDR, OI(N3OFF(hdr)), attr3_node_hdr_count,
FLD_COUNT, TYP_NONE },
{ "entries", FLDT_ATTR_LEAF_ENTRY, OI(L3OFF(entries)),
attr3_leaf_entries_count, FLD_ARRAY|FLD_COUNT, TYP_NONE },
{ "btree", FLDT_ATTR_NODE_ENTRY, OI(N3OFF(__btree)),
attr3_node_btree_count, FLD_ARRAY|FLD_COUNT, TYP_NONE },
{ "nvlist", FLDT_ATTR_LEAF_NAME, attr_leaf_nvlist_offset,
attr3_leaf_nvlist_count, FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ NULL }
};
#define LH3OFF(f) bitize(offsetof(struct xfs_attr3_leaf_hdr, f))
const field_t attr3_leaf_hdr_flds[] = {
{ "info", FLDT_DA3_BLKINFO, OI(LH3OFF(info)), C1, 0, TYP_NONE },
{ "count", FLDT_UINT16D, OI(LH3OFF(count)), C1, 0, TYP_NONE },
{ "usedbytes", FLDT_UINT16D, OI(LH3OFF(usedbytes)), C1, 0, TYP_NONE },
{ "firstused", FLDT_UINT16D, OI(LH3OFF(firstused)), C1, 0, TYP_NONE },
{ "holes", FLDT_UINT8D, OI(LH3OFF(holes)), C1, 0, TYP_NONE },
{ "pad1", FLDT_UINT8X, OI(LH3OFF(pad1)), C1, FLD_SKIPALL, TYP_NONE },
{ "freemap", FLDT_ATTR_LEAF_MAP, OI(LH3OFF(freemap)),
CI(XFS_ATTR_LEAF_MAPSIZE), FLD_ARRAY, TYP_NONE },
{ NULL }
};
/*
* Special read verifier for attribute buffers. Detect the magic number
* appropriately and set the correct verifier and call it.
*/
static void
xfs_attr3_db_read_verify(
struct xfs_buf *bp)
{
__be32 magic32;
__be16 magic16;
magic32 = *(__be32 *)bp->b_addr;
magic16 = ((struct xfs_da_blkinfo *)bp->b_addr)->magic;
switch (magic16) {
case cpu_to_be16(XFS_ATTR3_LEAF_MAGIC):
bp->b_ops = &xfs_attr3_leaf_buf_ops;
goto verify;
case cpu_to_be16(XFS_DA3_NODE_MAGIC):
bp->b_ops = &xfs_da3_node_buf_ops;
goto verify;
default:
break;
}
switch (magic32) {
case cpu_to_be32(XFS_ATTR3_RMT_MAGIC):
bp->b_ops = &xfs_attr3_rmt_buf_ops;
break;
default:
dbprintf(_("Unknown attribute buffer type!\n"));
xfs_buf_ioerror(bp, -EFSCORRUPTED);
return;
}
verify:
bp->b_ops->verify_read(bp);
}
static void
xfs_attr3_db_write_verify(
struct xfs_buf *bp)
{
dbprintf(_("Writing unknown attribute buffer type!\n"));
xfs_buf_ioerror(bp, -EFSCORRUPTED);
}
const struct xfs_buf_ops xfs_attr3_db_buf_ops = {
.name = "xfs_attr3",
.verify_read = xfs_attr3_db_read_verify,
.verify_write = xfs_attr3_db_write_verify,
};
xfsprogs-4.3.0+nmu1ubuntu1.1/db/attr.h 0000664 0000000 0000000 00000002636 12560572026 014344 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern const field_t attr_flds[];
extern const field_t attr_hfld[];
extern const field_t attr_blkinfo_flds[];
extern const field_t attr_leaf_entry_flds[];
extern const field_t attr_leaf_hdr_flds[];
extern const field_t attr_leaf_map_flds[];
extern const field_t attr_leaf_name_flds[];
extern const field_t attr_node_entry_flds[];
extern const field_t attr_node_hdr_flds[];
extern const field_t attr3_flds[];
extern const field_t attr3_hfld[];
extern const field_t attr3_leaf_hdr_flds[];
extern const field_t attr3_node_hdr_flds[];
extern int attr_leaf_name_size(void *obj, int startoff, int idx);
extern int attr_size(void *obj, int startoff, int idx);
extern const struct xfs_buf_ops xfs_attr3_db_buf_ops;
xfsprogs-4.3.0+nmu1ubuntu1.1/db/attrset.c 0000664 0000000 0000000 00000013310 12574431650 015044 0 ustar /*
* Copyright (c) 2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "command.h"
#include "attrset.h"
#include "io.h"
#include "output.h"
#include "type.h"
#include "init.h"
#include "fprint.h"
#include "faddr.h"
#include "field.h"
#include "inode.h"
#include "malloc.h"
static int attr_set_f(int argc, char **argv);
static int attr_remove_f(int argc, char **argv);
static void attrset_help(void);
static const cmdinfo_t attr_set_cmd =
{ "attr_set", "aset", attr_set_f, 1, -1, 0,
N_("[-r|-s|-p|-u] [-n] [-R|-C] [-v n] name"),
N_("set the named attribute on the current inode"), attrset_help };
static const cmdinfo_t attr_remove_cmd =
{ "attr_remove", "aremove", attr_remove_f, 1, -1, 0,
N_("[-r|-s|-p|-u] [-n] name"),
N_("remove the named attribute from the current inode"), attrset_help };
static void
attrset_help(void)
{
dbprintf(_(
"\n"
" The 'attr_set' and 'attr_remove' commands provide interfaces for debugging\n"
" the extended attribute allocation and removal code.\n"
" Both commands require an attribute name to be specified, and the attr_set\n"
" command allows an optional value length (-v) to be provided as well.\n"
" There are 4 namespace flags:\n"
" -r -- 'root'\n"
" -u -- 'user' (default)\n"
" -s -- 'secure'\n"
"\n"
" For attr_set, these options further define the type of set operation:\n"
" -C -- 'create' - create attribute, fail if it already exists\n"
" -R -- 'replace' - replace attribute, fail if it does not exist\n"
" The backward compatibility mode 'noattr2' can be emulated (-n) also.\n"
"\n"));
}
void
attrset_init(void)
{
if (!expert_mode)
return;
add_command(&attr_set_cmd);
add_command(&attr_remove_cmd);
}
static int
attr_set_f(
int argc,
char **argv)
{
xfs_inode_t *ip = NULL;
char *name, *value, *sp;
int c, valuelen = 0, flags = 0;
if (cur_typ == NULL) {
dbprintf(_("no current type\n"));
return 0;
}
if (cur_typ->typnm != TYP_INODE) {
dbprintf(_("current type is not inode\n"));
return 0;
}
while ((c = getopt(argc, argv, "rusCRnv:")) != EOF) {
switch (c) {
/* namespaces */
case 'r':
flags |= LIBXFS_ATTR_ROOT;
flags &= ~LIBXFS_ATTR_SECURE;
break;
case 'u':
flags &= ~(LIBXFS_ATTR_ROOT | LIBXFS_ATTR_SECURE);
break;
case 's':
flags |= LIBXFS_ATTR_SECURE;
flags &= ~LIBXFS_ATTR_ROOT;
break;
/* modifiers */
case 'C':
flags |= LIBXFS_ATTR_CREATE;
break;
case 'R':
flags |= LIBXFS_ATTR_REPLACE;
break;
case 'n':
mp->m_flags |= LIBXFS_MOUNT_COMPAT_ATTR;
break;
/* value length */
case 'v':
valuelen = (int)strtol(optarg, &sp, 0);
if (*sp != '\0' || valuelen < 0 || valuelen > 64*1024) {
dbprintf(_("bad attr_set valuelen %s\n"), optarg);
return 0;
}
break;
default:
dbprintf(_("bad option for attr_set command\n"));
return 0;
}
}
if (optind != argc - 1) {
dbprintf(_("too few options for attr_set (no name given)\n"));
return 0;
}
name = argv[optind];
if (valuelen) {
value = (char *)memalign(getpagesize(), valuelen);
if (!value) {
dbprintf(_("cannot allocate buffer (%d)\n"), valuelen);
goto out;
}
memset(value, 'v', valuelen);
} else {
value = NULL;
}
if (libxfs_iget(mp, NULL, iocur_top->ino, 0, &ip, 0)) {
dbprintf(_("failed to iget inode %llu\n"),
(unsigned long long)iocur_top->ino);
goto out;
}
if (libxfs_attr_set(ip, (unsigned char *)name,
(unsigned char *)value, valuelen, flags)) {
dbprintf(_("failed to set attr %s on inode %llu\n"),
name, (unsigned long long)iocur_top->ino);
goto out;
}
/* refresh with updated inode contents */
set_cur_inode(iocur_top->ino);
out:
mp->m_flags &= ~LIBXFS_MOUNT_COMPAT_ATTR;
if (ip)
IRELE(ip);
if (value)
free(value);
return 0;
}
static int
attr_remove_f(
int argc,
char **argv)
{
xfs_inode_t *ip = NULL;
char *name;
int c, flags = 0;
if (cur_typ == NULL) {
dbprintf(_("no current type\n"));
return 0;
}
if (cur_typ->typnm != TYP_INODE) {
dbprintf(_("current type is not inode\n"));
return 0;
}
while ((c = getopt(argc, argv, "rusn")) != EOF) {
switch (c) {
/* namespaces */
case 'r':
flags |= LIBXFS_ATTR_ROOT;
flags &= ~LIBXFS_ATTR_SECURE;
break;
case 'u':
flags &= ~(LIBXFS_ATTR_ROOT | LIBXFS_ATTR_SECURE);
break;
case 's':
flags |= LIBXFS_ATTR_SECURE;
flags &= ~LIBXFS_ATTR_ROOT;
break;
case 'n':
mp->m_flags |= LIBXFS_MOUNT_COMPAT_ATTR;
break;
default:
dbprintf(_("bad option for attr_remove command\n"));
return 0;
}
}
if (optind != argc - 1) {
dbprintf(_("too few options for attr_remove (no name given)\n"));
return 0;
}
name = argv[optind];
if (libxfs_iget(mp, NULL, iocur_top->ino, 0, &ip, 0)) {
dbprintf(_("failed to iget inode %llu\n"),
(unsigned long long)iocur_top->ino);
goto out;
}
if (libxfs_attr_remove(ip, (unsigned char *)name, flags)) {
dbprintf(_("failed to remove attr %s from inode %llu\n"),
name, (unsigned long long)iocur_top->ino);
goto out;
}
/* refresh with updated inode contents */
set_cur_inode(iocur_top->ino);
out:
mp->m_flags &= ~LIBXFS_MOUNT_COMPAT_ATTR;
if (ip)
IRELE(ip);
return 0;
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/attrset.h 0000664 0000000 0000000 00000001356 12560572026 015056 0 ustar /*
* Copyright (c) 2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void attrset_init(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/attrshort.c 0000664 0000000 0000000 00000010740 12574431650 015414 0 ustar /*
* Copyright (c) 2000-2001,2004-2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "bit.h"
#include "attrshort.h"
static int attr_sf_entry_name_count(void *obj, int startoff);
static int attr_sf_entry_value_count(void *obj, int startoff);
static int attr_sf_entry_value_offset(void *obj, int startoff, int idx);
static int attr_shortform_list_count(void *obj, int startoff);
static int attr_shortform_list_offset(void *obj, int startoff, int idx);
#define OFF(f) bitize(offsetof(xfs_attr_shortform_t, f))
const field_t attr_shortform_flds[] = {
{ "hdr", FLDT_ATTR_SF_HDR, OI(OFF(hdr)), C1, 0, TYP_NONE },
{ "list", FLDT_ATTR_SF_ENTRY, attr_shortform_list_offset,
attr_shortform_list_count, FLD_ARRAY|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ NULL }
};
#define HOFF(f) bitize(offsetof(xfs_attr_sf_hdr_t, f))
const field_t attr_sf_hdr_flds[] = {
{ "totsize", FLDT_UINT16D, OI(HOFF(totsize)), C1, 0, TYP_NONE },
{ "count", FLDT_UINT8D, OI(HOFF(count)), C1, 0, TYP_NONE },
{ NULL }
};
#define EOFF(f) bitize(offsetof(xfs_attr_sf_entry_t, f))
const field_t attr_sf_entry_flds[] = {
{ "namelen", FLDT_UINT8D, OI(EOFF(namelen)), C1, 0, TYP_NONE },
{ "valuelen", FLDT_UINT8D, OI(EOFF(valuelen)), C1, 0, TYP_NONE },
{ "flags", FLDT_UINT8X, OI(EOFF(flags)), C1, FLD_SKIPALL, TYP_NONE },
{ "root", FLDT_UINT1,
OI(EOFF(flags) + bitsz(__uint8_t) - XFS_ATTR_ROOT_BIT - 1), C1, 0,
TYP_NONE },
{ "secure", FLDT_UINT1,
OI(EOFF(flags) + bitsz(__uint8_t) - XFS_ATTR_SECURE_BIT - 1), C1, 0,
TYP_NONE },
{ "name", FLDT_CHARNS, OI(EOFF(nameval)), attr_sf_entry_name_count,
FLD_COUNT, TYP_NONE },
{ "value", FLDT_CHARNS, attr_sf_entry_value_offset,
attr_sf_entry_value_count, FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ NULL }
};
static int
attr_sf_entry_name_count(
void *obj,
int startoff)
{
xfs_attr_sf_entry_t *e;
ASSERT(bitoffs(startoff) == 0);
e = (xfs_attr_sf_entry_t *)((char *)obj + byteize(startoff));
return e->namelen;
}
int
attr_sf_entry_size(
void *obj,
int startoff,
int idx)
{
xfs_attr_sf_entry_t *e;
int i;
xfs_attr_shortform_t *sf;
ASSERT(bitoffs(startoff) == 0);
sf = (xfs_attr_shortform_t *)((char *)obj + byteize(startoff));
e = &sf->list[0];
for (i = 0; i < idx; i++)
e = XFS_ATTR_SF_NEXTENTRY(e);
return bitize((int)XFS_ATTR_SF_ENTSIZE(e));
}
static int
attr_sf_entry_value_count(
void *obj,
int startoff)
{
xfs_attr_sf_entry_t *e;
ASSERT(bitoffs(startoff) == 0);
e = (xfs_attr_sf_entry_t *)((char *)obj + byteize(startoff));
return e->valuelen;
}
/*ARGSUSED*/
static int
attr_sf_entry_value_offset(
void *obj,
int startoff,
int idx)
{
xfs_attr_sf_entry_t *e;
ASSERT(bitoffs(startoff) == 0);
ASSERT(idx == 0);
e = (xfs_attr_sf_entry_t *)((char *)obj + byteize(startoff));
return bitize((int)((char *)&e->nameval[e->namelen] - (char *)e));
}
static int
attr_shortform_list_count(
void *obj,
int startoff)
{
xfs_attr_shortform_t *sf;
ASSERT(bitoffs(startoff) == 0);
sf = (xfs_attr_shortform_t *)((char *)obj + byteize(startoff));
return sf->hdr.count;
}
static int
attr_shortform_list_offset(
void *obj,
int startoff,
int idx)
{
xfs_attr_sf_entry_t *e;
int i;
xfs_attr_shortform_t *sf;
ASSERT(bitoffs(startoff) == 0);
sf = (xfs_attr_shortform_t *)((char *)obj + byteize(startoff));
e = &sf->list[0];
for (i = 0; i < idx; i++)
e = XFS_ATTR_SF_NEXTENTRY(e);
return bitize((int)((char *)e - (char *)sf));
}
/*ARGSUSED*/
int
attrshort_size(
void *obj,
int startoff,
int idx)
{
xfs_attr_sf_entry_t *e;
int i;
xfs_attr_shortform_t *sf;
ASSERT(bitoffs(startoff) == 0);
ASSERT(idx == 0);
sf = (xfs_attr_shortform_t *)((char *)obj + byteize(startoff));
e = &sf->list[0];
for (i = 0; i < sf->hdr.count; i++)
e = XFS_ATTR_SF_NEXTENTRY(e);
return bitize((int)((char *)e - (char *)sf));
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/attrshort.h 0000664 0000000 0000000 00000001776 12560572026 015430 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern const field_t attr_sf_entry_flds[];
extern const field_t attr_sf_hdr_flds[];
extern const field_t attr_shortform_flds[];
extern const field_t attrshort_hfld[];
extern int attr_sf_entry_size(void *obj, int startoff, int idx);
extern int attrshort_size(void *obj, int startoff, int idx);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/bit.c 0000664 0000000 0000000 00000007677 12574431650 014157 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "bit.h"
#undef setbit /* defined in param.h on Linux */
static int getbit(char *ptr, int bit);
static void setbit(char *ptr, int bit, int val);
static int
getbit(
char *ptr,
int bit)
{
int mask;
int shift;
ptr += byteize(bit);
bit = bitoffs(bit);
shift = 7 - bit;
mask = 1 << shift;
return (*ptr & mask) >> shift;
}
static void
setbit(
char *ptr,
int bit,
int val)
{
int mask;
int shift;
ptr += byteize(bit);
bit = bitoffs(bit);
shift = 7 - bit;
mask = (1 << shift);
if (val) {
*ptr |= mask;
} else {
mask = ~mask;
*ptr &= mask;
}
}
__int64_t
getbitval(
void *obj,
int bitoff,
int nbits,
int flags)
{
int bit;
int i;
char *p;
__int64_t rval;
int signext;
int z1, z2, z3, z4;
ASSERT(nbits<=64);
p = (char *)obj + byteize(bitoff);
bit = bitoffs(bitoff);
signext = (flags & BVSIGNED) != 0;
z4 = ((intptr_t)p & 0xf) == 0 && bit == 0;
if (nbits == 64 && z4)
return be64_to_cpu(*(__be64 *)p);
z3 = ((intptr_t)p & 0x7) == 0 && bit == 0;
if (nbits == 32 && z3) {
if (signext)
return (__s32)be32_to_cpu(*(__be32 *)p);
else
return (__u32)be32_to_cpu(*(__be32 *)p);
}
z2 = ((intptr_t)p & 0x3) == 0 && bit == 0;
if (nbits == 16 && z2) {
if (signext)
return (__s16)be16_to_cpu(*(__be16 *)p);
else
return (__u16)be16_to_cpu(*(__be16 *)p);
}
z1 = ((intptr_t)p & 0x1) == 0 && bit == 0;
if (nbits == 8 && z1) {
if (signext)
return *(__s8 *)p;
else
return *(__u8 *)p;
}
for (i = 0, rval = 0LL; i < nbits; i++) {
if (getbit(p, bit + i)) {
/* If the last bit is on and we care about sign
* bits and we don't have a full 64 bit
* container, turn all bits on between the
* sign bit and the most sig bit.
*/
/* handle endian swap here */
#if __BYTE_ORDER == LITTLE_ENDIAN
if (i == 0 && signext && nbits < 64)
rval = -1LL << nbits;
rval |= 1LL << (nbits - i - 1);
#else
if ((i == (nbits - 1)) && signext && nbits < 64)
rval |= (-1LL << nbits);
rval |= 1LL << (nbits - i - 1);
#endif
}
}
return rval;
}
/*
* The input data can be 8, 16, 32, and 64 sized numeric values
* aligned on a byte boundry, or odd sized numbers stored on odd
* aligned offset (for example the bmbt fields).
*
* The input data sent to this routine has been converted to big endian
* and has been adjusted in the array so that the first input bit is to
* be written in the first bit in the output.
*
* If the field length and the output buffer are byte aligned, then use
* memcpy from the input to the output, but if either entries are not byte
* aligned, then loop over the entire bit range reading the input value
* and set/clear the matching bit in the output.
*
* example when ibuf is not multiple of a byte in length:
*
* ibuf: | BBBBBBBB | bbbxxxxx |
* \\\\\\\\--\\\\
* obuf+bitoff: | xBBBBBBB | Bbbbxxxx |
*
*/
void
setbitval(
void *obuf, /* start of buffer to write into */
int bitoff, /* bit offset into the output buffer */
int nbits, /* number of bits to write */
void *ibuf) /* source bits */
{
char *in = ibuf;
char *out = obuf;
int bit;
if (bitoff % NBBY || nbits % NBBY) {
for (bit = 0; bit < nbits; bit++)
setbit(out, bit + bitoff, getbit(in, bit));
} else
memcpy(out + byteize(bitoff), in, byteize(nbits));
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/bit.h 0000664 0000000 0000000 00000002106 12560572026 014140 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define bitize(s) ((s) * NBBY)
#define bitsz(t) bitize(sizeof(t))
#define bitszof(x,y) bitize(szof(x,y))
#define byteize(s) ((s) / NBBY)
#define bitoffs(s) ((s) % NBBY)
#define BVUNSIGNED 0
#define BVSIGNED 1
extern __int64_t getbitval(void *obj, int bitoff, int nbits, int flags);
extern void setbitval(void *obuf, int bitoff, int nbits, void *ibuf);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/block.c 0000664 0000000 0000000 00000014731 12574431650 014460 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "block.h"
#include "bmap.h"
#include "command.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "inode.h"
#include "io.h"
#include "output.h"
#include "init.h"
static int ablock_f(int argc, char **argv);
static void ablock_help(void);
static int daddr_f(int argc, char **argv);
static void daddr_help(void);
static int dblock_f(int argc, char **argv);
static void dblock_help(void);
static int fsblock_f(int argc, char **argv);
static void fsblock_help(void);
static void print_rawdata(void *data, int len);
static const cmdinfo_t ablock_cmd =
{ "ablock", NULL, ablock_f, 1, 1, 1, N_("filoff"),
N_("set address to file offset (attr fork)"), ablock_help };
static const cmdinfo_t daddr_cmd =
{ "daddr", NULL, daddr_f, 0, 1, 1, N_("[d]"),
N_("set address to daddr value"), daddr_help };
static const cmdinfo_t dblock_cmd =
{ "dblock", NULL, dblock_f, 1, 1, 1, N_("filoff"),
N_("set address to file offset (data fork)"), dblock_help };
static const cmdinfo_t fsblock_cmd =
{ "fsblock", "fsb", fsblock_f, 0, 1, 1, N_("[fsb]"),
N_("set address to fsblock value"), fsblock_help };
static void
ablock_help(void)
{
dbprintf(_(
"\n Example:\n"
"\n"
" 'ablock 23' - sets the file position to the 23rd filesystem block in\n"
" the inode's attribute fork. The filesystem block size is specified in\n"
" the superblock.\n\n"
));
}
/*ARGSUSED*/
static int
ablock_f(
int argc,
char **argv)
{
bmap_ext_t bm;
xfs_fileoff_t bno;
xfs_fsblock_t dfsbno;
int haveattr;
int nex;
char *p;
bno = (xfs_fileoff_t)strtoull(argv[1], &p, 0);
if (*p != '\0') {
dbprintf(_("bad block number %s\n"), argv[1]);
return 0;
}
push_cur();
set_cur_inode(iocur_top->ino);
haveattr = XFS_DFORK_Q((xfs_dinode_t *)iocur_top->data);
pop_cur();
if (!haveattr) {
dbprintf(_("no attribute data for file\n"));
return 0;
}
nex = 1;
bmap(bno, 1, XFS_ATTR_FORK, &nex, &bm);
if (nex == 0) {
dbprintf(_("file attr block is unmapped\n"));
return 0;
}
dfsbno = bm.startblock + (bno - bm.startoff);
ASSERT(typtab[TYP_ATTR].typnm == TYP_ATTR);
set_cur(&typtab[TYP_ATTR], (__int64_t)XFS_FSB_TO_DADDR(mp, dfsbno),
blkbb, DB_RING_ADD, NULL);
return 0;
}
void
block_init(void)
{
add_command(&ablock_cmd);
add_command(&daddr_cmd);
add_command(&dblock_cmd);
add_command(&fsblock_cmd);
}
static void
daddr_help(void)
{
dbprintf(_(
"\n Example:\n"
"\n"
" 'daddr 102' - sets position to the 102nd absolute disk block\n"
" (512 byte block).\n"
));
}
static int
daddr_f(
int argc,
char **argv)
{
__int64_t d;
char *p;
if (argc == 1) {
dbprintf(_("current daddr is %lld\n"), iocur_top->off >> BBSHIFT);
return 0;
}
d = (__int64_t)strtoull(argv[1], &p, 0);
if (*p != '\0' ||
d >= mp->m_sb.sb_dblocks << (mp->m_sb.sb_blocklog - BBSHIFT)) {
dbprintf(_("bad daddr %s\n"), argv[1]);
return 0;
}
ASSERT(typtab[TYP_DATA].typnm == TYP_DATA);
set_cur(&typtab[TYP_DATA], d, 1, DB_RING_ADD, NULL);
return 0;
}
static void
dblock_help(void)
{
dbprintf(_(
"\n Example:\n"
"\n"
" 'dblock 23' - sets the file position to the 23rd filesystem block in\n"
" the inode's data fork. The filesystem block size is specified in the\n"
" superblock.\n\n"
));
}
static int
dblock_f(
int argc,
char **argv)
{
bbmap_t bbmap;
bmap_ext_t *bmp;
xfs_fileoff_t bno;
xfs_fsblock_t dfsbno;
int nb;
int nex;
char *p;
typnm_t type;
bno = (xfs_fileoff_t)strtoull(argv[1], &p, 0);
if (*p != '\0') {
dbprintf(_("bad block number %s\n"), argv[1]);
return 0;
}
push_cur();
set_cur_inode(iocur_top->ino);
type = inode_next_type();
pop_cur();
if (type == TYP_NONE) {
dbprintf(_("no type for file data\n"));
return 0;
}
nex = nb = type == TYP_DIR2 ? mp->m_dir_geo->fsbcount : 1;
bmp = malloc(nb * sizeof(*bmp));
bmap(bno, nb, XFS_DATA_FORK, &nex, bmp);
if (nex == 0) {
dbprintf(_("file data block is unmapped\n"));
free(bmp);
return 0;
}
dfsbno = bmp->startblock + (bno - bmp->startoff);
ASSERT(typtab[type].typnm == type);
if (nex > 1)
make_bbmap(&bbmap, nex, bmp);
set_cur(&typtab[type], (__int64_t)XFS_FSB_TO_DADDR(mp, dfsbno),
nb * blkbb, DB_RING_ADD, nex > 1 ? &bbmap : NULL);
free(bmp);
return 0;
}
static void
fsblock_help(void)
{
dbprintf(_(
"\n Example:\n"
"\n"
" 'fsblock 1023' - sets the file position to the 1023rd filesystem block.\n"
" The filesystem block size is specified in the superblock and set during\n"
" mkfs time. Offset is absolute (not AG relative).\n\n"
));
}
static int
fsblock_f(
int argc,
char **argv)
{
xfs_agblock_t agbno;
xfs_agnumber_t agno;
xfs_fsblock_t d;
char *p;
if (argc == 1) {
dbprintf(_("current fsblock is %lld\n"),
XFS_DADDR_TO_FSB(mp, iocur_top->off >> BBSHIFT));
return 0;
}
d = strtoull(argv[1], &p, 0);
if (*p != '\0') {
dbprintf(_("bad fsblock %s\n"), argv[1]);
return 0;
}
agno = XFS_FSB_TO_AGNO(mp, d);
agbno = XFS_FSB_TO_AGBNO(mp, d);
if (agno >= mp->m_sb.sb_agcount || agbno >= mp->m_sb.sb_agblocks) {
dbprintf(_("bad fsblock %s\n"), argv[1]);
return 0;
}
ASSERT(typtab[TYP_DATA].typnm == TYP_DATA);
set_cur(&typtab[TYP_DATA], XFS_AGB_TO_DADDR(mp, agno, agbno),
blkbb, DB_RING_ADD, NULL);
return 0;
}
void
print_block(
const field_t *fields,
int argc,
char **argv)
{
print_rawdata(iocur_top->data, iocur_top->len);
}
static void
print_rawdata(
void *data,
int len)
{
int i;
int j;
int lastaddr;
int offchars;
unsigned char *p;
lastaddr = (len - 1) & ~(32 - 1);
if (lastaddr < 0x10)
offchars = 1;
else if (lastaddr < 0x100)
offchars = 2;
else if (lastaddr < 0x1000)
offchars = 3;
else
offchars = 4;
for (i = 0, p = data; i < len; i += 32) {
dbprintf("%-0*.*x:", offchars, offchars, i);
for (j = 0; j < 32 && i + j < len; j++, p++) {
if ((j & 3) == 0)
dbprintf(" ");
dbprintf("%02x", *p);
}
dbprintf("\n");
}
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/block.h 0000664 0000000 0000000 00000001521 12560572026 014454 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
struct field;
extern void block_init(void);
extern void print_block(const struct field *fields, int argc, char **argv);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/bmap.c 0000664 0000000 0000000 00000016461 12574431650 014307 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "command.h"
#include "type.h"
#include "fprint.h"
#include "faddr.h"
#include "field.h"
#include "bmap.h"
#include "io.h"
#include "inode.h"
#include "output.h"
#include "init.h"
static int bmap_f(int argc, char **argv);
static int bmap_one_extent(xfs_bmbt_rec_t *ep,
xfs_fileoff_t *offp, xfs_fileoff_t eoff,
int *idxp, bmap_ext_t *bep);
static xfs_fsblock_t select_child(xfs_fileoff_t off, xfs_bmbt_key_t *kp,
xfs_bmbt_ptr_t *pp, int nrecs);
static const cmdinfo_t bmap_cmd =
{ "bmap", NULL, bmap_f, 0, 3, 0, N_("[-ad] [block [len]]"),
N_("show block map for current file"), NULL };
void
bmap(
xfs_fileoff_t offset,
xfs_filblks_t len,
int whichfork,
int *nexp,
bmap_ext_t *bep)
{
struct xfs_btree_block *block;
xfs_fsblock_t bno;
xfs_fileoff_t curoffset;
xfs_dinode_t *dip;
xfs_fileoff_t eoffset;
xfs_bmbt_rec_t *ep;
xfs_dinode_fmt_t fmt;
int fsize;
xfs_bmbt_key_t *kp;
int n;
int nex;
xfs_fsblock_t nextbno;
int nextents;
xfs_bmbt_ptr_t *pp;
xfs_bmdr_block_t *rblock;
typnm_t typ;
xfs_bmbt_rec_t *xp;
push_cur();
set_cur_inode(iocur_top->ino);
nex = *nexp;
*nexp = 0;
ASSERT(nex > 0);
dip = iocur_top->data;
n = 0;
eoffset = offset + len - 1;
curoffset = offset;
fmt = (xfs_dinode_fmt_t)XFS_DFORK_FORMAT(dip, whichfork);
typ = whichfork == XFS_DATA_FORK ? TYP_BMAPBTD : TYP_BMAPBTA;
ASSERT(typtab[typ].typnm == typ);
ASSERT(fmt == XFS_DINODE_FMT_LOCAL || fmt == XFS_DINODE_FMT_EXTENTS ||
fmt == XFS_DINODE_FMT_BTREE);
if (fmt == XFS_DINODE_FMT_EXTENTS) {
nextents = XFS_DFORK_NEXTENTS(dip, whichfork);
xp = (xfs_bmbt_rec_t *)XFS_DFORK_PTR(dip, whichfork);
for (ep = xp; ep < &xp[nextents] && n < nex; ep++) {
if (!bmap_one_extent(ep, &curoffset, eoffset, &n, bep))
break;
}
} else if (fmt == XFS_DINODE_FMT_BTREE) {
push_cur();
rblock = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork);
fsize = XFS_DFORK_SIZE(dip, mp, whichfork);
pp = XFS_BMDR_PTR_ADDR(rblock, 1, xfs_bmdr_maxrecs(fsize, 0));
kp = XFS_BMDR_KEY_ADDR(rblock, 1);
bno = select_child(curoffset, kp, pp,
be16_to_cpu(rblock->bb_numrecs));
for (;;) {
set_cur(&typtab[typ], XFS_FSB_TO_DADDR(mp, bno),
blkbb, DB_RING_IGN, NULL);
block = (struct xfs_btree_block *)iocur_top->data;
if (be16_to_cpu(block->bb_level) == 0)
break;
pp = XFS_BMBT_PTR_ADDR(mp, block, 1,
xfs_bmbt_maxrecs(mp, mp->m_sb.sb_blocksize, 0));
kp = XFS_BMBT_KEY_ADDR(mp, block, 1);
bno = select_child(curoffset, kp, pp,
be16_to_cpu(block->bb_numrecs));
}
for (;;) {
nextbno = be64_to_cpu(block->bb_u.l.bb_rightsib);
nextents = be16_to_cpu(block->bb_numrecs);
xp = (xfs_bmbt_rec_t *)
XFS_BMBT_REC_ADDR(mp, block, 1);
for (ep = xp; ep < &xp[nextents] && n < nex; ep++) {
if (!bmap_one_extent(ep, &curoffset, eoffset,
&n, bep)) {
nextbno = NULLFSBLOCK;
break;
}
}
bno = nextbno;
if (bno == NULLFSBLOCK)
break;
set_cur(&typtab[typ], XFS_FSB_TO_DADDR(mp, bno),
blkbb, DB_RING_IGN, NULL);
block = (struct xfs_btree_block *)iocur_top->data;
}
pop_cur();
}
pop_cur();
*nexp = n;
}
static int
bmap_f(
int argc,
char **argv)
{
int afork = 0;
bmap_ext_t be;
int c;
xfs_fileoff_t co, cosave;
int dfork = 0;
xfs_dinode_t *dip;
xfs_fileoff_t eo;
xfs_filblks_t len;
int nex;
char *p;
int whichfork;
if (iocur_top->ino == NULLFSINO) {
dbprintf(_("no current inode\n"));
return 0;
}
optind = 0;
if (argc) while ((c = getopt(argc, argv, "ad")) != EOF) {
switch (c) {
case 'a':
afork = 1;
break;
case 'd':
dfork = 1;
break;
default:
dbprintf(_("bad option for bmap command\n"));
return 0;
}
}
if (afork + dfork == 0) {
push_cur();
set_cur_inode(iocur_top->ino);
dip = iocur_top->data;
if (be32_to_cpu(dip->di_nextents))
dfork = 1;
if (be16_to_cpu(dip->di_anextents))
afork = 1;
pop_cur();
}
if (optind < argc) {
co = (xfs_fileoff_t)strtoull(argv[optind], &p, 0);
if (*p != '\0') {
dbprintf(_("bad block number for bmap %s\n"),
argv[optind]);
return 0;
}
optind++;
if (optind < argc) {
len = (xfs_filblks_t)strtoull(argv[optind], &p, 0);
if (*p != '\0') {
dbprintf(_("bad len for bmap %s\n"), argv[optind]);
return 0;
}
eo = co + len - 1;
} else
eo = co;
} else {
co = 0;
eo = -1;
}
cosave = co;
for (whichfork = XFS_DATA_FORK;
whichfork <= XFS_ATTR_FORK;
whichfork++) {
if (whichfork == XFS_DATA_FORK && !dfork)
continue;
if (whichfork == XFS_ATTR_FORK && !afork)
continue;
for (;;) {
nex = 1;
bmap(co, eo - co + 1, whichfork, &nex, &be);
if (nex == 0)
break;
dbprintf(_("%s offset %lld startblock %llu (%u/%u) count "
"%llu flag %u\n"),
whichfork == XFS_DATA_FORK ? _("data") : _("attr"),
be.startoff, be.startblock,
XFS_FSB_TO_AGNO(mp, be.startblock),
XFS_FSB_TO_AGBNO(mp, be.startblock),
be.blockcount, be.flag);
co = be.startoff + be.blockcount;
}
co = cosave;
}
return 0;
}
void
bmap_init(void)
{
add_command(&bmap_cmd);
}
static int
bmap_one_extent(
xfs_bmbt_rec_t *ep,
xfs_fileoff_t *offp,
xfs_fileoff_t eoff,
int *idxp,
bmap_ext_t *bep)
{
xfs_filblks_t c;
xfs_fileoff_t curoffset;
int f;
int idx;
xfs_fileoff_t o;
xfs_fsblock_t s;
convert_extent(ep, &o, &s, &c, &f);
curoffset = *offp;
idx = *idxp;
if (o + c <= curoffset)
return 1;
if (o > eoff)
return 0;
if (o < curoffset) {
c -= curoffset - o;
s += curoffset - o;
o = curoffset;
}
if (o + c - 1 > eoff)
c -= (o + c - 1) - eoff;
bep[idx].startoff = o;
bep[idx].startblock = s;
bep[idx].blockcount = c;
bep[idx].flag = f;
*idxp = idx + 1;
*offp = o + c;
return 1;
}
void
convert_extent(
xfs_bmbt_rec_t *rp,
xfs_fileoff_t *op,
xfs_fsblock_t *sp,
xfs_filblks_t *cp,
int *fp)
{
struct xfs_bmbt_irec irec;
libxfs_bmbt_disk_get_all(rp, &irec);
*fp = irec.br_state == XFS_EXT_UNWRITTEN;
*op = irec.br_startoff;
*sp = irec.br_startblock;
*cp = irec.br_blockcount;
}
void
make_bbmap(
bbmap_t *bbmap,
int nex,
bmap_ext_t *bmp)
{
int i;
for (i = 0; i < nex; i++) {
bbmap->b[i].bm_bn = XFS_FSB_TO_DADDR(mp, bmp[i].startblock);
bbmap->b[i].bm_len = XFS_FSB_TO_BB(mp, bmp[i].blockcount);
}
bbmap->nmaps = nex;
}
static xfs_fsblock_t
select_child(
xfs_fileoff_t off,
xfs_bmbt_key_t *kp,
xfs_bmbt_ptr_t *pp,
int nrecs)
{
int i;
for (i = 0; i < nrecs; i++) {
if (be64_to_cpu(kp[i].br_startoff) == off)
return be64_to_cpu(pp[i]);
if (be64_to_cpu(kp[i].br_startoff) > off) {
if (i == 0)
return be64_to_cpu(pp[i]);
else
return be64_to_cpu(pp[i - 1]);
}
}
return be64_to_cpu(pp[nrecs - 1]);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/bmap.h 0000664 0000000 0000000 00000002322 12574431650 014303 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
struct bbmap;
struct xfs_bmbt_rec;
typedef struct bmap_ext {
xfs_fileoff_t startoff;
xfs_fsblock_t startblock;
xfs_filblks_t blockcount;
int flag;
} bmap_ext_t;
extern void bmap(xfs_fileoff_t offset, xfs_filblks_t len, int whichfork,
int *nexp, bmap_ext_t *bep);
extern void bmap_init(void);
extern void convert_extent(struct xfs_bmbt_rec *rp, xfs_fileoff_t *op,
xfs_fsblock_t *sp, xfs_filblks_t *cp, int *fp);
extern void make_bbmap(struct bbmap *bbmap, int nex, bmap_ext_t *bmp);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/bmroot.c 0000664 0000000 0000000 00000015226 12574431650 014670 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "bmroot.h"
#include "io.h"
#include "print.h"
#include "bit.h"
#include "init.h"
static int bmroota_key_count(void *obj, int startoff);
static int bmroota_key_offset(void *obj, int startoff, int idx);
static int bmroota_ptr_count(void *obj, int startoff);
static int bmroota_ptr_offset(void *obj, int startoff, int idx);
static int bmrootd_key_count(void *obj, int startoff);
static int bmrootd_key_offset(void *obj, int startoff, int idx);
static int bmrootd_ptr_count(void *obj, int startoff);
static int bmrootd_ptr_offset(void *obj, int startoff, int idx);
#define OFF(f) bitize(offsetof(xfs_bmdr_block_t, bb_ ## f))
const field_t bmroota_flds[] = {
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
{ "keys", FLDT_BMROOTAKEY, bmroota_key_offset, bmroota_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "ptrs", FLDT_BMROOTAPTR, bmroota_ptr_offset, bmroota_ptr_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_BMAPBTA },
{ NULL }
};
const field_t bmrootd_flds[] = {
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
{ "keys", FLDT_BMROOTDKEY, bmrootd_key_offset, bmrootd_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "ptrs", FLDT_BMROOTDPTR, bmrootd_ptr_offset, bmrootd_ptr_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_BMAPBTD },
{ NULL }
};
#define KOFF(f) bitize(offsetof(xfs_bmdr_key_t, br_ ## f))
const field_t bmroota_key_flds[] = {
{ "startoff", FLDT_DFILOFFA, OI(KOFF(startoff)), C1, 0, TYP_NONE },
{ NULL }
};
const field_t bmrootd_key_flds[] = {
{ "startoff", FLDT_DFILOFFD, OI(KOFF(startoff)), C1, 0, TYP_NONE },
{ NULL }
};
static int
bmroota_key_count(
void *obj,
int startoff)
{
xfs_bmdr_block_t *block;
#ifdef DEBUG
xfs_dinode_t *dip = obj;
#endif
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
block = (xfs_bmdr_block_t *)((char *)obj + byteize(startoff));
ASSERT(XFS_DFORK_Q(dip) && (char *)block == XFS_DFORK_APTR(dip));
ASSERT(be16_to_cpu(block->bb_level) > 0);
return be16_to_cpu(block->bb_numrecs);
}
static int
bmroota_key_offset(
void *obj,
int startoff,
int idx)
{
xfs_bmdr_block_t *block;
#ifdef DEBUG
xfs_dinode_t *dip = obj;
#endif
xfs_bmdr_key_t *kp;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
block = (xfs_bmdr_block_t *)((char *)obj + byteize(startoff));
ASSERT(XFS_DFORK_Q(dip) && (char *)block == XFS_DFORK_APTR(dip));
ASSERT(be16_to_cpu(block->bb_level) > 0);
kp = XFS_BMDR_KEY_ADDR(block, idx);
return bitize((int)((char *)kp - (char *)block));
}
static int
bmroota_ptr_count(
void *obj,
int startoff)
{
xfs_bmdr_block_t *block;
#ifdef DEBUG
xfs_dinode_t *dip = obj;
#endif
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
block = (xfs_bmdr_block_t *)((char *)obj + byteize(startoff));
ASSERT(XFS_DFORK_Q(dip) && (char *)block == XFS_DFORK_APTR(dip));
ASSERT(be16_to_cpu(block->bb_level) > 0);
return be16_to_cpu(block->bb_numrecs);
}
static int
bmroota_ptr_offset(
void *obj,
int startoff,
int idx)
{
xfs_bmdr_block_t *block;
xfs_dinode_t *dip;
xfs_bmdr_ptr_t *pp;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
dip = obj;
block = (xfs_bmdr_block_t *)((char *)obj + byteize(startoff));
ASSERT(XFS_DFORK_Q(dip) && (char *)block == XFS_DFORK_APTR(dip));
ASSERT(be16_to_cpu(block->bb_level) > 0);
pp = XFS_BMDR_PTR_ADDR(block, idx,
xfs_bmdr_maxrecs(XFS_DFORK_ASIZE(dip, mp), 0));
return bitize((int)((char *)pp - (char *)block));
}
int
bmroota_size(
void *obj,
int startoff,
int idx)
{
xfs_dinode_t *dip;
#ifdef DEBUG
xfs_bmdr_block_t *block;
#endif
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
ASSERT(idx == 0);
dip = obj;
#ifdef DEBUG
block = (xfs_bmdr_block_t *)((char *)obj + byteize(startoff));
ASSERT(XFS_DFORK_Q(dip) && (char *)block == XFS_DFORK_APTR(dip));
#endif
return bitize((int)XFS_DFORK_ASIZE(dip, mp));
}
static int
bmrootd_key_count(
void *obj,
int startoff)
{
xfs_bmdr_block_t *block;
#ifdef DEBUG
xfs_dinode_t *dip = obj;
#endif
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
block = (xfs_bmdr_block_t *)((char *)obj + byteize(startoff));
ASSERT((char *)block == XFS_DFORK_DPTR(dip));
ASSERT(be16_to_cpu(block->bb_level) > 0);
return be16_to_cpu(block->bb_numrecs);
}
static int
bmrootd_key_offset(
void *obj,
int startoff,
int idx)
{
xfs_bmdr_block_t *block;
xfs_bmdr_key_t *kp;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
block = (xfs_bmdr_block_t *)((char *)obj + byteize(startoff));
ASSERT(be16_to_cpu(block->bb_level) > 0);
kp = XFS_BMDR_KEY_ADDR(block, idx);
return bitize((int)((char *)kp - (char *)block));
}
static int
bmrootd_ptr_count(
void *obj,
int startoff)
{
xfs_bmdr_block_t *block;
#ifdef DEBUG
xfs_dinode_t *dip = obj;
#endif
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
block = (xfs_bmdr_block_t *)((char *)obj + byteize(startoff));
ASSERT((char *)block == XFS_DFORK_DPTR(dip));
ASSERT(be16_to_cpu(block->bb_level) > 0);
return be16_to_cpu(block->bb_numrecs);
}
static int
bmrootd_ptr_offset(
void *obj,
int startoff,
int idx)
{
xfs_bmdr_block_t *block;
xfs_bmdr_ptr_t *pp;
xfs_dinode_t *dip;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
dip = obj;
block = (xfs_bmdr_block_t *)((char *)obj + byteize(startoff));
ASSERT(be16_to_cpu(block->bb_level) > 0);
pp = XFS_BMDR_PTR_ADDR(block, idx,
xfs_bmdr_maxrecs(XFS_DFORK_DSIZE(dip, mp), 0));
return bitize((int)((char *)pp - (char *)block));
}
int
bmrootd_size(
void *obj,
int startoff,
int idx)
{
xfs_dinode_t *dip;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
ASSERT(idx == 0);
dip = obj;
return bitize((int)XFS_DFORK_DSIZE(dip, mp));
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/bmroot.h 0000664 0000000 0000000 00000001777 12560572026 014701 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern const struct field bmroota_flds[];
extern const struct field bmroota_key_flds[];
extern const struct field bmrootd_flds[];
extern const struct field bmrootd_key_flds[];
extern int bmroota_size(void *obj, int startoff, int idx);
extern int bmrootd_size(void *obj, int startoff, int idx);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/btblock.c 0000664 0000000 0000000 00000047100 12574431650 015002 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "btblock.h"
#include "print.h"
#include "bit.h"
#include "init.h"
/*
* Definition of the possible btree block layouts.
*/
struct xfs_db_btree {
uint32_t magic;
size_t block_len;
size_t key_len;
size_t rec_len;
size_t ptr_len;
} btrees[] = {
{ XFS_BMAP_MAGIC,
XFS_BTREE_LBLOCK_LEN,
sizeof(xfs_bmbt_key_t),
sizeof(xfs_bmbt_rec_t),
sizeof(__be64),
},
{ XFS_ABTB_MAGIC,
XFS_BTREE_SBLOCK_LEN,
sizeof(xfs_alloc_key_t),
sizeof(xfs_alloc_rec_t),
sizeof(__be32),
},
{ XFS_ABTC_MAGIC,
XFS_BTREE_SBLOCK_LEN,
sizeof(xfs_alloc_key_t),
sizeof(xfs_alloc_rec_t),
sizeof(__be32),
},
{ XFS_IBT_MAGIC,
XFS_BTREE_SBLOCK_LEN,
sizeof(xfs_inobt_key_t),
sizeof(xfs_inobt_rec_t),
sizeof(__be32),
},
{ XFS_FIBT_MAGIC,
XFS_BTREE_SBLOCK_LEN,
sizeof(xfs_inobt_key_t),
sizeof(xfs_inobt_rec_t),
sizeof(__be32),
},
{ XFS_BMAP_CRC_MAGIC,
XFS_BTREE_LBLOCK_CRC_LEN,
sizeof(xfs_bmbt_key_t),
sizeof(xfs_bmbt_rec_t),
sizeof(__be64),
},
{ XFS_ABTB_CRC_MAGIC,
XFS_BTREE_SBLOCK_CRC_LEN,
sizeof(xfs_alloc_key_t),
sizeof(xfs_alloc_rec_t),
sizeof(__be32),
},
{ XFS_ABTC_CRC_MAGIC,
XFS_BTREE_SBLOCK_CRC_LEN,
sizeof(xfs_alloc_key_t),
sizeof(xfs_alloc_rec_t),
sizeof(__be32),
},
{ XFS_IBT_CRC_MAGIC,
XFS_BTREE_SBLOCK_CRC_LEN,
sizeof(xfs_inobt_key_t),
sizeof(xfs_inobt_rec_t),
sizeof(__be32),
},
{ XFS_FIBT_CRC_MAGIC,
XFS_BTREE_SBLOCK_CRC_LEN,
sizeof(xfs_inobt_key_t),
sizeof(xfs_inobt_rec_t),
sizeof(__be32),
},
{ 0,
},
};
/*
* Find the right block defintion for a given ondisk block.
*
* We use the least significant bit of the magic number as index into
* the array of block defintions.
*/
static struct xfs_db_btree *
block_to_bt(
struct xfs_btree_block *bb)
{
struct xfs_db_btree *btp = &btrees[0];
do {
if (be32_to_cpu((bb)->bb_magic) == btp->magic)
return btp;
btp++;
} while (btp->magic != 0);
return NULL;
}
/* calculate max records. Only for non-leaves. */
static int
btblock_maxrecs(struct xfs_db_btree *bt, int blocksize)
{
blocksize -= bt->block_len;
return blocksize / (bt->key_len + bt->ptr_len);
}
/*
* Get the number of keys in a btree block.
*
* Note: can also be used to get the number of ptrs because there are
* always the same number of keys and ptrs in a block.
*/
static int
btblock_key_count(
void *obj,
int startoff)
{
struct xfs_btree_block *block = obj;
ASSERT(startoff == 0);
if (block->bb_level == 0)
return 0;
return be16_to_cpu(block->bb_numrecs);
}
/*
* Get the number of keys in a btree block.
*/
static int
btblock_rec_count(
void *obj,
int startoff)
{
struct xfs_btree_block *block = obj;
ASSERT(startoff == 0);
if (block->bb_level != 0)
return 0;
return be16_to_cpu(block->bb_numrecs);
}
/*
* Get the offset of the key at idx in a btree block.
*/
static int
btblock_key_offset(
void *obj,
int startoff,
int idx)
{
struct xfs_btree_block *block = obj;
struct xfs_db_btree *bt = block_to_bt(block);
int offset;
ASSERT(startoff == 0);
ASSERT(block->bb_level != 0);
offset = bt->block_len + (idx - 1) * bt->key_len;
return bitize(offset);
}
/*
* Get the offset of the ptr at idx in a btree block.
*/
static int
btblock_ptr_offset(
void *obj,
int startoff,
int idx)
{
struct xfs_btree_block *block = obj;
struct xfs_db_btree *bt = block_to_bt(block);
int offset;
int maxrecs;
ASSERT(startoff == 0);
ASSERT(block->bb_level != 0);
maxrecs = btblock_maxrecs(bt, mp->m_sb.sb_blocksize);
offset = bt->block_len +
maxrecs * bt->key_len +
(idx - 1) * bt->ptr_len;
return bitize(offset);
}
/*
* Get the offset of the record at idx in a btree block.
*/
static int
btblock_rec_offset(
void *obj,
int startoff,
int idx)
{
struct xfs_btree_block *block = obj;
struct xfs_db_btree *bt = block_to_bt(block);
int offset;
ASSERT(startoff == 0);
ASSERT(block->bb_level == 0);
offset = bt->block_len + (idx - 1) * bt->rec_len;
return bitize(offset);
}
/*
* Get the size of a btree block.
*/
int
btblock_size(
void *obj,
int startoff,
int idx)
{
return bitize(mp->m_sb.sb_blocksize);
}
/*
* Bmap btree.
*/
const field_t bmapbta_hfld[] = {
{ "", FLDT_BMAPBTA, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
const field_t bmapbtd_hfld[] = {
{ "", FLDT_BMAPBTD, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
const field_t bmapbta_crc_hfld[] = {
{ "", FLDT_BMAPBTA_CRC, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
const field_t bmapbtd_crc_hfld[] = {
{ "", FLDT_BMAPBTD_CRC, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
#define OFF(f) bitize(offsetof(struct xfs_btree_block, bb_ ## f))
const field_t bmapbta_flds[] = {
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
{ "leftsib", FLDT_DFSBNO, OI(OFF(u.l.bb_leftsib)), C1, 0, TYP_BMAPBTA },
{ "rightsib", FLDT_DFSBNO, OI(OFF(u.l.bb_rightsib)), C1, 0, TYP_BMAPBTA },
{ "recs", FLDT_BMAPBTAREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_BMAPBTAKEY, btblock_key_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "ptrs", FLDT_BMAPBTAPTR, btblock_ptr_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_BMAPBTA },
{ NULL }
};
const field_t bmapbtd_flds[] = {
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
{ "leftsib", FLDT_DFSBNO, OI(OFF(u.l.bb_leftsib)), C1, 0, TYP_BMAPBTD },
{ "rightsib", FLDT_DFSBNO, OI(OFF(u.l.bb_rightsib)), C1, 0, TYP_BMAPBTD },
{ "recs", FLDT_BMAPBTDREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_BMAPBTDKEY, btblock_key_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "ptrs", FLDT_BMAPBTDPTR, btblock_ptr_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_BMAPBTD },
{ NULL }
};
/* crc enabled versions */
const field_t bmapbta_crc_flds[] = {
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
{ "leftsib", FLDT_DFSBNO, OI(OFF(u.l.bb_leftsib)), C1, 0, TYP_BMAPBTA },
{ "rightsib", FLDT_DFSBNO, OI(OFF(u.l.bb_rightsib)), C1, 0, TYP_BMAPBTA },
{ "bno", FLDT_DFSBNO, OI(OFF(u.l.bb_blkno)), C1, 0, TYP_BMAPBTD },
{ "lsn", FLDT_UINT64X, OI(OFF(u.l.bb_lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(u.l.bb_uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_INO, OI(OFF(u.l.bb_owner)), C1, 0, TYP_NONE },
{ "crc", FLDT_CRC, OI(OFF(u.l.bb_crc)), C1, 0, TYP_NONE },
{ "recs", FLDT_BMAPBTAREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_BMAPBTAKEY, btblock_key_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "ptrs", FLDT_BMAPBTAPTR, btblock_ptr_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_BMAPBTA },
{ NULL }
};
const field_t bmapbtd_crc_flds[] = {
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
{ "leftsib", FLDT_DFSBNO, OI(OFF(u.l.bb_leftsib)), C1, 0, TYP_BMAPBTD },
{ "rightsib", FLDT_DFSBNO, OI(OFF(u.l.bb_rightsib)), C1, 0, TYP_BMAPBTD },
{ "bno", FLDT_DFSBNO, OI(OFF(u.l.bb_blkno)), C1, 0, TYP_BMAPBTD },
{ "lsn", FLDT_UINT64X, OI(OFF(u.l.bb_lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(u.l.bb_uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_INO, OI(OFF(u.l.bb_owner)), C1, 0, TYP_NONE },
{ "crc", FLDT_CRC, OI(OFF(u.l.bb_crc)), C1, 0, TYP_NONE },
{ "recs", FLDT_BMAPBTDREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_BMAPBTDKEY, btblock_key_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "ptrs", FLDT_BMAPBTDPTR, btblock_ptr_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_BMAPBTD },
{ NULL }
};
#undef OFF
#define KOFF(f) bitize(offsetof(xfs_bmbt_key_t, br_ ## f))
const field_t bmapbta_key_flds[] = {
{ "startoff", FLDT_DFILOFFA, OI(KOFF(startoff)), C1, 0, TYP_ATTR },
{ NULL }
};
const field_t bmapbtd_key_flds[] = {
{ "startoff", FLDT_DFILOFFD, OI(KOFF(startoff)), C1, 0, TYP_INODATA },
{ NULL }
};
#undef KOFF
#define BMBT_EXNTFLAG_BITOFF 0
#define BMBT_STARTOFF_BITOFF (BMBT_EXNTFLAG_BITOFF + BMBT_EXNTFLAG_BITLEN)
#define BMBT_STARTBLOCK_BITOFF (BMBT_STARTOFF_BITOFF + BMBT_STARTOFF_BITLEN)
#define BMBT_BLOCKCOUNT_BITOFF \
(BMBT_STARTBLOCK_BITOFF + BMBT_STARTBLOCK_BITLEN)
const field_t bmapbta_rec_flds[] = {
{ "startoff", FLDT_CFILEOFFA, OI(BMBT_STARTOFF_BITOFF), C1, 0,
TYP_ATTR },
{ "startblock", FLDT_CFSBLOCK, OI(BMBT_STARTBLOCK_BITOFF), C1, 0,
TYP_ATTR },
{ "blockcount", FLDT_CEXTLEN, OI(BMBT_BLOCKCOUNT_BITOFF), C1, 0,
TYP_NONE },
{ "extentflag", FLDT_CEXTFLG, OI(BMBT_EXNTFLAG_BITOFF), C1, 0,
TYP_NONE },
{ NULL }
};
const field_t bmapbtd_rec_flds[] = {
{ "startoff", FLDT_CFILEOFFD, OI(BMBT_STARTOFF_BITOFF), C1, 0,
TYP_INODATA },
{ "startblock", FLDT_CFSBLOCK, OI(BMBT_STARTBLOCK_BITOFF), C1, 0,
TYP_INODATA },
{ "blockcount", FLDT_CEXTLEN, OI(BMBT_BLOCKCOUNT_BITOFF), C1, 0,
TYP_NONE },
{ "extentflag", FLDT_CEXTFLG, OI(BMBT_EXNTFLAG_BITOFF), C1, 0,
TYP_NONE },
{ NULL }
};
/*
* Inode allocation btree.
*/
const field_t inobt_hfld[] = {
{ "", FLDT_INOBT, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
const field_t inobt_crc_hfld[] = {
{ "", FLDT_INOBT_CRC, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
const field_t inobt_spcrc_hfld[] = {
{ "", FLDT_INOBT_SPCRC, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
#define OFF(f) bitize(offsetof(struct xfs_btree_block, bb_ ## f))
const field_t inobt_flds[] = {
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
{ "leftsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_leftsib)), C1, 0, TYP_INOBT },
{ "rightsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_rightsib)), C1, 0, TYP_INOBT },
{ "recs", FLDT_INOBTREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_INOBTKEY, btblock_key_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "ptrs", FLDT_INOBTPTR, btblock_ptr_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_INOBT },
{ NULL }
};
const field_t inobt_crc_flds[] = {
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
{ "leftsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_leftsib)), C1, 0, TYP_INOBT },
{ "rightsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_rightsib)), C1, 0, TYP_INOBT },
{ "bno", FLDT_DFSBNO, OI(OFF(u.s.bb_blkno)), C1, 0, TYP_INOBT },
{ "lsn", FLDT_UINT64X, OI(OFF(u.s.bb_lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(u.s.bb_uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_AGNUMBER, OI(OFF(u.s.bb_owner)), C1, 0, TYP_NONE },
{ "crc", FLDT_CRC, OI(OFF(u.s.bb_crc)), C1, 0, TYP_NONE },
{ "recs", FLDT_INOBTREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_INOBTKEY, btblock_key_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "ptrs", FLDT_INOBTPTR, btblock_ptr_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_INOBT },
{ NULL }
};
const field_t inobt_spcrc_flds[] = {
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
{ "leftsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_leftsib)), C1, 0, TYP_INOBT },
{ "rightsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_rightsib)), C1, 0, TYP_INOBT },
{ "bno", FLDT_DFSBNO, OI(OFF(u.s.bb_blkno)), C1, 0, TYP_INOBT },
{ "lsn", FLDT_UINT64X, OI(OFF(u.s.bb_lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(u.s.bb_uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_AGNUMBER, OI(OFF(u.s.bb_owner)), C1, 0, TYP_NONE },
{ "crc", FLDT_CRC, OI(OFF(u.s.bb_crc)), C1, 0, TYP_NONE },
{ "recs", FLDT_INOBTSPREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_INOBTKEY, btblock_key_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "ptrs", FLDT_INOBTPTR, btblock_ptr_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_INOBT },
{ NULL }
};
#undef OFF
#define KOFF(f) bitize(offsetof(xfs_inobt_key_t, ir_ ## f))
const field_t inobt_key_flds[] = {
{ "startino", FLDT_AGINO, OI(KOFF(startino)), C1, 0, TYP_INODE },
{ NULL }
};
#undef KOFF
#define ROFF(f) bitize(offsetof(xfs_inobt_rec_t, f))
const field_t inobt_rec_flds[] = {
{ "startino", FLDT_AGINO, OI(ROFF(ir_startino)), C1, 0, TYP_INODE },
{ "freecount", FLDT_INT32D, OI(ROFF(ir_u.f.ir_freecount)), C1, 0, TYP_NONE },
{ "free", FLDT_INOFREE, OI(ROFF(ir_free)), C1, 0, TYP_NONE },
{ NULL }
};
/* sparse inode on-disk format */
const field_t inobt_sprec_flds[] = {
{ "startino", FLDT_AGINO, OI(ROFF(ir_startino)), C1, 0, TYP_INODE },
{ "holemask", FLDT_UINT16X, OI(ROFF(ir_u.sp.ir_holemask)), C1, 0,
TYP_NONE },
{ "count", FLDT_UINT8D, OI(ROFF(ir_u.sp.ir_count)), C1, 0, TYP_NONE },
{ "freecount", FLDT_INT8D, OI(ROFF(ir_u.sp.ir_freecount)), C1, 0,
TYP_NONE },
{ "free", FLDT_INOFREE, OI(ROFF(ir_free)), C1, 0, TYP_NONE },
{ NULL }
};
#undef ROFF
/*
* Allocation btrees.
*/
const field_t bnobt_hfld[] = {
{ "", FLDT_BNOBT, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
const field_t bnobt_crc_hfld[] = {
{ "", FLDT_BNOBT_CRC, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
#define OFF(f) bitize(offsetof(struct xfs_btree_block, bb_ ## f))
const field_t bnobt_flds[] = {
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
{ "leftsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_leftsib)), C1, 0, TYP_BNOBT },
{ "rightsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_rightsib)), C1, 0, TYP_BNOBT },
{ "recs", FLDT_BNOBTREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_BNOBTKEY, btblock_key_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "ptrs", FLDT_BNOBTPTR, btblock_ptr_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_BNOBT },
{ NULL }
};
const field_t bnobt_crc_flds[] = {
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
{ "leftsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_leftsib)), C1, 0, TYP_BNOBT },
{ "rightsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_rightsib)), C1, 0, TYP_BNOBT },
{ "bno", FLDT_DFSBNO, OI(OFF(u.s.bb_blkno)), C1, 0, TYP_BNOBT },
{ "lsn", FLDT_UINT64X, OI(OFF(u.s.bb_lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(u.s.bb_uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_AGNUMBER, OI(OFF(u.s.bb_owner)), C1, 0, TYP_NONE },
{ "crc", FLDT_CRC, OI(OFF(u.s.bb_crc)), C1, 0, TYP_NONE },
{ "recs", FLDT_BNOBTREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_BNOBTKEY, btblock_key_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "ptrs", FLDT_BNOBTPTR, btblock_ptr_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_BNOBT },
{ NULL }
};
#undef OFF
#define KOFF(f) bitize(offsetof(xfs_alloc_key_t, ar_ ## f))
const field_t bnobt_key_flds[] = {
{ "startblock", FLDT_AGBLOCK, OI(KOFF(startblock)), C1, 0, TYP_DATA },
{ "blockcount", FLDT_EXTLEN, OI(KOFF(blockcount)), C1, 0, TYP_NONE },
{ NULL }
};
#undef KOFF
#define ROFF(f) bitize(offsetof(xfs_alloc_rec_t, ar_ ## f))
const field_t bnobt_rec_flds[] = {
{ "startblock", FLDT_AGBLOCK, OI(ROFF(startblock)), C1, 0, TYP_DATA },
{ "blockcount", FLDT_EXTLEN, OI(ROFF(blockcount)), C1, 0, TYP_NONE },
{ NULL }
};
#undef ROFF
const field_t cntbt_hfld[] = {
{ "", FLDT_CNTBT, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
const field_t cntbt_crc_hfld[] = {
{ "", FLDT_CNTBT_CRC, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
#define OFF(f) bitize(offsetof(struct xfs_btree_block, bb_ ## f))
const field_t cntbt_flds[] = {
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
{ "leftsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_leftsib)), C1, 0, TYP_CNTBT },
{ "rightsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_rightsib)), C1, 0, TYP_CNTBT },
{ "recs", FLDT_CNTBTREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_CNTBTKEY, btblock_key_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "ptrs", FLDT_CNTBTPTR, btblock_ptr_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_CNTBT },
{ NULL }
};
const field_t cntbt_crc_flds[] = {
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
{ "leftsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_leftsib)), C1, 0, TYP_CNTBT },
{ "rightsib", FLDT_AGBLOCK, OI(OFF(u.s.bb_rightsib)), C1, 0, TYP_CNTBT },
{ "bno", FLDT_DFSBNO, OI(OFF(u.s.bb_blkno)), C1, 0, TYP_CNTBT },
{ "lsn", FLDT_UINT64X, OI(OFF(u.s.bb_lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(u.s.bb_uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_AGNUMBER, OI(OFF(u.s.bb_owner)), C1, 0, TYP_NONE },
{ "crc", FLDT_CRC, OI(OFF(u.s.bb_crc)), C1, 0, TYP_NONE },
{ "recs", FLDT_CNTBTREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_CNTBTKEY, btblock_key_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "ptrs", FLDT_CNTBTPTR, btblock_ptr_offset, btblock_key_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_CNTBT },
{ NULL }
};
#undef OFF
#define KOFF(f) bitize(offsetof(xfs_alloc_key_t, ar_ ## f))
const field_t cntbt_key_flds[] = {
{ "blockcount", FLDT_EXTLEN, OI(KOFF(blockcount)), C1, 0, TYP_NONE },
{ "startblock", FLDT_AGBLOCK, OI(KOFF(startblock)), C1, 0, TYP_DATA },
{ NULL }
};
#undef KOFF
#define ROFF(f) bitize(offsetof(xfs_alloc_rec_t, ar_ ## f))
const field_t cntbt_rec_flds[] = {
{ "startblock", FLDT_AGBLOCK, OI(ROFF(startblock)), C1, 0, TYP_DATA },
{ "blockcount", FLDT_EXTLEN, OI(ROFF(blockcount)), C1, 0, TYP_NONE },
{ NULL }
};
#undef ROFF
xfsprogs-4.3.0+nmu1ubuntu1.1/db/btblock.h 0000664 0000000 0000000 00000004272 12574431650 015012 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern const struct field bmapbta_flds[];
extern const struct field bmapbta_hfld[];
extern const struct field bmapbta_crc_flds[];
extern const struct field bmapbta_crc_hfld[];
extern const struct field bmapbta_key_flds[];
extern const struct field bmapbta_rec_flds[];
extern const struct field bmapbtd_flds[];
extern const struct field bmapbtd_hfld[];
extern const struct field bmapbtd_crc_flds[];
extern const struct field bmapbtd_crc_hfld[];
extern const struct field bmapbtd_key_flds[];
extern const struct field bmapbtd_rec_flds[];
extern const struct field inobt_flds[];
extern const struct field inobt_hfld[];
extern const struct field inobt_crc_flds[];
extern const struct field inobt_spcrc_flds[];
extern const struct field inobt_crc_hfld[];
extern const struct field inobt_spcrc_hfld[];
extern const struct field inobt_key_flds[];
extern const struct field inobt_rec_flds[];
extern const struct field inobt_sprec_flds[];
extern const struct field bnobt_flds[];
extern const struct field bnobt_hfld[];
extern const struct field bnobt_crc_flds[];
extern const struct field bnobt_crc_hfld[];
extern const struct field bnobt_key_flds[];
extern const struct field bnobt_rec_flds[];
extern const struct field cntbt_flds[];
extern const struct field cntbt_hfld[];
extern const struct field cntbt_crc_flds[];
extern const struct field cntbt_crc_hfld[];
extern const struct field cntbt_key_flds[];
extern const struct field cntbt_rec_flds[];
extern int btblock_size(void *obj, int startoff, int idx);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/check.c 0000664 0000000 0000000 00000340537 12625713771 014455 0 ustar /*
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include
#include
#include "bmap.h"
#include "check.h"
#include "command.h"
#include "io.h"
#include "type.h"
#include "fprint.h"
#include "faddr.h"
#include "field.h"
#include "sb.h"
#include "output.h"
#include "init.h"
#include "malloc.h"
#include "dir2.h"
typedef enum {
IS_USER_QUOTA, IS_PROJECT_QUOTA, IS_GROUP_QUOTA,
} qtype_t;
typedef enum {
DBM_UNKNOWN, DBM_AGF, DBM_AGFL, DBM_AGI,
DBM_ATTR, DBM_BTBMAPA, DBM_BTBMAPD, DBM_BTBNO,
DBM_BTCNT, DBM_BTINO, DBM_DATA, DBM_DIR,
DBM_FREE1, DBM_FREE2, DBM_FREELIST, DBM_INODE,
DBM_LOG, DBM_MISSING, DBM_QUOTA, DBM_RTBITMAP,
DBM_RTDATA, DBM_RTFREE, DBM_RTSUM, DBM_SB,
DBM_SYMLINK, DBM_BTFINO,
DBM_NDBM
} dbm_t;
typedef struct inodata {
struct inodata *next;
nlink_t link_set;
nlink_t link_add;
char isdir;
char security;
char ilist;
xfs_ino_t ino;
struct inodata *parent;
char *name;
} inodata_t;
#define MIN_INODATA_HASH_SIZE 256
#define MAX_INODATA_HASH_SIZE 65536
#define INODATA_AVG_HASH_LENGTH 8
typedef struct qinfo {
xfs_qcnt_t bc;
xfs_qcnt_t ic;
xfs_qcnt_t rc;
} qinfo_t;
#define QDATA_HASH_SIZE 256
typedef struct qdata {
struct qdata *next;
xfs_dqid_t id;
qinfo_t count;
qinfo_t dq;
} qdata_t;
typedef struct blkent {
xfs_fileoff_t startoff;
int nblks;
xfs_fsblock_t blks[1];
} blkent_t;
#define BLKENT_SIZE(n) \
(offsetof(blkent_t, blks) + (sizeof(xfs_fsblock_t) * (n)))
typedef struct blkmap {
int naents;
int nents;
blkent_t *ents[1];
} blkmap_t;
#define BLKMAP_SIZE(n) \
(offsetof(blkmap_t, ents) + (sizeof(blkent_t *) * (n)))
typedef struct freetab {
int naents;
int nents;
xfs_dir2_data_off_t ents[1];
} freetab_t;
#define FREETAB_SIZE(n) \
(offsetof(freetab_t, ents) + (sizeof(xfs_dir2_data_off_t) * (n)))
typedef struct dirhash {
struct dirhash *next;
__u32 hashval;
__u32 address;
int seen;
} dirhash_t;
#define DIR_HASH_SIZE 1024
#define DIR_HASH_FUNC(h,a) (((h) ^ (a)) % DIR_HASH_SIZE)
static xfs_extlen_t agffreeblks;
static xfs_extlen_t agflongest;
static __uint64_t agf_aggr_freeblks; /* aggregate count over all */
static __uint32_t agfbtreeblks;
static int lazycount;
static xfs_agino_t agicount;
static xfs_agino_t agifreecount;
static xfs_fsblock_t *blist;
static int blist_size;
static char **dbmap; /* really dbm_t:8 */
static dirhash_t **dirhash;
static int error;
static __uint64_t fdblocks;
static __uint64_t frextents;
static __uint64_t icount;
static __uint64_t ifree;
static inodata_t ***inodata;
static int inodata_hash_size;
static inodata_t ***inomap;
static int nflag;
static int pflag;
static int tflag;
static qdata_t **qpdata;
static int qpdo;
static qdata_t **qudata;
static int qudo;
static qdata_t **qgdata;
static int qgdo;
static unsigned sbversion;
static int sbver_err;
static int serious_error;
static int sflag;
static xfs_suminfo_t *sumcompute;
static xfs_suminfo_t *sumfile;
static const char *typename[] = {
"unknown",
"agf",
"agfl",
"agi",
"attr",
"btbmapa",
"btbmapd",
"btbno",
"btcnt",
"btino",
"data",
"dir",
"free1",
"free2",
"freelist",
"inode",
"log",
"missing",
"quota",
"rtbitmap",
"rtdata",
"rtfree",
"rtsum",
"sb",
"symlink",
"btfino",
NULL
};
static int verbose;
#define CHECK_BLIST(b) (blist_size && check_blist(b))
#define CHECK_BLISTA(a,b) \
(blist_size && check_blist(XFS_AGB_TO_FSB(mp, a, b)))
typedef void (*scan_lbtree_f_t)(struct xfs_btree_block *block,
int level,
dbm_t type,
xfs_fsblock_t bno,
inodata_t *id,
xfs_rfsblock_t *totd,
xfs_rfsblock_t *toti,
xfs_extnum_t *nex,
blkmap_t **blkmapp,
int isroot,
typnm_t btype);
typedef void (*scan_sbtree_f_t)(struct xfs_btree_block *block,
int level,
xfs_agf_t *agf,
xfs_agblock_t bno,
int isroot);
static void add_blist(xfs_fsblock_t bno);
static void add_ilist(xfs_ino_t ino);
static void addlink_inode(inodata_t *id);
static void addname_inode(inodata_t *id, char *name, int namelen);
static void addparent_inode(inodata_t *id, xfs_ino_t parent);
static void blkent_append(blkent_t **entp, xfs_fsblock_t b,
xfs_extlen_t c);
static blkent_t *blkent_new(xfs_fileoff_t o, xfs_fsblock_t b,
xfs_extlen_t c);
static void blkent_prepend(blkent_t **entp, xfs_fsblock_t b,
xfs_extlen_t c);
static blkmap_t *blkmap_alloc(xfs_extnum_t);
static void blkmap_free(blkmap_t *blkmap);
static xfs_fsblock_t blkmap_get(blkmap_t *blkmap, xfs_fileoff_t o);
static int blkmap_getn(blkmap_t *blkmap, xfs_fileoff_t o, int nb,
bmap_ext_t **bmpp);
static void blkmap_grow(blkmap_t **blkmapp, blkent_t **entp,
blkent_t *newent);
static xfs_fileoff_t blkmap_next_off(blkmap_t *blkmap, xfs_fileoff_t o,
int *t);
static void blkmap_set_blk(blkmap_t **blkmapp, xfs_fileoff_t o,
xfs_fsblock_t b);
static void blkmap_set_ext(blkmap_t **blkmapp, xfs_fileoff_t o,
xfs_fsblock_t b, xfs_extlen_t c);
static void blkmap_shrink(blkmap_t *blkmap, blkent_t **entp);
static int blockfree_f(int argc, char **argv);
static int blockget_f(int argc, char **argv);
static int blocktrash_f(int argc, char **argv);
static int blockuse_f(int argc, char **argv);
static int check_blist(xfs_fsblock_t bno);
static void check_dbmap(xfs_agnumber_t agno, xfs_agblock_t agbno,
xfs_extlen_t len, dbm_t type);
static int check_inomap(xfs_agnumber_t agno, xfs_agblock_t agbno,
xfs_extlen_t len, xfs_ino_t c_ino);
static void check_linkcounts(xfs_agnumber_t agno);
static int check_range(xfs_agnumber_t agno, xfs_agblock_t agbno,
xfs_extlen_t len);
static void check_rdbmap(xfs_rfsblock_t bno, xfs_extlen_t len,
dbm_t type);
static int check_rinomap(xfs_rfsblock_t bno, xfs_extlen_t len,
xfs_ino_t c_ino);
static void check_rootdir(void);
static int check_rrange(xfs_rfsblock_t bno, xfs_extlen_t len);
static void check_set_dbmap(xfs_agnumber_t agno,
xfs_agblock_t agbno, xfs_extlen_t len,
dbm_t type1, dbm_t type2,
xfs_agnumber_t c_agno,
xfs_agblock_t c_agbno);
static void check_set_rdbmap(xfs_rfsblock_t bno, xfs_extlen_t len,
dbm_t type1, dbm_t type2);
static void check_summary(void);
static void checknot_dbmap(xfs_agnumber_t agno, xfs_agblock_t agbno,
xfs_extlen_t len, int typemask);
static void checknot_rdbmap(xfs_rfsblock_t bno, xfs_extlen_t len,
int typemask);
static void dir_hash_add(xfs_dahash_t hash,
xfs_dir2_dataptr_t addr);
static void dir_hash_check(inodata_t *id, int v);
static void dir_hash_done(void);
static void dir_hash_init(void);
static int dir_hash_see(xfs_dahash_t hash,
xfs_dir2_dataptr_t addr);
static inodata_t *find_inode(xfs_ino_t ino, int add);
static void free_inodata(xfs_agnumber_t agno);
static int init(int argc, char **argv);
static char *inode_name(xfs_ino_t ino, inodata_t **ipp);
static int ncheck_f(int argc, char **argv);
static char *prepend_path(char *oldpath, char *parent);
static xfs_ino_t process_block_dir_v2(blkmap_t *blkmap, int *dot,
int *dotdot, inodata_t *id);
static void process_bmbt_reclist(xfs_bmbt_rec_t *rp, int numrecs,
dbm_t type, inodata_t *id,
xfs_rfsblock_t *tot,
blkmap_t **blkmapp);
static void process_btinode(inodata_t *id, xfs_dinode_t *dip,
dbm_t type, xfs_rfsblock_t *totd,
xfs_rfsblock_t *toti, xfs_extnum_t *nex,
blkmap_t **blkmapp, int whichfork);
static xfs_ino_t process_data_dir_v2(int *dot, int *dotdot,
inodata_t *id, int v,
xfs_dablk_t dabno,
freetab_t **freetabp);
static xfs_dir2_data_free_t *process_data_dir_v2_freefind(
struct xfs_dir2_data_hdr *data,
struct xfs_dir2_data_unused *dup);
static void process_dir(xfs_dinode_t *dip, blkmap_t *blkmap,
inodata_t *id);
static int process_dir_v2(xfs_dinode_t *dip, blkmap_t *blkmap,
int *dot, int *dotdot, inodata_t *id,
xfs_ino_t *parent);
static void process_exinode(inodata_t *id, xfs_dinode_t *dip,
dbm_t type, xfs_rfsblock_t *totd,
xfs_rfsblock_t *toti, xfs_extnum_t *nex,
blkmap_t **blkmapp, int whichfork);
static void process_inode(xfs_agf_t *agf, xfs_agino_t agino,
xfs_dinode_t *dip, int isfree);
static void process_lclinode(inodata_t *id, xfs_dinode_t *dip,
dbm_t type, xfs_rfsblock_t *totd,
xfs_rfsblock_t *toti, xfs_extnum_t *nex,
blkmap_t **blkmapp, int whichfork);
static xfs_ino_t process_leaf_node_dir_v2(blkmap_t *blkmap, int *dot,
int *dotdot, inodata_t *id,
xfs_fsize_t dirsize);
static void process_leaf_node_dir_v2_free(inodata_t *id, int v,
xfs_dablk_t dbno,
freetab_t *freetab);
static void process_leaf_node_dir_v2_int(inodata_t *id, int v,
xfs_dablk_t dbno,
freetab_t *freetab);
static void process_quota(qtype_t qtype, inodata_t *id,
blkmap_t *blkmap);
static void process_rtbitmap(blkmap_t *blkmap);
static void process_rtsummary(blkmap_t *blkmap);
static xfs_ino_t process_sf_dir_v2(xfs_dinode_t *dip, int *dot,
int *dotdot, inodata_t *id);
static void quota_add(xfs_dqid_t *p, xfs_dqid_t *g, xfs_dqid_t *u,
int dq, xfs_qcnt_t bc, xfs_qcnt_t ic,
xfs_qcnt_t rc);
static void quota_add1(qdata_t **qt, xfs_dqid_t id, int dq,
xfs_qcnt_t bc, xfs_qcnt_t ic,
xfs_qcnt_t rc);
static void quota_check(char *s, qdata_t **qt);
static void quota_init(void);
static void scan_ag(xfs_agnumber_t agno);
static void scan_freelist(xfs_agf_t *agf);
static void scan_lbtree(xfs_fsblock_t root, int nlevels,
scan_lbtree_f_t func, dbm_t type,
inodata_t *id, xfs_rfsblock_t *totd,
xfs_rfsblock_t *toti, xfs_extnum_t *nex,
blkmap_t **blkmapp, int isroot,
typnm_t btype);
static void scan_sbtree(xfs_agf_t *agf, xfs_agblock_t root,
int nlevels, int isroot,
scan_sbtree_f_t func, typnm_t btype);
static void scanfunc_bmap(struct xfs_btree_block *block,
int level, dbm_t type, xfs_fsblock_t bno,
inodata_t *id, xfs_rfsblock_t *totd,
xfs_rfsblock_t *toti, xfs_extnum_t *nex,
blkmap_t **blkmapp, int isroot,
typnm_t btype);
static void scanfunc_bno(struct xfs_btree_block *block, int level,
xfs_agf_t *agf, xfs_agblock_t bno,
int isroot);
static void scanfunc_cnt(struct xfs_btree_block *block, int level,
xfs_agf_t *agf, xfs_agblock_t bno,
int isroot);
static void scanfunc_ino(struct xfs_btree_block *block, int level,
xfs_agf_t *agf, xfs_agblock_t bno,
int isroot);
static void scanfunc_fino(struct xfs_btree_block *block, int level,
struct xfs_agf *agf, xfs_agblock_t bno,
int isroot);
static void set_dbmap(xfs_agnumber_t agno, xfs_agblock_t agbno,
xfs_extlen_t len, dbm_t type,
xfs_agnumber_t c_agno, xfs_agblock_t c_agbno);
static void set_inomap(xfs_agnumber_t agno, xfs_agblock_t agbno,
xfs_extlen_t len, inodata_t *id);
static void set_rdbmap(xfs_rfsblock_t bno, xfs_extlen_t len,
dbm_t type);
static void set_rinomap(xfs_rfsblock_t bno, xfs_extlen_t len,
inodata_t *id);
static void setlink_inode(inodata_t *id, nlink_t nlink, int isdir,
int security);
static const cmdinfo_t blockfree_cmd =
{ "blockfree", NULL, blockfree_f, 0, 0, 0,
NULL, N_("free block usage information"), NULL };
static const cmdinfo_t blockget_cmd =
{ "blockget", "check", blockget_f, 0, -1, 0,
N_("[-s|-v] [-n] [-t] [-b bno]... [-i ino] ..."),
N_("get block usage and check consistency"), NULL };
static const cmdinfo_t blocktrash_cmd =
{ "blocktrash", NULL, blocktrash_f, 0, -1, 0,
N_("[-n count] [-x minlen] [-y maxlen] [-s seed] [-0123] [-t type] ..."),
N_("trash randomly selected block(s)"), NULL };
static const cmdinfo_t blockuse_cmd =
{ "blockuse", NULL, blockuse_f, 0, 3, 0,
N_("[-n] [-c blockcount]"),
N_("print usage for current block(s)"), NULL };
static const cmdinfo_t ncheck_cmd =
{ "ncheck", NULL, ncheck_f, 0, -1, 0,
N_("[-s] [-i ino] ..."),
N_("print inode-name pairs"), NULL };
static void
add_blist(
xfs_fsblock_t bno)
{
blist_size++;
blist = xrealloc(blist, blist_size * sizeof(bno));
blist[blist_size - 1] = bno;
}
static void
add_ilist(
xfs_ino_t ino)
{
inodata_t *id;
id = find_inode(ino, 1);
if (id == NULL) {
dbprintf(_("-i %lld bad inode number\n"), ino);
return;
}
id->ilist = 1;
}
static void
addlink_inode(
inodata_t *id)
{
id->link_add++;
if (verbose || id->ilist)
dbprintf(_("inode %lld add link, now %u\n"), id->ino,
id->link_add);
}
static void
addname_inode(
inodata_t *id,
char *name,
int namelen)
{
if (!nflag || id->name)
return;
id->name = xmalloc(namelen + 1);
memcpy(id->name, name, namelen);
id->name[namelen] = '\0';
}
static void
addparent_inode(
inodata_t *id,
xfs_ino_t parent)
{
inodata_t *pid;
pid = find_inode(parent, 1);
id->parent = pid;
if (verbose || id->ilist || (pid && pid->ilist))
dbprintf(_("inode %lld parent %lld\n"), id->ino, parent);
}
static void
blkent_append(
blkent_t **entp,
xfs_fsblock_t b,
xfs_extlen_t c)
{
blkent_t *ent;
int i;
ent = *entp;
*entp = ent = xrealloc(ent, BLKENT_SIZE(c + ent->nblks));
for (i = 0; i < c; i++)
ent->blks[ent->nblks + i] = b + i;
ent->nblks += c;
}
static blkent_t *
blkent_new(
xfs_fileoff_t o,
xfs_fsblock_t b,
xfs_extlen_t c)
{
blkent_t *ent;
int i;
ent = xmalloc(BLKENT_SIZE(c));
ent->nblks = c;
ent->startoff = o;
for (i = 0; i < c; i++)
ent->blks[i] = b + i;
return ent;
}
static void
blkent_prepend(
blkent_t **entp,
xfs_fsblock_t b,
xfs_extlen_t c)
{
int i;
blkent_t *newent;
blkent_t *oldent;
oldent = *entp;
newent = xmalloc(BLKENT_SIZE(oldent->nblks + c));
newent->nblks = oldent->nblks + c;
newent->startoff = oldent->startoff - c;
for (i = 0; i < c; i++)
newent->blks[i] = b + c;
for (; i < oldent->nblks + c; i++)
newent->blks[i] = oldent->blks[i - c];
xfree(oldent);
*entp = newent;
}
static blkmap_t *
blkmap_alloc(
xfs_extnum_t nex)
{
blkmap_t *blkmap;
if (nex < 1)
nex = 1;
blkmap = xmalloc(BLKMAP_SIZE(nex));
blkmap->naents = nex;
blkmap->nents = 0;
return blkmap;
}
static void
blkmap_free(
blkmap_t *blkmap)
{
blkent_t **entp;
xfs_extnum_t i;
for (i = 0, entp = blkmap->ents; i < blkmap->nents; i++, entp++)
xfree(*entp);
xfree(blkmap);
}
static xfs_fsblock_t
blkmap_get(
blkmap_t *blkmap,
xfs_fileoff_t o)
{
blkent_t *ent;
blkent_t **entp;
int i;
for (i = 0, entp = blkmap->ents; i < blkmap->nents; i++, entp++) {
ent = *entp;
if (o >= ent->startoff && o < ent->startoff + ent->nblks)
return ent->blks[o - ent->startoff];
}
return NULLFSBLOCK;
}
static int
blkmap_getn(
blkmap_t *blkmap,
xfs_fileoff_t o,
int nb,
bmap_ext_t **bmpp)
{
bmap_ext_t *bmp;
blkent_t *ent;
xfs_fileoff_t ento;
blkent_t **entp;
int i;
int nex;
for (i = nex = 0, bmp = NULL, entp = blkmap->ents;
i < blkmap->nents;
i++, entp++) {
ent = *entp;
if (ent->startoff >= o + nb)
break;
if (ent->startoff + ent->nblks <= o)
continue;
for (ento = ent->startoff;
ento < ent->startoff + ent->nblks && ento < o + nb;
ento++) {
if (ento < o)
continue;
if (bmp &&
bmp[nex - 1].startoff + bmp[nex - 1].blockcount ==
ento &&
bmp[nex - 1].startblock + bmp[nex - 1].blockcount ==
ent->blks[ento - ent->startoff])
bmp[nex - 1].blockcount++;
else {
bmp = realloc(bmp, ++nex * sizeof(*bmp));
bmp[nex - 1].startoff = ento;
bmp[nex - 1].startblock =
ent->blks[ento - ent->startoff];
bmp[nex - 1].blockcount = 1;
bmp[nex - 1].flag = 0;
}
}
}
*bmpp = bmp;
return nex;
}
static void
blkmap_grow(
blkmap_t **blkmapp,
blkent_t **entp,
blkent_t *newent)
{
blkmap_t *blkmap;
int i;
int idx;
blkmap = *blkmapp;
idx = (int)(entp - blkmap->ents);
if (blkmap->naents == blkmap->nents) {
blkmap = xrealloc(blkmap, BLKMAP_SIZE(blkmap->nents + 1));
*blkmapp = blkmap;
blkmap->naents++;
}
for (i = blkmap->nents; i > idx; i--)
blkmap->ents[i] = blkmap->ents[i - 1];
blkmap->ents[idx] = newent;
blkmap->nents++;
}
static xfs_fileoff_t
blkmap_last_off(
blkmap_t *blkmap)
{
blkent_t *ent;
if (!blkmap->nents)
return NULLFILEOFF;
ent = blkmap->ents[blkmap->nents - 1];
return ent->startoff + ent->nblks;
}
static xfs_fileoff_t
blkmap_next_off(
blkmap_t *blkmap,
xfs_fileoff_t o,
int *t)
{
blkent_t *ent;
blkent_t **entp;
if (!blkmap->nents)
return NULLFILEOFF;
if (o == NULLFILEOFF) {
*t = 0;
ent = blkmap->ents[0];
return ent->startoff;
}
entp = &blkmap->ents[*t];
ent = *entp;
if (o < ent->startoff + ent->nblks - 1)
return o + 1;
entp++;
if (entp >= &blkmap->ents[blkmap->nents])
return NULLFILEOFF;
(*t)++;
ent = *entp;
return ent->startoff;
}
static void
blkmap_set_blk(
blkmap_t **blkmapp,
xfs_fileoff_t o,
xfs_fsblock_t b)
{
blkmap_t *blkmap;
blkent_t *ent;
blkent_t **entp;
blkent_t *nextent;
blkmap = *blkmapp;
for (entp = blkmap->ents; entp < &blkmap->ents[blkmap->nents]; entp++) {
ent = *entp;
if (o < ent->startoff - 1) {
ent = blkent_new(o, b, 1);
blkmap_grow(blkmapp, entp, ent);
return;
}
if (o == ent->startoff - 1) {
blkent_prepend(entp, b, 1);
return;
}
if (o >= ent->startoff && o < ent->startoff + ent->nblks) {
ent->blks[o - ent->startoff] = b;
return;
}
if (o > ent->startoff + ent->nblks)
continue;
blkent_append(entp, b, 1);
if (entp == &blkmap->ents[blkmap->nents - 1])
return;
ent = *entp;
nextent = entp[1];
if (ent->startoff + ent->nblks < nextent->startoff)
return;
blkent_append(entp, nextent->blks[0], nextent->nblks);
blkmap_shrink(blkmap, &entp[1]);
return;
}
ent = blkent_new(o, b, 1);
blkmap_grow(blkmapp, entp, ent);
}
static void
blkmap_set_ext(
blkmap_t **blkmapp,
xfs_fileoff_t o,
xfs_fsblock_t b,
xfs_extlen_t c)
{
blkmap_t *blkmap;
blkent_t *ent;
blkent_t **entp;
xfs_extnum_t i;
blkmap = *blkmapp;
if (!blkmap->nents) {
blkmap->ents[0] = blkent_new(o, b, c);
blkmap->nents = 1;
return;
}
entp = &blkmap->ents[blkmap->nents - 1];
ent = *entp;
if (ent->startoff + ent->nblks == o) {
blkent_append(entp, b, c);
return;
}
if (ent->startoff + ent->nblks < o) {
ent = blkent_new(o, b, c);
blkmap_grow(blkmapp, &blkmap->ents[blkmap->nents], ent);
return;
}
for (i = 0; i < c; i++)
blkmap_set_blk(blkmapp, o + i, b + i);
}
static void
blkmap_shrink(
blkmap_t *blkmap,
blkent_t **entp)
{
int i;
int idx;
xfree(*entp);
idx = (int)(entp - blkmap->ents);
for (i = idx + 1; i < blkmap->nents; i++)
blkmap->ents[i] = blkmap->ents[i - 1];
blkmap->nents--;
}
/* ARGSUSED */
static int
blockfree_f(
int argc,
char **argv)
{
xfs_agnumber_t c;
int rt;
if (!dbmap) {
dbprintf(_("block usage information not allocated\n"));
return 0;
}
rt = mp->m_sb.sb_rextents != 0;
for (c = 0; c < mp->m_sb.sb_agcount; c++) {
xfree(dbmap[c]);
xfree(inomap[c]);
free_inodata(c);
}
if (rt) {
xfree(dbmap[c]);
xfree(inomap[c]);
xfree(sumcompute);
xfree(sumfile);
sumcompute = sumfile = NULL;
}
xfree(dbmap);
xfree(inomap);
xfree(inodata);
dbmap = NULL;
inomap = NULL;
inodata = NULL;
return 0;
}
/*
* Check consistency of xfs filesystem contents.
*/
static int
blockget_f(
int argc,
char **argv)
{
xfs_agnumber_t agno;
int oldprefix;
int sbyell;
if (dbmap) {
dbprintf(_("already have block usage information\n"));
return 0;
}
if (!init(argc, argv)) {
if (serious_error)
exitcode = 3;
else
exitcode = 1;
return 0;
}
oldprefix = dbprefix;
dbprefix |= pflag;
for (agno = 0, sbyell = 0; agno < mp->m_sb.sb_agcount; agno++) {
scan_ag(agno);
if (sbver_err > 4 && !sbyell && sbver_err >= agno) {
sbyell = 1;
dbprintf(_("WARNING: this may be a newer XFS "
"filesystem.\n"));
}
}
if (blist_size) {
xfree(blist);
blist = NULL;
blist_size = 0;
}
if (serious_error) {
exitcode = 2;
dbprefix = oldprefix;
return 0;
}
check_rootdir();
/*
* Check that there are no blocks either
* a) unaccounted for or
* b) bno-free but not cnt-free
*/
if (!tflag) { /* are we in test mode, faking out freespace? */
for (agno = 0; agno < mp->m_sb.sb_agcount; agno++)
checknot_dbmap(agno, 0, mp->m_sb.sb_agblocks,
(1 << DBM_UNKNOWN) | (1 << DBM_FREE1));
}
for (agno = 0; agno < mp->m_sb.sb_agcount; agno++)
check_linkcounts(agno);
if (mp->m_sb.sb_rblocks) {
checknot_rdbmap(0,
(xfs_extlen_t)(mp->m_sb.sb_rextents *
mp->m_sb.sb_rextsize),
1 << DBM_UNKNOWN);
check_summary();
}
if (mp->m_sb.sb_icount != icount) {
if (!sflag)
dbprintf(_("sb_icount %lld, counted %lld\n"),
mp->m_sb.sb_icount, icount);
error++;
}
if (mp->m_sb.sb_ifree != ifree) {
if (!sflag)
dbprintf(_("sb_ifree %lld, counted %lld\n"),
mp->m_sb.sb_ifree, ifree);
error++;
}
if (mp->m_sb.sb_fdblocks != fdblocks) {
if (!sflag)
dbprintf(_("sb_fdblocks %lld, counted %lld\n"),
mp->m_sb.sb_fdblocks, fdblocks);
error++;
}
if (lazycount && mp->m_sb.sb_fdblocks != agf_aggr_freeblks) {
if (!sflag)
dbprintf(_("sb_fdblocks %lld, aggregate AGF count %lld\n"),
mp->m_sb.sb_fdblocks, agf_aggr_freeblks);
error++;
}
if (mp->m_sb.sb_frextents != frextents) {
if (!sflag)
dbprintf(_("sb_frextents %lld, counted %lld\n"),
mp->m_sb.sb_frextents, frextents);
error++;
}
if (mp->m_sb.sb_bad_features2 != 0 &&
mp->m_sb.sb_bad_features2 != mp->m_sb.sb_features2) {
if (!sflag)
dbprintf(_("sb_features2 (0x%x) not same as "
"sb_bad_features2 (0x%x)\n"),
mp->m_sb.sb_features2,
mp->m_sb.sb_bad_features2);
error++;
}
if ((sbversion & XFS_SB_VERSION_ATTRBIT) &&
!xfs_sb_version_hasattr(&mp->m_sb)) {
if (!sflag)
dbprintf(_("sb versionnum missing attr bit %x\n"),
XFS_SB_VERSION_ATTRBIT);
error++;
}
if ((sbversion & XFS_SB_VERSION_QUOTABIT) &&
!xfs_sb_version_hasquota(&mp->m_sb)) {
if (!sflag)
dbprintf(_("sb versionnum missing quota bit %x\n"),
XFS_SB_VERSION_QUOTABIT);
error++;
}
if (!(sbversion & XFS_SB_VERSION_ALIGNBIT) &&
xfs_sb_version_hasalign(&mp->m_sb)) {
if (!sflag)
dbprintf(_("sb versionnum extra align bit %x\n"),
XFS_SB_VERSION_ALIGNBIT);
error++;
}
if (qudo)
quota_check("user", qudata);
if (qpdo)
quota_check("project", qpdata);
if (qgdo)
quota_check("group", qgdata);
if (sbver_err > mp->m_sb.sb_agcount / 2)
dbprintf(_("WARNING: this may be a newer XFS filesystem.\n"));
if (error)
exitcode = 3;
dbprefix = oldprefix;
return 0;
}
typedef struct ltab {
int min;
int max;
} ltab_t;
static void
blocktrash_b(
int bit_offset,
dbm_t type,
ltab_t *ltabp,
int mode)
{
int bit;
int bitno;
char *buf;
int byte;
int len;
int mask;
int newbit;
const struct xfs_buf_ops *stashed_ops;
static char *modestr[] = {
N_("zeroed"), N_("set"), N_("flipped"), N_("randomized")
};
xfs_agnumber_t agno;
xfs_agblock_t agbno;
agno = XFS_FSB_TO_AGNO(mp, XFS_DADDR_TO_FSB(mp, iocur_top->bb));
agbno = XFS_FSB_TO_AGBNO(mp, XFS_DADDR_TO_FSB(mp, iocur_top->bb));
if (iocur_top->len == 0) {
dbprintf(_("zero-length block %u/%u buffer to trash??\n"),
agno, agbno);
return;
}
len = (int)((random() % (ltabp->max - ltabp->min + 1)) + ltabp->min);
/*
* bit_offset >= 0: start fuzzing at this exact bit_offset.
* bit_offset < 0: pick an offset at least as high at -(bit_offset + 1).
*/
if (bit_offset < 0) {
bit_offset = -(bit_offset + 1);
bit_offset += (int)(random() % (int)((iocur_top->len - bit_offset) * NBBY));
}
if (bit_offset + len >= iocur_top->len * NBBY)
len = (iocur_top->len * NBBY) - bit_offset;
newbit = 0;
stashed_ops = iocur_top->bp->b_ops;
iocur_top->bp->b_ops = NULL;
if ((buf = iocur_top->data) == NULL) {
dbprintf(_("can't read block %u/%u for trashing\n"), agno, agbno);
return;
}
for (bitno = 0; bitno < len; bitno++) {
bit = (bit_offset + bitno) % (mp->m_sb.sb_blocksize * NBBY);
byte = bit / NBBY;
bit %= NBBY;
mask = 1 << bit;
switch (mode) {
case 0:
newbit = 0;
break;
case 1:
newbit = 1;
break;
case 2:
newbit = (buf[byte] & mask) == 0;
break;
case 3:
newbit = (int)random() & 1;
break;
}
if (newbit)
buf[byte] |= mask;
else
buf[byte] &= ~mask;
}
write_cur();
iocur_top->bp->b_ops = stashed_ops;
printf(_("blocktrash: %u/%u %s block %d bit%s starting %d:%d %s\n"),
agno, agbno, typename[type], len, len == 1 ? "" : "s",
bit_offset / NBBY, bit_offset % NBBY, modestr[mode]);
}
int
blocktrash_f(
int argc,
char **argv)
{
xfs_agblock_t agbno;
xfs_agnumber_t agno;
xfs_rfsblock_t bi;
xfs_rfsblock_t blocks;
int c;
int count;
int done;
int goodmask;
int i;
ltab_t *lentab;
int lentablen;
int max;
int min;
int mode;
struct timeval now;
char *p;
xfs_rfsblock_t randb;
uint seed;
int sopt;
int tmask;
bool this_block = false;
int bit_offset = -1;
optind = 0;
count = 1;
min = 1;
max = 128 * NBBY;
mode = 2;
gettimeofday(&now, NULL);
seed = (unsigned int)(now.tv_sec ^ now.tv_usec);
sopt = 0;
tmask = 0;
goodmask = (1 << DBM_AGF) |
(1 << DBM_AGFL) |
(1 << DBM_AGI) |
(1 << DBM_ATTR) |
(1 << DBM_BTBMAPA) |
(1 << DBM_BTBMAPD) |
(1 << DBM_BTBNO) |
(1 << DBM_BTCNT) |
(1 << DBM_BTINO) |
(1 << DBM_DIR) |
(1 << DBM_INODE) |
(1 << DBM_LOG) |
(1 << DBM_QUOTA) |
(1 << DBM_RTBITMAP) |
(1 << DBM_RTSUM) |
(1 << DBM_SYMLINK) |
(1 << DBM_BTFINO) |
(1 << DBM_SB);
while ((c = getopt(argc, argv, "0123n:o:s:t:x:y:z")) != EOF) {
switch (c) {
case '0':
mode = 0;
break;
case '1':
mode = 1;
break;
case '2':
mode = 2;
break;
case '3':
mode = 3;
break;
case 'n':
count = (int)strtol(optarg, &p, 0);
if (*p != '\0' || count <= 0) {
dbprintf(_("bad blocktrash count %s\n"), optarg);
return 0;
}
break;
case 'o': {
int relative = 0;
if (optarg[0] == '+') {
optarg++;
relative = 1;
}
bit_offset = (int)strtol(optarg, &p, 0);
if (*p != '\0' || bit_offset < 0) {
dbprintf(_("bad blocktrash offset %s\n"), optarg);
return 0;
}
if (relative)
bit_offset = -bit_offset - 1;
break;
}
case 's':
seed = (uint)strtoul(optarg, &p, 0);
sopt = 1;
break;
case 't':
for (i = 0; typename[i]; i++) {
if (strcmp(typename[i], optarg) == 0)
break;
}
if (!typename[i] || (((1 << i) & goodmask) == 0)) {
dbprintf(_("bad blocktrash type %s\n"), optarg);
return 0;
}
tmask |= 1 << i;
break;
case 'x':
min = (int)strtol(optarg, &p, 0);
if (*p != '\0' || min <= 0 ||
min > mp->m_sb.sb_blocksize * NBBY) {
dbprintf(_("bad blocktrash min %s\n"), optarg);
return 0;
}
break;
case 'y':
max = (int)strtol(optarg, &p, 0);
if (*p != '\0' || max <= 0 ||
max > mp->m_sb.sb_blocksize * NBBY) {
dbprintf(_("bad blocktrash max %s\n"), optarg);
return 0;
}
break;
case 'z':
this_block = true;
break;
default:
dbprintf(_("bad option for blocktrash command\n"));
return 0;
}
}
if (!this_block && !dbmap) {
dbprintf(_("must run blockget first\n"));
return 0;
}
if (this_block && iocur_sp == 0) {
dbprintf(_("nothing on stack\n"));
return 0;
}
if (min > max) {
dbprintf(_("bad min/max for blocktrash command\n"));
return 0;
}
if (tmask == 0)
tmask = goodmask & ~((1 << DBM_LOG) | (1 << DBM_SB));
lentab = xmalloc(sizeof(ltab_t));
lentab->min = lentab->max = min;
lentablen = 1;
for (i = min + 1; i <= max; i++) {
if ((i & (i - 1)) == 0) {
lentab = xrealloc(lentab,
sizeof(ltab_t) * (lentablen + 1));
lentab[lentablen].min = lentab[lentablen].max = i;
lentablen++;
} else
lentab[lentablen - 1].max = i;
}
if (!sopt)
dbprintf(_("blocktrash: seed %u\n"), seed);
srandom(seed);
if (this_block) {
blocktrash_b(bit_offset, DBM_UNKNOWN,
&lentab[random() % lentablen], mode);
goto out;
}
for (blocks = 0, agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
for (agbno = 0, p = dbmap[agno];
agbno < mp->m_sb.sb_agblocks;
agbno++, p++) {
if ((1 << *p) & tmask)
blocks++;
}
}
if (blocks == 0) {
dbprintf(_("blocktrash: no matching blocks\n"));
goto out;
}
for (i = 0; i < count; i++) {
randb = (xfs_rfsblock_t)((((__int64_t)random() << 32) |
random()) % blocks);
for (bi = 0, agno = 0, done = 0;
!done && agno < mp->m_sb.sb_agcount;
agno++) {
for (agbno = 0, p = dbmap[agno];
agbno < mp->m_sb.sb_agblocks;
agbno++, p++) {
if (!((1 << *p) & tmask))
continue;
if (bi++ < randb)
continue;
push_cur();
set_cur(NULL,
XFS_AGB_TO_DADDR(mp, agno, agbno),
blkbb, DB_RING_IGN, NULL);
blocktrash_b(bit_offset, (dbm_t)*p,
&lentab[random() % lentablen], mode);
pop_cur();
done = 1;
break;
}
}
}
out:
xfree(lentab);
return 0;
}
int
blockuse_f(
int argc,
char **argv)
{
xfs_agblock_t agbno;
xfs_agnumber_t agno;
int c;
int count;
xfs_agblock_t end;
xfs_fsblock_t fsb;
inodata_t *i;
char *p;
int shownames;
if (!dbmap) {
dbprintf(_("must run blockget first\n"));
return 0;
}
optind = 0;
shownames = 0;
fsb = XFS_DADDR_TO_FSB(mp, iocur_top->off >> BBSHIFT);
agno = XFS_FSB_TO_AGNO(mp, fsb);
end = agbno = XFS_FSB_TO_AGBNO(mp, fsb);
while ((c = getopt(argc, argv, "c:n")) != EOF) {
switch (c) {
case 'c':
count = (int)strtol(optarg, &p, 0);
end = agbno + count - 1;
if (*p != '\0' || count <= 0 ||
end >= mp->m_sb.sb_agblocks) {
dbprintf(_("bad blockuse count %s\n"), optarg);
return 0;
}
break;
case 'n':
if (!nflag) {
dbprintf(_("must run blockget -n first\n"));
return 0;
}
shownames = 1;
break;
default:
dbprintf(_("bad option for blockuse command\n"));
return 0;
}
}
while (agbno <= end) {
p = &dbmap[agno][agbno];
i = inomap[agno][agbno];
dbprintf(_("block %llu (%u/%u) type %s"),
(xfs_fsblock_t)XFS_AGB_TO_FSB(mp, agno, agbno),
agno, agbno, typename[(dbm_t)*p]);
if (i) {
dbprintf(_(" inode %lld"), i->ino);
if (shownames && (p = inode_name(i->ino, NULL))) {
dbprintf(" %s", p);
xfree(p);
}
}
dbprintf("\n");
agbno++;
}
return 0;
}
static int
check_blist(
xfs_fsblock_t bno)
{
int i;
for (i = 0; i < blist_size; i++) {
if (blist[i] == bno)
return 1;
}
return 0;
}
static void
check_dbmap(
xfs_agnumber_t agno,
xfs_agblock_t agbno,
xfs_extlen_t len,
dbm_t type)
{
xfs_extlen_t i;
char *p;
for (i = 0, p = &dbmap[agno][agbno]; i < len; i++, p++) {
if ((dbm_t)*p != type) {
if (!sflag || CHECK_BLISTA(agno, agbno + i))
dbprintf(_("block %u/%u expected type %s got "
"%s\n"),
agno, agbno + i, typename[type],
typename[(dbm_t)*p]);
error++;
}
}
}
void
check_init(void)
{
add_command(&blockfree_cmd);
add_command(&blockget_cmd);
if (expert_mode)
add_command(&blocktrash_cmd);
add_command(&blockuse_cmd);
add_command(&ncheck_cmd);
}
static int
check_inomap(
xfs_agnumber_t agno,
xfs_agblock_t agbno,
xfs_extlen_t len,
xfs_ino_t c_ino)
{
xfs_extlen_t i;
inodata_t **idp;
int rval;
if (!check_range(agno, agbno, len)) {
dbprintf(_("blocks %u/%u..%u claimed by inode %lld\n"),
agno, agbno, agbno + len - 1, c_ino);
return 0;
}
for (i = 0, rval = 1, idp = &inomap[agno][agbno]; i < len; i++, idp++) {
if (*idp) {
if (!sflag || (*idp)->ilist ||
CHECK_BLISTA(agno, agbno + i))
dbprintf(_("block %u/%u claimed by inode %lld, "
"previous inum %lld\n"),
agno, agbno + i, c_ino, (*idp)->ino);
error++;
rval = 0;
}
}
return rval;
}
static void
check_linkcounts(
xfs_agnumber_t agno)
{
inodata_t *ep;
inodata_t **ht;
int idx;
char *path;
ht = inodata[agno];
for (idx = 0; idx < inodata_hash_size; ht++, idx++) {
ep = *ht;
while (ep) {
if (ep->link_set != ep->link_add || ep->link_set == 0) {
path = inode_name(ep->ino, NULL);
if (!path && ep->link_add)
path = xstrdup("?");
if (!sflag || ep->ilist) {
if (ep->link_add)
dbprintf(_("link count mismatch "
"for inode %lld (name "
"%s), nlink %d, "
"counted %d\n"),
ep->ino, path,
ep->link_set,
ep->link_add);
else if (ep->link_set)
dbprintf(_("disconnected inode "
"%lld, nlink %d\n"),
ep->ino, ep->link_set);
else
dbprintf(_("allocated inode %lld "
"has 0 link count\n"),
ep->ino);
}
if (path)
xfree(path);
error++;
} else if (verbose || ep->ilist) {
path = inode_name(ep->ino, NULL);
if (path) {
dbprintf(_("inode %lld name %s\n"),
ep->ino, path);
xfree(path);
}
}
ep = ep->next;
}
}
}
static int
check_range(
xfs_agnumber_t agno,
xfs_agblock_t agbno,
xfs_extlen_t len)
{
xfs_extlen_t i;
xfs_agblock_t low = 0;
xfs_agblock_t high = 0;
int valid_range = 0;
int cur, prev = 0;
if (agno >= mp->m_sb.sb_agcount ||
agbno + len - 1 >= mp->m_sb.sb_agblocks) {
for (i = 0; i < len; i++) {
cur = !sflag || CHECK_BLISTA(agno, agbno + i) ? 1 : 0;
if (cur == 1 && prev == 0) {
low = high = agbno + i;
valid_range = 1;
} else if (cur == 0 && prev == 0) {
/* Do nothing */
} else if (cur == 0 && prev == 1) {
if (low == high) {
dbprintf(_("block %u/%u out of range\n"),
agno, low);
} else {
dbprintf(_("blocks %u/%u..%u "
"out of range\n"),
agno, low, high);
}
valid_range = 0;
} else if (cur == 1 && prev == 1) {
high = agbno + i;
}
prev = cur;
}
if (valid_range) {
if (low == high) {
dbprintf(_("block %u/%u out of range\n"),
agno, low);
} else {
dbprintf(_("blocks %u/%u..%u "
"out of range\n"),
agno, low, high);
}
}
error++;
return 0;
}
return 1;
}
static void
check_rdbmap(
xfs_rfsblock_t bno,
xfs_extlen_t len,
dbm_t type)
{
xfs_extlen_t i;
char *p;
for (i = 0, p = &dbmap[mp->m_sb.sb_agcount][bno]; i < len; i++, p++) {
if ((dbm_t)*p != type) {
if (!sflag || CHECK_BLIST(bno + i))
dbprintf(_("rtblock %llu expected type %s got "
"%s\n"),
bno + i, typename[type],
typename[(dbm_t)*p]);
error++;
}
}
}
static int
check_rinomap(
xfs_rfsblock_t bno,
xfs_extlen_t len,
xfs_ino_t c_ino)
{
xfs_extlen_t i;
inodata_t **idp;
int rval;
if (!check_rrange(bno, len)) {
dbprintf(_("rtblocks %llu..%llu claimed by inode %lld\n"),
bno, bno + len - 1, c_ino);
return 0;
}
for (i = 0, rval = 1, idp = &inomap[mp->m_sb.sb_agcount][bno];
i < len;
i++, idp++) {
if (*idp) {
if (!sflag || (*idp)->ilist || CHECK_BLIST(bno + i))
dbprintf(_("rtblock %llu claimed by inode %lld, "
"previous inum %lld\n"),
bno + i, c_ino, (*idp)->ino);
error++;
rval = 0;
}
}
return rval;
}
static void
check_rootdir(void)
{
inodata_t *id;
id = find_inode(mp->m_sb.sb_rootino, 0);
if (id == NULL) {
if (!sflag)
dbprintf(_("root inode %lld is missing\n"),
mp->m_sb.sb_rootino);
error++;
} else if (!id->isdir) {
if (!sflag || id->ilist)
dbprintf(_("root inode %lld is not a directory\n"),
mp->m_sb.sb_rootino);
error++;
}
}
static int
check_rrange(
xfs_rfsblock_t bno,
xfs_extlen_t len)
{
xfs_extlen_t i;
if (bno + len - 1 >= mp->m_sb.sb_rblocks) {
for (i = 0; i < len; i++) {
if (!sflag || CHECK_BLIST(bno + i))
dbprintf(_("rtblock %llu out of range\n"),
bno + i);
}
error++;
return 0;
}
return 1;
}
static void
check_set_dbmap(
xfs_agnumber_t agno,
xfs_agblock_t agbno,
xfs_extlen_t len,
dbm_t type1,
dbm_t type2,
xfs_agnumber_t c_agno,
xfs_agblock_t c_agbno)
{
xfs_extlen_t i;
int mayprint;
char *p;
if (!check_range(agno, agbno, len)) {
dbprintf(_("blocks %u/%u..%u claimed by block %u/%u\n"), agno,
agbno, agbno + len - 1, c_agno, c_agbno);
return;
}
check_dbmap(agno, agbno, len, type1);
mayprint = verbose | blist_size;
for (i = 0, p = &dbmap[agno][agbno]; i < len; i++, p++) {
*p = (char)type2;
if (mayprint && (verbose || CHECK_BLISTA(agno, agbno + i)))
dbprintf(_("setting block %u/%u to %s\n"), agno, agbno + i,
typename[type2]);
}
}
static void
check_set_rdbmap(
xfs_rfsblock_t bno,
xfs_extlen_t len,
dbm_t type1,
dbm_t type2)
{
xfs_extlen_t i;
int mayprint;
char *p;
if (!check_rrange(bno, len))
return;
check_rdbmap(bno, len, type1);
mayprint = verbose | blist_size;
for (i = 0, p = &dbmap[mp->m_sb.sb_agcount][bno]; i < len; i++, p++) {
*p = (char)type2;
if (mayprint && (verbose || CHECK_BLIST(bno + i)))
dbprintf(_("setting rtblock %llu to %s\n"),
bno + i, typename[type2]);
}
}
static void
check_summary(void)
{
xfs_rfsblock_t bno;
xfs_suminfo_t *csp;
xfs_suminfo_t *fsp;
int log;
csp = sumcompute;
fsp = sumfile;
for (log = 0; log < mp->m_rsumlevels; log++) {
for (bno = 0;
bno < mp->m_sb.sb_rbmblocks;
bno++, csp++, fsp++) {
if (*csp != *fsp) {
if (!sflag)
dbprintf(_("rt summary mismatch, size %d "
"block %llu, file: %d, "
"computed: %d\n"),
log, bno, *fsp, *csp);
error++;
}
}
}
}
static void
checknot_dbmap(
xfs_agnumber_t agno,
xfs_agblock_t agbno,
xfs_extlen_t len,
int typemask)
{
xfs_extlen_t i;
char *p;
if (!check_range(agno, agbno, len))
return;
for (i = 0, p = &dbmap[agno][agbno]; i < len; i++, p++) {
if ((1 << *p) & typemask) {
if (!sflag || CHECK_BLISTA(agno, agbno + i))
dbprintf(_("block %u/%u type %s not expected\n"),
agno, agbno + i, typename[(dbm_t)*p]);
error++;
}
}
}
static void
checknot_rdbmap(
xfs_rfsblock_t bno,
xfs_extlen_t len,
int typemask)
{
xfs_extlen_t i;
char *p;
if (!check_rrange(bno, len))
return;
for (i = 0, p = &dbmap[mp->m_sb.sb_agcount][bno]; i < len; i++, p++) {
if ((1 << *p) & typemask) {
if (!sflag || CHECK_BLIST(bno + i))
dbprintf(_("rtblock %llu type %s not expected\n"),
bno + i, typename[(dbm_t)*p]);
error++;
}
}
}
static void
dir_hash_add(
xfs_dahash_t hash,
xfs_dir2_dataptr_t addr)
{
int i;
dirhash_t *p;
i = DIR_HASH_FUNC(hash, addr);
p = malloc(sizeof(*p));
p->next = dirhash[i];
dirhash[i] = p;
p->hashval = hash;
p->address = addr;
p->seen = 0;
}
static void
dir_hash_check(
inodata_t *id,
int v)
{
int i;
dirhash_t *p;
for (i = 0; i < DIR_HASH_SIZE; i++) {
for (p = dirhash[i]; p; p = p->next) {
if (p->seen)
continue;
if (!sflag || id->ilist || v)
dbprintf(_("dir ino %lld missing leaf entry for "
"%x/%x\n"),
id->ino, p->hashval, p->address);
error++;
}
}
}
static void
dir_hash_done(void)
{
int i;
dirhash_t *n;
dirhash_t *p;
for (i = 0; i < DIR_HASH_SIZE; i++) {
for (p = dirhash[i]; p; p = n) {
n = p->next;
free(p);
}
dirhash[i] = NULL;
}
}
static void
dir_hash_init(void)
{
if (!dirhash)
dirhash = calloc(DIR_HASH_SIZE, sizeof(*dirhash));
}
static int
dir_hash_see(
xfs_dahash_t hash,
xfs_dir2_dataptr_t addr)
{
int i;
dirhash_t *p;
i = DIR_HASH_FUNC(hash, addr);
for (p = dirhash[i]; p; p = p->next) {
if (p->hashval == hash && p->address == addr) {
if (p->seen)
return 1;
p->seen = 1;
return 0;
}
}
return -1;
}
static inodata_t *
find_inode(
xfs_ino_t ino,
int add)
{
xfs_agino_t agino;
xfs_agnumber_t agno;
inodata_t *ent;
inodata_t **htab;
xfs_agino_t ih;
agno = XFS_INO_TO_AGNO(mp, ino);
agino = XFS_INO_TO_AGINO(mp, ino);
if (agno >= mp->m_sb.sb_agcount ||
XFS_AGINO_TO_INO(mp, agno, agino) != ino)
return NULL;
htab = inodata[agno];
ih = agino % inodata_hash_size;
ent = htab[ih];
while (ent) {
if (ent->ino == ino)
return ent;
ent = ent->next;
}
if (!add)
return NULL;
ent = xcalloc(1, sizeof(*ent));
ent->ino = ino;
ent->next = htab[ih];
htab[ih] = ent;
return ent;
}
static void
free_inodata(
xfs_agnumber_t agno)
{
inodata_t *hp;
inodata_t **ht;
int i;
inodata_t *next;
ht = inodata[agno];
for (i = 0; i < inodata_hash_size; i++) {
hp = ht[i];
while (hp) {
next = hp->next;
if (hp->name)
xfree(hp->name);
xfree(hp);
hp = next;
}
}
xfree(ht);
}
static int
init(
int argc,
char **argv)
{
xfs_fsblock_t bno;
int c;
xfs_ino_t ino;
int rt;
serious_error = 0;
if (mp->m_sb.sb_magicnum != XFS_SB_MAGIC) {
dbprintf(_("bad superblock magic number %x, giving up\n"),
mp->m_sb.sb_magicnum);
serious_error = 1;
return 0;
}
if (!sb_logcheck())
return 0;
rt = mp->m_sb.sb_rextents != 0;
dbmap = xmalloc((mp->m_sb.sb_agcount + rt) * sizeof(*dbmap));
inomap = xmalloc((mp->m_sb.sb_agcount + rt) * sizeof(*inomap));
inodata = xmalloc(mp->m_sb.sb_agcount * sizeof(*inodata));
inodata_hash_size =
(int)MAX(MIN(mp->m_sb.sb_icount /
(INODATA_AVG_HASH_LENGTH * mp->m_sb.sb_agcount),
MAX_INODATA_HASH_SIZE),
MIN_INODATA_HASH_SIZE);
for (c = 0; c < mp->m_sb.sb_agcount; c++) {
dbmap[c] = xcalloc(mp->m_sb.sb_agblocks, sizeof(**dbmap));
inomap[c] = xcalloc(mp->m_sb.sb_agblocks, sizeof(**inomap));
inodata[c] = xcalloc(inodata_hash_size, sizeof(**inodata));
}
if (rt) {
dbmap[c] = xcalloc(mp->m_sb.sb_rblocks, sizeof(**dbmap));
inomap[c] = xcalloc(mp->m_sb.sb_rblocks, sizeof(**inomap));
sumfile = xcalloc(mp->m_rsumsize, 1);
sumcompute = xcalloc(mp->m_rsumsize, 1);
}
nflag = sflag = tflag = verbose = optind = 0;
while ((c = getopt(argc, argv, "b:i:npstv")) != EOF) {
switch (c) {
case 'b':
bno = strtoll(optarg, NULL, 10);
add_blist(bno);
break;
case 'i':
ino = strtoll(optarg, NULL, 10);
add_ilist(ino);
break;
case 'n':
nflag = 1;
break;
case 'p':
pflag = 1;
break;
case 's':
sflag = 1;
break;
case 't':
tflag = 1;
break;
case 'v':
verbose = 1;
break;
default:
dbprintf(_("bad option for blockget command\n"));
return 0;
}
}
error = sbver_err = serious_error = 0;
fdblocks = frextents = icount = ifree = 0;
sbversion = XFS_SB_VERSION_4;
/*
* Note that inoalignmt == 0 is valid when fsb size is large enough for
* at least one full inode record per block. Check this case explicitly.
*/
if (mp->m_sb.sb_inoalignmt ||
(xfs_sb_version_hasalign(&mp->m_sb) &&
mp->m_sb.sb_inopblock >= XFS_INODES_PER_CHUNK))
sbversion |= XFS_SB_VERSION_ALIGNBIT;
if ((mp->m_sb.sb_uquotino && mp->m_sb.sb_uquotino != NULLFSINO) ||
(mp->m_sb.sb_gquotino && mp->m_sb.sb_gquotino != NULLFSINO) ||
(mp->m_sb.sb_pquotino && mp->m_sb.sb_pquotino != NULLFSINO))
sbversion |= XFS_SB_VERSION_QUOTABIT;
quota_init();
return 1;
}
static char *
inode_name(
xfs_ino_t ino,
inodata_t **ipp)
{
inodata_t *id;
char *npath;
char *path;
id = find_inode(ino, 0);
if (ipp)
*ipp = id;
if (id == NULL)
return NULL;
if (id->name == NULL)
return NULL;
path = xstrdup(id->name);
while (id->parent) {
id = id->parent;
if (id->name == NULL)
break;
npath = prepend_path(path, id->name);
xfree(path);
path = npath;
}
return path;
}
static int
ncheck_f(
int argc,
char **argv)
{
xfs_agnumber_t agno;
int c;
inodata_t *hp;
inodata_t **ht;
int i;
inodata_t *id;
xfs_ino_t *ilist;
int ilist_size;
xfs_ino_t *ilp;
xfs_ino_t ino;
char *p;
int security;
if (!inodata || !nflag) {
dbprintf(_("must run blockget -n first\n"));
return 0;
}
security = optind = ilist_size = 0;
ilist = NULL;
while ((c = getopt(argc, argv, "i:s")) != EOF) {
switch (c) {
case 'i':
ino = strtoll(optarg, NULL, 10);
ilist = xrealloc(ilist, (ilist_size + 1) *
sizeof(*ilist));
ilist[ilist_size++] = ino;
break;
case 's':
security = 1;
break;
default:
dbprintf(_("bad option -%c for ncheck command\n"), c);
xfree(ilist);
return 0;
}
}
if (ilist) {
for (ilp = ilist; ilp < &ilist[ilist_size]; ilp++) {
ino = *ilp;
if ((p = inode_name(ino, &hp))) {
dbprintf("%11llu %s", ino, p);
if (hp->isdir)
dbprintf("/.");
dbprintf("\n");
xfree(p);
}
}
xfree(ilist);
return 0;
}
for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
ht = inodata[agno];
for (i = 0; i < inodata_hash_size; i++) {
hp = ht[i];
for (hp = ht[i]; hp; hp = hp->next) {
ino = XFS_AGINO_TO_INO(mp, agno, hp->ino);
p = inode_name(ino, &id);
if (!p || !id)
continue;
if (!security || id->security) {
dbprintf("%11llu %s", ino, p);
if (hp->isdir)
dbprintf("/.");
dbprintf("\n");
}
xfree(p);
}
}
}
return 0;
}
static char *
prepend_path(
char *oldpath,
char *parent)
{
int len;
char *path;
len = (int)(strlen(oldpath) + strlen(parent) + 2);
path = xmalloc(len);
snprintf(path, len, "%s/%s", parent, oldpath);
return path;
}
static xfs_ino_t
process_block_dir_v2(
blkmap_t *blkmap,
int *dot,
int *dotdot,
inodata_t *id)
{
xfs_fsblock_t b;
bbmap_t bbmap;
bmap_ext_t *bmp;
int nex;
xfs_ino_t parent;
int v;
int x;
nex = blkmap_getn(blkmap, 0, mp->m_dir_geo->fsbcount, &bmp);
v = id->ilist || verbose;
if (nex == 0) {
if (!sflag || v)
dbprintf(_("block 0 for directory inode %lld is "
"missing\n"),
id->ino);
error++;
return 0;
}
push_cur();
if (nex > 1)
make_bbmap(&bbmap, nex, bmp);
set_cur(&typtab[TYP_DIR2], XFS_FSB_TO_DADDR(mp, bmp->startblock),
mp->m_dir_geo->fsbcount * blkbb, DB_RING_IGN, nex > 1 ? &bbmap : NULL);
for (x = 0; !v && x < nex; x++) {
for (b = bmp[x].startblock;
!v && b < bmp[x].startblock + bmp[x].blockcount;
b++)
v = CHECK_BLIST(b);
}
free(bmp);
if (iocur_top->data == NULL) {
if (!sflag || id->ilist || v)
dbprintf(_("can't read block 0 for directory inode "
"%lld\n"),
id->ino);
error++;
pop_cur();
return 0;
}
dir_hash_init();
parent = process_data_dir_v2(dot, dotdot, id, v, mp->m_dir_geo->datablk,
NULL);
dir_hash_check(id, v);
dir_hash_done();
pop_cur();
return parent;
}
static void
process_bmbt_reclist(
xfs_bmbt_rec_t *rp,
int numrecs,
dbm_t type,
inodata_t *id,
xfs_rfsblock_t *tot,
blkmap_t **blkmapp)
{
xfs_agblock_t agbno;
xfs_agnumber_t agno;
xfs_fsblock_t b;
xfs_filblks_t c;
xfs_filblks_t cp;
int f;
int i;
xfs_agblock_t iagbno;
xfs_agnumber_t iagno;
xfs_fileoff_t o;
xfs_fileoff_t op;
xfs_fsblock_t s;
int v;
cp = op = 0;
v = verbose || id->ilist;
iagno = XFS_INO_TO_AGNO(mp, id->ino);
iagbno = XFS_INO_TO_AGBNO(mp, id->ino);
for (i = 0; i < numrecs; i++, rp++) {
convert_extent(rp, &o, &s, &c, &f);
if (v)
dbprintf(_("inode %lld extent [%lld,%lld,%lld,%d]\n"),
id->ino, o, s, c, f);
if (!sflag && i > 0 && op + cp > o)
dbprintf(_("bmap rec out of order, inode %lld entry %d\n"),
id->ino, i);
op = o;
cp = c;
if (type == DBM_RTDATA) {
if (!sflag && s >= mp->m_sb.sb_rblocks) {
dbprintf(_("inode %lld bad rt block number %lld, "
"offset %lld\n"),
id->ino, s, o);
continue;
}
} else if (!sflag) {
agno = XFS_FSB_TO_AGNO(mp, s);
agbno = XFS_FSB_TO_AGBNO(mp, s);
if (agno >= mp->m_sb.sb_agcount ||
agbno >= mp->m_sb.sb_agblocks) {
dbprintf(_("inode %lld bad block number %lld "
"[%d,%d], offset %lld\n"),
id->ino, s, agno, agbno, o);
continue;
}
if (agbno + c - 1 >= mp->m_sb.sb_agblocks) {
dbprintf(_("inode %lld bad block number %lld "
"[%d,%d], offset %lld\n"),
id->ino, s + c - 1, agno,
agbno + (xfs_agblock_t)c - 1, o);
continue;
}
}
if (blkmapp && *blkmapp)
blkmap_set_ext(blkmapp, (xfs_fileoff_t)o,
(xfs_fsblock_t)s, (xfs_extlen_t)c);
if (type == DBM_RTDATA) {
set_rdbmap((xfs_fsblock_t)s, (xfs_extlen_t)c,
DBM_RTDATA);
set_rinomap((xfs_fsblock_t)s, (xfs_extlen_t)c, id);
for (b = (xfs_fsblock_t)s;
blist_size && b < s + c;
b++, o++) {
if (CHECK_BLIST(b))
dbprintf(_("inode %lld block %lld at "
"offset %lld\n"),
id->ino, (xfs_fsblock_t)b, o);
}
} else {
agno = XFS_FSB_TO_AGNO(mp, (xfs_fsblock_t)s);
agbno = XFS_FSB_TO_AGBNO(mp, (xfs_fsblock_t)s);
set_dbmap(agno, agbno, (xfs_extlen_t)c, type, iagno,
iagbno);
set_inomap(agno, agbno, (xfs_extlen_t)c, id);
for (b = (xfs_fsblock_t)s;
blist_size && b < s + c;
b++, o++, agbno++) {
if (CHECK_BLIST(b))
dbprintf(_("inode %lld block %lld at "
"offset %lld\n"),
id->ino, (xfs_fsblock_t)b, o);
}
}
*tot += c;
}
}
static void
process_btinode(
inodata_t *id,
xfs_dinode_t *dip,
dbm_t type,
xfs_rfsblock_t *totd,
xfs_rfsblock_t *toti,
xfs_extnum_t *nex,
blkmap_t **blkmapp,
int whichfork)
{
xfs_bmdr_block_t *dib;
int i;
xfs_bmbt_ptr_t *pp;
dib = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork);
if (be16_to_cpu(dib->bb_level) >= XFS_BM_MAXLEVELS(mp, whichfork)) {
if (!sflag || id->ilist)
dbprintf(_("level for ino %lld %s fork bmap root too "
"large (%u)\n"),
id->ino,
whichfork == XFS_DATA_FORK ? _("data") : _("attr"),
be16_to_cpu(dib->bb_level));
error++;
return;
}
if (be16_to_cpu(dib->bb_numrecs) >
xfs_bmdr_maxrecs(XFS_DFORK_SIZE(dip, mp, whichfork),
be16_to_cpu(dib->bb_level) == 0)) {
if (!sflag || id->ilist)
dbprintf(_("numrecs for ino %lld %s fork bmap root too "
"large (%u)\n"),
id->ino,
whichfork == XFS_DATA_FORK ? _("data") : _("attr"),
be16_to_cpu(dib->bb_numrecs));
error++;
return;
}
if (be16_to_cpu(dib->bb_level) == 0) {
xfs_bmbt_rec_t *rp = XFS_BMDR_REC_ADDR(dib, 1);
process_bmbt_reclist(rp, be16_to_cpu(dib->bb_numrecs), type,
id, totd, blkmapp);
*nex += be16_to_cpu(dib->bb_numrecs);
return;
} else {
pp = XFS_BMDR_PTR_ADDR(dib, 1, xfs_bmdr_maxrecs(
XFS_DFORK_SIZE(dip, mp, whichfork), 0));
for (i = 0; i < be16_to_cpu(dib->bb_numrecs); i++)
scan_lbtree(be64_to_cpu(pp[i]),
be16_to_cpu(dib->bb_level),
scanfunc_bmap, type, id, totd, toti,
nex, blkmapp, 1,
whichfork == XFS_DATA_FORK ?
TYP_BMAPBTD : TYP_BMAPBTA);
}
if (*nex <= XFS_DFORK_SIZE(dip, mp, whichfork) / sizeof(xfs_bmbt_rec_t)) {
if (!sflag || id->ilist)
dbprintf(_("extent count for ino %lld %s fork too low "
"(%d) for file format\n"),
id->ino,
whichfork == XFS_DATA_FORK ? _("data") : _("attr"),
*nex);
error++;
}
}
static xfs_ino_t
process_data_dir_v2(
int *dot,
int *dotdot,
inodata_t *id,
int v,
xfs_dablk_t dabno,
freetab_t **freetabp)
{
xfs_dir2_dataptr_t addr;
xfs_dir2_data_free_t *bf;
int bf_err;
struct xfs_dir2_data_hdr *block;
xfs_dir2_block_tail_t *btp = NULL;
inodata_t *cid;
int count;
struct xfs_dir2_data_hdr *data;
xfs_dir2_db_t db;
xfs_dir2_data_entry_t *dep;
xfs_dir2_data_free_t *dfp;
xfs_dir2_data_unused_t *dup;
char *endptr;
int freeseen;
freetab_t *freetab;
int i;
int lastfree;
int lastfree_err;
xfs_dir2_leaf_entry_t *lep = NULL;
xfs_ino_t lino;
xfs_ino_t parent = 0;
char *ptr;
int stale = 0;
int tag_err;
__be16 *tagp;
struct xfs_name xname;
data = iocur_top->data;
block = iocur_top->data;
if (be32_to_cpu(block->magic) != XFS_DIR2_BLOCK_MAGIC &&
be32_to_cpu(data->magic) != XFS_DIR2_DATA_MAGIC &&
be32_to_cpu(block->magic) != XFS_DIR3_BLOCK_MAGIC &&
be32_to_cpu(data->magic) != XFS_DIR3_DATA_MAGIC) {
if (!sflag || v)
dbprintf(_("bad directory data magic # %#x for dir ino "
"%lld block %d\n"),
be32_to_cpu(data->magic), id->ino, dabno);
error++;
return NULLFSINO;
}
db = xfs_dir2_da_to_db(mp->m_dir_geo, dabno);
bf = M_DIROPS(mp)->data_bestfree_p(data);
ptr = (char *)M_DIROPS(mp)->data_unused_p(data);
if (be32_to_cpu(block->magic) == XFS_DIR2_BLOCK_MAGIC ||
be32_to_cpu(block->magic) == XFS_DIR3_BLOCK_MAGIC) {
btp = xfs_dir2_block_tail_p(mp->m_dir_geo, block);
lep = xfs_dir2_block_leaf_p(btp);
endptr = (char *)lep;
if (endptr <= ptr || endptr > (char *)btp) {
endptr = (char *)data + mp->m_dir_geo->blksize;
lep = NULL;
if (!sflag || v)
dbprintf(_("bad block directory tail for dir ino "
"%lld\n"),
id->ino);
error++;
}
} else
endptr = (char *)data + mp->m_dir_geo->blksize;
bf_err = lastfree_err = tag_err = 0;
count = lastfree = freeseen = 0;
if (be16_to_cpu(bf[0].length) == 0) {
bf_err += be16_to_cpu(bf[0].offset) != 0;
freeseen |= 1 << 0;
}
if (be16_to_cpu(bf[1].length) == 0) {
bf_err += be16_to_cpu(bf[1].offset) != 0;
freeseen |= 1 << 1;
}
if (be16_to_cpu(bf[2].length) == 0) {
bf_err += be16_to_cpu(bf[2].offset) != 0;
freeseen |= 1 << 2;
}
bf_err += be16_to_cpu(bf[0].length) < be16_to_cpu(bf[1].length);
bf_err += be16_to_cpu(bf[1].length) < be16_to_cpu(bf[2].length);
if (freetabp) {
freetab = *freetabp;
if (freetab->naents <= db) {
*freetabp = freetab =
realloc(freetab, FREETAB_SIZE(db + 1));
for (i = freetab->naents; i < db; i++)
freetab->ents[i] = NULLDATAOFF;
freetab->naents = db + 1;
}
if (freetab->nents < db + 1)
freetab->nents = db + 1;
freetab->ents[db] = be16_to_cpu(bf[0].length);
}
while (ptr < endptr) {
dup = (xfs_dir2_data_unused_t *)ptr;
if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
lastfree_err += lastfree != 0;
tagp = xfs_dir2_data_unused_tag_p(dup);
if ((be16_to_cpu(dup->length) & (XFS_DIR2_DATA_ALIGN - 1)) ||
be16_to_cpu(dup->length) == 0 ||
(char *)tagp >= endptr) {
if (!sflag || v)
dbprintf(_("dir %lld block %d bad free "
"entry at %d\n"),
id->ino, dabno,
(int)((char *)dup -
(char *)data));
error++;
break;
}
tag_err += be16_to_cpu(*tagp) != (char *)dup - (char *)data;
dfp = process_data_dir_v2_freefind(data, dup);
if (dfp) {
i = (int)(dfp - bf);
bf_err += (freeseen & (1 << i)) != 0;
freeseen |= 1 << i;
} else
bf_err += be16_to_cpu(dup->length) >
be16_to_cpu(bf[2].length);
ptr += be16_to_cpu(dup->length);
lastfree = 1;
continue;
}
dep = (xfs_dir2_data_entry_t *)dup;
if (dep->namelen == 0) {
if (!sflag || v)
dbprintf(_("dir %lld block %d zero length entry "
"at %d\n"),
id->ino, dabno,
(int)((char *)dep - (char *)data));
error++;
}
tagp = M_DIROPS(mp)->data_entry_tag_p(dep);
if ((char *)tagp >= endptr) {
if (!sflag || v)
dbprintf(_("dir %lld block %d bad entry at %d\n"),
id->ino, dabno,
(int)((char *)dep - (char *)data));
error++;
break;
}
tag_err += be16_to_cpu(*tagp) != (char *)dep - (char *)data;
addr = xfs_dir2_db_off_to_dataptr(mp->m_dir_geo, db,
(char *)dep - (char *)data);
xname.name = dep->name;
xname.len = dep->namelen;
dir_hash_add(mp->m_dirnameops->hashname(&xname), addr);
ptr += M_DIROPS(mp)->data_entsize(dep->namelen);
count++;
lastfree = 0;
lino = be64_to_cpu(dep->inumber);
cid = find_inode(lino, 1);
if (v)
dbprintf(_("dir %lld block %d entry %*.*s %lld\n"),
id->ino, dabno, dep->namelen, dep->namelen,
dep->name, lino);
if (cid)
addlink_inode(cid);
else {
if (!sflag || v)
dbprintf(_("dir %lld block %d entry %*.*s bad "
"inode number %lld\n"),
id->ino, dabno, dep->namelen,
dep->namelen, dep->name, lino);
error++;
}
if (dep->namelen == 2 && dep->name[0] == '.' &&
dep->name[1] == '.') {
if (parent) {
if (!sflag || v)
dbprintf(_("multiple .. entries in dir "
"%lld (%lld, %lld)\n"),
id->ino, parent, lino);
error++;
} else
parent = cid ? lino : NULLFSINO;
(*dotdot)++;
} else if (dep->namelen != 1 || dep->name[0] != '.') {
if (cid != NULL) {
if (!cid->parent)
cid->parent = id;
addname_inode(cid, (char *)dep->name,
dep->namelen);
}
} else {
if (lino != id->ino) {
if (!sflag || v)
dbprintf(_("dir %lld entry . inode "
"number mismatch (%lld)\n"),
id->ino, lino);
error++;
}
(*dot)++;
}
}
if (be32_to_cpu(data->magic) == XFS_DIR2_BLOCK_MAGIC ||
be32_to_cpu(data->magic) == XFS_DIR3_BLOCK_MAGIC) {
endptr = (char *)data + mp->m_dir_geo->blksize;
for (i = stale = 0; lep && i < be32_to_cpu(btp->count); i++) {
if ((char *)&lep[i] >= endptr) {
if (!sflag || v)
dbprintf(_("dir %lld block %d bad count "
"%u\n"), id->ino, dabno,
be32_to_cpu(btp->count));
error++;
break;
}
if (be32_to_cpu(lep[i].address) == XFS_DIR2_NULL_DATAPTR)
stale++;
else if (dir_hash_see(be32_to_cpu(lep[i].hashval),
be32_to_cpu(lep[i].address))) {
if (!sflag || v)
dbprintf(_("dir %lld block %d extra leaf "
"entry %x %x\n"),
id->ino, dabno,
be32_to_cpu(lep[i].hashval),
be32_to_cpu(lep[i].address));
error++;
}
}
}
bf_err += freeseen != 7;
if (bf_err) {
if (!sflag || v)
dbprintf(_("dir %lld block %d bad bestfree data\n"),
id->ino, dabno);
error++;
}
if ((be32_to_cpu(data->magic) == XFS_DIR2_BLOCK_MAGIC ||
be32_to_cpu(data->magic) == XFS_DIR3_BLOCK_MAGIC) &&
count != be32_to_cpu(btp->count) - be32_to_cpu(btp->stale)) {
if (!sflag || v)
dbprintf(_("dir %lld block %d bad block tail count %d "
"(stale %d)\n"),
id->ino, dabno, be32_to_cpu(btp->count),
be32_to_cpu(btp->stale));
error++;
}
if ((be32_to_cpu(data->magic) == XFS_DIR2_BLOCK_MAGIC ||
be32_to_cpu(data->magic) == XFS_DIR2_BLOCK_MAGIC) &&
stale != be32_to_cpu(btp->stale)) {
if (!sflag || v)
dbprintf(_("dir %lld block %d bad stale tail count %d\n"),
id->ino, dabno, be32_to_cpu(btp->stale));
error++;
}
if (lastfree_err) {
if (!sflag || v)
dbprintf(_("dir %lld block %d consecutive free entries\n"),
id->ino, dabno);
error++;
}
if (tag_err) {
if (!sflag || v)
dbprintf(_("dir %lld block %d entry/unused tag "
"mismatch\n"),
id->ino, dabno);
error++;
}
return parent;
}
static xfs_dir2_data_free_t *
process_data_dir_v2_freefind(
struct xfs_dir2_data_hdr *data,
xfs_dir2_data_unused_t *dup)
{
struct xfs_dir2_data_free *bf;
struct xfs_dir2_data_free *dfp;
xfs_dir2_data_aoff_t off;
off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)data);
bf = M_DIROPS(mp)->data_bestfree_p(data);
if (be16_to_cpu(dup->length) <
be16_to_cpu(bf[XFS_DIR2_DATA_FD_COUNT - 1].length))
return NULL;
for (dfp = bf; dfp < &bf[XFS_DIR2_DATA_FD_COUNT]; dfp++) {
if (be16_to_cpu(dfp->offset) == 0)
return NULL;
if (be16_to_cpu(dfp->offset) == off)
return dfp;
}
return NULL;
}
static void
process_dir(
xfs_dinode_t *dip,
blkmap_t *blkmap,
inodata_t *id)
{
xfs_fsblock_t bno;
int dot;
int dotdot;
xfs_ino_t parent;
dot = dotdot = 0;
if (process_dir_v2(dip, blkmap, &dot, &dotdot, id, &parent))
return;
bno = XFS_INO_TO_FSB(mp, id->ino);
if (dot == 0) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
dbprintf(_("no . entry for directory %lld\n"), id->ino);
error++;
}
if (dotdot == 0) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
dbprintf(_("no .. entry for directory %lld\n"), id->ino);
error++;
} else if (parent == id->ino && id->ino != mp->m_sb.sb_rootino) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
dbprintf(_(". and .. same for non-root directory %lld\n"),
id->ino);
error++;
} else if (id->ino == mp->m_sb.sb_rootino && id->ino != parent) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
dbprintf(_("root directory %lld has .. %lld\n"), id->ino,
parent);
error++;
} else if (parent != NULLFSINO && id->ino != parent)
addparent_inode(id, parent);
}
static int
process_dir_v2(
xfs_dinode_t *dip,
blkmap_t *blkmap,
int *dot,
int *dotdot,
inodata_t *id,
xfs_ino_t *parent)
{
xfs_fileoff_t last = 0;
xfs_fsize_t size = be64_to_cpu(dip->di_size);
if (blkmap)
last = blkmap_last_off(blkmap);
if (size <= XFS_DFORK_DSIZE(dip, mp) &&
dip->di_format == XFS_DINODE_FMT_LOCAL)
*parent = process_sf_dir_v2(dip, dot, dotdot, id);
else if (last == mp->m_dir_geo->fsbcount &&
(dip->di_format == XFS_DINODE_FMT_EXTENTS ||
dip->di_format == XFS_DINODE_FMT_BTREE))
*parent = process_block_dir_v2(blkmap, dot, dotdot, id);
else if (last >= mp->m_dir_geo->leafblk + mp->m_dir_geo->fsbcount &&
(dip->di_format == XFS_DINODE_FMT_EXTENTS ||
dip->di_format == XFS_DINODE_FMT_BTREE))
*parent = process_leaf_node_dir_v2(blkmap, dot, dotdot, id, size);
else {
dbprintf(_("bad size (%lld) or format (%d) for directory inode "
"%lld\n"),
size, dip->di_format, id->ino);
error++;
return 1;
}
return 0;
}
/* ARGSUSED */
static void
process_exinode(
inodata_t *id,
xfs_dinode_t *dip,
dbm_t type,
xfs_rfsblock_t *totd,
xfs_rfsblock_t *toti,
xfs_extnum_t *nex,
blkmap_t **blkmapp,
int whichfork)
{
xfs_bmbt_rec_t *rp;
rp = (xfs_bmbt_rec_t *)XFS_DFORK_PTR(dip, whichfork);
*nex = XFS_DFORK_NEXTENTS(dip, whichfork);
if (*nex < 0 || *nex > XFS_DFORK_SIZE(dip, mp, whichfork) /
sizeof(xfs_bmbt_rec_t)) {
if (!sflag || id->ilist)
dbprintf(_("bad number of extents %d for inode %lld\n"),
*nex, id->ino);
error++;
return;
}
process_bmbt_reclist(rp, *nex, type, id, totd, blkmapp);
}
static void
process_inode(
xfs_agf_t *agf,
xfs_agino_t agino,
xfs_dinode_t *dip,
int isfree)
{
blkmap_t *blkmap;
xfs_fsblock_t bno = 0;
xfs_icdinode_t idic;
inodata_t *id = NULL;
xfs_ino_t ino;
xfs_extnum_t nextents = 0;
int nlink;
int security;
xfs_rfsblock_t totblocks;
xfs_rfsblock_t totdblocks = 0;
xfs_rfsblock_t totiblocks = 0;
dbm_t type;
xfs_extnum_t anextents = 0;
xfs_rfsblock_t atotdblocks = 0;
xfs_rfsblock_t atotiblocks = 0;
xfs_qcnt_t bc = 0;
xfs_qcnt_t ic = 0;
xfs_qcnt_t rc = 0;
xfs_dqid_t dqprid;
int v = 0;
static char okfmts[] = {
0, /* type 0 unused */
1 << XFS_DINODE_FMT_DEV, /* FIFO */
1 << XFS_DINODE_FMT_DEV, /* CHR */
0, /* type 3 unused */
(1 << XFS_DINODE_FMT_LOCAL) |
(1 << XFS_DINODE_FMT_EXTENTS) |
(1 << XFS_DINODE_FMT_BTREE), /* DIR */
0, /* type 5 unused */
1 << XFS_DINODE_FMT_DEV, /* BLK */
0, /* type 7 unused */
(1 << XFS_DINODE_FMT_EXTENTS) |
(1 << XFS_DINODE_FMT_BTREE), /* REG */
0, /* type 9 unused */
(1 << XFS_DINODE_FMT_LOCAL) |
(1 << XFS_DINODE_FMT_EXTENTS), /* LNK */
0, /* type 11 unused */
1 << XFS_DINODE_FMT_DEV, /* SOCK */
0, /* type 13 unused */
1 << XFS_DINODE_FMT_UUID, /* MNT */
0 /* type 15 unused */
};
static char *fmtnames[] = {
"dev", "local", "extents", "btree", "uuid"
};
libxfs_dinode_from_disk(&idic, dip);
ino = XFS_AGINO_TO_INO(mp, be32_to_cpu(agf->agf_seqno), agino);
if (!isfree) {
id = find_inode(ino, 1);
bno = XFS_INO_TO_FSB(mp, ino);
blkmap = NULL;
}
v = (!sflag || (id && id->ilist) || CHECK_BLIST(bno));
if (idic.di_magic != XFS_DINODE_MAGIC) {
if (isfree || v)
dbprintf(_("bad magic number %#x for inode %lld\n"),
idic.di_magic, ino);
error++;
return;
}
if (!xfs_dinode_good_version(mp, idic.di_version)) {
if (isfree || v)
dbprintf(_("bad version number %#x for inode %lld\n"),
idic.di_version, ino);
error++;
return;
}
if (isfree) {
if (idic.di_nblocks != 0) {
if (v)
dbprintf(_("bad nblocks %lld for free inode "
"%lld\n"),
idic.di_nblocks, ino);
error++;
}
if (idic.di_version == 1)
nlink = idic.di_onlink;
else
nlink = idic.di_nlink;
if (nlink != 0) {
if (v)
dbprintf(_("bad nlink %d for free inode %lld\n"),
nlink, ino);
error++;
}
if (idic.di_mode != 0) {
if (v)
dbprintf(_("bad mode %#o for free inode %lld\n"),
idic.di_mode, ino);
error++;
}
return;
}
if (be32_to_cpu(dip->di_next_unlinked) != NULLAGINO) {
if (v)
dbprintf(_("bad next unlinked %#x for inode %lld\n"),
be32_to_cpu(dip->di_next_unlinked), ino);
error++;
}
/*
* di_mode is a 16-bit uint so no need to check the < 0 case
*/
if ((((idic.di_mode & S_IFMT) >> 12) > 15) ||
(!(okfmts[(idic.di_mode & S_IFMT) >> 12] & (1 << idic.di_format)))) {
if (v)
dbprintf(_("bad format %d for inode %lld type %#o\n"),
idic.di_format, id->ino, idic.di_mode & S_IFMT);
error++;
return;
}
if ((unsigned int)XFS_DFORK_ASIZE(dip, mp) >=
XFS_LITINO(mp, idic.di_version)) {
if (v)
dbprintf(_("bad fork offset %d for inode %lld\n"),
idic.di_forkoff, id->ino);
error++;
return;
}
if ((unsigned int)idic.di_aformat > XFS_DINODE_FMT_BTREE) {
if (v)
dbprintf(_("bad attribute format %d for inode %lld\n"),
idic.di_aformat, id->ino);
error++;
return;
}
if (verbose || (id && id->ilist) || CHECK_BLIST(bno))
dbprintf(_("inode %lld mode %#o fmt %s "
"afmt %s "
"nex %d anex %d nblk %lld sz %lld%s%s%s%s%s%s%s\n"),
id->ino, idic.di_mode, fmtnames[(int)idic.di_format],
fmtnames[(int)idic.di_aformat],
idic.di_nextents,
idic.di_anextents,
idic.di_nblocks, idic.di_size,
idic.di_flags & XFS_DIFLAG_REALTIME ? " rt" : "",
idic.di_flags & XFS_DIFLAG_PREALLOC ? " pre" : "",
idic.di_flags & XFS_DIFLAG_IMMUTABLE? " imm" : "",
idic.di_flags & XFS_DIFLAG_APPEND ? " app" : "",
idic.di_flags & XFS_DIFLAG_SYNC ? " syn" : "",
idic.di_flags & XFS_DIFLAG_NOATIME ? " noa" : "",
idic.di_flags & XFS_DIFLAG_NODUMP ? " nod" : "");
security = 0;
switch (idic.di_mode & S_IFMT) {
case S_IFDIR:
type = DBM_DIR;
if (idic.di_format == XFS_DINODE_FMT_LOCAL)
break;
blkmap = blkmap_alloc(idic.di_nextents);
break;
case S_IFREG:
if (idic.di_flags & XFS_DIFLAG_REALTIME)
type = DBM_RTDATA;
else if (id->ino == mp->m_sb.sb_rbmino) {
type = DBM_RTBITMAP;
blkmap = blkmap_alloc(idic.di_nextents);
addlink_inode(id);
} else if (id->ino == mp->m_sb.sb_rsumino) {
type = DBM_RTSUM;
blkmap = blkmap_alloc(idic.di_nextents);
addlink_inode(id);
}
else if (id->ino == mp->m_sb.sb_uquotino ||
id->ino == mp->m_sb.sb_gquotino ||
id->ino == mp->m_sb.sb_pquotino) {
type = DBM_QUOTA;
blkmap = blkmap_alloc(idic.di_nextents);
addlink_inode(id);
}
else
type = DBM_DATA;
if (idic.di_mode & (S_ISUID | S_ISGID))
security = 1;
break;
case S_IFLNK:
type = DBM_SYMLINK;
break;
default:
security = 1;
type = DBM_UNKNOWN;
break;
}
if (idic.di_version == 1)
setlink_inode(id, idic.di_onlink, type == DBM_DIR, security);
else {
sbversion |= XFS_SB_VERSION_NLINKBIT;
setlink_inode(id, idic.di_nlink, type == DBM_DIR, security);
}
switch (idic.di_format) {
case XFS_DINODE_FMT_LOCAL:
process_lclinode(id, dip, type, &totdblocks, &totiblocks,
&nextents, &blkmap, XFS_DATA_FORK);
break;
case XFS_DINODE_FMT_EXTENTS:
process_exinode(id, dip, type, &totdblocks, &totiblocks,
&nextents, &blkmap, XFS_DATA_FORK);
break;
case XFS_DINODE_FMT_BTREE:
process_btinode(id, dip, type, &totdblocks, &totiblocks,
&nextents, &blkmap, XFS_DATA_FORK);
break;
}
if (XFS_DFORK_Q(dip)) {
sbversion |= XFS_SB_VERSION_ATTRBIT;
switch (idic.di_aformat) {
case XFS_DINODE_FMT_LOCAL:
process_lclinode(id, dip, DBM_ATTR, &atotdblocks,
&atotiblocks, &anextents, NULL, XFS_ATTR_FORK);
break;
case XFS_DINODE_FMT_EXTENTS:
process_exinode(id, dip, DBM_ATTR, &atotdblocks,
&atotiblocks, &anextents, NULL, XFS_ATTR_FORK);
break;
case XFS_DINODE_FMT_BTREE:
process_btinode(id, dip, DBM_ATTR, &atotdblocks,
&atotiblocks, &anextents, NULL, XFS_ATTR_FORK);
break;
}
}
if (qgdo || qpdo || qudo) {
switch (type) {
case DBM_DATA:
case DBM_DIR:
case DBM_RTBITMAP:
case DBM_RTSUM:
case DBM_SYMLINK:
case DBM_UNKNOWN:
bc = totdblocks + totiblocks +
atotdblocks + atotiblocks;
ic = 1;
break;
case DBM_RTDATA:
bc = totiblocks + atotdblocks + atotiblocks;
rc = totdblocks;
ic = 1;
break;
default:
break;
}
if (ic) {
dqprid = xfs_get_projid(&idic); /* dquot ID is u32 */
quota_add(&dqprid, &idic.di_gid, &idic.di_uid,
0, bc, ic, rc);
}
}
totblocks = totdblocks + totiblocks + atotdblocks + atotiblocks;
if (totblocks != idic.di_nblocks) {
if (v)
dbprintf(_("bad nblocks %lld for inode %lld, counted "
"%lld\n"),
idic.di_nblocks, id->ino, totblocks);
error++;
}
if (nextents != idic.di_nextents) {
if (v)
dbprintf(_("bad nextents %d for inode %lld, counted %d\n"),
idic.di_nextents, id->ino, nextents);
error++;
}
if (anextents != idic.di_anextents) {
if (v)
dbprintf(_("bad anextents %d for inode %lld, counted "
"%d\n"),
idic.di_anextents, id->ino, anextents);
error++;
}
if (type == DBM_DIR)
process_dir(dip, blkmap, id);
else if (type == DBM_RTBITMAP)
process_rtbitmap(blkmap);
else if (type == DBM_RTSUM)
process_rtsummary(blkmap);
/*
* If the CHKD flag is not set, this can legitimately contain garbage;
* xfs_repair may have cleared that bit.
*/
else if (type == DBM_QUOTA) {
if (id->ino == mp->m_sb.sb_uquotino &&
(mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT) &&
(mp->m_sb.sb_qflags & XFS_UQUOTA_CHKD))
process_quota(IS_USER_QUOTA, id, blkmap);
else if (id->ino == mp->m_sb.sb_gquotino &&
(mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) &&
(mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD))
process_quota(IS_GROUP_QUOTA, id, blkmap);
else if (id->ino == mp->m_sb.sb_pquotino &&
(mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) &&
(mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD))
process_quota(IS_PROJECT_QUOTA, id, blkmap);
}
if (blkmap)
blkmap_free(blkmap);
}
/* ARGSUSED */
static void
process_lclinode(
inodata_t *id,
xfs_dinode_t *dip,
dbm_t type,
xfs_rfsblock_t *totd,
xfs_rfsblock_t *toti,
xfs_extnum_t *nex,
blkmap_t **blkmapp,
int whichfork)
{
xfs_attr_shortform_t *asf;
xfs_fsblock_t bno;
bno = XFS_INO_TO_FSB(mp, id->ino);
if (whichfork == XFS_DATA_FORK && be64_to_cpu(dip->di_size) >
XFS_DFORK_DSIZE(dip, mp)) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
dbprintf(_("local inode %lld data is too large (size "
"%lld)\n"),
id->ino, be64_to_cpu(dip->di_size));
error++;
}
else if (whichfork == XFS_ATTR_FORK) {
asf = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip);
if (be16_to_cpu(asf->hdr.totsize) > XFS_DFORK_ASIZE(dip, mp)) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
dbprintf(_("local inode %lld attr is too large "
"(size %d)\n"),
id->ino, be16_to_cpu(asf->hdr.totsize));
error++;
}
}
}
static xfs_ino_t
process_leaf_node_dir_v2(
blkmap_t *blkmap,
int *dot,
int *dotdot,
inodata_t *id,
xfs_fsize_t dirsize)
{
xfs_fsblock_t b;
bbmap_t bbmap;
bmap_ext_t *bmp;
xfs_fileoff_t dbno;
freetab_t *freetab;
int i;
xfs_ino_t lino;
int nex;
xfs_ino_t parent;
int t = 0;
int v;
int v2;
int x;
v2 = verbose || id->ilist;
v = parent = 0;
dbno = NULLFILEOFF;
freetab = malloc(FREETAB_SIZE(dirsize / mp->m_dir_geo->blksize));
freetab->naents = (int)(dirsize / mp->m_dir_geo->blksize);
freetab->nents = 0;
for (i = 0; i < freetab->naents; i++)
freetab->ents[i] = NULLDATAOFF;
dir_hash_init();
while ((dbno = blkmap_next_off(blkmap, dbno, &t)) != NULLFILEOFF) {
nex = blkmap_getn(blkmap, dbno, mp->m_dir_geo->fsbcount, &bmp);
ASSERT(nex > 0);
for (v = v2, x = 0; !v && x < nex; x++) {
for (b = bmp[x].startblock;
!v && b < bmp[x].startblock + bmp[x].blockcount;
b++)
v = CHECK_BLIST(b);
}
if (v)
dbprintf(_("dir inode %lld block %u=%llu\n"), id->ino,
(__uint32_t)dbno,
(xfs_fsblock_t)bmp->startblock);
push_cur();
if (nex > 1)
make_bbmap(&bbmap, nex, bmp);
set_cur(&typtab[TYP_DIR2], XFS_FSB_TO_DADDR(mp, bmp->startblock),
mp->m_dir_geo->fsbcount * blkbb, DB_RING_IGN,
nex > 1 ? &bbmap : NULL);
free(bmp);
if (iocur_top->data == NULL) {
if (!sflag || v)
dbprintf(_("can't read block %u for directory "
"inode %lld\n"),
(__uint32_t)dbno, id->ino);
error++;
pop_cur();
dbno += mp->m_dir_geo->fsbcount - 1;
continue;
}
if (dbno < mp->m_dir_geo->leafblk) {
lino = process_data_dir_v2(dot, dotdot, id, v,
(xfs_dablk_t)dbno, &freetab);
if (lino) {
if (parent) {
if (!sflag || v)
dbprintf(_("multiple .. entries "
"in dir %lld\n"),
id->ino);
error++;
} else
parent = lino;
}
} else if (dbno < mp->m_dir_geo->freeblk) {
process_leaf_node_dir_v2_int(id, v, (xfs_dablk_t)dbno,
freetab);
} else {
process_leaf_node_dir_v2_free(id, v, (xfs_dablk_t)dbno,
freetab);
}
pop_cur();
dbno += mp->m_dir_geo->fsbcount - 1;
}
dir_hash_check(id, v);
dir_hash_done();
for (i = 0; i < freetab->nents; i++) {
if (freetab->ents[i] != NULLDATAOFF) {
if (!sflag || v)
dbprintf(_("missing free index for data block %d "
"in dir ino %lld\n"),
xfs_dir2_db_to_da(mp->m_dir_geo, i), id->ino);
error++;
}
}
free(freetab);
return parent;
}
static void
process_leaf_node_dir_v3_free(
inodata_t *id,
int v,
xfs_dablk_t dabno,
freetab_t *freetab)
{
xfs_dir2_data_off_t ent;
struct xfs_dir3_free *free;
int i;
int maxent;
int used;
free = iocur_top->data;
maxent = M_DIROPS(mp)->free_max_bests(mp->m_dir_geo);
if (be32_to_cpu(free->hdr.firstdb) != xfs_dir2_da_to_db(mp->m_dir_geo,
dabno - mp->m_dir_geo->freeblk) * maxent) {
if (!sflag || v)
dbprintf(_("bad free block firstdb %d for dir ino %lld "
"block %d\n"),
be32_to_cpu(free->hdr.firstdb), id->ino, dabno);
error++;
return;
}
if (be32_to_cpu(free->hdr.nvalid) > maxent ||
be32_to_cpu(free->hdr.nvalid) < 0 ||
be32_to_cpu(free->hdr.nused) > maxent ||
be32_to_cpu(free->hdr.nused) < 0 ||
be32_to_cpu(free->hdr.nused) >
be32_to_cpu(free->hdr.nvalid)) {
if (!sflag || v)
dbprintf(_("bad free block nvalid/nused %d/%d for dir "
"ino %lld block %d\n"),
be32_to_cpu(free->hdr.nvalid),
be32_to_cpu(free->hdr.nused), id->ino, dabno);
error++;
return;
}
for (used = i = 0; i < be32_to_cpu(free->hdr.nvalid); i++) {
if (freetab->nents <= be32_to_cpu(free->hdr.firstdb) + i)
ent = NULLDATAOFF;
else
ent = freetab->ents[be32_to_cpu(free->hdr.firstdb) + i];
if (ent != be16_to_cpu(free->bests[i])) {
if (!sflag || v)
dbprintf(_("bad free block ent %d is %d should "
"be %d for dir ino %lld block %d\n"),
i, be16_to_cpu(free->bests[i]), ent,
id->ino, dabno);
error++;
}
if (be16_to_cpu(free->bests[i]) != NULLDATAOFF)
used++;
if (ent != NULLDATAOFF)
freetab->ents[be32_to_cpu(free->hdr.firstdb) + i] =
NULLDATAOFF;
}
if (used != be32_to_cpu(free->hdr.nused)) {
if (!sflag || v)
dbprintf(_("bad free block nused %d should be %d for dir "
"ino %lld block %d\n"),
be32_to_cpu(free->hdr.nused), used, id->ino,
dabno);
error++;
}
}
static void
process_leaf_node_dir_v2_free(
inodata_t *id,
int v,
xfs_dablk_t dabno,
freetab_t *freetab)
{
xfs_dir2_data_off_t ent;
xfs_dir2_free_t *free;
int i;
int maxent;
int used;
free = iocur_top->data;
if (be32_to_cpu(free->hdr.magic) != XFS_DIR2_FREE_MAGIC &&
be32_to_cpu(free->hdr.magic) != XFS_DIR3_FREE_MAGIC) {
if (!sflag || v)
dbprintf(_("bad free block magic # %#x for dir ino %lld "
"block %d\n"),
be32_to_cpu(free->hdr.magic), id->ino, dabno);
error++;
return;
}
if (be32_to_cpu(free->hdr.magic) == XFS_DIR3_FREE_MAGIC) {
process_leaf_node_dir_v3_free(id, v, dabno, freetab);
return;
}
maxent = M_DIROPS(mp)->free_max_bests(mp->m_dir_geo);
if (be32_to_cpu(free->hdr.firstdb) != xfs_dir2_da_to_db(mp->m_dir_geo,
dabno - mp->m_dir_geo->freeblk) * maxent) {
if (!sflag || v)
dbprintf(_("bad free block firstdb %d for dir ino %lld "
"block %d\n"),
be32_to_cpu(free->hdr.firstdb), id->ino, dabno);
error++;
return;
}
if (be32_to_cpu(free->hdr.nvalid) > maxent ||
be32_to_cpu(free->hdr.nvalid) < 0 ||
be32_to_cpu(free->hdr.nused) > maxent ||
be32_to_cpu(free->hdr.nused) < 0 ||
be32_to_cpu(free->hdr.nused) >
be32_to_cpu(free->hdr.nvalid)) {
if (!sflag || v)
dbprintf(_("bad free block nvalid/nused %d/%d for dir "
"ino %lld block %d\n"),
be32_to_cpu(free->hdr.nvalid),
be32_to_cpu(free->hdr.nused), id->ino, dabno);
error++;
return;
}
for (used = i = 0; i < be32_to_cpu(free->hdr.nvalid); i++) {
if (freetab->nents <= be32_to_cpu(free->hdr.firstdb) + i)
ent = NULLDATAOFF;
else
ent = freetab->ents[be32_to_cpu(free->hdr.firstdb) + i];
if (ent != be16_to_cpu(free->bests[i])) {
if (!sflag || v)
dbprintf(_("bad free block ent %d is %d should "
"be %d for dir ino %lld block %d\n"),
i, be16_to_cpu(free->bests[i]), ent,
id->ino, dabno);
error++;
}
if (be16_to_cpu(free->bests[i]) != NULLDATAOFF)
used++;
if (ent != NULLDATAOFF)
freetab->ents[be32_to_cpu(free->hdr.firstdb) + i] =
NULLDATAOFF;
}
if (used != be32_to_cpu(free->hdr.nused)) {
if (!sflag || v)
dbprintf(_("bad free block nused %d should be %d for dir "
"ino %lld block %d\n"),
be32_to_cpu(free->hdr.nused), used, id->ino,
dabno);
error++;
}
}
/*
* Get address of the bestcount field in the single-leaf block.
*/
static inline int
xfs_dir3_leaf_ents_count(struct xfs_dir2_leaf *lp)
{
if (lp->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC) ||
lp->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)) {
struct xfs_dir3_leaf *lp3 = (struct xfs_dir3_leaf *)lp;
return be16_to_cpu(lp3->hdr.count);
}
return be16_to_cpu(lp->hdr.count);
}
static void
process_leaf_node_dir_v2_int(
inodata_t *id,
int v,
xfs_dablk_t dabno,
freetab_t *freetab)
{
int i;
__be16 *lbp;
xfs_dir2_leaf_t *leaf;
struct xfs_dir3_leaf *leaf3 = NULL;
xfs_dir2_leaf_entry_t *lep;
xfs_dir2_leaf_tail_t *ltp;
xfs_da_intnode_t *node;
int stale;
struct xfs_da3_icnode_hdr nodehdr;
leaf = iocur_top->data;
switch (be16_to_cpu(leaf->hdr.info.magic)) {
case XFS_DIR3_LEAF1_MAGIC:
case XFS_DIR3_LEAFN_MAGIC:
case XFS_DA3_NODE_MAGIC:
leaf3 = iocur_top->data;
break;
}
switch (be16_to_cpu(leaf->hdr.info.magic)) {
case XFS_DIR2_LEAF1_MAGIC:
case XFS_DIR3_LEAF1_MAGIC:
if (be32_to_cpu(leaf->hdr.info.forw) ||
be32_to_cpu(leaf->hdr.info.back)) {
if (!sflag || v)
dbprintf(_("bad leaf block forw/back pointers "
"%d/%d for dir ino %lld block %d\n"),
be32_to_cpu(leaf->hdr.info.forw),
be32_to_cpu(leaf->hdr.info.back),
id->ino, dabno);
error++;
}
if (dabno != mp->m_dir_geo->leafblk) {
if (!sflag || v)
dbprintf(_("single leaf block for dir ino %lld "
"block %d should be at block %d\n"),
id->ino, dabno,
(xfs_dablk_t)mp->m_dir_geo->leafblk);
error++;
}
ltp = xfs_dir2_leaf_tail_p(mp->m_dir_geo, leaf);
lbp = xfs_dir2_leaf_bests_p(ltp);
for (i = 0; i < be32_to_cpu(ltp->bestcount); i++) {
if (freetab->nents <= i || freetab->ents[i] !=
be16_to_cpu(lbp[i])) {
if (!sflag || v)
dbprintf(_("bestfree %d for dir ino %lld "
"block %d doesn't match table "
"value %d\n"),
freetab->nents <= i ?
NULLDATAOFF :
freetab->ents[i],
id->ino,
xfs_dir2_db_to_da(mp->m_dir_geo, i),
be16_to_cpu(lbp[i]));
}
if (freetab->nents > i)
freetab->ents[i] = NULLDATAOFF;
}
break;
case XFS_DIR2_LEAFN_MAGIC:
case XFS_DIR3_LEAFN_MAGIC:
/* if it's at the root location then we can check the
* pointers are null XXX */
break;
case XFS_DA_NODE_MAGIC:
case XFS_DA3_NODE_MAGIC:
node = iocur_top->data;
M_DIROPS(mp)->node_hdr_from_disk(&nodehdr, node);
if (nodehdr.level < 1 || nodehdr.level > XFS_DA_NODE_MAXDEPTH) {
if (!sflag || v)
dbprintf(_("bad node block level %d for dir ino "
"%lld block %d\n"),
nodehdr.level, id->ino,
dabno);
error++;
}
return;
default:
if (!sflag || v)
dbprintf(_("bad directory data magic # %#x for dir ino "
"%lld block %d\n"),
be16_to_cpu(leaf->hdr.info.magic), id->ino,
dabno);
error++;
return;
}
lep = M_DIROPS(mp)->leaf_ents_p(leaf);
for (i = stale = 0; i < xfs_dir3_leaf_ents_count(leaf); i++) {
if (be32_to_cpu(lep[i].address) == XFS_DIR2_NULL_DATAPTR)
stale++;
else if (dir_hash_see(be32_to_cpu(lep[i].hashval),
be32_to_cpu(lep[i].address))) {
if (!sflag || v)
dbprintf(_("dir %lld block %d extra leaf entry "
"%x %x\n"), id->ino, dabno,
be32_to_cpu(lep[i].hashval),
be32_to_cpu(lep[i].address));
error++;
}
}
if (leaf3 && stale != be16_to_cpu(leaf3->hdr.stale)) {
if (!sflag || v)
dbprintf(_("dir3 %lld block %d stale mismatch "
"%d/%d\n"),
id->ino, dabno, stale,
be16_to_cpu(leaf3->hdr.stale));
error++;
} else if (!leaf && stale != be16_to_cpu(leaf->hdr.stale)) {
if (!sflag || v)
dbprintf(_("dir %lld block %d stale mismatch "
"%d/%d\n"),
id->ino, dabno, stale,
be16_to_cpu(leaf->hdr.stale));
error++;
}
}
static void
process_quota(
qtype_t qtype,
inodata_t *id,
blkmap_t *blkmap)
{
xfs_fsblock_t bno;
int cb;
xfs_dqblk_t *dqb;
xfs_dqid_t dqid;
u_int8_t exp_flags = 0;
uint i;
uint perblock;
xfs_fileoff_t qbno;
char *s = NULL;
int scicb;
int t = 0;
switch (qtype) {
case IS_USER_QUOTA:
s = "user";
exp_flags = XFS_DQ_USER;
break;
case IS_PROJECT_QUOTA:
s = "project";
exp_flags = XFS_DQ_PROJ;
break;
case IS_GROUP_QUOTA:
s = "group";
exp_flags = XFS_DQ_GROUP;
break;
default:
ASSERT(0);
}
perblock = (uint)(mp->m_sb.sb_blocksize / sizeof(*dqb));
dqid = 0;
qbno = NULLFILEOFF;
while ((qbno = blkmap_next_off(blkmap, qbno, &t)) != NULLFILEOFF) {
bno = blkmap_get(blkmap, qbno);
dqid = (xfs_dqid_t)qbno * perblock;
cb = CHECK_BLIST(bno);
scicb = !sflag || id->ilist || cb;
push_cur();
set_cur(&typtab[TYP_DQBLK], XFS_FSB_TO_DADDR(mp, bno), blkbb,
DB_RING_IGN, NULL);
if ((dqb = iocur_top->data) == NULL) {
if (scicb)
dbprintf(_("can't read block %lld for %s quota "
"inode (fsblock %lld)\n"),
(xfs_fileoff_t)qbno, s,
(xfs_fsblock_t)bno);
error++;
pop_cur();
continue;
}
for (i = 0; i < perblock; i++, dqid++, dqb++) {
if (verbose || id->ilist || cb)
dbprintf(_("%s dqblk %lld entry %d id %u bc "
"%lld ic %lld rc %lld\n"),
s, (xfs_fileoff_t)qbno, i, dqid,
be64_to_cpu(dqb->dd_diskdq.d_bcount),
be64_to_cpu(dqb->dd_diskdq.d_icount),
be64_to_cpu(dqb->dd_diskdq.d_rtbcount));
if (be16_to_cpu(dqb->dd_diskdq.d_magic) != XFS_DQUOT_MAGIC) {
if (scicb)
dbprintf(_("bad magic number %#x for %s "
"dqblk %lld entry %d id %u\n"),
be16_to_cpu(dqb->dd_diskdq.d_magic), s,
(xfs_fileoff_t)qbno, i, dqid);
error++;
continue;
}
if (dqb->dd_diskdq.d_version != XFS_DQUOT_VERSION) {
if (scicb)
dbprintf(_("bad version number %#x for "
"%s dqblk %lld entry %d id "
"%u\n"),
dqb->dd_diskdq.d_version, s,
(xfs_fileoff_t)qbno, i, dqid);
error++;
continue;
}
if (dqb->dd_diskdq.d_flags != exp_flags) {
if (scicb)
dbprintf(_("bad flags %#x for %s dqblk "
"%lld entry %d id %u\n"),
dqb->dd_diskdq.d_flags, s,
(xfs_fileoff_t)qbno, i, dqid);
error++;
continue;
}
if (be32_to_cpu(dqb->dd_diskdq.d_id) != dqid) {
if (scicb)
dbprintf(_("bad id %u for %s dqblk %lld "
"entry %d id %u\n"),
be32_to_cpu(dqb->dd_diskdq.d_id), s,
(xfs_fileoff_t)qbno, i, dqid);
error++;
continue;
}
quota_add((qtype == IS_PROJECT_QUOTA) ? &dqid : NULL,
(qtype == IS_GROUP_QUOTA) ? &dqid : NULL,
(qtype == IS_USER_QUOTA) ? &dqid : NULL,
1,
be64_to_cpu(dqb->dd_diskdq.d_bcount),
be64_to_cpu(dqb->dd_diskdq.d_icount),
be64_to_cpu(dqb->dd_diskdq.d_rtbcount));
}
pop_cur();
}
}
static void
process_rtbitmap(
blkmap_t *blkmap)
{
int bit;
int bitsperblock;
xfs_fileoff_t bmbno;
xfs_fsblock_t bno;
xfs_rtblock_t extno;
int len;
int log;
int offs;
int prevbit;
xfs_rfsblock_t rtbno;
int start_bmbno;
int start_bit;
int t;
xfs_rtword_t *words;
bitsperblock = mp->m_sb.sb_blocksize * NBBY;
bit = extno = prevbit = start_bmbno = start_bit = 0;
bmbno = NULLFILEOFF;
while ((bmbno = blkmap_next_off(blkmap, bmbno, &t)) !=
NULLFILEOFF) {
bno = blkmap_get(blkmap, bmbno);
if (bno == NULLFSBLOCK) {
if (!sflag)
dbprintf(_("block %lld for rtbitmap inode is "
"missing\n"),
(xfs_fileoff_t)bmbno);
error++;
continue;
}
push_cur();
set_cur(&typtab[TYP_RTBITMAP], XFS_FSB_TO_DADDR(mp, bno), blkbb,
DB_RING_IGN, NULL);
if ((words = iocur_top->data) == NULL) {
if (!sflag)
dbprintf(_("can't read block %lld for rtbitmap "
"inode\n"),
(xfs_fileoff_t)bmbno);
error++;
pop_cur();
continue;
}
for (bit = 0;
bit < bitsperblock && extno < mp->m_sb.sb_rextents;
bit++, extno++) {
if (xfs_isset(words, bit)) {
rtbno = extno * mp->m_sb.sb_rextsize;
set_rdbmap(rtbno, mp->m_sb.sb_rextsize,
DBM_RTFREE);
frextents++;
if (prevbit == 0) {
start_bmbno = (int)bmbno;
start_bit = bit;
prevbit = 1;
}
} else if (prevbit == 1) {
len = ((int)bmbno - start_bmbno) *
bitsperblock + (bit - start_bit);
log = XFS_RTBLOCKLOG(len);
offs = XFS_SUMOFFS(mp, log, start_bmbno);
sumcompute[offs]++;
prevbit = 0;
}
}
pop_cur();
if (extno == mp->m_sb.sb_rextents)
break;
}
if (prevbit == 1) {
len = ((int)bmbno - start_bmbno) * bitsperblock +
(bit - start_bit);
log = XFS_RTBLOCKLOG(len);
offs = XFS_SUMOFFS(mp, log, start_bmbno);
sumcompute[offs]++;
}
}
static void
process_rtsummary(
blkmap_t *blkmap)
{
xfs_fsblock_t bno;
char *bytes;
xfs_fileoff_t sumbno;
int t;
sumbno = NULLFILEOFF;
while ((sumbno = blkmap_next_off(blkmap, sumbno, &t)) != NULLFILEOFF) {
bno = blkmap_get(blkmap, sumbno);
if (bno == NULLFSBLOCK) {
if (!sflag)
dbprintf(_("block %lld for rtsummary inode is "
"missing\n"),
(xfs_fileoff_t)sumbno);
error++;
continue;
}
push_cur();
set_cur(&typtab[TYP_RTSUMMARY], XFS_FSB_TO_DADDR(mp, bno),
blkbb, DB_RING_IGN, NULL);
if ((bytes = iocur_top->data) == NULL) {
if (!sflag)
dbprintf(_("can't read block %lld for rtsummary "
"inode\n"),
(xfs_fileoff_t)sumbno);
error++;
pop_cur();
continue;
}
memcpy((char *)sumfile + sumbno * mp->m_sb.sb_blocksize, bytes,
mp->m_sb.sb_blocksize);
pop_cur();
}
}
static xfs_ino_t
process_sf_dir_v2(
xfs_dinode_t *dip,
int *dot,
int *dotdot,
inodata_t *id)
{
inodata_t *cid;
int i;
int i8;
xfs_ino_t lino;
int offset;
struct xfs_dir2_sf_hdr *sf;
xfs_dir2_sf_entry_t *sfe;
int v;
sf = (struct xfs_dir2_sf_hdr *)XFS_DFORK_DPTR(dip);
addlink_inode(id);
v = verbose || id->ilist;
if (v)
dbprintf(_("dir %lld entry . %lld\n"), id->ino, id->ino);
(*dot)++;
sfe = xfs_dir2_sf_firstentry(sf);
offset = M_DIROPS(mp)->data_first_offset;
for (i = sf->count - 1, i8 = 0; i >= 0; i--) {
if ((intptr_t)sfe + M_DIROPS(mp)->sf_entsize(sf, sfe->namelen) -
(intptr_t)sf > be64_to_cpu(dip->di_size)) {
if (!sflag)
dbprintf(_("dir %llu bad size in entry at %d\n"),
id->ino,
(int)((char *)sfe - (char *)sf));
error++;
break;
}
lino = M_DIROPS(mp)->sf_get_ino(sf, sfe);
if (lino > XFS_DIR2_MAX_SHORT_INUM)
i8++;
cid = find_inode(lino, 1);
if (cid == NULL) {
if (!sflag)
dbprintf(_("dir %lld entry %*.*s bad inode "
"number %lld\n"),
id->ino, sfe->namelen, sfe->namelen,
sfe->name, lino);
error++;
} else {
addlink_inode(cid);
if (!cid->parent)
cid->parent = id;
addname_inode(cid, (char *)sfe->name, sfe->namelen);
}
if (v)
dbprintf(_("dir %lld entry %*.*s offset %d %lld\n"),
id->ino, sfe->namelen, sfe->namelen, sfe->name,
xfs_dir2_sf_get_offset(sfe), lino);
if (xfs_dir2_sf_get_offset(sfe) < offset) {
if (!sflag)
dbprintf(_("dir %lld entry %*.*s bad offset %d\n"),
id->ino, sfe->namelen, sfe->namelen,
sfe->name, xfs_dir2_sf_get_offset(sfe));
error++;
}
offset =
xfs_dir2_sf_get_offset(sfe) +
M_DIROPS(mp)->sf_entsize(sf, sfe->namelen);
sfe = M_DIROPS(mp)->sf_nextentry(sf, sfe);
}
if (i < 0 && (intptr_t)sfe - (intptr_t)sf !=
be64_to_cpu(dip->di_size)) {
if (!sflag)
dbprintf(_("dir %llu size is %lld, should be %u\n"),
id->ino, be64_to_cpu(dip->di_size),
(uint)((char *)sfe - (char *)sf));
error++;
}
if (offset + (sf->count + 2) * sizeof(xfs_dir2_leaf_entry_t) +
sizeof(xfs_dir2_block_tail_t) > mp->m_dir_geo->blksize) {
if (!sflag)
dbprintf(_("dir %llu offsets too high\n"), id->ino);
error++;
}
lino = M_DIROPS(mp)->sf_get_parent_ino(sf);
if (lino > XFS_DIR2_MAX_SHORT_INUM)
i8++;
cid = find_inode(lino, 1);
if (cid)
addlink_inode(cid);
else {
if (!sflag)
dbprintf(_("dir %lld entry .. bad inode number %lld\n"),
id->ino, lino);
error++;
}
if (v)
dbprintf(_("dir %lld entry .. %lld\n"), id->ino, lino);
if (i8 != sf->i8count) {
if (!sflag)
dbprintf(_("dir %lld i8count mismatch is %d should be "
"%d\n"),
id->ino, sf->i8count, i8);
error++;
}
(*dotdot)++;
return cid ? lino : NULLFSINO;
}
static void
quota_add(
xfs_dqid_t *prjid,
xfs_dqid_t *grpid,
xfs_dqid_t *usrid,
int dq,
xfs_qcnt_t bc,
xfs_qcnt_t ic,
xfs_qcnt_t rc)
{
if (qudo && usrid != NULL)
quota_add1(qudata, *usrid, dq, bc, ic, rc);
if (qgdo && grpid != NULL)
quota_add1(qgdata, *grpid, dq, bc, ic, rc);
if (qpdo && prjid != NULL)
quota_add1(qpdata, *prjid, dq, bc, ic, rc);
}
static void
quota_add1(
qdata_t **qt,
xfs_dqid_t id,
int dq,
xfs_qcnt_t bc,
xfs_qcnt_t ic,
xfs_qcnt_t rc)
{
qdata_t *qe;
int qh;
qinfo_t *qi;
qh = (int)(id % QDATA_HASH_SIZE);
qe = qt[qh];
while (qe) {
if (qe->id == id) {
qi = dq ? &qe->dq : &qe->count;
qi->bc += bc;
qi->ic += ic;
qi->rc += rc;
return;
}
qe = qe->next;
}
qe = xmalloc(sizeof(*qe));
qe->id = id;
qi = dq ? &qe->dq : &qe->count;
qi->bc = bc;
qi->ic = ic;
qi->rc = rc;
qi = dq ? &qe->count : &qe->dq;
qi->bc = qi->ic = qi->rc = 0;
qe->next = qt[qh];
qt[qh] = qe;
}
static void
quota_check(
char *s,
qdata_t **qt)
{
int i;
qdata_t *next;
qdata_t *qp;
for (i = 0; i < QDATA_HASH_SIZE; i++) {
qp = qt[i];
while (qp) {
next = qp->next;
if (qp->count.bc != qp->dq.bc ||
qp->count.ic != qp->dq.ic ||
qp->count.rc != qp->dq.rc) {
if (!sflag) {
dbprintf(_("%s quota id %u, have/exp"),
s, qp->id);
if (qp->count.bc != qp->dq.bc)
dbprintf(_(" bc %lld/%lld"),
qp->dq.bc,
qp->count.bc);
if (qp->count.ic != qp->dq.ic)
dbprintf(_(" ic %lld/%lld"),
qp->dq.ic,
qp->count.ic);
if (qp->count.rc != qp->dq.rc)
dbprintf(_(" rc %lld/%lld"),
qp->dq.rc,
qp->count.rc);
dbprintf("\n");
}
error++;
}
xfree(qp);
qp = next;
}
}
xfree(qt);
}
static void
quota_init(void)
{
qudo = mp->m_sb.sb_uquotino != 0 &&
mp->m_sb.sb_uquotino != NULLFSINO &&
(mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT) &&
(mp->m_sb.sb_qflags & XFS_UQUOTA_CHKD);
qgdo = mp->m_sb.sb_gquotino != 0 &&
mp->m_sb.sb_gquotino != NULLFSINO &&
(mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) &&
(mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD);
qpdo = mp->m_sb.sb_pquotino != 0 &&
mp->m_sb.sb_pquotino != NULLFSINO &&
(mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) &&
(mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD);
if (qudo)
qudata = xcalloc(QDATA_HASH_SIZE, sizeof(qdata_t *));
if (qgdo)
qgdata = xcalloc(QDATA_HASH_SIZE, sizeof(qdata_t *));
if (qpdo)
qpdata = xcalloc(QDATA_HASH_SIZE, sizeof(qdata_t *));
}
static void
scan_ag(
xfs_agnumber_t agno)
{
xfs_agf_t *agf;
xfs_agi_t *agi;
int i;
xfs_sb_t tsb;
xfs_sb_t *sb = &tsb;
agffreeblks = agflongest = 0;
agfbtreeblks = -2;
agicount = agifreecount = 0;
push_cur(); /* 1 pushed */
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);
serious_error++;
goto pop1_out;
}
libxfs_sb_from_disk(sb, iocur_top->data);
if (sb->sb_magicnum != XFS_SB_MAGIC) {
if (!sflag)
dbprintf(_("bad sb magic # %#x in ag %u\n"),
sb->sb_magicnum, agno);
error++;
}
if (!xfs_sb_good_version(sb)) {
if (!sflag)
dbprintf(_("bad sb version # %#x in ag %u\n"),
sb->sb_versionnum, agno);
error++;
sbver_err++;
}
if (!lazycount && xfs_sb_version_haslazysbcount(sb)) {
lazycount = 1;
}
if (agno == 0 && sb->sb_inprogress != 0) {
if (!sflag)
dbprintf(_("mkfs not completed successfully\n"));
error++;
}
set_dbmap(agno, XFS_SB_BLOCK(mp), 1, DBM_SB, agno, XFS_SB_BLOCK(mp));
if (sb->sb_logstart && XFS_FSB_TO_AGNO(mp, sb->sb_logstart) == agno)
set_dbmap(agno, XFS_FSB_TO_AGBNO(mp, sb->sb_logstart),
sb->sb_logblocks, DBM_LOG, agno, XFS_SB_BLOCK(mp));
push_cur(); /* 2 pushed */
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);
serious_error++;
goto pop2_out;
}
if (be32_to_cpu(agf->agf_magicnum) != XFS_AGF_MAGIC) {
if (!sflag)
dbprintf(_("bad agf magic # %#x in ag %u\n"),
be32_to_cpu(agf->agf_magicnum), agno);
error++;
}
if (!XFS_AGF_GOOD_VERSION(be32_to_cpu(agf->agf_versionnum))) {
if (!sflag)
dbprintf(_("bad agf version # %#x in ag %u\n"),
be32_to_cpu(agf->agf_versionnum), agno);
error++;
}
if (XFS_SB_BLOCK(mp) != XFS_AGF_BLOCK(mp))
set_dbmap(agno, XFS_AGF_BLOCK(mp), 1, DBM_AGF, agno,
XFS_SB_BLOCK(mp));
if (sb->sb_agblocks > be32_to_cpu(agf->agf_length))
set_dbmap(agno, be32_to_cpu(agf->agf_length),
sb->sb_agblocks - be32_to_cpu(agf->agf_length),
DBM_MISSING, agno, XFS_SB_BLOCK(mp));
push_cur(); /* 3 pushed */
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++;
goto pop3_out;
}
if (be32_to_cpu(agi->agi_magicnum) != XFS_AGI_MAGIC) {
if (!sflag)
dbprintf(_("bad agi magic # %#x in ag %u\n"),
be32_to_cpu(agi->agi_magicnum), agno);
error++;
}
if (!XFS_AGI_GOOD_VERSION(be32_to_cpu(agi->agi_versionnum))) {
if (!sflag)
dbprintf(_("bad agi version # %#x in ag %u\n"),
be32_to_cpu(agi->agi_versionnum), agno);
error++;
}
if (XFS_SB_BLOCK(mp) != XFS_AGI_BLOCK(mp) &&
XFS_AGF_BLOCK(mp) != XFS_AGI_BLOCK(mp))
set_dbmap(agno, XFS_AGI_BLOCK(mp), 1, DBM_AGI, agno,
XFS_SB_BLOCK(mp));
scan_freelist(agf);
fdblocks--;
scan_sbtree(agf,
be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1, scanfunc_bno, TYP_BNOBT);
fdblocks--;
scan_sbtree(agf,
be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1, scanfunc_cnt, TYP_CNTBT);
scan_sbtree(agf,
be32_to_cpu(agi->agi_root),
be32_to_cpu(agi->agi_level),
1, scanfunc_ino, TYP_INOBT);
if (agi->agi_free_root) {
scan_sbtree(agf,
be32_to_cpu(agi->agi_free_root),
be32_to_cpu(agi->agi_free_level),
1, scanfunc_fino, TYP_FINOBT);
}
if (be32_to_cpu(agf->agf_freeblks) != agffreeblks) {
if (!sflag)
dbprintf(_("agf_freeblks %u, counted %u in ag %u\n"),
be32_to_cpu(agf->agf_freeblks),
agffreeblks, agno);
error++;
}
if (be32_to_cpu(agf->agf_longest) != agflongest) {
if (!sflag)
dbprintf(_("agf_longest %u, counted %u in ag %u\n"),
be32_to_cpu(agf->agf_longest),
agflongest, agno);
error++;
}
if (lazycount &&
be32_to_cpu(agf->agf_btreeblks) != agfbtreeblks) {
if (!sflag)
dbprintf(_("agf_btreeblks %u, counted %u in ag %u\n"),
be32_to_cpu(agf->agf_btreeblks),
agfbtreeblks, agno);
error++;
}
agf_aggr_freeblks += agffreeblks + agfbtreeblks;
if (be32_to_cpu(agi->agi_count) != agicount) {
if (!sflag)
dbprintf(_("agi_count %u, counted %u in ag %u\n"),
be32_to_cpu(agi->agi_count),
agicount, agno);
error++;
}
if (be32_to_cpu(agi->agi_freecount) != agifreecount) {
if (!sflag)
dbprintf(_("agi_freecount %u, counted %u in ag %u\n"),
be32_to_cpu(agi->agi_freecount),
agifreecount, agno);
error++;
}
for (i = 0; i < XFS_AGI_UNLINKED_BUCKETS; i++) {
if (be32_to_cpu(agi->agi_unlinked[i]) != NULLAGINO) {
if (!sflag) {
xfs_agino_t agino=be32_to_cpu(agi->agi_unlinked[i]);
dbprintf(_("agi unlinked bucket %d is %u in ag "
"%u (inode=%lld)\n"), i, agino, agno,
XFS_AGINO_TO_INO(mp, agno, agino));
}
error++;
}
}
pop3_out:
pop_cur();
pop2_out:
pop_cur();
pop1_out:
pop_cur();
}
static void
scan_freelist(
xfs_agf_t *agf)
{
xfs_agnumber_t seqno = be32_to_cpu(agf->agf_seqno);
xfs_agfl_t *agfl;
xfs_agblock_t bno;
uint count;
int i;
__be32 *freelist;
if (XFS_SB_BLOCK(mp) != XFS_AGFL_BLOCK(mp) &&
XFS_AGF_BLOCK(mp) != XFS_AGFL_BLOCK(mp) &&
XFS_AGI_BLOCK(mp) != XFS_AGFL_BLOCK(mp))
set_dbmap(seqno, XFS_AGFL_BLOCK(mp), 1, DBM_AGFL, seqno,
XFS_SB_BLOCK(mp));
if (be32_to_cpu(agf->agf_flcount) == 0)
return;
push_cur();
set_cur(&typtab[TYP_AGFL],
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++;
pop_cur();
return;
}
i = be32_to_cpu(agf->agf_flfirst);
/* verify agf values before proceeding */
if (be32_to_cpu(agf->agf_flfirst) >= XFS_AGFL_SIZE(mp) ||
be32_to_cpu(agf->agf_fllast) >= XFS_AGFL_SIZE(mp)) {
dbprintf(_("agf %d freelist blocks bad, skipping "
"freelist scan\n"), i);
pop_cur();
return;
}
/* open coded XFS_BUF_TO_AGFL_BNO */
freelist = xfs_sb_version_hascrc(&((mp)->m_sb)) ? &agfl->agfl_bno[0]
: (__be32 *)agfl;
count = 0;
for (;;) {
bno = be32_to_cpu(freelist[i]);
set_dbmap(seqno, bno, 1, DBM_FREELIST, seqno,
XFS_AGFL_BLOCK(mp));
count++;
if (i == be32_to_cpu(agf->agf_fllast))
break;
if (++i == XFS_AGFL_SIZE(mp))
i = 0;
}
if (count != be32_to_cpu(agf->agf_flcount)) {
if (!sflag)
dbprintf(_("freeblk count %u != flcount %u in ag %u\n"),
count, be32_to_cpu(agf->agf_flcount),
seqno);
error++;
}
fdblocks += count;
agf_aggr_freeblks += count;
pop_cur();
}
static void
scan_lbtree(
xfs_fsblock_t root,
int nlevels,
scan_lbtree_f_t func,
dbm_t type,
inodata_t *id,
xfs_rfsblock_t *totd,
xfs_rfsblock_t *toti,
xfs_extnum_t *nex,
blkmap_t **blkmapp,
int isroot,
typnm_t btype)
{
push_cur();
set_cur(&typtab[btype], XFS_FSB_TO_DADDR(mp, root), blkbb, DB_RING_IGN,
NULL);
if (iocur_top->data == NULL) {
if (!sflag)
dbprintf(_("can't read btree block %u/%u\n"),
XFS_FSB_TO_AGNO(mp, root),
XFS_FSB_TO_AGBNO(mp, root));
error++;
pop_cur();
return;
}
(*func)(iocur_top->data, nlevels - 1, type, root, id, totd, toti, nex,
blkmapp, isroot, btype);
pop_cur();
}
static void
scan_sbtree(
xfs_agf_t *agf,
xfs_agblock_t root,
int nlevels,
int isroot,
scan_sbtree_f_t func,
typnm_t btype)
{
xfs_agnumber_t seqno = be32_to_cpu(agf->agf_seqno);
push_cur();
set_cur(&typtab[btype],
XFS_AGB_TO_DADDR(mp, seqno, root), blkbb, DB_RING_IGN, NULL);
if (iocur_top->data == NULL) {
if (!sflag)
dbprintf(_("can't read btree block %u/%u\n"), seqno, root);
error++;
pop_cur();
return;
}
(*func)(iocur_top->data, nlevels - 1, agf, root, isroot);
pop_cur();
}
static void
scanfunc_bmap(
struct xfs_btree_block *block,
int level,
dbm_t type,
xfs_fsblock_t bno,
inodata_t *id,
xfs_rfsblock_t *totd,
xfs_rfsblock_t *toti,
xfs_extnum_t *nex,
blkmap_t **blkmapp,
int isroot,
typnm_t btype)
{
xfs_agblock_t agbno;
xfs_agnumber_t agno;
int i;
xfs_bmbt_ptr_t *pp;
xfs_bmbt_rec_t *rp;
agno = XFS_FSB_TO_AGNO(mp, bno);
agbno = XFS_FSB_TO_AGBNO(mp, bno);
if (be32_to_cpu(block->bb_magic) != XFS_BMAP_MAGIC &&
be32_to_cpu(block->bb_magic) != XFS_BMAP_CRC_MAGIC) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
dbprintf(_("bad magic # %#x in inode %lld bmbt block "
"%u/%u\n"),
be32_to_cpu(block->bb_magic), id->ino, agno, agbno);
error++;
}
if (be16_to_cpu(block->bb_level) != level) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
dbprintf(_("expected level %d got %d in inode %lld bmbt "
"block %u/%u\n"),
level, be16_to_cpu(block->bb_level), id->ino, agno, agbno);
error++;
}
set_dbmap(agno, agbno, 1, type, agno, agbno);
set_inomap(agno, agbno, 1, id);
(*toti)++;
if (level == 0) {
if (be16_to_cpu(block->bb_numrecs) > mp->m_bmap_dmxr[0] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_bmap_dmnr[0])) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) "
"in inode %lld bmap block %lld\n"),
be16_to_cpu(block->bb_numrecs), mp->m_bmap_dmnr[0],
mp->m_bmap_dmxr[0], id->ino,
(xfs_fsblock_t)bno);
error++;
return;
}
rp = XFS_BMBT_REC_ADDR(mp, block, 1);
*nex += be16_to_cpu(block->bb_numrecs);
process_bmbt_reclist(rp, be16_to_cpu(block->bb_numrecs), type, id, totd,
blkmapp);
return;
}
if (be16_to_cpu(block->bb_numrecs) > mp->m_bmap_dmxr[1] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_bmap_dmnr[1])) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in "
"inode %lld bmap block %lld\n"),
be16_to_cpu(block->bb_numrecs), mp->m_bmap_dmnr[1],
mp->m_bmap_dmxr[1], id->ino, (xfs_fsblock_t)bno);
error++;
return;
}
pp = XFS_BMBT_PTR_ADDR(mp, block, 1, mp->m_bmap_dmxr[0]);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++)
scan_lbtree(be64_to_cpu(pp[i]), level, scanfunc_bmap, type, id,
totd, toti, nex, blkmapp, 0, btype);
}
static void
scanfunc_bno(
struct xfs_btree_block *block,
int level,
xfs_agf_t *agf,
xfs_agblock_t bno,
int isroot)
{
int i;
xfs_alloc_ptr_t *pp;
xfs_alloc_rec_t *rp;
xfs_agnumber_t seqno = be32_to_cpu(agf->agf_seqno);
xfs_agblock_t lastblock;
if (be32_to_cpu(block->bb_magic) != XFS_ABTB_MAGIC &&
be32_to_cpu(block->bb_magic) != XFS_ABTB_CRC_MAGIC) {
dbprintf(_("bad magic # %#x in btbno block %u/%u\n"),
be32_to_cpu(block->bb_magic), seqno, bno);
serious_error++;
return;
}
fdblocks++;
agfbtreeblks++;
if (be16_to_cpu(block->bb_level) != level) {
if (!sflag)
dbprintf(_("expected level %d got %d in btbno block "
"%u/%u\n"),
level, be16_to_cpu(block->bb_level), seqno, bno);
error++;
}
set_dbmap(seqno, bno, 1, DBM_BTBNO, seqno, bno);
if (level == 0) {
if (be16_to_cpu(block->bb_numrecs) > mp->m_alloc_mxr[0] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_alloc_mnr[0])) {
dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in "
"btbno block %u/%u\n"),
be16_to_cpu(block->bb_numrecs), mp->m_alloc_mnr[0],
mp->m_alloc_mxr[0], seqno, bno);
serious_error++;
return;
}
rp = XFS_ALLOC_REC_ADDR(mp, block, 1);
lastblock = 0;
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++) {
set_dbmap(seqno, be32_to_cpu(rp[i].ar_startblock),
be32_to_cpu(rp[i].ar_blockcount), DBM_FREE1,
seqno, bno);
if (be32_to_cpu(rp[i].ar_startblock) <= lastblock) {
dbprintf(_(
"out-of-order bno btree record %d (%u %u) block %u/%u\n"),
i, be32_to_cpu(rp[i].ar_startblock),
be32_to_cpu(rp[i].ar_blockcount),
be32_to_cpu(agf->agf_seqno), bno);
serious_error++;
} else {
lastblock = be32_to_cpu(rp[i].ar_startblock);
}
}
return;
}
if (be16_to_cpu(block->bb_numrecs) > mp->m_alloc_mxr[1] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_alloc_mnr[1])) {
dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in btbno block "
"%u/%u\n"),
be16_to_cpu(block->bb_numrecs), mp->m_alloc_mnr[1],
mp->m_alloc_mxr[1], seqno, bno);
serious_error++;
return;
}
pp = XFS_ALLOC_PTR_ADDR(mp, block, 1, mp->m_alloc_mxr[1]);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++)
scan_sbtree(agf, be32_to_cpu(pp[i]), level, 0, scanfunc_bno, TYP_BNOBT);
}
static void
scanfunc_cnt(
struct xfs_btree_block *block,
int level,
xfs_agf_t *agf,
xfs_agblock_t bno,
int isroot)
{
xfs_agnumber_t seqno = be32_to_cpu(agf->agf_seqno);
int i;
xfs_alloc_ptr_t *pp;
xfs_alloc_rec_t *rp;
xfs_extlen_t lastcount;
if (be32_to_cpu(block->bb_magic) != XFS_ABTC_MAGIC &&
be32_to_cpu(block->bb_magic) != XFS_ABTC_CRC_MAGIC) {
dbprintf(_("bad magic # %#x in btcnt block %u/%u\n"),
be32_to_cpu(block->bb_magic), seqno, bno);
serious_error++;
return;
}
fdblocks++;
agfbtreeblks++;
if (be16_to_cpu(block->bb_level) != level) {
if (!sflag)
dbprintf(_("expected level %d got %d in btcnt block "
"%u/%u\n"),
level, be16_to_cpu(block->bb_level), seqno, bno);
error++;
}
set_dbmap(seqno, bno, 1, DBM_BTCNT, seqno, bno);
if (level == 0) {
if (be16_to_cpu(block->bb_numrecs) > mp->m_alloc_mxr[0] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_alloc_mnr[0])) {
dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in "
"btbno block %u/%u\n"),
be16_to_cpu(block->bb_numrecs), mp->m_alloc_mnr[0],
mp->m_alloc_mxr[0], seqno, bno);
serious_error++;
return;
}
rp = XFS_ALLOC_REC_ADDR(mp, block, 1);
lastcount = 0;
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++) {
check_set_dbmap(seqno, be32_to_cpu(rp[i].ar_startblock),
be32_to_cpu(rp[i].ar_blockcount), DBM_FREE1, DBM_FREE2,
seqno, bno);
fdblocks += be32_to_cpu(rp[i].ar_blockcount);
agffreeblks += be32_to_cpu(rp[i].ar_blockcount);
if (be32_to_cpu(rp[i].ar_blockcount) > agflongest)
agflongest = be32_to_cpu(rp[i].ar_blockcount);
if (be32_to_cpu(rp[i].ar_blockcount) < lastcount) {
dbprintf(_(
"out-of-order cnt btree record %d (%u %u) block %u/%u\n"),
i, be32_to_cpu(rp[i].ar_startblock),
be32_to_cpu(rp[i].ar_blockcount),
be32_to_cpu(agf->agf_seqno), bno);
} else {
lastcount = be32_to_cpu(rp[i].ar_blockcount);
}
}
return;
}
if (be16_to_cpu(block->bb_numrecs) > mp->m_alloc_mxr[1] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_alloc_mnr[1])) {
dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in btbno block "
"%u/%u\n"),
be16_to_cpu(block->bb_numrecs), mp->m_alloc_mnr[1],
mp->m_alloc_mxr[1], seqno, bno);
serious_error++;
return;
}
pp = XFS_ALLOC_PTR_ADDR(mp, block, 1, mp->m_alloc_mxr[1]);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++)
scan_sbtree(agf, be32_to_cpu(pp[i]), level, 0, scanfunc_cnt, TYP_CNTBT);
}
static void
scanfunc_ino(
struct xfs_btree_block *block,
int level,
xfs_agf_t *agf,
xfs_agblock_t bno,
int isroot)
{
xfs_agino_t agino;
xfs_agnumber_t seqno = be32_to_cpu(agf->agf_seqno);
int i;
int isfree;
int j;
int nfree;
int off;
xfs_inobt_ptr_t *pp;
xfs_inobt_rec_t *rp;
if (be32_to_cpu(block->bb_magic) != XFS_IBT_MAGIC &&
be32_to_cpu(block->bb_magic) != XFS_IBT_CRC_MAGIC) {
dbprintf(_("bad magic # %#x in inobt block %u/%u\n"),
be32_to_cpu(block->bb_magic), seqno, bno);
serious_error++;
return;
}
if (be16_to_cpu(block->bb_level) != level) {
if (!sflag)
dbprintf(_("expected level %d got %d in inobt block "
"%u/%u\n"),
level, be16_to_cpu(block->bb_level), seqno, bno);
error++;
}
set_dbmap(seqno, bno, 1, DBM_BTINO, seqno, bno);
if (level == 0) {
if (be16_to_cpu(block->bb_numrecs) > mp->m_inobt_mxr[0] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_inobt_mnr[0])) {
dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in "
"inobt block %u/%u\n"),
be16_to_cpu(block->bb_numrecs), mp->m_inobt_mnr[0],
mp->m_inobt_mxr[0], seqno, bno);
serious_error++;
return;
}
rp = XFS_INOBT_REC_ADDR(mp, block, 1);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++) {
agino = be32_to_cpu(rp[i].ir_startino);
off = XFS_INO_TO_OFFSET(mp, agino);
if (off == 0) {
if ((sbversion & XFS_SB_VERSION_ALIGNBIT) &&
mp->m_sb.sb_inoalignmt &&
(XFS_INO_TO_AGBNO(mp, agino) %
mp->m_sb.sb_inoalignmt))
sbversion &= ~XFS_SB_VERSION_ALIGNBIT;
set_dbmap(seqno, XFS_AGINO_TO_AGBNO(mp, agino),
(xfs_extlen_t)MAX(1,
XFS_INODES_PER_CHUNK >>
mp->m_sb.sb_inopblog),
DBM_INODE, seqno, bno);
}
icount += XFS_INODES_PER_CHUNK;
agicount += XFS_INODES_PER_CHUNK;
ifree += be32_to_cpu(rp[i].ir_u.f.ir_freecount);
agifreecount += be32_to_cpu(rp[i].ir_u.f.ir_freecount);
push_cur();
set_cur(&typtab[TYP_INODE],
XFS_AGB_TO_DADDR(mp, seqno,
XFS_AGINO_TO_AGBNO(mp, agino)),
(int)XFS_FSB_TO_BB(mp, mp->m_ialloc_blks),
DB_RING_IGN, NULL);
if (iocur_top->data == NULL) {
if (!sflag)
dbprintf(_("can't read inode block "
"%u/%u\n"),
seqno,
XFS_AGINO_TO_AGBNO(mp, agino));
error++;
pop_cur();
continue;
}
for (j = 0, nfree = 0; j < XFS_INODES_PER_CHUNK; j++) {
isfree = XFS_INOBT_IS_FREE_DISK(&rp[i], j);
if (isfree)
nfree++;
process_inode(agf, agino + j,
(xfs_dinode_t *)((char *)iocur_top->data + ((off + j) << mp->m_sb.sb_inodelog)),
isfree);
}
if (nfree != be32_to_cpu(rp[i].ir_u.f.ir_freecount)) {
if (!sflag)
dbprintf(_("ir_freecount/free mismatch, "
"inode chunk %u/%u, freecount "
"%d nfree %d\n"),
seqno, agino,
be32_to_cpu(rp[i].ir_u.f.ir_freecount), nfree);
error++;
}
pop_cur();
}
return;
}
if (be16_to_cpu(block->bb_numrecs) > mp->m_inobt_mxr[1] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_inobt_mnr[1])) {
dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in inobt block "
"%u/%u\n"),
be16_to_cpu(block->bb_numrecs), mp->m_inobt_mnr[1],
mp->m_inobt_mxr[1], seqno, bno);
serious_error++;
return;
}
pp = XFS_INOBT_PTR_ADDR(mp, block, 1, mp->m_inobt_mxr[1]);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++)
scan_sbtree(agf, be32_to_cpu(pp[i]), level, 0, scanfunc_ino, TYP_INOBT);
}
static void
scanfunc_fino(
struct xfs_btree_block *block,
int level,
struct xfs_agf *agf,
xfs_agblock_t bno,
int isroot)
{
xfs_agino_t agino;
xfs_agnumber_t seqno = be32_to_cpu(agf->agf_seqno);
int i;
int off;
xfs_inobt_ptr_t *pp;
struct xfs_inobt_rec *rp;
if (be32_to_cpu(block->bb_magic) != XFS_FIBT_MAGIC &&
be32_to_cpu(block->bb_magic) != XFS_FIBT_CRC_MAGIC) {
dbprintf(_("bad magic # %#x in finobt block %u/%u\n"),
be32_to_cpu(block->bb_magic), seqno, bno);
serious_error++;
return;
}
if (be16_to_cpu(block->bb_level) != level) {
if (!sflag)
dbprintf(_("expected level %d got %d in finobt block "
"%u/%u\n"),
level, be16_to_cpu(block->bb_level), seqno, bno);
error++;
}
set_dbmap(seqno, bno, 1, DBM_BTFINO, seqno, bno);
if (level == 0) {
if (be16_to_cpu(block->bb_numrecs) > mp->m_inobt_mxr[0] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_inobt_mnr[0])) {
dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in "
"finobt block %u/%u\n"),
be16_to_cpu(block->bb_numrecs), mp->m_inobt_mnr[0],
mp->m_inobt_mxr[0], seqno, bno);
serious_error++;
return;
}
rp = XFS_INOBT_REC_ADDR(mp, block, 1);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++) {
agino = be32_to_cpu(rp[i].ir_startino);
off = XFS_INO_TO_OFFSET(mp, agino);
if (off == 0) {
if ((sbversion & XFS_SB_VERSION_ALIGNBIT) &&
mp->m_sb.sb_inoalignmt &&
(XFS_INO_TO_AGBNO(mp, agino) %
mp->m_sb.sb_inoalignmt))
sbversion &= ~XFS_SB_VERSION_ALIGNBIT;
check_set_dbmap(seqno, XFS_AGINO_TO_AGBNO(mp, agino),
(xfs_extlen_t)MAX(1,
XFS_INODES_PER_CHUNK >>
mp->m_sb.sb_inopblog),
DBM_INODE, DBM_INODE, seqno, bno);
}
}
return;
}
if (be16_to_cpu(block->bb_numrecs) > mp->m_inobt_mxr[1] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_inobt_mnr[1])) {
dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in finobt block "
"%u/%u\n"),
be16_to_cpu(block->bb_numrecs), mp->m_inobt_mnr[1],
mp->m_inobt_mxr[1], seqno, bno);
serious_error++;
return;
}
pp = XFS_INOBT_PTR_ADDR(mp, block, 1, mp->m_inobt_mxr[1]);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++)
scan_sbtree(agf, be32_to_cpu(pp[i]), level, 0, scanfunc_fino, TYP_FINOBT);
}
static void
set_dbmap(
xfs_agnumber_t agno,
xfs_agblock_t agbno,
xfs_extlen_t len,
dbm_t type,
xfs_agnumber_t c_agno,
xfs_agblock_t c_agbno)
{
check_set_dbmap(agno, agbno, len, DBM_UNKNOWN, type, c_agno, c_agbno);
}
static void
set_inomap(
xfs_agnumber_t agno,
xfs_agblock_t agbno,
xfs_extlen_t len,
inodata_t *id)
{
xfs_extlen_t i;
inodata_t **idp;
int mayprint;
if (!check_inomap(agno, agbno, len, id->ino))
return;
mayprint = verbose | id->ilist | blist_size;
for (i = 0, idp = &inomap[agno][agbno]; i < len; i++, idp++) {
*idp = id;
if (mayprint &&
(verbose || id->ilist || CHECK_BLISTA(agno, agbno + i)))
dbprintf(_("setting inode to %lld for block %u/%u\n"),
id->ino, agno, agbno + i);
}
}
static void
set_rdbmap(
xfs_rfsblock_t bno,
xfs_extlen_t len,
dbm_t type)
{
check_set_rdbmap(bno, len, DBM_UNKNOWN, type);
}
static void
set_rinomap(
xfs_rfsblock_t bno,
xfs_extlen_t len,
inodata_t *id)
{
xfs_extlen_t i;
inodata_t **idp;
int mayprint;
if (!check_rinomap(bno, len, id->ino))
return;
mayprint = verbose | id->ilist | blist_size;
for (i = 0, idp = &inomap[mp->m_sb.sb_agcount][bno];
i < len;
i++, idp++) {
*idp = id;
if (mayprint && (verbose || id->ilist || CHECK_BLIST(bno + i)))
dbprintf(_("setting inode to %lld for rtblock %llu\n"),
id->ino, bno + i);
}
}
static void
setlink_inode(
inodata_t *id,
nlink_t nlink,
int isdir,
int security)
{
id->link_set = nlink;
id->isdir = isdir;
id->security = security;
if (verbose || id->ilist)
dbprintf(_("inode %lld nlink %u %s dir\n"), id->ino, nlink,
isdir ? "is" : "not");
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/check.h 0000664 0000000 0000000 00000001366 12560572026 014446 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void check_init(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/command.c 0000664 0000000 0000000 00000005677 12574431650 015015 0 ustar /*
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "addr.h"
#include "attrset.h"
#include "block.h"
#include "bmap.h"
#include "check.h"
#include "command.h"
#include "convert.h"
#include "debug.h"
#include "type.h"
#include "echo.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "agf.h"
#include "agfl.h"
#include "agi.h"
#include "frag.h"
#include "freesp.h"
#include "help.h"
#include "hash.h"
#include "inode.h"
#include "input.h"
#include "io.h"
#include "metadump.h"
#include "output.h"
#include "print.h"
#include "quit.h"
#include "sb.h"
#include "write.h"
#include "malloc.h"
#include "dquot.h"
cmdinfo_t *cmdtab;
int ncmds;
static int
cmd_compare(const void *a, const void *b)
{
return strcmp(((const cmdinfo_t *)a)->name,
((const cmdinfo_t *)b)->name);
}
void
add_command(
const cmdinfo_t *ci)
{
cmdtab = xrealloc((void *)cmdtab, ++ncmds * sizeof(*cmdtab));
cmdtab[ncmds - 1] = *ci;
qsort(cmdtab, ncmds, sizeof(*cmdtab), cmd_compare);
}
int
command(
int argc,
char **argv)
{
char *cmd;
const cmdinfo_t *ct;
cmd = argv[0];
ct = find_command(cmd);
if (ct == NULL) {
dbprintf(_("command %s not found\n"), cmd);
return 0;
}
if (argc-1 < ct->argmin || (ct->argmax != -1 && argc-1 > ct->argmax)) {
dbprintf(_("bad argument count %d to %s, expected "), argc-1, cmd);
if (ct->argmax == -1)
dbprintf(_("at least %d"), ct->argmin);
else if (ct->argmin == ct->argmax)
dbprintf("%d", ct->argmin);
else
dbprintf(_("between %d and %d"), ct->argmin, ct->argmax);
dbprintf(_(" arguments\n"));
return 0;
}
platform_getoptreset();
return ct->cfunc(argc, argv);
}
const cmdinfo_t *
find_command(
const char *cmd)
{
cmdinfo_t *ct;
for (ct = cmdtab; ct < &cmdtab[ncmds]; ct++) {
if (strcmp(ct->name, cmd) == 0 ||
(ct->altname && strcmp(ct->altname, cmd) == 0))
return (const cmdinfo_t *)ct;
}
return NULL;
}
void
init_commands(void)
{
addr_init();
agf_init();
agfl_init();
agi_init();
attrset_init();
block_init();
bmap_init();
check_init();
convert_init();
debug_init();
echo_init();
frag_init();
freesp_init();
help_init();
hash_init();
inode_init();
input_init();
io_init();
metadump_init();
output_init();
print_init();
quit_init();
sb_init();
type_init();
write_init();
dquot_init();
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/command.h 0000664 0000000 0000000 00000002330 12560572026 014777 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
typedef int (*cfunc_t)(int argc, char **argv);
typedef void (*helpfunc_t)(void);
typedef struct cmdinfo
{
const char *name;
const char *altname;
cfunc_t cfunc;
int argmin;
int argmax;
int canpush;
const char *args;
const char *oneline;
helpfunc_t help;
} cmdinfo_t;
extern cmdinfo_t *cmdtab;
extern int ncmds;
extern void add_command(const cmdinfo_t *ci);
extern int command(int argc, char **argv);
extern const cmdinfo_t *find_command(const char *cmd);
extern void init_commands(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/convert.c 0000664 0000000 0000000 00000017762 12574431650 015055 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "command.h"
#include "convert.h"
#include "output.h"
#include "init.h"
#define M(A) (1 << CT_ ## A)
#define agblock_to_bytes(x) \
((__uint64_t)(x) << mp->m_sb.sb_blocklog)
#define agino_to_bytes(x) \
((__uint64_t)(x) << mp->m_sb.sb_inodelog)
#define agnumber_to_bytes(x) \
agblock_to_bytes((__uint64_t)(x) * mp->m_sb.sb_agblocks)
#define daddr_to_bytes(x) \
((__uint64_t)(x) << BBSHIFT)
#define fsblock_to_bytes(x) \
(agnumber_to_bytes(XFS_FSB_TO_AGNO(mp, (x))) + \
agblock_to_bytes(XFS_FSB_TO_AGBNO(mp, (x))))
#define ino_to_bytes(x) \
(agnumber_to_bytes(XFS_INO_TO_AGNO(mp, (x))) + \
agino_to_bytes(XFS_INO_TO_AGINO(mp, (x))))
#define inoidx_to_bytes(x) \
((__uint64_t)(x) << mp->m_sb.sb_inodelog)
typedef enum {
CT_NONE = -1,
CT_AGBLOCK, /* xfs_agblock_t */
CT_AGINO, /* xfs_agino_t */
CT_AGNUMBER, /* xfs_agno_t */
CT_BBOFF, /* byte offset in daddr */
CT_BLKOFF, /* byte offset in fsb/agb */
CT_BYTE, /* byte in filesystem */
CT_DADDR, /* daddr_t */
CT_FSBLOCK, /* xfs_fsblock_t */
CT_INO, /* xfs_ino_t */
CT_INOIDX, /* index of inode in fsblock */
CT_INOOFF, /* byte offset in inode */
NCTS
} ctype_t;
typedef struct ctydesc {
ctype_t ctype;
int allowed;
const char **names;
} ctydesc_t;
typedef union {
xfs_agblock_t agblock;
xfs_agino_t agino;
xfs_agnumber_t agnumber;
int bboff;
int blkoff;
__uint64_t byte;
xfs_daddr_t daddr;
xfs_fsblock_t fsblock;
xfs_ino_t ino;
int inoidx;
int inooff;
} cval_t;
static __uint64_t bytevalue(ctype_t ctype, cval_t *val);
static int convert_f(int argc, char **argv);
static int getvalue(char *s, ctype_t ctype, cval_t *val);
static ctype_t lookupcty(char *ctyname);
static const char *agblock_names[] = { "agblock", "agbno", NULL };
static const char *agino_names[] = { "agino", "aginode", NULL };
static const char *agnumber_names[] = { "agnumber", "agno", NULL };
static const char *bboff_names[] = { "bboff", "daddroff", NULL };
static const char *blkoff_names[] = { "blkoff", "fsboff", "agboff",
NULL };
static const char *byte_names[] = { "byte", "fsbyte", NULL };
static const char *daddr_names[] = { "daddr", "bb", NULL };
static const char *fsblock_names[] = { "fsblock", "fsb", "fsbno", NULL };
static const char *ino_names[] = { "ino", "inode", NULL };
static const char *inoidx_names[] = { "inoidx", "offset", NULL };
static const char *inooff_names[] = { "inooff", "inodeoff", NULL };
static const ctydesc_t ctydescs[NCTS] = {
{ CT_AGBLOCK, M(AGNUMBER)|M(BBOFF)|M(BLKOFF)|M(INOIDX)|M(INOOFF),
agblock_names },
{ CT_AGINO, M(AGNUMBER)|M(INOOFF), agino_names },
{ CT_AGNUMBER,
M(AGBLOCK)|M(AGINO)|M(BBOFF)|M(BLKOFF)|M(INOIDX)|M(INOOFF),
agnumber_names },
{ CT_BBOFF, M(AGBLOCK)|M(AGNUMBER)|M(DADDR)|M(FSBLOCK), bboff_names },
{ CT_BLKOFF, M(AGBLOCK)|M(AGNUMBER)|M(FSBLOCK), blkoff_names },
{ CT_BYTE, 0, byte_names },
{ CT_DADDR, M(BBOFF), daddr_names },
{ CT_FSBLOCK, M(BBOFF)|M(BLKOFF)|M(INOIDX), fsblock_names },
{ CT_INO, M(INOOFF), ino_names },
{ CT_INOIDX, M(AGBLOCK)|M(AGNUMBER)|M(FSBLOCK)|M(INOOFF),
inoidx_names },
{ CT_INOOFF,
M(AGBLOCK)|M(AGINO)|M(AGNUMBER)|M(FSBLOCK)|M(INO)|M(INOIDX),
inooff_names },
};
static const cmdinfo_t convert_cmd =
{ "convert", NULL, convert_f, 3, 9, 0, "type num [type num]... type",
"convert from one address form to another", NULL };
static __uint64_t
bytevalue(ctype_t ctype, cval_t *val)
{
switch (ctype) {
case CT_AGBLOCK:
return agblock_to_bytes(val->agblock);
case CT_AGINO:
return agino_to_bytes(val->agino);
case CT_AGNUMBER:
return agnumber_to_bytes(val->agnumber);
case CT_BBOFF:
return (__uint64_t)val->bboff;
case CT_BLKOFF:
return (__uint64_t)val->blkoff;
case CT_BYTE:
return val->byte;
case CT_DADDR:
return daddr_to_bytes(val->daddr);
case CT_FSBLOCK:
return fsblock_to_bytes(val->fsblock);
case CT_INO:
return ino_to_bytes(val->ino);
case CT_INOIDX:
return inoidx_to_bytes(val->inoidx);
case CT_INOOFF:
return (__uint64_t)val->inooff;
case CT_NONE:
case NCTS:
break;
}
/* NOTREACHED */
return 0;
}
static int
convert_f(int argc, char **argv)
{
ctype_t c;
int conmask;
cval_t cvals[NCTS] = {};
int i;
int mask;
__uint64_t v;
ctype_t wtype;
/* move past the "convert" command */
argc--;
argv++;
if ((argc % 2) != 1) {
dbprintf(_("bad argument count %d to convert, expected 3,5,7,9 "
"arguments\n"), argc);
return 0;
}
if ((wtype = lookupcty(argv[argc - 1])) == CT_NONE) {
dbprintf(_("unknown conversion type %s\n"), argv[argc - 1]);
return 0;
}
for (i = mask = conmask = 0; i < (argc - 1) / 2; i++) {
c = lookupcty(argv[i * 2]);
if (c == CT_NONE) {
dbprintf(_("unknown conversion type %s\n"), argv[i * 2]);
return 0;
}
if (c == wtype) {
dbprintf(_("result type same as argument\n"));
return 0;
}
if (conmask & (1 << c)) {
dbprintf(_("conflicting conversion type %s\n"),
argv[i * 2]);
return 0;
}
if (!getvalue(argv[i * 2 + 1], c, &cvals[c]))
return 0;
mask |= 1 << c;
conmask |= ~ctydescs[c].allowed;
}
if (cur_agno != NULLAGNUMBER && (conmask & M(AGNUMBER)) == 0) {
cvals[CT_AGNUMBER].agnumber = cur_agno;
mask |= M(AGNUMBER);
}
v = 0;
for (c = (ctype_t)0; c < NCTS; c++) {
if (!(mask & (1 << c)))
continue;
v += bytevalue(c, &cvals[c]);
}
switch (wtype) {
case CT_AGBLOCK:
v = xfs_daddr_to_agbno(mp, v >> BBSHIFT);
break;
case CT_AGINO:
v = (v >> mp->m_sb.sb_inodelog) %
(mp->m_sb.sb_agblocks << mp->m_sb.sb_inopblog);
break;
case CT_AGNUMBER:
v = xfs_daddr_to_agno(mp, v >> BBSHIFT);
break;
case CT_BBOFF:
v &= BBMASK;
break;
case CT_BLKOFF:
v &= mp->m_blockmask;
break;
case CT_BYTE:
break;
case CT_DADDR:
v >>= BBSHIFT;
break;
case CT_FSBLOCK:
v = XFS_DADDR_TO_FSB(mp, v >> BBSHIFT);
break;
case CT_INO:
v = XFS_AGINO_TO_INO(mp, xfs_daddr_to_agno(mp, v >> BBSHIFT),
(v >> mp->m_sb.sb_inodelog) %
(mp->m_sb.sb_agblocks << mp->m_sb.sb_inopblog));
break;
case CT_INOIDX:
v = (v >> mp->m_sb.sb_inodelog) & (mp->m_sb.sb_inopblock - 1);
break;
case CT_INOOFF:
v &= mp->m_sb.sb_inodesize - 1;
break;
case CT_NONE:
case NCTS:
/* NOTREACHED */
break;
}
dbprintf("0x%llx (%llu)\n", v, v);
return 0;
}
void
convert_init(void)
{
add_command(&convert_cmd);
}
static int
getvalue(char *s, ctype_t ctype, cval_t *val)
{
char *p;
__uint64_t v;
v = strtoull(s, &p, 0);
if (*p != '\0') {
dbprintf(_("%s is not a number\n"), s);
return 0;
}
switch (ctype) {
case CT_AGBLOCK:
val->agblock = (xfs_agblock_t)v;
break;
case CT_AGINO:
val->agino = (xfs_agino_t)v;
break;
case CT_AGNUMBER:
val->agnumber = (xfs_agnumber_t)v;
break;
case CT_BBOFF:
val->bboff = (int)v;
break;
case CT_BLKOFF:
val->blkoff = (int)v;
break;
case CT_BYTE:
val->byte = (__uint64_t)v;
break;
case CT_DADDR:
val->daddr = (xfs_daddr_t)v;
break;
case CT_FSBLOCK:
val->fsblock = (xfs_fsblock_t)v;
break;
case CT_INO:
val->ino = (xfs_ino_t)v;
break;
case CT_INOIDX:
val->inoidx = (int)v;
break;
case CT_INOOFF:
val->inooff = (int)v;
break;
case CT_NONE:
case NCTS:
/* NOTREACHED */
break;
}
return 1;
}
static ctype_t
lookupcty(char *ctyname)
{
ctype_t cty;
const char **name;
for (cty = (ctype_t)0; cty < NCTS; cty++) {
for (name = ctydescs[cty].names; *name; name++) {
if (strcmp(ctyname, *name) == 0)
return cty;
}
}
return CT_NONE;
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/convert.h 0000664 0000000 0000000 00000001370 12560572026 015044 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void convert_init(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/debug.c 0000664 0000000 0000000 00000002445 12574431650 014453 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "command.h"
#include "debug.h"
#include "output.h"
static int debug_f(int argc, char **argv);
static const cmdinfo_t debug_cmd =
{ "debug", NULL, debug_f, 0, 1, 0, N_("[flagbits]"),
N_("set debug option bits"), NULL };
long debug_state;
static int
debug_f(
int argc,
char **argv)
{
char *p;
if (argc > 1) {
debug_state = strtol(argv[1], &p, 0);
if (*p != '\0') {
dbprintf(_("bad value for debug %s\n"), argv[1]);
return 0;
}
}
dbprintf("debug = %ld\n", debug_state);
return 0;
}
void
debug_init(void)
{
add_command(&debug_cmd);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/debug.h 0000664 0000000 0000000 00000001450 12560572026 014451 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define DEBUG_FLIST 0x1
extern long debug_state;
extern void debug_init(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/dir2.c 0000664 0000000 0000000 00000072071 12625713771 014233 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "bit.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "dir2.h"
#include "init.h"
#include "output.h"
static int dir2_block_hdr_count(void *obj, int startoff);
static int dir2_block_leaf_count(void *obj, int startoff);
static int dir2_block_leaf_offset(void *obj, int startoff, int idx);
static int dir2_block_tail_count(void *obj, int startoff);
static int dir2_block_tail_offset(void *obj, int startoff, int idx);
static int dir2_block_u_count(void *obj, int startoff);
static int dir2_block_u_offset(void *obj, int startoff, int idx);
static int dir2_data_union_freetag_count(void *obj, int startoff);
static int dir2_data_union_inumber_count(void *obj, int startoff);
static int dir2_data_union_length_count(void *obj, int startoff);
static int dir2_data_union_name_count(void *obj, int startoff);
static int dir2_data_union_namelen_count(void *obj, int startoff);
static int dir2_data_union_tag_count(void *obj, int startoff);
static int dir2_data_union_tag_offset(void *obj, int startoff, int idx);
static int dir2_data_hdr_count(void *obj, int startoff);
static int dir2_data_u_count(void *obj, int startoff);
static int dir2_data_u_offset(void *obj, int startoff, int idx);
static int dir2_free_bests_count(void *obj, int startoff);
static int dir2_free_hdr_count(void *obj, int startoff);
static int dir2_leaf_bests_count(void *obj, int startoff);
static int dir2_leaf_bests_offset(void *obj, int startoff, int idx);
static int dir2_leaf_ents_count(void *obj, int startoff);
static int dir2_leaf_hdr_count(void *obj, int startoff);
static int dir2_leaf_tail_count(void *obj, int startoff);
static int dir2_leaf_tail_offset(void *obj, int startoff, int idx);
static int dir2_node_btree_count(void *obj, int startoff);
static int dir2_node_hdr_count(void *obj, int startoff);
const field_t dir2_hfld[] = {
{ "", FLDT_DIR2, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
#define BOFF(f) bitize(offsetof(struct xfs_dir2_data_hdr, f))
#define DOFF(f) bitize(offsetof(struct xfs_dir2_data_hdr, f))
#define FOFF(f) bitize(offsetof(struct xfs_dir2_free, f))
#define LOFF(f) bitize(offsetof(struct xfs_dir2_leaf, f))
#define NOFF(f) bitize(offsetof(struct xfs_da_intnode, f))
const field_t dir2_flds[] = {
{ "bhdr", FLDT_DIR2_DATA_HDR, OI(BOFF(magic)), dir2_block_hdr_count,
FLD_COUNT, TYP_NONE },
{ "bu", FLDT_DIR2_DATA_UNION, dir2_block_u_offset, dir2_block_u_count,
FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "bleaf", FLDT_DIR2_LEAF_ENTRY, dir2_block_leaf_offset,
dir2_block_leaf_count, FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "btail", FLDT_DIR2_BLOCK_TAIL, dir2_block_tail_offset,
dir2_block_tail_count, FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "dhdr", FLDT_DIR2_DATA_HDR, OI(DOFF(magic)), dir2_data_hdr_count,
FLD_COUNT, TYP_NONE },
{ "du", FLDT_DIR2_DATA_UNION, dir2_data_u_offset, dir2_data_u_count,
FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "lhdr", FLDT_DIR2_LEAF_HDR, OI(LOFF(hdr)), dir2_leaf_hdr_count,
FLD_COUNT, TYP_NONE },
{ "lbests", FLDT_DIR2_DATA_OFF, dir2_leaf_bests_offset,
dir2_leaf_bests_count, FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "lents", FLDT_DIR2_LEAF_ENTRY, OI(LOFF(__ents)), dir2_leaf_ents_count,
FLD_ARRAY|FLD_COUNT, TYP_NONE },
{ "ltail", FLDT_DIR2_LEAF_TAIL, dir2_leaf_tail_offset,
dir2_leaf_tail_count, FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "nhdr", FLDT_DA_NODE_HDR, OI(NOFF(hdr)), dir2_node_hdr_count,
FLD_COUNT, TYP_NONE },
{ "nbtree", FLDT_DA_NODE_ENTRY, OI(NOFF(__btree)), dir2_node_btree_count,
FLD_ARRAY|FLD_COUNT, TYP_NONE },
{ "fhdr", FLDT_DIR2_FREE_HDR, OI(FOFF(hdr)), dir2_free_hdr_count,
FLD_COUNT, TYP_NONE },
{ "fbests", FLDT_DIR2_DATA_OFFNZ, OI(FOFF(bests)),
dir2_free_bests_count, FLD_ARRAY|FLD_COUNT, TYP_NONE },
{ NULL }
};
#define BTOFF(f) bitize(offsetof(xfs_dir2_block_tail_t, f))
const field_t dir2_block_tail_flds[] = {
{ "count", FLDT_UINT32D, OI(BTOFF(count)), C1, 0, TYP_NONE },
{ "stale", FLDT_UINT32D, OI(BTOFF(stale)), C1, 0, TYP_NONE },
{ NULL }
};
#define DFOFF(f) bitize(offsetof(xfs_dir2_data_free_t, f))
const field_t dir2_data_free_flds[] = {
{ "offset", FLDT_DIR2_DATA_OFF, OI(DFOFF(offset)), C1, 0, TYP_NONE },
{ "length", FLDT_DIR2_DATA_OFF, OI(DFOFF(length)), C1, 0, TYP_NONE },
{ NULL }
};
#define DHOFF(f) bitize(offsetof(xfs_dir2_data_hdr_t, f))
const field_t dir2_data_hdr_flds[] = {
{ "magic", FLDT_UINT32X, OI(DHOFF(magic)), C1, 0, TYP_NONE },
{ "bestfree", FLDT_DIR2_DATA_FREE, OI(DHOFF(bestfree)),
CI(XFS_DIR2_DATA_FD_COUNT), FLD_ARRAY, TYP_NONE },
{ NULL }
};
#define DEOFF(f) bitize(offsetof(xfs_dir2_data_entry_t, f))
#define DUOFF(f) bitize(offsetof(xfs_dir2_data_unused_t, f))
const field_t dir2_data_union_flds[] = {
{ "freetag", FLDT_UINT16X, OI(DUOFF(freetag)),
dir2_data_union_freetag_count, FLD_COUNT, TYP_NONE },
{ "inumber", FLDT_INO, OI(DEOFF(inumber)),
dir2_data_union_inumber_count, FLD_COUNT, TYP_INODE },
{ "length", FLDT_DIR2_DATA_OFF, OI(DUOFF(length)),
dir2_data_union_length_count, FLD_COUNT, TYP_NONE },
{ "namelen", FLDT_UINT8D, OI(DEOFF(namelen)),
dir2_data_union_namelen_count, FLD_COUNT, TYP_NONE },
{ "name", FLDT_CHARNS, OI(DEOFF(name)), dir2_data_union_name_count,
FLD_COUNT, TYP_NONE },
{ "tag", FLDT_DIR2_DATA_OFF, dir2_data_union_tag_offset,
dir2_data_union_tag_count, FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ NULL }
};
#define LEOFF(f) bitize(offsetof(xfs_dir2_leaf_entry_t, f))
const field_t dir2_leaf_entry_flds[] = {
{ "hashval", FLDT_UINT32X, OI(LEOFF(hashval)), C1, 0, TYP_NONE },
{ "address", FLDT_UINT32X, OI(LEOFF(address)), C1, 0, TYP_NONE },
{ NULL }
};
#define LHOFF(f) bitize(offsetof(xfs_dir2_leaf_hdr_t, f))
const field_t dir2_leaf_hdr_flds[] = {
{ "info", FLDT_DA_BLKINFO, OI(LHOFF(info)), C1, 0, TYP_NONE },
{ "count", FLDT_UINT16D, OI(LHOFF(count)), C1, 0, TYP_NONE },
{ "stale", FLDT_UINT16D, OI(LHOFF(stale)), C1, 0, TYP_NONE },
{ NULL }
};
#define LTOFF(f) bitize(offsetof(xfs_dir2_leaf_tail_t, f))
const field_t dir2_leaf_tail_flds[] = {
{ "bestcount", FLDT_UINT32D, OI(LTOFF(bestcount)), C1, 0, TYP_NONE },
{ NULL }
};
#define FHOFF(f) bitize(offsetof(xfs_dir2_free_hdr_t, f))
const field_t dir2_free_hdr_flds[] = {
{ "magic", FLDT_UINT32X, OI(FHOFF(magic)), C1, 0, TYP_NONE },
{ "firstdb", FLDT_INT32D, OI(FHOFF(firstdb)), C1, 0, TYP_NONE },
{ "nvalid", FLDT_INT32D, OI(FHOFF(nvalid)), C1, 0, TYP_NONE },
{ "nused", FLDT_INT32D, OI(FHOFF(nused)), C1, 0, TYP_NONE },
{ NULL }
};
#define DBOFF(f) bitize(offsetof(xfs_da_blkinfo_t, f))
const field_t da_blkinfo_flds[] = {
{ "forw", FLDT_DIRBLOCK, OI(DBOFF(forw)), C1, 0, TYP_INODATA },
{ "back", FLDT_DIRBLOCK, OI(DBOFF(back)), C1, 0, TYP_INODATA },
{ "magic", FLDT_UINT16X, OI(DBOFF(magic)), C1, 0, TYP_NONE },
{ "pad", FLDT_UINT16X, OI(DBOFF(pad)), C1, FLD_SKIPALL, TYP_NONE },
{ NULL }
};
#define EOFF(f) bitize(offsetof(xfs_da_node_entry_t, f))
const field_t da_node_entry_flds[] = {
{ "hashval", FLDT_UINT32X, OI(EOFF(hashval)), C1, 0, TYP_NONE },
{ "before", FLDT_DIRBLOCK, OI(EOFF(before)), C1, 0, TYP_INODATA },
{ NULL }
};
#define HOFF(f) bitize(offsetof(xfs_da_node_hdr_t, f))
const field_t da_node_hdr_flds[] = {
{ "info", FLDT_DA_BLKINFO, OI(HOFF(info)), C1, 0, TYP_NONE },
{ "count", FLDT_UINT16D, OI(HOFF(__count)), C1, 0, TYP_NONE },
{ "level", FLDT_UINT16D, OI(HOFF(__level)), C1, 0, TYP_NONE },
{ NULL }
};
/*
* Worker functions shared between either dir2/dir3 or block/data formats
*/
static int
__dir2_block_tail_offset(
struct xfs_dir2_data_hdr *block,
int startoff,
int idx)
{
struct xfs_dir2_block_tail *btp;
ASSERT(startoff == 0);
ASSERT(idx == 0);
btp = xfs_dir2_block_tail_p(mp->m_dir_geo, block);
return bitize((int)((char *)btp - (char *)block));
}
static int
__dir2_data_entries_count(
char *ptr,
char *endptr)
{
int i;
for (i = 0; ptr < endptr; i++) {
struct xfs_dir2_data_entry *dep;
struct xfs_dir2_data_unused *dup;
dup = (xfs_dir2_data_unused_t *)ptr;
if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG)
ptr += be16_to_cpu(dup->length);
else {
dep = (xfs_dir2_data_entry_t *)ptr;
ptr += M_DIROPS(mp)->data_entsize(dep->namelen);
}
}
return i;
}
static char *
__dir2_data_entry_offset(
char *ptr,
char *endptr,
int idx)
{
int i;
for (i = 0; i < idx; i++) {
struct xfs_dir2_data_entry *dep;
struct xfs_dir2_data_unused *dup;
ASSERT(ptr < endptr);
dup = (xfs_dir2_data_unused_t *)ptr;
if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG)
ptr += be16_to_cpu(dup->length);
else {
dep = (xfs_dir2_data_entry_t *)ptr;
ptr += M_DIROPS(mp)->data_entsize(dep->namelen);
}
}
return ptr;
}
/*
* Block format functions
*/
static int
dir2_block_hdr_count(
void *obj,
int startoff)
{
struct xfs_dir2_data_hdr *block = obj;
ASSERT(startoff == 0);
return be32_to_cpu(block->magic) == XFS_DIR2_BLOCK_MAGIC;
}
static int
dir3_block_hdr_count(
void *obj,
int startoff)
{
struct xfs_dir2_data_hdr *block = obj;
ASSERT(startoff == 0);
return be32_to_cpu(block->magic) == XFS_DIR3_BLOCK_MAGIC;
}
static int
dir2_block_leaf_count(
void *obj,
int startoff)
{
struct xfs_dir2_data_hdr *block = obj;
struct xfs_dir2_block_tail *btp;
ASSERT(startoff == 0);
if (be32_to_cpu(block->magic) != XFS_DIR2_BLOCK_MAGIC &&
be32_to_cpu(block->magic) != XFS_DIR3_BLOCK_MAGIC)
return 0;
btp = xfs_dir2_block_tail_p(mp->m_dir_geo, block);
return be32_to_cpu(btp->count);
}
static int
dir2_block_leaf_offset(
void *obj,
int startoff,
int idx)
{
struct xfs_dir2_data_hdr *block = obj;
struct xfs_dir2_block_tail *btp;
struct xfs_dir2_leaf_entry *lep;
ASSERT(startoff == 0);
ASSERT(be32_to_cpu(block->magic) == XFS_DIR2_BLOCK_MAGIC ||
be32_to_cpu(block->magic) == XFS_DIR3_BLOCK_MAGIC);
btp = xfs_dir2_block_tail_p(mp->m_dir_geo, block);
lep = xfs_dir2_block_leaf_p(btp) + idx;
return bitize((int)((char *)lep - (char *)block));
}
static int
dir2_block_tail_count(
void *obj,
int startoff)
{
struct xfs_dir2_data_hdr *block = obj;
ASSERT(startoff == 0);
return be32_to_cpu(block->magic) == XFS_DIR2_BLOCK_MAGIC;
}
static int
dir3_block_tail_count(
void *obj,
int startoff)
{
struct xfs_dir2_data_hdr *block = obj;
ASSERT(startoff == 0);
return be32_to_cpu(block->magic) == XFS_DIR3_BLOCK_MAGIC;
}
static int
dir2_block_tail_offset(
void *obj,
int startoff,
int idx)
{
struct xfs_dir2_data_hdr *block = obj;
ASSERT(be32_to_cpu(block->magic) == XFS_DIR2_BLOCK_MAGIC ||
be32_to_cpu(block->magic) == XFS_DIR3_BLOCK_MAGIC);
return __dir2_block_tail_offset(block, startoff, idx);
}
static int
dir2_block_u_count(
void *obj,
int startoff)
{
struct xfs_dir2_data_hdr *block = obj;
struct xfs_dir2_block_tail *btp;
ASSERT(startoff == 0);
if (be32_to_cpu(block->magic) != XFS_DIR2_BLOCK_MAGIC &&
be32_to_cpu(block->magic) != XFS_DIR3_BLOCK_MAGIC)
return 0;
btp = xfs_dir2_block_tail_p(mp->m_dir_geo, block);
return __dir2_data_entries_count(
(char *)M_DIROPS(mp)->data_unused_p(block),
(char *)xfs_dir2_block_leaf_p(btp));
}
static int
dir2_block_u_offset(
void *obj,
int startoff,
int idx)
{
struct xfs_dir2_data_hdr *block = obj;
struct xfs_dir2_block_tail *btp;
char *ptr;
ASSERT(startoff == 0);
ASSERT(be32_to_cpu(block->magic) == XFS_DIR2_BLOCK_MAGIC ||
be32_to_cpu(block->magic) == XFS_DIR3_BLOCK_MAGIC);
btp = xfs_dir2_block_tail_p(mp->m_dir_geo, block);
ptr = __dir2_data_entry_offset(
(char *)M_DIROPS(mp)->data_unused_p(block),
(char *)xfs_dir2_block_leaf_p(btp), idx);
return bitize((int)(ptr - (char *)block));
}
/*
* Data block format functions
*/
static int
dir2_data_union_freetag_count(
void *obj,
int startoff)
{
xfs_dir2_data_unused_t *dup;
char *end;
ASSERT(bitoffs(startoff) == 0);
dup = (xfs_dir2_data_unused_t *)((char *)obj + byteize(startoff));
end = (char *)&dup->freetag + sizeof(dup->freetag);
return end <= (char *)obj + mp->m_dir_geo->blksize &&
be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG;
}
static int
dir2_data_union_inumber_count(
void *obj,
int startoff)
{
xfs_dir2_data_entry_t *dep;
xfs_dir2_data_unused_t *dup;
char *end;
ASSERT(bitoffs(startoff) == 0);
dup = (xfs_dir2_data_unused_t *)((char *)obj + byteize(startoff));
dep = (xfs_dir2_data_entry_t *)dup;
end = (char *)&dep->inumber + sizeof(dep->inumber);
return end <= (char *)obj + mp->m_dir_geo->blksize &&
be16_to_cpu(dup->freetag) != XFS_DIR2_DATA_FREE_TAG;
}
static int
dir2_data_union_length_count(
void *obj,
int startoff)
{
xfs_dir2_data_unused_t *dup;
char *end;
ASSERT(bitoffs(startoff) == 0);
dup = (xfs_dir2_data_unused_t *)((char *)obj + byteize(startoff));
end = (char *)&dup->length + sizeof(dup->length);
return end <= (char *)obj + mp->m_dir_geo->blksize &&
be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG;
}
static int
dir2_data_union_name_count(
void *obj,
int startoff)
{
xfs_dir2_data_entry_t *dep;
xfs_dir2_data_unused_t *dup;
char *end;
ASSERT(bitoffs(startoff) == 0);
dup = (xfs_dir2_data_unused_t *)((char *)obj + byteize(startoff));
dep = (xfs_dir2_data_entry_t *)dup;
end = (char *)&dep->namelen + sizeof(dep->namelen);
if (end >= (char *)obj + mp->m_dir_geo->blksize ||
be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG)
return 0;
end = (char *)&dep->name[0] + dep->namelen;
return end <= (char *)obj + mp->m_dir_geo->blksize ? dep->namelen : 0;
}
static int
dir2_data_union_namelen_count(
void *obj,
int startoff)
{
xfs_dir2_data_entry_t *dep;
xfs_dir2_data_unused_t *dup;
char *end;
ASSERT(bitoffs(startoff) == 0);
dup = (xfs_dir2_data_unused_t *)((char *)obj + byteize(startoff));
dep = (xfs_dir2_data_entry_t *)dup;
end = (char *)&dep->namelen + sizeof(dep->namelen);
return end <= (char *)obj + mp->m_dir_geo->blksize &&
be16_to_cpu(dup->freetag) != XFS_DIR2_DATA_FREE_TAG;
}
static int
dir2_data_union_tag_count(
void *obj,
int startoff)
{
xfs_dir2_data_entry_t *dep;
xfs_dir2_data_unused_t *dup;
char *end;
__be16 *tagp;
ASSERT(bitoffs(startoff) == 0);
dup = (xfs_dir2_data_unused_t *)((char *)obj + byteize(startoff));
dep = (xfs_dir2_data_entry_t *)dup;
end = (char *)&dup->freetag + sizeof(dup->freetag);
if (end > (char *)obj + mp->m_dir_geo->blksize)
return 0;
if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
end = (char *)&dup->length + sizeof(dup->length);
if (end > (char *)obj + mp->m_dir_geo->blksize)
return 0;
tagp = xfs_dir2_data_unused_tag_p(dup);
} else {
end = (char *)&dep->namelen + sizeof(dep->namelen);
if (end > (char *)obj + mp->m_dir_geo->blksize)
return 0;
tagp = M_DIROPS(mp)->data_entry_tag_p(dep);
}
end = (char *)tagp + sizeof(*tagp);
return end <= (char *)obj + mp->m_dir_geo->blksize;
}
static int
dir2_data_union_tag_offset(
void *obj,
int startoff,
int idx)
{
xfs_dir2_data_entry_t *dep;
xfs_dir2_data_unused_t *dup;
ASSERT(bitoffs(startoff) == 0);
ASSERT(idx == 0);
dup = (xfs_dir2_data_unused_t *)((char *)obj + byteize(startoff));
if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG)
return bitize((int)((char *)xfs_dir2_data_unused_tag_p(dup) -
(char *)dup));
dep = (xfs_dir2_data_entry_t *)dup;
return bitize((int)((char *)M_DIROPS(mp)->data_entry_tag_p(dep) -
(char *)dep));
}
static int
dir2_data_hdr_count(
void *obj,
int startoff)
{
struct xfs_dir2_data_hdr *data = obj;
ASSERT(startoff == 0);
return be32_to_cpu(data->magic) == XFS_DIR2_DATA_MAGIC;
}
static int
dir3_data_hdr_count(
void *obj,
int startoff)
{
struct xfs_dir2_data_hdr *data = obj;
ASSERT(startoff == 0);
return be32_to_cpu(data->magic) == XFS_DIR3_DATA_MAGIC;
}
static int
dir2_data_u_count(
void *obj,
int startoff)
{
struct xfs_dir2_data_hdr *data = obj;
ASSERT(startoff == 0);
if (be32_to_cpu(data->magic) != XFS_DIR2_DATA_MAGIC &&
be32_to_cpu(data->magic) != XFS_DIR3_DATA_MAGIC)
return 0;
return __dir2_data_entries_count(
(char *)M_DIROPS(mp)->data_unused_p(data),
(char *)data + mp->m_dir_geo->blksize);
}
static int
dir2_data_u_offset(
void *obj,
int startoff,
int idx)
{
struct xfs_dir2_data_hdr *data = obj;
char *ptr;
ASSERT(startoff == 0);
ASSERT(be32_to_cpu(data->magic) == XFS_DIR2_DATA_MAGIC ||
be32_to_cpu(data->magic) == XFS_DIR3_DATA_MAGIC);
ptr = __dir2_data_entry_offset(
(char *)M_DIROPS(mp)->data_unused_p(data),
(char *)data + mp->m_dir_geo->blksize, idx);
return bitize((int)(ptr - (char *)data));
}
int
dir2_data_union_size(
void *obj,
int startoff,
int idx)
{
xfs_dir2_data_entry_t *dep;
xfs_dir2_data_unused_t *dup;
ASSERT(bitoffs(startoff) == 0);
ASSERT(idx == 0);
dup = (xfs_dir2_data_unused_t *)((char *)obj + byteize(startoff));
if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG)
return bitize(be16_to_cpu(dup->length));
else {
dep = (xfs_dir2_data_entry_t *)dup;
return bitize(M_DIROPS(mp)->data_entsize(dep->namelen));
}
}
static int
dir3_data_union_ftype_offset(
void *obj,
int startoff,
int idx)
{
xfs_dir2_data_entry_t *dep;
xfs_dir2_data_unused_t *dup;
ASSERT(bitoffs(startoff) == 0);
ASSERT(idx == 0);
dup = (xfs_dir2_data_unused_t *)((char *)obj + byteize(startoff));
if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG)
return bitize((int)((char *)xfs_dir2_data_unused_tag_p(dup) -
(char *)dup));
dep = (xfs_dir2_data_entry_t *)dup;
return bitize((int)((char *)&dep->name[dep->namelen] - (char *)dep));
}
/*
* Free block functions
*/
static int
dir2_free_bests_count(
void *obj,
int startoff)
{
struct xfs_dir2_free *free = obj;
ASSERT(startoff == 0);
if (be32_to_cpu(free->hdr.magic) != XFS_DIR2_FREE_MAGIC)
return 0;
return be32_to_cpu(free->hdr.nvalid);
}
static int
dir3_free_bests_count(
void *obj,
int startoff)
{
struct xfs_dir3_free *free = obj;
ASSERT(startoff == 0);
if (be32_to_cpu(free->hdr.hdr.magic) != XFS_DIR3_FREE_MAGIC)
return 0;
return be32_to_cpu(free->hdr.nvalid);
}
static int
dir2_free_hdr_count(
void *obj,
int startoff)
{
struct xfs_dir2_free *free = obj;
ASSERT(startoff == 0);
return be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC;
}
static int
dir3_free_hdr_count(
void *obj,
int startoff)
{
struct xfs_dir3_free *free = obj;
ASSERT(startoff == 0);
return be32_to_cpu(free->hdr.hdr.magic) == XFS_DIR3_FREE_MAGIC;
}
/*
* Leaf block functions
*/
static int
dir2_leaf_bests_count(
void *obj,
int startoff)
{
struct xfs_dir2_leaf *leaf = obj;
struct xfs_dir2_leaf_tail *ltp;
ASSERT(startoff == 0);
if (be16_to_cpu(leaf->hdr.info.magic) != XFS_DIR2_LEAF1_MAGIC &&
be16_to_cpu(leaf->hdr.info.magic) != XFS_DIR3_LEAF1_MAGIC)
return 0;
ltp = xfs_dir2_leaf_tail_p(mp->m_dir_geo, leaf);
return be32_to_cpu(ltp->bestcount);
}
static int
dir2_leaf_bests_offset(
void *obj,
int startoff,
int idx)
{
struct xfs_dir2_leaf *leaf = obj;
struct xfs_dir2_leaf_tail *ltp;
__be16 *lbp;
ASSERT(startoff == 0);
ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC ||
be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR3_LEAF1_MAGIC);
ltp = xfs_dir2_leaf_tail_p(mp->m_dir_geo, leaf);
lbp = xfs_dir2_leaf_bests_p(ltp) + idx;
return bitize((int)((char *)lbp - (char *)leaf));
}
static int
dir2_leaf_ents_count(
void *obj,
int startoff)
{
struct xfs_dir2_leaf *leaf = obj;
ASSERT(startoff == 0);
if (be16_to_cpu(leaf->hdr.info.magic) != XFS_DIR2_LEAF1_MAGIC &&
be16_to_cpu(leaf->hdr.info.magic) != XFS_DIR2_LEAFN_MAGIC)
return 0;
return be16_to_cpu(leaf->hdr.count);
}
static int
dir3_leaf_ents_count(
void *obj,
int startoff)
{
struct xfs_dir3_leaf *leaf = obj;
ASSERT(startoff == 0);
if (be16_to_cpu(leaf->hdr.info.hdr.magic) != XFS_DIR3_LEAF1_MAGIC &&
be16_to_cpu(leaf->hdr.info.hdr.magic) != XFS_DIR3_LEAFN_MAGIC)
return 0;
return be16_to_cpu(leaf->hdr.count);
}
static int
dir2_leaf_hdr_count(
void *obj,
int startoff)
{
struct xfs_dir2_leaf *leaf = obj;
ASSERT(startoff == 0);
return be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC ||
be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC;
}
static int
dir3_leaf_hdr_count(
void *obj,
int startoff)
{
struct xfs_dir3_leaf *leaf = obj;
ASSERT(startoff == 0);
return be16_to_cpu(leaf->hdr.info.hdr.magic) == XFS_DIR3_LEAF1_MAGIC ||
be16_to_cpu(leaf->hdr.info.hdr.magic) == XFS_DIR3_LEAFN_MAGIC;
}
static int
dir2_leaf_tail_count(
void *obj,
int startoff)
{
struct xfs_dir2_leaf *leaf = obj;
ASSERT(startoff == 0);
return be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC;
}
static int
dir3_leaf_tail_count(
void *obj,
int startoff)
{
struct xfs_dir3_leaf *leaf = obj;
ASSERT(startoff == 0);
return be16_to_cpu(leaf->hdr.info.hdr.magic) == XFS_DIR3_LEAF1_MAGIC;
}
static int
dir2_leaf_tail_offset(
void *obj,
int startoff,
int idx)
{
struct xfs_dir2_leaf *leaf = obj;
struct xfs_dir2_leaf_tail *ltp;
ASSERT(startoff == 0);
ASSERT(idx == 0);
ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC ||
be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR3_LEAF1_MAGIC);
ltp = xfs_dir2_leaf_tail_p(mp->m_dir_geo, leaf);
return bitize((int)((char *)ltp - (char *)leaf));
}
/*
* Node format functions
*/
static int
dir2_node_btree_count(
void *obj,
int startoff)
{
xfs_da_intnode_t *node = obj;
ASSERT(startoff == 0);
if (be16_to_cpu(node->hdr.info.magic) != XFS_DA_NODE_MAGIC)
return 0;
return be16_to_cpu(node->hdr.__count);
}
static int
dir3_node_btree_count(
void *obj,
int startoff)
{
struct xfs_da3_intnode *node = obj;
ASSERT(startoff == 0);
if (be16_to_cpu(node->hdr.info.hdr.magic) != XFS_DA3_NODE_MAGIC)
return 0;
return be16_to_cpu(node->hdr.__count);
}
static int
dir2_node_hdr_count(
void *obj,
int startoff)
{
struct xfs_da_intnode *node = obj;
ASSERT(startoff == 0);
return be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC;
}
static int
dir3_node_hdr_count(
void *obj,
int startoff)
{
struct xfs_da3_intnode *node = obj;
ASSERT(startoff == 0);
return be16_to_cpu(node->hdr.info.hdr.magic) == XFS_DA3_NODE_MAGIC;
}
int
dir2_size(
void *obj,
int startoff,
int idx)
{
return bitize(mp->m_dir_geo->blksize);
}
/*
* CRC enabled structure definitions
*/
const field_t dir3_hfld[] = {
{ "", FLDT_DIR3, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
#define B3OFF(f) bitize(offsetof(struct xfs_dir3_data_hdr, f))
#define D3OFF(f) bitize(offsetof(struct xfs_dir3_data_hdr, f))
#define F3OFF(f) bitize(offsetof(struct xfs_dir3_free, f))
#define L3OFF(f) bitize(offsetof(struct xfs_dir3_leaf, f))
#define N3OFF(f) bitize(offsetof(struct xfs_da3_intnode, f))
const field_t dir3_flds[] = {
{ "bhdr", FLDT_DIR3_DATA_HDR, OI(B3OFF(hdr)), dir3_block_hdr_count,
FLD_COUNT, TYP_NONE },
{ "bu", FLDT_DIR3_DATA_UNION, dir2_block_u_offset, dir2_block_u_count,
FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "bleaf", FLDT_DIR2_LEAF_ENTRY, dir2_block_leaf_offset,
dir2_block_leaf_count, FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "btail", FLDT_DIR2_BLOCK_TAIL, dir2_block_tail_offset,
dir3_block_tail_count, FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "dhdr", FLDT_DIR3_DATA_HDR, OI(D3OFF(hdr)), dir3_data_hdr_count,
FLD_COUNT, TYP_NONE },
{ "du", FLDT_DIR3_DATA_UNION, dir2_data_u_offset, dir2_data_u_count,
FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "lhdr", FLDT_DIR3_LEAF_HDR, OI(L3OFF(hdr)), dir3_leaf_hdr_count,
FLD_COUNT, TYP_NONE },
{ "lbests", FLDT_DIR2_DATA_OFF, dir2_leaf_bests_offset,
dir2_leaf_bests_count, FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "lents", FLDT_DIR2_LEAF_ENTRY, OI(L3OFF(__ents)), dir3_leaf_ents_count,
FLD_ARRAY|FLD_COUNT, TYP_NONE },
{ "ltail", FLDT_DIR2_LEAF_TAIL, dir2_leaf_tail_offset,
dir3_leaf_tail_count, FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ "nhdr", FLDT_DA3_NODE_HDR, OI(N3OFF(hdr)), dir3_node_hdr_count,
FLD_COUNT, TYP_NONE },
{ "nbtree", FLDT_DA_NODE_ENTRY, OI(N3OFF(__btree)), dir3_node_btree_count,
FLD_ARRAY|FLD_COUNT, TYP_NONE },
{ "fhdr", FLDT_DIR3_FREE_HDR, OI(F3OFF(hdr)), dir3_free_hdr_count,
FLD_COUNT, TYP_NONE },
{ "fbests", FLDT_DIR2_DATA_OFFNZ, OI(F3OFF(bests)),
dir3_free_bests_count, FLD_ARRAY|FLD_COUNT, TYP_NONE },
{ NULL }
};
#define D3EOFF(f) bitize(offsetof(xfs_dir2_data_entry_t, f))
#define D3UOFF(f) bitize(offsetof(xfs_dir2_data_unused_t, f))
const field_t dir3_data_union_flds[] = {
{ "freetag", FLDT_UINT16X, OI(D3UOFF(freetag)),
dir2_data_union_freetag_count, FLD_COUNT, TYP_NONE },
{ "inumber", FLDT_INO, OI(D3EOFF(inumber)),
dir2_data_union_inumber_count, FLD_COUNT, TYP_INODE },
{ "length", FLDT_DIR2_DATA_OFF, OI(D3UOFF(length)),
dir2_data_union_length_count, FLD_COUNT, TYP_NONE },
{ "namelen", FLDT_UINT8D, OI(D3EOFF(namelen)),
dir2_data_union_namelen_count, FLD_COUNT, TYP_NONE },
{ "name", FLDT_CHARNS, OI(D3EOFF(name)), dir2_data_union_name_count,
FLD_COUNT, TYP_NONE },
{ "filetype", FLDT_UINT8D, dir3_data_union_ftype_offset, C1,
FLD_OFFSET, TYP_NONE },
{ "tag", FLDT_DIR2_DATA_OFF, dir2_data_union_tag_offset,
dir2_data_union_tag_count, FLD_OFFSET|FLD_COUNT, TYP_NONE },
{ NULL }
};
#define DBH3OFF(f) bitize(offsetof(struct xfs_dir3_blk_hdr, f))
const field_t dir3_blkhdr_flds[] = {
{ "magic", FLDT_UINT32X, OI(DBH3OFF(magic)), C1, 0, TYP_NONE },
{ "crc", FLDT_CRC, OI(DBH3OFF(crc)), C1, 0, TYP_NONE },
{ "bno", FLDT_DFSBNO, OI(DBH3OFF(blkno)), C1, 0, TYP_BMAPBTD },
{ "lsn", FLDT_UINT64X, OI(DBH3OFF(lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(DBH3OFF(uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_INO, OI(DBH3OFF(owner)), C1, 0, TYP_NONE },
{ NULL }
};
#define DH3OFF(f) bitize(offsetof(struct xfs_dir3_data_hdr, f))
const field_t dir3_data_hdr_flds[] = {
{ "hdr", FLDT_DIR3_BLKHDR, OI(DH3OFF(hdr)), C1, 0, TYP_NONE },
{ "bestfree", FLDT_DIR2_DATA_FREE, OI(DH3OFF(best_free)),
CI(XFS_DIR2_DATA_FD_COUNT), FLD_ARRAY, TYP_NONE },
{ NULL }
};
#define LH3OFF(f) bitize(offsetof(struct xfs_dir3_leaf_hdr, f))
const field_t dir3_leaf_hdr_flds[] = {
{ "info", FLDT_DA3_BLKINFO, OI(LH3OFF(info)), C1, 0, TYP_NONE },
{ "count", FLDT_UINT16D, OI(LH3OFF(count)), C1, 0, TYP_NONE },
{ "stale", FLDT_UINT16D, OI(LH3OFF(stale)), C1, 0, TYP_NONE },
{ NULL }
};
#define FH3OFF(f) bitize(offsetof(struct xfs_dir3_free_hdr, f))
const field_t dir3_free_hdr_flds[] = {
{ "hdr", FLDT_DIR3_BLKHDR, OI(FH3OFF(hdr)), C1, 0, TYP_NONE },
{ "firstdb", FLDT_INT32D, OI(FH3OFF(firstdb)), C1, 0, TYP_NONE },
{ "nvalid", FLDT_INT32D, OI(FH3OFF(nvalid)), C1, 0, TYP_NONE },
{ "nused", FLDT_INT32D, OI(FH3OFF(nused)), C1, 0, TYP_NONE },
{ NULL }
};
#define DB3OFF(f) bitize(offsetof(struct xfs_da3_blkinfo, f))
const field_t da3_blkinfo_flds[] = {
{ "hdr", FLDT_DA_BLKINFO, OI(DB3OFF(hdr)), C1, 0, TYP_NONE },
{ "crc", FLDT_CRC, OI(DB3OFF(crc)), C1, 0, TYP_NONE },
{ "bno", FLDT_DFSBNO, OI(DB3OFF(blkno)), C1, 0, TYP_BMAPBTD },
{ "lsn", FLDT_UINT64X, OI(DB3OFF(lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(DB3OFF(uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_INO, OI(DB3OFF(owner)), C1, 0, TYP_NONE },
{ NULL }
};
#define H3OFF(f) bitize(offsetof(struct xfs_da3_node_hdr, f))
const field_t da3_node_hdr_flds[] = {
{ "info", FLDT_DA3_BLKINFO, OI(H3OFF(info)), C1, 0, TYP_NONE },
{ "count", FLDT_UINT16D, OI(H3OFF(__count)), C1, 0, TYP_NONE },
{ "level", FLDT_UINT16D, OI(H3OFF(__level)), C1, 0, TYP_NONE },
{ "pad", FLDT_UINT32D, OI(H3OFF(__pad32)), C1, 0, TYP_NONE },
{ NULL }
};
/*
* Special read verifier for directory buffers. Detect the magic number
* appropriately and set the correct verifier and call it.
*/
static void
xfs_dir3_db_read_verify(
struct xfs_buf *bp)
{
__be32 magic32;
__be16 magic16;
magic32 = *(__be32 *)bp->b_addr;
magic16 = ((struct xfs_da_blkinfo *)bp->b_addr)->magic;
switch (magic32) {
case cpu_to_be32(XFS_DIR3_BLOCK_MAGIC):
bp->b_ops = &xfs_dir3_block_buf_ops;
goto verify;
case cpu_to_be32(XFS_DIR3_DATA_MAGIC):
bp->b_ops = &xfs_dir3_data_buf_ops;
goto verify;
case cpu_to_be32(XFS_DIR3_FREE_MAGIC):
bp->b_ops = &xfs_dir3_free_buf_ops;
goto verify;
default:
break;
}
switch (magic16) {
case cpu_to_be16(XFS_DIR3_LEAF1_MAGIC):
bp->b_ops = &xfs_dir3_leaf1_buf_ops;
break;
case cpu_to_be16(XFS_DIR3_LEAFN_MAGIC):
bp->b_ops = &xfs_dir3_leafn_buf_ops;
break;
case cpu_to_be16(XFS_DA3_NODE_MAGIC):
bp->b_ops = &xfs_da3_node_buf_ops;
break;
default:
dbprintf(_("Unknown directory buffer type!\n"));
xfs_buf_ioerror(bp, -EFSCORRUPTED);
return;
}
verify:
bp->b_ops->verify_read(bp);
}
static void
xfs_dir3_db_write_verify(
struct xfs_buf *bp)
{
dbprintf(_("Writing unknown directory buffer type!\n"));
xfs_buf_ioerror(bp, -EFSCORRUPTED);
}
const struct xfs_buf_ops xfs_dir3_db_buf_ops = {
.name = "xfs_dir3",
.verify_read = xfs_dir3_db_read_verify,
.verify_write = xfs_dir3_db_write_verify,
};
xfsprogs-4.3.0+nmu1ubuntu1.1/db/dir2.h 0000664 0000000 0000000 00000004032 12560572026 014222 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* common types across directory formats
*/
extern const field_t dir2_block_tail_flds[];
extern const field_t dir2_data_free_flds[];
extern const field_t dir2_data_union_flds[];
extern const field_t dir2_leaf_tail_flds[];
extern const field_t dir2_leaf_entry_flds[];
extern const field_t da_node_entry_flds[];
/*
* dirv2 specific types
*/
extern const field_t dir2_flds[];
extern const field_t dir2_hfld[];
extern const field_t dir2_data_hdr_flds[];
extern const field_t dir2_free_hdr_flds[];
extern const field_t dir2_leaf_hdr_flds[];
extern const field_t da_blkinfo_flds[];
extern const field_t da_node_hdr_flds[];
/*
* dirv3 specific types
*/
extern const field_t dir3_flds[];
extern const field_t dir3_hfld[];
extern const field_t dir3_blkhdr_flds[];
extern const field_t dir3_data_hdr_flds[];
extern const field_t dir3_free_hdr_flds[];
extern const field_t dir3_leaf_hdr_flds[];
extern const field_t dir3_data_union_flds[];
extern const field_t da3_blkinfo_flds[];
extern const field_t da3_node_hdr_flds[];
static inline xfs_dir2_inou_t *xfs_dir2_sf_inumberp(xfs_dir2_sf_entry_t *sfep)
{
return (xfs_dir2_inou_t *)&(sfep)->name[(sfep)->namelen];
}
extern int dir2_data_union_size(void *obj, int startoff, int idx);
extern int dir2_size(void *obj, int startoff, int idx);
extern const struct xfs_buf_ops xfs_dir3_db_buf_ops;
xfsprogs-4.3.0+nmu1ubuntu1.1/db/dir2sf.c 0000664 0000000 0000000 00000015627 12574431650 014564 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "bit.h"
#include "dir2.h"
#include "dir2sf.h"
#include "init.h"
static int dir2_inou_i4_count(void *obj, int startoff);
static int dir2_inou_i8_count(void *obj, int startoff);
static int dir2_sf_entry_inumber_offset(void *obj, int startoff, int idx);
static int dir2_sf_entry_name_count(void *obj, int startoff);
static int dir2_sf_list_count(void *obj, int startoff);
static int dir2_sf_list_offset(void *obj, int startoff, int idx);
#define OFF(f) bitize(offsetof(struct xfs_dir2_sf_hdr, f))
const field_t dir2sf_flds[] = {
{ "hdr", FLDT_DIR2_SF_HDR, OI(OFF(count)), C1, 0, TYP_NONE },
{ "list", FLDT_DIR2_SF_ENTRY, dir2_sf_list_offset, dir2_sf_list_count,
FLD_ARRAY|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ NULL }
};
#define UOFF(f) bitize(offsetof(xfs_dir2_inou_t, f))
const field_t dir2_inou_flds[] = {
{ "i8", FLDT_DIR2_INO8, OI(UOFF(i8)), dir2_inou_i8_count, FLD_COUNT,
TYP_INODE },
{ "i4", FLDT_DIR2_INO4, OI(UOFF(i4)), dir2_inou_i4_count, FLD_COUNT,
TYP_INODE },
{ NULL }
};
#define HOFF(f) bitize(offsetof(xfs_dir2_sf_hdr_t, f))
const field_t dir2_sf_hdr_flds[] = {
{ "count", FLDT_UINT8D, OI(HOFF(count)), C1, 0, TYP_NONE },
{ "i8count", FLDT_UINT8D, OI(HOFF(i8count)), C1, 0, TYP_NONE },
{ "parent", FLDT_DIR2_INOU, OI(HOFF(parent)), C1, 0, TYP_NONE },
{ NULL }
};
#define EOFF(f) bitize(offsetof(xfs_dir2_sf_entry_t, f))
const field_t dir2_sf_entry_flds[] = {
{ "namelen", FLDT_UINT8D, OI(EOFF(namelen)), C1, 0, TYP_NONE },
{ "offset", FLDT_DIR2_SF_OFF, OI(EOFF(offset)), C1, 0, TYP_NONE },
{ "name", FLDT_CHARNS, OI(EOFF(name)), dir2_sf_entry_name_count,
FLD_COUNT, TYP_NONE },
{ "inumber", FLDT_DIR2_INOU, dir2_sf_entry_inumber_offset, C1,
FLD_OFFSET, TYP_NONE },
{ NULL }
};
/*ARGSUSED*/
static int
dir2_inou_i4_count(
void *obj,
int startoff)
{
struct xfs_dinode *dip = obj;
struct xfs_dir2_sf_hdr *sf;
ASSERT(bitoffs(startoff) == 0);
sf = (struct xfs_dir2_sf_hdr *)XFS_DFORK_DPTR(dip);
return sf->i8count == 0;
}
/*ARGSUSED*/
static int
dir2_inou_i8_count(
void *obj,
int startoff)
{
struct xfs_dinode *dip = obj;
struct xfs_dir2_sf_hdr *sf;
ASSERT(bitoffs(startoff) == 0);
sf = (struct xfs_dir2_sf_hdr *)XFS_DFORK_DPTR(dip);
return sf->i8count != 0;
}
/*ARGSUSED*/
int
dir2_inou_size(
void *obj,
int startoff,
int idx)
{
struct xfs_dinode *dip = obj;
struct xfs_dir2_sf_hdr *sf;
ASSERT(bitoffs(startoff) == 0);
ASSERT(idx == 0);
sf = (struct xfs_dir2_sf_hdr *)XFS_DFORK_DPTR(dip);
return bitize(sf->i8count ?
(uint)sizeof(xfs_dir2_ino8_t) :
(uint)sizeof(xfs_dir2_ino4_t));
}
static int
dir2_sf_entry_name_count(
void *obj,
int startoff)
{
xfs_dir2_sf_entry_t *e;
ASSERT(bitoffs(startoff) == 0);
e = (xfs_dir2_sf_entry_t *)((char *)obj + byteize(startoff));
return e->namelen;
}
static int
dir2_sf_entry_inumber_offset(
void *obj,
int startoff,
int idx)
{
xfs_dir2_sf_entry_t *e;
ASSERT(bitoffs(startoff) == 0);
ASSERT(idx == 0);
e = (xfs_dir2_sf_entry_t *)((char *)obj + byteize(startoff));
return bitize((int)((char *)xfs_dir2_sf_inumberp(e) - (char *)e));
}
static int
dir3_sf_entry_inumber_offset(
void *obj,
int startoff,
int idx)
{
xfs_dir2_sf_entry_t *e;
ASSERT(bitoffs(startoff) == 0);
ASSERT(idx == 0);
e = (xfs_dir2_sf_entry_t *)((char *)obj + byteize(startoff));
/* plus 1 to skip the ftype entry */
return bitize((int)((char *)xfs_dir2_sf_inumberp(e) + 1 - (char *)e));
}
static int
dir3_sf_entry_ftype_offset(
void *obj,
int startoff,
int idx)
{
xfs_dir2_sf_entry_t *e;
ASSERT(bitoffs(startoff) == 0);
ASSERT(idx == 0);
e = (xfs_dir2_sf_entry_t *)((char *)obj + byteize(startoff));
return bitize((int)((char *)&e->name[e->namelen] - (char *)e));
}
int
dir2_sf_entry_size(
void *obj,
int startoff,
int idx)
{
xfs_dir2_sf_entry_t *e;
int i;
struct xfs_dir2_sf_hdr *sf;
ASSERT(bitoffs(startoff) == 0);
sf = (struct xfs_dir2_sf_hdr *)((char *)obj + byteize(startoff));
e = xfs_dir2_sf_firstentry(sf);
for (i = 0; i < idx; i++)
e = M_DIROPS(mp)->sf_nextentry(sf, e);
return bitize((int)M_DIROPS(mp)->sf_entsize(sf, e->namelen));
}
/*ARGSUSED*/
int
dir2_sf_hdr_size(
void *obj,
int startoff,
int idx)
{
struct xfs_dir2_sf_hdr *sf;
ASSERT(bitoffs(startoff) == 0);
ASSERT(idx == 0);
sf = (struct xfs_dir2_sf_hdr *)((char *)obj + byteize(startoff));
return bitize(xfs_dir2_sf_hdr_size(sf->i8count));
}
static int
dir2_sf_list_count(
void *obj,
int startoff)
{
struct xfs_dir2_sf_hdr *sf;
ASSERT(bitoffs(startoff) == 0);
sf = (struct xfs_dir2_sf_hdr *)((char *)obj + byteize(startoff));
return sf->count;
}
static int
dir2_sf_list_offset(
void *obj,
int startoff,
int idx)
{
xfs_dir2_sf_entry_t *e;
int i;
struct xfs_dir2_sf_hdr *sf;
ASSERT(bitoffs(startoff) == 0);
sf = (struct xfs_dir2_sf_hdr *)((char *)obj + byteize(startoff));
e = xfs_dir2_sf_firstentry(sf);
for (i = 0; i < idx; i++)
e = M_DIROPS(mp)->sf_nextentry(sf, e);
return bitize((int)((char *)e - (char *)sf));
}
/*ARGSUSED*/
int
dir2sf_size(
void *obj,
int startoff,
int idx)
{
xfs_dir2_sf_entry_t *e;
int i;
struct xfs_dir2_sf_hdr *sf;
ASSERT(bitoffs(startoff) == 0);
ASSERT(idx == 0);
sf = (struct xfs_dir2_sf_hdr *)((char *)obj + byteize(startoff));
e = xfs_dir2_sf_firstentry(sf);
for (i = 0; i < sf->count; i++)
e = M_DIROPS(mp)->sf_nextentry(sf, e);
return bitize((int)((char *)e - (char *)sf));
}
#define OFF(f) bitize(offsetof(struct xfs_dir2_sf_hdr, f))
const field_t dir3sf_flds[] = {
{ "hdr", FLDT_DIR2_SF_HDR, OI(OFF(count)), C1, 0, TYP_NONE },
{ "list", FLDT_DIR3_SF_ENTRY, dir2_sf_list_offset, dir2_sf_list_count,
FLD_ARRAY|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ NULL }
};
#define E3OFF(f) bitize(offsetof(xfs_dir2_sf_entry_t, f))
const field_t dir3_sf_entry_flds[] = {
{ "namelen", FLDT_UINT8D, OI(EOFF(namelen)), C1, 0, TYP_NONE },
{ "offset", FLDT_DIR2_SF_OFF, OI(EOFF(offset)), C1, 0, TYP_NONE },
{ "name", FLDT_CHARNS, OI(EOFF(name)), dir2_sf_entry_name_count,
FLD_COUNT, TYP_NONE },
{ "inumber", FLDT_DIR2_INOU, dir3_sf_entry_inumber_offset, C1,
FLD_OFFSET, TYP_NONE },
{ "filetype", FLDT_UINT8D, dir3_sf_entry_ftype_offset, C1,
FLD_OFFSET, TYP_NONE },
{ NULL }
};
xfsprogs-4.3.0+nmu1ubuntu1.1/db/dir2sf.h 0000664 0000000 0000000 00000002277 12560572026 014564 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern const field_t dir2sf_flds[];
extern const field_t dir2_inou_flds[];
extern const field_t dir2_sf_hdr_flds[];
extern const field_t dir2_sf_entry_flds[];
extern const field_t dir3sf_flds[];
extern const field_t dir3_sf_entry_flds[];
extern int dir2sf_size(void *obj, int startoff, int idx);
extern int dir2_inou_size(void *obj, int startoff, int idx);
extern int dir2_sf_entry_size(void *obj, int startoff, int idx);
extern int dir2_sf_hdr_size(void *obj, int startoff, int idx);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/dquot.c 0000664 0000000 0000000 00000011560 12574431650 014517 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "bit.h"
#include "bmap.h"
#include "command.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "inode.h"
#include "io.h"
#include "init.h"
#include "output.h"
#include "dquot.h"
static int dquot_f(int argc, char **argv);
static void dquot_help(void);
static const cmdinfo_t dquot_cmd =
{ "dquot", NULL, dquot_f, 1, 2, 1, N_("[projid|gid|uid]"),
N_("set current address to project, group or user quota block"), dquot_help };
const field_t dqblk_hfld[] = {
{ "", FLDT_DQBLK, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
#define DDOFF(f) bitize(offsetof(xfs_dqblk_t, dd_ ## f))
#define DDSZC(f) szcount(xfs_dqblk_t, dd_ ## f)
const field_t dqblk_flds[] = {
{ "diskdq", FLDT_DISK_DQUOT, OI(DDOFF(diskdq)), C1, 0, TYP_NONE },
{ "fill", FLDT_CHARS, OI(DDOFF(fill)), CI(DDSZC(fill)), FLD_SKIPALL,
TYP_NONE },
{ "crc", FLDT_CRC, OI(DDOFF(crc)), C1, 0, TYP_NONE },
{ "lsn", FLDT_UINT64X, OI(DDOFF(lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(DDOFF(uuid)), C1, 0, TYP_NONE },
{ NULL }
};
#define DOFF(f) bitize(offsetof(xfs_disk_dquot_t, d_ ## f))
const field_t disk_dquot_flds[] = {
{ "magic", FLDT_UINT16X, OI(DOFF(magic)), C1, 0, TYP_NONE },
{ "version", FLDT_UINT8X, OI(DOFF(version)), C1, 0, TYP_NONE },
{ "flags", FLDT_UINT8X, OI(DOFF(flags)), C1, 0, TYP_NONE },
{ "id", FLDT_DQID, OI(DOFF(id)), C1, 0, TYP_NONE },
{ "blk_hardlimit", FLDT_QCNT, OI(DOFF(blk_hardlimit)), C1, 0,
TYP_NONE },
{ "blk_softlimit", FLDT_QCNT, OI(DOFF(blk_softlimit)), C1, 0,
TYP_NONE },
{ "ino_hardlimit", FLDT_QCNT, OI(DOFF(ino_hardlimit)), C1, 0,
TYP_NONE },
{ "ino_softlimit", FLDT_QCNT, OI(DOFF(ino_softlimit)), C1, 0,
TYP_NONE },
{ "bcount", FLDT_QCNT, OI(DOFF(bcount)), C1, 0, TYP_NONE },
{ "icount", FLDT_QCNT, OI(DOFF(icount)), C1, 0, TYP_NONE },
{ "itimer", FLDT_INT32D, OI(DOFF(itimer)), C1, 0, TYP_NONE },
{ "btimer", FLDT_INT32D, OI(DOFF(btimer)), C1, 0, TYP_NONE },
{ "iwarns", FLDT_QWARNCNT, OI(DOFF(iwarns)), C1, 0, TYP_NONE },
{ "bwarns", FLDT_QWARNCNT, OI(DOFF(bwarns)), C1, 0, TYP_NONE },
{ "pad0", FLDT_INT32D, OI(DOFF(pad0)), C1, FLD_SKIPALL, TYP_NONE },
{ "rtb_hardlimit", FLDT_QCNT, OI(DOFF(rtb_hardlimit)), C1, 0,
TYP_NONE },
{ "rtb_softlimit", FLDT_QCNT, OI(DOFF(rtb_softlimit)), C1, 0,
TYP_NONE },
{ "rtbcount", FLDT_QCNT, OI(DOFF(rtbcount)), C1, 0, TYP_NONE },
{ "rtbtimer", FLDT_INT32D, OI(DOFF(rtbtimer)), C1, 0, TYP_NONE },
{ "rtbwarns", FLDT_QWARNCNT, OI(DOFF(rtbwarns)), C1, 0, TYP_NONE },
{ "pad", FLDT_UINT16X, OI(DOFF(pad)), C1, FLD_SKIPALL, TYP_NONE },
{ NULL }
};
static void
dquot_help(void)
{
}
static int
dquot_f(
int argc,
char **argv)
{
bmap_ext_t bm;
int c;
int dogrp;
int doprj;
xfs_dqid_t id;
xfs_ino_t ino;
int nex;
char *p;
int perblock;
xfs_fileoff_t qbno;
int qoff;
char *s;
dogrp = doprj = optind = 0;
while ((c = getopt(argc, argv, "gpu")) != EOF) {
switch (c) {
case 'g':
dogrp = 1;
doprj = 0;
break;
case 'p':
doprj = 1;
dogrp = 0;
break;
case 'u':
dogrp = doprj = 0;
break;
default:
dbprintf(_("bad option for dquot command\n"));
return 0;
}
}
s = doprj ? _("project") : dogrp ? _("group") : _("user");
if (optind != argc - 1) {
dbprintf(_("dquot command requires one %s id argument\n"), s);
return 0;
}
ino = mp->m_sb.sb_uquotino;
if (doprj)
ino = mp->m_sb.sb_pquotino;
else if (dogrp)
ino = mp->m_sb.sb_gquotino;
if (ino == 0 || ino == NULLFSINO) {
dbprintf(_("no %s quota inode present\n"), s);
return 0;
}
id = (xfs_dqid_t)strtol(argv[optind], &p, 0);
if (*p != '\0') {
dbprintf(_("bad %s id for dquot %s\n"), s, argv[optind]);
return 0;
}
perblock = (int)(mp->m_sb.sb_blocksize / sizeof(xfs_dqblk_t));
qbno = (xfs_fileoff_t)id / perblock;
qoff = (int)(id % perblock);
push_cur();
set_cur_inode(ino);
nex = 1;
bmap(qbno, 1, XFS_DATA_FORK, &nex, &bm);
pop_cur();
if (nex == 0) {
dbprintf(_("no %s quota data for id %d\n"), s, id);
return 0;
}
set_cur(&typtab[TYP_DQBLK], XFS_FSB_TO_DADDR(mp, bm.startblock), blkbb,
DB_RING_IGN, NULL);
off_cur(qoff * (int)sizeof(xfs_dqblk_t), sizeof(xfs_dqblk_t));
ring_add();
return 0;
}
void
dquot_init(void)
{
add_command(&dquot_cmd);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/dquot.h 0000664 0000000 0000000 00000001564 12560572026 014525 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern const struct field disk_dquot_flds[];
extern const struct field dqblk_flds[];
extern const struct field dqblk_hfld[];
extern void dquot_init(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/echo.c 0000664 0000000 0000000 00000002237 12574431650 014302 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "command.h"
#include "echo.h"
#include "output.h"
static int echo_f(int argc, char **argv);
static const cmdinfo_t echo_cmd =
{ "echo", NULL, echo_f, 0, -1, 0, N_("[args]..."),
N_("echo arguments"), NULL };
/*ARGSUSED*/
static int
echo_f(
int argc,
char **argv)
{
char *c;
for (c = *(++argv); c; c = *(++argv))
dbprintf("%s ", c);
dbprintf("\n");
return 0;
}
void
echo_init(void)
{
add_command(&echo_cmd);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/echo.h 0000664 0000000 0000000 00000001365 12560572026 014306 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void echo_init(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/faddr.c 0000664 0000000 0000000 00000020543 12574431650 014444 0 ustar /*
* Copyright (c) 2000-2001,2004-2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "type.h"
#include "fprint.h"
#include "faddr.h"
#include "field.h"
#include "inode.h"
#include "io.h"
#include "bit.h"
#include "bmap.h"
#include "output.h"
#include "init.h"
void
fa_agblock(
void *obj,
int bit,
typnm_t next)
{
xfs_agblock_t bno;
if (cur_agno == NULLAGNUMBER) {
dbprintf(_("no current allocation group, cannot set new addr\n"));
return;
}
bno = (xfs_agblock_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
if (bno == NULLAGBLOCK) {
dbprintf(_("null block number, cannot set new addr\n"));
return;
}
ASSERT(typtab[next].typnm == next);
set_cur(&typtab[next], XFS_AGB_TO_DADDR(mp, cur_agno, bno), blkbb,
DB_RING_ADD, NULL);
}
/*ARGSUSED*/
void
fa_agino(
void *obj,
int bit,
typnm_t next)
{
xfs_agino_t agino;
if (cur_agno == NULLAGNUMBER) {
dbprintf(_("no current allocation group, cannot set new addr\n"));
return;
}
agino = (xfs_agino_t)getbitval(obj, bit, bitsz(agino), BVUNSIGNED);
if (agino == NULLAGINO) {
dbprintf(_("null inode number, cannot set new addr\n"));
return;
}
set_cur_inode(XFS_AGINO_TO_INO(mp, cur_agno, agino));
}
/*ARGSUSED*/
void
fa_attrblock(
void *obj,
int bit,
typnm_t next)
{
bmap_ext_t bm;
__uint32_t bno;
xfs_fsblock_t dfsbno;
int nex;
bno = (__uint32_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
if (bno == 0) {
dbprintf(_("null attribute block number, cannot set new addr\n"));
return;
}
nex = 1;
bmap(bno, 1, XFS_ATTR_FORK, &nex, &bm);
if (nex == 0) {
dbprintf(_("attribute block is unmapped\n"));
return;
}
dfsbno = bm.startblock + (bno - bm.startoff);
ASSERT(typtab[next].typnm == next);
set_cur(&typtab[next], (__int64_t)XFS_FSB_TO_DADDR(mp, dfsbno), blkbb,
DB_RING_ADD, NULL);
}
void
fa_cfileoffa(
void *obj,
int bit,
typnm_t next)
{
bmap_ext_t bm;
xfs_fileoff_t bno;
xfs_fsblock_t dfsbno;
int nex;
bno = (xfs_fileoff_t)getbitval(obj, bit, BMBT_STARTOFF_BITLEN,
BVUNSIGNED);
if (bno == NULLFILEOFF) {
dbprintf(_("null block number, cannot set new addr\n"));
return;
}
nex = 1;
bmap(bno, 1, XFS_ATTR_FORK, &nex, &bm);
if (nex == 0) {
dbprintf(_("file block is unmapped\n"));
return;
}
dfsbno = bm.startblock + (bno - bm.startoff);
ASSERT(typtab[next].typnm == next);
set_cur(&typtab[next], XFS_FSB_TO_DADDR(mp, dfsbno), blkbb, DB_RING_ADD,
NULL);
}
void
fa_cfileoffd(
void *obj,
int bit,
typnm_t next)
{
bbmap_t bbmap;
bmap_ext_t *bmp;
xfs_fileoff_t bno;
xfs_fsblock_t dfsbno;
int nb;
int nex;
bno = (xfs_fileoff_t)getbitval(obj, bit, BMBT_STARTOFF_BITLEN,
BVUNSIGNED);
if (bno == NULLFILEOFF) {
dbprintf(_("null block number, cannot set new addr\n"));
return;
}
nex = nb = next == TYP_DIR2 ? mp->m_dir_geo->fsbcount : 1;
bmp = malloc(nb * sizeof(*bmp));
bmap(bno, nb, XFS_DATA_FORK, &nex, bmp);
if (nex == 0) {
dbprintf(_("file block is unmapped\n"));
free(bmp);
return;
}
dfsbno = bmp->startblock + (bno - bmp->startoff);
ASSERT(typtab[next].typnm == next);
if (nex > 1)
make_bbmap(&bbmap, nex, bmp);
set_cur(&typtab[next], XFS_FSB_TO_DADDR(mp, dfsbno), nb * blkbb,
DB_RING_ADD, nex > 1 ? &bbmap: NULL);
free(bmp);
}
void
fa_cfsblock(
void *obj,
int bit,
typnm_t next)
{
xfs_fsblock_t bno;
int nb;
bno = (xfs_fsblock_t)getbitval(obj, bit, BMBT_STARTBLOCK_BITLEN,
BVUNSIGNED);
if (bno == NULLFSBLOCK) {
dbprintf(_("null block number, cannot set new addr\n"));
return;
}
nb = next == TYP_DIR2 ? mp->m_dir_geo->fsbcount : 1;
ASSERT(typtab[next].typnm == next);
set_cur(&typtab[next], XFS_FSB_TO_DADDR(mp, bno), nb * blkbb,
DB_RING_ADD, NULL);
}
void
fa_dfiloffa(
void *obj,
int bit,
typnm_t next)
{
bmap_ext_t bm;
xfs_fileoff_t bno;
xfs_fsblock_t dfsbno;
int nex;
bno = (xfs_fileoff_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
if (bno == NULLFILEOFF) {
dbprintf(_("null block number, cannot set new addr\n"));
return;
}
nex = 1;
bmap(bno, 1, XFS_ATTR_FORK, &nex, &bm);
if (nex == 0) {
dbprintf(_("file block is unmapped\n"));
return;
}
dfsbno = bm.startblock + (bno - bm.startoff);
ASSERT(typtab[next].typnm == next);
set_cur(&typtab[next], XFS_FSB_TO_DADDR(mp, dfsbno), blkbb, DB_RING_ADD,
NULL);
}
void
fa_dfiloffd(
void *obj,
int bit,
typnm_t next)
{
bbmap_t bbmap;
bmap_ext_t *bmp;
xfs_fileoff_t bno;
xfs_fsblock_t dfsbno;
int nb;
int nex;
bno = (xfs_fileoff_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
if (bno == NULLFILEOFF) {
dbprintf(_("null block number, cannot set new addr\n"));
return;
}
nex = nb = next == TYP_DIR2 ? mp->m_dir_geo->fsbcount : 1;
bmp = malloc(nb * sizeof(*bmp));
bmap(bno, nb, XFS_DATA_FORK, &nex, bmp);
if (nex == 0) {
dbprintf(_("file block is unmapped\n"));
free(bmp);
return;
}
dfsbno = bmp->startblock + (bno - bmp->startoff);
ASSERT(typtab[next].typnm == next);
if (nex > 1)
make_bbmap(&bbmap, nex, bmp);
set_cur(&typtab[next], XFS_FSB_TO_DADDR(mp, dfsbno), nb * blkbb,
DB_RING_ADD, nex > 1 ? &bbmap : NULL);
free(bmp);
}
void
fa_dfsbno(
void *obj,
int bit,
typnm_t next)
{
xfs_fsblock_t bno;
bno = (xfs_fsblock_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
if (bno == NULLFSBLOCK) {
dbprintf(_("null block number, cannot set new addr\n"));
return;
}
ASSERT(typtab[next].typnm == next);
set_cur(&typtab[next], XFS_FSB_TO_DADDR(mp, bno), blkbb, DB_RING_ADD,
NULL);
}
/*ARGSUSED*/
void
fa_dirblock(
void *obj,
int bit,
typnm_t next)
{
bbmap_t bbmap;
bmap_ext_t *bmp;
__uint32_t bno;
xfs_fsblock_t dfsbno;
int nex;
bno = (__uint32_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
if (bno == 0) {
dbprintf(_("null directory block number, cannot set new addr\n"));
return;
}
nex = mp->m_dir_geo->fsbcount;
bmp = malloc(nex * sizeof(*bmp));
bmap(bno, mp->m_dir_geo->fsbcount, XFS_DATA_FORK, &nex, bmp);
if (nex == 0) {
dbprintf(_("directory block is unmapped\n"));
free(bmp);
return;
}
dfsbno = bmp->startblock + (bno - bmp->startoff);
ASSERT(typtab[next].typnm == next);
if (nex > 1)
make_bbmap(&bbmap, nex, bmp);
set_cur(&typtab[next], (__int64_t)XFS_FSB_TO_DADDR(mp, dfsbno),
XFS_FSB_TO_BB(mp, mp->m_dir_geo->fsbcount), DB_RING_ADD,
nex > 1 ? &bbmap : NULL);
free(bmp);
}
void
fa_drfsbno(
void *obj,
int bit,
typnm_t next)
{
xfs_rfsblock_t bno;
bno = (xfs_rfsblock_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
if (bno == NULLRFSBLOCK) {
dbprintf(_("null block number, cannot set new addr\n"));
return;
}
ASSERT(typtab[next].typnm == next);
set_cur(&typtab[next], (__int64_t)XFS_FSB_TO_BB(mp, bno), blkbb,
DB_RING_ADD, NULL);
}
/*ARGSUSED*/
void
fa_drtbno(
void *obj,
int bit,
typnm_t next)
{
xfs_rtblock_t bno;
bno = (xfs_rtblock_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
if (bno == NULLRTBLOCK) {
dbprintf(_("null block number, cannot set new addr\n"));
return;
}
/* need set_cur to understand rt subvolume */
}
/*ARGSUSED*/
void
fa_ino(
void *obj,
int bit,
typnm_t next)
{
xfs_ino_t ino;
ASSERT(next == TYP_INODE);
ino = (xfs_ino_t)getbitval(obj, bit, bitsz(ino), BVUNSIGNED);
if (ino == NULLFSINO) {
dbprintf(_("null inode number, cannot set new addr\n"));
return;
}
set_cur_inode(ino);
}
void
fa_ino4(
void *obj,
int bit,
typnm_t next)
{
xfs_ino_t ino;
xfs_dir2_ino4_t ino4;
ASSERT(next == TYP_INODE);
ino = (xfs_ino_t)getbitval(obj, bit, bitsz(ino4), BVUNSIGNED);
if (ino == NULLFSINO) {
dbprintf(_("null inode number, cannot set new addr\n"));
return;
}
set_cur_inode(ino);
}
void
fa_ino8(
void *obj,
int bit,
typnm_t next)
{
xfs_ino_t ino;
xfs_dir2_ino8_t ino8;
ASSERT(next == TYP_INODE);
ino = (xfs_ino_t)getbitval(obj, bit, bitsz(ino8), BVUNSIGNED);
if (ino == NULLFSINO) {
dbprintf(_("null inode number, cannot set new addr\n"));
return;
}
set_cur_inode(ino);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/faddr.h 0000664 0000000 0000000 00000003265 12560572026 014451 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
typedef void (*adfnc_t)(void *obj, int bit, typnm_t next);
extern void fa_agblock(void *obj, int bit, typnm_t next);
extern void fa_agino(void *obj, int bit, typnm_t next);
extern void fa_attrblock(void *obj, int bit, typnm_t next);
extern void fa_cfileoffd(void *obj, int bit, typnm_t next);
extern void fa_cfsblock(void *obj, int bit, typnm_t next);
extern void fa_dfiloffd(void *obj, int bit, typnm_t next);
extern void fa_dfsbno(void *obj, int bit, typnm_t next);
extern void fa_dinode_union(void *obj, int bit, typnm_t next);
extern void fa_dirblock(void *obj, int bit, typnm_t next);
extern void fa_drfsbno(void *obj, int bit, typnm_t next);
extern void fa_drtbno(void *obj, int bit, typnm_t next);
extern void fa_ino(void *obj, int bit, typnm_t next);
extern void fa_cfileoffa(void *obj, int bit, typnm_t next);
extern void fa_dfiloffa(void *obj, int bit, typnm_t next);
extern void fa_ino4(void *obj, int bit, typnm_t next);
extern void fa_ino8(void *obj, int bit, typnm_t next);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/field.c 0000664 0000000 0000000 00000044223 12574431650 014450 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "inode.h"
#include "btblock.h"
#include "bmroot.h"
#include "bit.h"
#include "agf.h"
#include "agfl.h"
#include "agi.h"
#include "sb.h"
#include "attr.h"
#include "attrshort.h"
#include "dquot.h"
#include "dir2.h"
#include "dir2sf.h"
#include "symlink.h"
const ftattr_t ftattrtab[] = {
{ FLDT_AEXTNUM, "aextnum", fp_num, "%d", SI(bitsz(xfs_aextnum_t)),
FTARG_SIGNED, NULL, NULL },
{ FLDT_AGBLOCK, "agblock", fp_num, "%u", SI(bitsz(xfs_agblock_t)),
FTARG_DONULL, fa_agblock, NULL },
{ FLDT_AGBLOCKNZ, "agblocknz", fp_num, "%u", SI(bitsz(xfs_agblock_t)),
FTARG_SKIPZERO|FTARG_DONULL, fa_agblock, NULL },
{ FLDT_AGF, "agf", NULL, (char *)agf_flds, agf_size, FTARG_SIZE, NULL,
agf_flds },
{ FLDT_AGFL, "agfl", NULL, (char *)agfl_flds, agfl_size, FTARG_SIZE,
NULL, agfl_flds },
{ FLDT_AGFL_CRC, "agfl", NULL, (char *)agfl_crc_flds, agfl_size,
FTARG_SIZE, NULL, agfl_crc_flds },
{ FLDT_AGI, "agi", NULL, (char *)agi_flds, agi_size, FTARG_SIZE, NULL,
agi_flds },
{ FLDT_AGINO, "agino", fp_num, "%u", SI(bitsz(xfs_agino_t)),
FTARG_DONULL, fa_agino, NULL },
{ FLDT_AGINONN, "aginonn", fp_num, "%u", SI(bitsz(xfs_agino_t)),
FTARG_SKIPNULL, fa_agino, NULL },
{ FLDT_AGNUMBER, "agnumber", fp_num, "%u", SI(bitsz(xfs_agnumber_t)),
FTARG_DONULL, NULL, NULL },
/* attr fields */
{ FLDT_ATTR, "attr", NULL, (char *)attr_flds, attr_size, FTARG_SIZE,
NULL, attr_flds },
{ FLDT_ATTR_BLKINFO, "attr_blkinfo", NULL, (char *)attr_blkinfo_flds,
SI(bitsz(struct xfs_da_blkinfo)), 0, NULL, attr_blkinfo_flds },
{ FLDT_ATTR_LEAF_ENTRY, "attr_leaf_entry", fp_sarray,
(char *)attr_leaf_entry_flds, SI(bitsz(struct xfs_attr_leaf_entry)),
0, NULL, attr_leaf_entry_flds },
{ FLDT_ATTR_LEAF_HDR, "attr_leaf_hdr", NULL, (char *)attr_leaf_hdr_flds,
SI(bitsz(struct xfs_attr_leaf_hdr)), 0, NULL, attr_leaf_hdr_flds },
{ FLDT_ATTR_LEAF_MAP, "attr_leaf_map", fp_sarray,
(char *)attr_leaf_map_flds, SI(bitsz(struct xfs_attr_leaf_map)), 0,
NULL, attr_leaf_map_flds },
{ FLDT_ATTR_LEAF_NAME, "attr_leaf_name", NULL,
(char *)attr_leaf_name_flds, attr_leaf_name_size, FTARG_SIZE, NULL,
attr_leaf_name_flds },
{ FLDT_ATTR_NODE_ENTRY, "attr_node_entry", fp_sarray,
(char *)attr_node_entry_flds, SI(bitsz(struct xfs_da_node_entry)), 0,
NULL, attr_node_entry_flds },
{ FLDT_ATTR_NODE_HDR, "attr_node_hdr", NULL, (char *)attr_node_hdr_flds,
SI(bitsz(struct xfs_da_node_hdr)), 0, NULL, attr_node_hdr_flds },
{ FLDT_ATTR_SF_ENTRY, "attr_sf_entry", NULL, (char *)attr_sf_entry_flds,
attr_sf_entry_size, FTARG_SIZE, NULL, attr_sf_entry_flds },
{ FLDT_ATTR_SF_HDR, "attr_sf_hdr", NULL, (char *)attr_sf_hdr_flds,
SI(bitsz(struct xfs_attr_sf_hdr)), 0, NULL, attr_sf_hdr_flds },
{ FLDT_ATTRBLOCK, "attrblock", fp_num, "%u", SI(bitsz(__uint32_t)), 0,
fa_attrblock, NULL },
{ FLDT_ATTRSHORT, "attrshort", NULL, (char *)attr_shortform_flds,
attrshort_size, FTARG_SIZE, NULL, attr_shortform_flds },
/* attr3 specific fields */
{ FLDT_ATTR3, "attr3", NULL, (char *)attr3_flds, attr_size, FTARG_SIZE,
NULL, attr3_flds },
{ FLDT_ATTR3_LEAF_HDR, "attr3_leaf_hdr", NULL,
(char *)attr3_leaf_hdr_flds, SI(bitsz(struct xfs_attr3_leaf_hdr)),
0, NULL, attr3_leaf_hdr_flds },
{ FLDT_ATTR3_NODE_HDR, "attr3_node_hdr", NULL,
(char *)da3_node_hdr_flds, SI(bitsz(struct xfs_da3_node_hdr)),
0, NULL, da3_node_hdr_flds },
{ FLDT_BMAPBTA, "bmapbta", NULL, (char *)bmapbta_flds, btblock_size,
FTARG_SIZE, NULL, bmapbta_flds },
{ FLDT_BMAPBTA_CRC, "bmapbta", NULL, (char *)bmapbta_crc_flds,
btblock_size, FTARG_SIZE, NULL, bmapbta_crc_flds },
{ FLDT_BMAPBTAKEY, "bmapbtakey", fp_sarray, (char *)bmapbta_key_flds,
SI(bitsz(xfs_bmbt_key_t)), 0, NULL, bmapbta_key_flds },
{ FLDT_BMAPBTAPTR, "bmapbtaptr", fp_num, "%llu",
SI(bitsz(xfs_bmbt_ptr_t)), 0, fa_dfsbno, NULL },
{ FLDT_BMAPBTAREC, "bmapbtarec", fp_sarray, (char *)bmapbta_rec_flds,
SI(bitsz(xfs_bmbt_rec_t)), 0, NULL, bmapbta_rec_flds },
{ FLDT_BMAPBTD, "bmapbtd", NULL, (char *)bmapbtd_flds, btblock_size,
FTARG_SIZE, NULL, bmapbtd_flds },
{ FLDT_BMAPBTD_CRC, "bmapbtd", NULL, (char *)bmapbtd_crc_flds,
btblock_size, FTARG_SIZE, NULL, bmapbtd_crc_flds },
{ FLDT_BMAPBTDKEY, "bmapbtdkey", fp_sarray, (char *)bmapbtd_key_flds,
SI(bitsz(xfs_bmbt_key_t)), 0, NULL, bmapbtd_key_flds },
{ FLDT_BMAPBTDPTR, "bmapbtdptr", fp_num, "%llu",
SI(bitsz(xfs_bmbt_ptr_t)), 0, fa_dfsbno, NULL },
{ FLDT_BMAPBTDREC, "bmapbtdrec", fp_sarray, (char *)bmapbtd_rec_flds,
SI(bitsz(xfs_bmbt_rec_t)), 0, NULL, bmapbtd_rec_flds },
{ FLDT_BMROOTA, "bmroota", NULL, (char *)bmroota_flds, bmroota_size,
FTARG_SIZE, NULL, bmroota_flds },
{ FLDT_BMROOTAKEY, "bmrootakey", fp_sarray, (char *)bmroota_key_flds,
SI(bitsz(xfs_bmdr_key_t)), 0, NULL, bmroota_key_flds },
{ FLDT_BMROOTAPTR, "bmrootaptr", fp_num, "%llu",
SI(bitsz(xfs_bmdr_ptr_t)), 0, fa_dfsbno, NULL },
{ FLDT_BMROOTD, "bmrootd", NULL, (char *)bmrootd_flds, bmrootd_size,
FTARG_SIZE, NULL, bmrootd_flds },
{ FLDT_BMROOTDKEY, "bmrootdkey", fp_sarray, (char *)bmrootd_key_flds,
SI(bitsz(xfs_bmdr_key_t)), 0, NULL, bmrootd_key_flds },
{ FLDT_BMROOTDPTR, "bmrootdptr", fp_num, "%llu",
SI(bitsz(xfs_bmdr_ptr_t)), 0, fa_dfsbno, NULL },
{ FLDT_BNOBT, "bnobt", NULL, (char *)bnobt_flds, btblock_size, FTARG_SIZE,
NULL, bnobt_flds },
{ FLDT_BNOBT_CRC, "bnobt", NULL, (char *)bnobt_crc_flds, btblock_size,
FTARG_SIZE, NULL, bnobt_crc_flds },
{ FLDT_BNOBTKEY, "bnobtkey", fp_sarray, (char *)bnobt_key_flds,
SI(bitsz(xfs_alloc_key_t)), 0, NULL, bnobt_key_flds },
{ FLDT_BNOBTPTR, "bnobtptr", fp_num, "%u", SI(bitsz(xfs_alloc_ptr_t)),
0, fa_agblock, NULL },
{ FLDT_BNOBTREC, "bnobtrec", fp_sarray, (char *)bnobt_rec_flds,
SI(bitsz(xfs_alloc_rec_t)), 0, NULL, bnobt_rec_flds },
{ FLDT_CEXTFLG, "cextflag", fp_num, "%u", SI(BMBT_EXNTFLAG_BITLEN), 0,
NULL, NULL },
{ FLDT_CEXTLEN, "cextlen", fp_num, "%u", SI(BMBT_BLOCKCOUNT_BITLEN), 0,
NULL, NULL },
{ FLDT_CFILEOFFA, "cfileoffa", fp_num, "%llu", SI(BMBT_STARTOFF_BITLEN),
0, fa_cfileoffa, NULL },
{ FLDT_CFILEOFFD, "cfileoffd", fp_num, "%llu", SI(BMBT_STARTOFF_BITLEN),
0, fa_cfileoffd, NULL },
{ FLDT_CFSBLOCK, "cfsblock", fp_num, "%llu", SI(BMBT_STARTBLOCK_BITLEN),
0, fa_cfsblock, NULL },
{ FLDT_CHARNS, "charns", fp_charns, NULL, SI(bitsz(char)), 0, NULL,
NULL },
{ FLDT_CHARS, "chars", fp_num, "%c", SI(bitsz(char)), 0, NULL, NULL },
{ FLDT_CNTBT, "cntbt", NULL, (char *)cntbt_flds, btblock_size, FTARG_SIZE,
NULL, cntbt_flds },
{ FLDT_CNTBT_CRC, "cntbt", NULL, (char *)cntbt_crc_flds, btblock_size,
FTARG_SIZE, NULL, cntbt_crc_flds },
{ FLDT_CNTBTKEY, "cntbtkey", fp_sarray, (char *)cntbt_key_flds,
SI(bitsz(xfs_alloc_key_t)), 0, NULL, cntbt_key_flds },
{ FLDT_CNTBTPTR, "cntbtptr", fp_num, "%u", SI(bitsz(xfs_alloc_ptr_t)),
0, fa_agblock, NULL },
{ FLDT_CNTBTREC, "cntbtrec", fp_sarray, (char *)cntbt_rec_flds,
SI(bitsz(xfs_alloc_rec_t)), 0, NULL, cntbt_rec_flds },
/* CRC field */
{ FLDT_CRC, "crc", fp_crc, "%#x (%s)", SI(bitsz(__uint32_t)),
0, NULL, NULL },
{ FLDT_DEV, "dev", fp_num, "%#x", SI(bitsz(xfs_dev_t)), 0, NULL, NULL },
{ FLDT_DFILOFFA, "dfiloffa", fp_num, "%llu", SI(bitsz(xfs_fileoff_t)),
0, fa_dfiloffa, NULL },
{ FLDT_DFILOFFD, "dfiloffd", fp_num, "%llu", SI(bitsz(xfs_fileoff_t)),
0, fa_dfiloffd, NULL },
{ FLDT_DFSBNO, "dfsbno", fp_num, "%llu", SI(bitsz(xfs_fsblock_t)),
FTARG_DONULL, fa_dfsbno, NULL },
{ FLDT_DINODE_A, "dinode_a", NULL, (char *)inode_a_flds, inode_a_size,
FTARG_SIZE|FTARG_OKEMPTY, NULL, inode_a_flds },
{ FLDT_DINODE_CORE, "dinode_core", NULL, (char *)inode_core_flds,
SI(bitsz(xfs_dinode_t)), 0, NULL, inode_core_flds },
{ FLDT_DINODE_FMT, "dinode_fmt", fp_dinode_fmt, NULL,
SI(bitsz(__int8_t)), 0, NULL, NULL },
{ FLDT_DINODE_U, "dinode_u", NULL, (char *)inode_u_flds, inode_u_size,
FTARG_SIZE|FTARG_OKEMPTY, NULL, inode_u_flds },
{ FLDT_DINODE_V3, "dinode_v3", NULL, (char *)inode_v3_flds,
SI(bitsz(xfs_dinode_t)), 0, NULL, inode_v3_flds },
/* dir v2 fields */
{ FLDT_DIR2, "dir2", NULL, (char *)dir2_flds, dir2_size, FTARG_SIZE,
NULL, dir2_flds },
{ FLDT_DIR2_BLOCK_TAIL, "dir2_block_tail", NULL,
(char *)dir2_block_tail_flds, SI(bitsz(xfs_dir2_block_tail_t)), 0,
NULL, dir2_block_tail_flds },
{ FLDT_DIR2_DATA_FREE, "dir2_data_free", NULL,
(char *)dir2_data_free_flds, SI(bitsz(xfs_dir2_data_free_t)), 0, NULL,
dir2_data_free_flds },
{ FLDT_DIR2_DATA_HDR, "dir2_data_hdr", NULL, (char *)dir2_data_hdr_flds,
SI(bitsz(xfs_dir2_data_hdr_t)), 0, NULL, dir2_data_hdr_flds },
{ FLDT_DIR2_DATA_OFF, "dir2_data_off", fp_num, "%#x",
SI(bitsz(xfs_dir2_data_off_t)), 0, NULL, NULL },
{ FLDT_DIR2_DATA_OFFNZ, "dir2_data_offnz", fp_num, "%#x",
SI(bitsz(xfs_dir2_data_off_t)), FTARG_SKIPZERO, NULL, NULL },
{ FLDT_DIR2_DATA_UNION, "dir2_data_union", NULL,
(char *)dir2_data_union_flds, dir2_data_union_size, FTARG_SIZE, NULL,
dir2_data_union_flds },
{ FLDT_DIR2_FREE_HDR, "dir2_free_hdr", NULL, (char *)dir2_free_hdr_flds,
SI(bitsz(xfs_dir2_free_hdr_t)), 0, NULL, dir2_free_hdr_flds },
{ FLDT_DIR2_INO4, "dir2_ino4", fp_num, "%u", SI(bitsz(xfs_dir2_ino4_t)),
0, fa_ino4, NULL },
{ FLDT_DIR2_INO8, "dir2_ino8", fp_num, "%llu",
SI(bitsz(xfs_dir2_ino8_t)), 0, fa_ino8, NULL },
{ FLDT_DIR2_INOU, "dir2_inou", NULL, (char *)dir2_inou_flds,
dir2_inou_size, FTARG_SIZE, NULL, dir2_inou_flds },
{ FLDT_DIR2_LEAF_ENTRY, "dir2_leaf_entry", NULL,
(char *)dir2_leaf_entry_flds, SI(bitsz(xfs_dir2_leaf_entry_t)), 0,
NULL, dir2_leaf_entry_flds },
{ FLDT_DIR2_LEAF_HDR, "dir2_leaf_hdr", NULL, (char *)dir2_leaf_hdr_flds,
SI(bitsz(xfs_dir2_leaf_hdr_t)), 0, NULL, dir2_leaf_hdr_flds },
{ FLDT_DIR2_LEAF_TAIL, "dir2_leaf_tail", NULL,
(char *)dir2_leaf_tail_flds, SI(bitsz(xfs_dir2_leaf_tail_t)), 0, NULL,
dir2_leaf_tail_flds },
{ FLDT_DIR2_SF_ENTRY, "dir2_sf_entry", NULL, (char *)dir2_sf_entry_flds,
dir2_sf_entry_size, FTARG_SIZE, NULL, dir2_sf_entry_flds },
{ FLDT_DIR2_SF_HDR, "dir2_sf_hdr", NULL, (char *)dir2_sf_hdr_flds,
dir2_sf_hdr_size, FTARG_SIZE, NULL, dir2_sf_hdr_flds },
{ FLDT_DIR2_SF_OFF, "dir2_sf_off", fp_num, "%#x",
SI(bitsz(xfs_dir2_sf_off_t)), 0, NULL, NULL },
{ FLDT_DIR2SF, "dir2sf", NULL, (char *)dir2sf_flds, dir2sf_size,
FTARG_SIZE, NULL, dir2sf_flds },
/* dir v3 fields */
{ FLDT_DIR3, "dir3", NULL, (char *)dir3_flds, dir2_size, FTARG_SIZE,
NULL, dir3_flds },
{ FLDT_DIR3_BLKHDR, "dir3_blk_hdr", NULL, (char *)dir3_blkhdr_flds,
SI(bitsz(struct xfs_dir3_blk_hdr)), 0, NULL, dir3_blkhdr_flds },
{ FLDT_DIR3_DATA_HDR, "dir3_data_hdr", NULL, (char *)dir3_data_hdr_flds,
SI(bitsz(struct xfs_dir3_data_hdr)), 0, NULL, dir3_data_hdr_flds },
{ FLDT_DIR3_FREE_HDR, "dir3_free_hdr", NULL, (char *)dir3_free_hdr_flds,
SI(bitsz(struct xfs_dir3_free_hdr)), 0, NULL, dir3_free_hdr_flds },
{ FLDT_DIR3_LEAF_HDR, "dir3_leaf_hdr", NULL, (char *)dir3_leaf_hdr_flds,
SI(bitsz(struct xfs_dir3_leaf_hdr)), 0, NULL, dir3_leaf_hdr_flds },
{ FLDT_DIR3_DATA_UNION, "dir3_data_union", NULL,
(char *)dir3_data_union_flds, dir2_data_union_size, FTARG_SIZE, NULL,
dir3_data_union_flds },
{ FLDT_DIR3_SF_ENTRY, "dir3_sf_entry", NULL, (char *)dir3_sf_entry_flds,
dir2_sf_entry_size, FTARG_SIZE, NULL, dir3_sf_entry_flds },
{ FLDT_DIR3SF, "dir3sf", NULL, (char *)dir3sf_flds, dir2sf_size,
FTARG_SIZE, NULL, dir3sf_flds },
/* dir v2/3 node fields */
{ FLDT_DA_BLKINFO, "dir_blkinfo", NULL, (char *)da_blkinfo_flds,
SI(bitsz(struct xfs_da_blkinfo)), 0, NULL, da_blkinfo_flds },
{ FLDT_DA_NODE_ENTRY, "dir_node_entry", fp_sarray,
(char *)da_node_entry_flds, SI(bitsz(struct xfs_da_node_entry)), 0,
NULL, da_node_entry_flds },
{ FLDT_DA_NODE_HDR, "dir_node_hdr", NULL, (char *)da_node_hdr_flds,
SI(bitsz(struct xfs_da_node_hdr)), 0, NULL, da_node_hdr_flds },
{ FLDT_DA3_BLKINFO, "dir_blkinfo", NULL, (char *)da3_blkinfo_flds,
SI(bitsz(struct xfs_da3_blkinfo)), 0, NULL, da3_blkinfo_flds },
{ FLDT_DA3_NODE_HDR, "dir_node_hdr", NULL, (char *)da3_node_hdr_flds,
SI(bitsz(struct xfs_da3_node_hdr)), 0, NULL, da3_node_hdr_flds },
{ FLDT_DIRBLOCK, "dirblock", fp_num, "%u", SI(bitsz(__uint32_t)), 0,
fa_dirblock, NULL },
{ FLDT_DISK_DQUOT, "disk_dquot", NULL, (char *)disk_dquot_flds,
SI(bitsz(xfs_disk_dquot_t)), 0, NULL, disk_dquot_flds },
{ FLDT_DQBLK, "dqblk", NULL, (char *)dqblk_flds, SI(bitsz(xfs_dqblk_t)),
0, NULL, dqblk_flds },
{ FLDT_DQID, "dqid", fp_num, "%d", SI(bitsz(xfs_dqid_t)), 0, NULL,
NULL },
{ FLDT_DRFSBNO, "drfsbno", fp_num, "%llu", SI(bitsz(xfs_rfsblock_t)),
FTARG_DONULL, fa_drfsbno, NULL },
{ FLDT_DRTBNO, "drtbno", fp_num, "%llu", SI(bitsz(xfs_rtblock_t)),
FTARG_DONULL, fa_drtbno, NULL },
{ FLDT_EXTLEN, "extlen", fp_num, "%u", SI(bitsz(xfs_extlen_t)), 0, NULL,
NULL },
{ FLDT_EXTNUM, "extnum", fp_num, "%d", SI(bitsz(xfs_extnum_t)),
FTARG_SIGNED, NULL, NULL },
{ FLDT_FSIZE, "fsize", fp_num, "%lld", SI(bitsz(xfs_fsize_t)),
FTARG_SIGNED, NULL, NULL },
{ FLDT_INO, "ino", fp_num, "%llu", SI(bitsz(xfs_ino_t)), FTARG_DONULL,
fa_ino, NULL },
{ FLDT_INOBT, "inobt", NULL, (char *)inobt_flds, btblock_size,
FTARG_SIZE, NULL, inobt_flds },
{ FLDT_INOBT_CRC, "inobt", NULL, (char *)inobt_crc_flds, btblock_size,
FTARG_SIZE, NULL, inobt_crc_flds },
{ FLDT_INOBT_SPCRC, "inobt", NULL, (char *)inobt_spcrc_flds,
btblock_size, FTARG_SIZE, NULL, inobt_spcrc_flds },
{ FLDT_INOBTKEY, "inobtkey", fp_sarray, (char *)inobt_key_flds,
SI(bitsz(xfs_inobt_key_t)), 0, NULL, inobt_key_flds },
{ FLDT_INOBTPTR, "inobtptr", fp_num, "%u", SI(bitsz(xfs_inobt_ptr_t)),
0, fa_agblock, NULL },
{ FLDT_INOBTREC, "inobtrec", fp_sarray, (char *)inobt_rec_flds,
SI(bitsz(xfs_inobt_rec_t)), 0, NULL, inobt_rec_flds },
{ FLDT_INOBTSPREC, "inobtsprec", fp_sarray, (char *) inobt_sprec_flds,
SI(bitsz(xfs_inobt_rec_t)), 0, NULL, inobt_sprec_flds },
{ FLDT_INODE, "inode", NULL, (char *)inode_flds, inode_size, FTARG_SIZE,
NULL, inode_flds },
{ FLDT_INODE_CRC, "inode", NULL, (char *)inode_crc_flds, inode_size,
FTARG_SIZE, NULL, inode_crc_flds },
{ FLDT_INOFREE, "inofree", fp_num, "%#llx", SI(bitsz(xfs_inofree_t)), 0,
NULL, NULL },
{ FLDT_INT16D, "int16d", fp_num, "%d", SI(bitsz(__int16_t)),
FTARG_SIGNED, NULL, NULL },
{ FLDT_INT32D, "int32d", fp_num, "%d", SI(bitsz(__int32_t)),
FTARG_SIGNED, NULL, NULL },
{ FLDT_INT64D, "int64d", fp_num, "%lld", SI(bitsz(__int64_t)),
FTARG_SIGNED, NULL, NULL },
{ FLDT_INT8D, "int8d", fp_num, "%d", SI(bitsz(__int8_t)), FTARG_SIGNED,
NULL, NULL },
{ FLDT_NSEC, "nsec", fp_num, "%09d", SI(bitsz(__int32_t)), FTARG_SIGNED,
NULL, NULL },
{ FLDT_QCNT, "qcnt", fp_num, "%llu", SI(bitsz(xfs_qcnt_t)), 0, NULL,
NULL },
{ FLDT_QWARNCNT, "qwarncnt", fp_num, "%u", SI(bitsz(xfs_qwarncnt_t)), 0,
NULL, NULL },
{ FLDT_SB, "sb", NULL, (char *)sb_flds, sb_size, FTARG_SIZE, NULL,
sb_flds },
/* CRC enabled symlink */
{ FLDT_SYMLINK_CRC, "symlink", NULL, (char *)symlink_crc_flds,
symlink_size, FTARG_SIZE, NULL, symlink_crc_flds },
{ FLDT_TIME, "time", fp_time, NULL, SI(bitsz(__int32_t)), FTARG_SIGNED,
NULL, NULL },
{ FLDT_TIMESTAMP, "timestamp", NULL, (char *)timestamp_flds,
SI(bitsz(xfs_timestamp_t)), 0, NULL, timestamp_flds },
{ FLDT_UINT1, "uint1", fp_num, "%u", SI(1), 0, NULL, NULL },
{ FLDT_UINT16D, "uint16d", fp_num, "%u", SI(bitsz(__uint16_t)), 0, NULL,
NULL },
{ FLDT_UINT16O, "uint16o", fp_num, "%#o", SI(bitsz(__uint16_t)), 0,
NULL, NULL },
{ FLDT_UINT16X, "uint16x", fp_num, "%#x", SI(bitsz(__uint16_t)), 0,
NULL, NULL },
{ FLDT_UINT32D, "uint32d", fp_num, "%u", SI(bitsz(__uint32_t)), 0, NULL,
NULL },
{ FLDT_UINT32O, "uint32o", fp_num, "%#o", SI(bitsz(__uint32_t)), 0,
NULL, NULL },
{ FLDT_UINT32X, "uint32x", fp_num, "%#x", SI(bitsz(__uint32_t)), 0,
NULL, NULL },
{ FLDT_UINT64D, "uint64d", fp_num, "%llu", SI(bitsz(__uint64_t)), 0,
NULL, NULL },
{ FLDT_UINT64O, "uint64o", fp_num, "%#llo", SI(bitsz(__uint64_t)), 0,
NULL, NULL },
{ FLDT_UINT64X, "uint64x", fp_num, "%#llx", SI(bitsz(__uint64_t)), 0,
NULL, NULL },
{ FLDT_UINT8D, "uint8d", fp_num, "%u", SI(bitsz(__uint8_t)), 0, NULL,
NULL },
{ FLDT_UINT8O, "uint8o", fp_num, "%#o", SI(bitsz(__uint8_t)), 0, NULL,
NULL },
{ FLDT_UINT8X, "uint8x", fp_num, "%#x", SI(bitsz(__uint8_t)), 0, NULL,
NULL },
{ FLDT_UUID, "uuid", fp_uuid, NULL, SI(bitsz(uuid_t)), 0, NULL, NULL },
{ FLDT_ZZZ, NULL }
};
int
bitoffset(
const field_t *f,
void *obj,
int startoff,
int idx)
{
if (!(f->flags & FLD_OFFSET)) {
if (f->flags & FLD_ARRAY) {
int abase;
#ifdef DEBUG
const ftattr_t *fa = &ftattrtab[f->ftyp];
#endif
abase = (f->flags & FLD_ABASE1) != 0;
ASSERT(fa->ftyp == f->ftyp);
ASSERT((fa->arg & FTARG_SIZE) == 0);
return (int)(intptr_t)f->offset +
(idx - abase) * fsize(f, obj, startoff, idx);
} else
return (int)(intptr_t)f->offset;
} else
return (*f->offset)(obj, startoff, idx);
}
int
fcount(
const field_t *f,
void *obj,
int startoff)
{
if (!(f->flags & FLD_COUNT))
return (int)(intptr_t)f->count;
else
return (*f->count)(obj, startoff);
}
const field_t *
findfield(
char *name,
const field_t *fields,
void *obj,
int startoff)
{
const field_t *f;
/* we only match if this field name matches and has a non-zero count */
for (f = fields; f->name; f++)
if (strcmp(f->name, name) == 0 && fcount(f, obj, startoff))
return f;
return NULL;
}
int
fsize(
const field_t *f,
void *obj,
int startoff,
int idx)
{
const ftattr_t *fa;
fa = &ftattrtab[f->ftyp];
ASSERT(fa->ftyp == f->ftyp);
if (!(fa->arg & FTARG_SIZE))
return (int)(intptr_t)fa->size;
else
return (*fa->size)(obj, startoff, idx);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/field.h 0000664 0000000 0000000 00000011703 12574431650 014452 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
typedef enum fldt {
FLDT_AEXTNUM,
FLDT_AGBLOCK,
FLDT_AGBLOCKNZ,
FLDT_AGF,
FLDT_AGFL,
FLDT_AGFL_CRC,
FLDT_AGI,
FLDT_AGINO,
FLDT_AGINONN,
FLDT_AGNUMBER,
/* attr fields */
FLDT_ATTR,
FLDT_ATTR_BLKINFO,
FLDT_ATTR_LEAF_ENTRY,
FLDT_ATTR_LEAF_HDR,
FLDT_ATTR_LEAF_MAP,
FLDT_ATTR_LEAF_NAME,
FLDT_ATTR_NODE_ENTRY,
FLDT_ATTR_NODE_HDR,
FLDT_ATTR_SF_ENTRY,
FLDT_ATTR_SF_HDR,
FLDT_ATTRBLOCK,
FLDT_ATTRSHORT,
/* attr 3 specific fields */
FLDT_ATTR3,
FLDT_ATTR3_LEAF_HDR,
FLDT_ATTR3_NODE_HDR,
FLDT_BMAPBTA,
FLDT_BMAPBTA_CRC,
FLDT_BMAPBTAKEY,
FLDT_BMAPBTAPTR,
FLDT_BMAPBTAREC,
FLDT_BMAPBTD,
FLDT_BMAPBTD_CRC,
FLDT_BMAPBTDKEY,
FLDT_BMAPBTDPTR,
FLDT_BMAPBTDREC,
FLDT_BMROOTA,
FLDT_BMROOTAKEY,
FLDT_BMROOTAPTR,
FLDT_BMROOTD,
FLDT_BMROOTDKEY,
FLDT_BMROOTDPTR,
FLDT_BNOBT,
FLDT_BNOBT_CRC,
FLDT_BNOBTKEY,
FLDT_BNOBTPTR,
FLDT_BNOBTREC,
FLDT_CEXTFLG,
FLDT_CEXTLEN,
FLDT_CFILEOFFA,
FLDT_CFILEOFFD,
FLDT_CFSBLOCK,
FLDT_CHARNS,
FLDT_CHARS,
FLDT_CNTBT,
FLDT_CNTBT_CRC,
FLDT_CNTBTKEY,
FLDT_CNTBTPTR,
FLDT_CNTBTREC,
/* CRC field type */
FLDT_CRC,
FLDT_DEV,
FLDT_DFILOFFA,
FLDT_DFILOFFD,
FLDT_DFSBNO,
FLDT_DINODE_A,
FLDT_DINODE_CORE,
FLDT_DINODE_FMT,
FLDT_DINODE_U,
FLDT_DINODE_V3,
/* dir v2 fields */
FLDT_DIR2,
FLDT_DIR2_BLOCK_TAIL,
FLDT_DIR2_DATA_FREE,
FLDT_DIR2_DATA_HDR,
FLDT_DIR2_DATA_OFF,
FLDT_DIR2_DATA_OFFNZ,
FLDT_DIR2_DATA_UNION,
FLDT_DIR2_FREE_HDR,
FLDT_DIR2_INO4,
FLDT_DIR2_INO8,
FLDT_DIR2_INOU,
FLDT_DIR2_LEAF_ENTRY,
FLDT_DIR2_LEAF_HDR,
FLDT_DIR2_LEAF_TAIL,
FLDT_DIR2_SF_ENTRY,
FLDT_DIR2_SF_HDR,
FLDT_DIR2_SF_OFF,
FLDT_DIR2SF,
/* dir v3 fields */
FLDT_DIR3,
FLDT_DIR3_BLKHDR,
FLDT_DIR3_DATA_HDR,
FLDT_DIR3_FREE_HDR,
FLDT_DIR3_LEAF_HDR,
FLDT_DIR3_DATA_UNION,
FLDT_DIR3_SF_ENTRY,
FLDT_DIR3SF,
/* dir v2/3 node fields */
FLDT_DA_BLKINFO,
FLDT_DA_NODE_ENTRY,
FLDT_DA_NODE_HDR,
FLDT_DA3_BLKINFO,
FLDT_DA3_NODE_HDR,
FLDT_DIRBLOCK,
FLDT_DISK_DQUOT,
FLDT_DQBLK,
FLDT_DQID,
FLDT_DRFSBNO,
FLDT_DRTBNO,
FLDT_EXTLEN,
FLDT_EXTNUM,
FLDT_FSIZE,
FLDT_INO,
FLDT_INOBT,
FLDT_INOBT_CRC,
FLDT_INOBT_SPCRC,
FLDT_INOBTKEY,
FLDT_INOBTPTR,
FLDT_INOBTREC,
FLDT_INOBTSPREC,
FLDT_INODE,
FLDT_INODE_CRC,
FLDT_INOFREE,
FLDT_INT16D,
FLDT_INT32D,
FLDT_INT64D,
FLDT_INT8D,
FLDT_NSEC,
FLDT_QCNT,
FLDT_QWARNCNT,
FLDT_SB,
/* CRC enabled symlink */
FLDT_SYMLINK_CRC,
FLDT_TIME,
FLDT_TIMESTAMP,
FLDT_UINT1,
FLDT_UINT16D,
FLDT_UINT16O,
FLDT_UINT16X,
FLDT_UINT32D,
FLDT_UINT32O,
FLDT_UINT32X,
FLDT_UINT64D,
FLDT_UINT64O,
FLDT_UINT64X,
FLDT_UINT8D,
FLDT_UINT8O,
FLDT_UINT8X,
FLDT_UUID,
FLDT_ZZZ /* mark last entry */
} fldt_t;
typedef int (*offset_fnc_t)(void *obj, int startoff, int idx);
#define OI(o) ((offset_fnc_t)(intptr_t)(o))
typedef int (*count_fnc_t)(void *obj, int startoff);
#define CI(c) ((count_fnc_t)(intptr_t)(c))
#define C1 CI(1)
typedef struct field
{
char *name;
fldt_t ftyp;
offset_fnc_t offset;
count_fnc_t count;
int flags;
typnm_t next;
} field_t;
/*
* flag values
*/
#define FLD_ABASE1 1 /* field array base is 1 not 0 */
#define FLD_SKIPALL 2 /* skip this field in an all-fields print */
#define FLD_ARRAY 4 /* this field is an array */
#define FLD_OFFSET 8 /* offset value is a function pointer */
#define FLD_COUNT 16 /* count value is a function pointer */
typedef int (*size_fnc_t)(void *obj, int startoff, int idx);
#define SI(s) ((size_fnc_t)(intptr_t)(s))
typedef struct ftattr
{
fldt_t ftyp;
char *name;
prfnc_t prfunc;
char *fmtstr;
size_fnc_t size;
int arg;
adfnc_t adfunc;
const field_t *subfld;
} ftattr_t;
extern const ftattr_t ftattrtab[];
/*
* arg values
*/
#define FTARG_SKIPZERO 1 /* skip 0 words */
#define FTARG_DONULL 2 /* make -1 words be "null" */
#define FTARG_SKIPNULL 4 /* skip -1 words */
#define FTARG_SIGNED 8 /* field value is signed */
#define FTARG_SIZE 16 /* size field is a function */
#define FTARG_SKIPNMS 32 /* skip printing names this time */
#define FTARG_OKEMPTY 64 /* ok if this (union type) is empty */
extern int bitoffset(const field_t *f, void *obj, int startoff,
int idx);
extern int fcount(const field_t *f, void *obj, int startoff);
extern const field_t *findfield(char *name, const field_t *fields,
void *obj, int startoff);
extern int fsize(const field_t *f, void *obj, int startoff,
int idx);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/flist.c 0000664 0000000 0000000 00000021422 12574431650 014502 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "flist.h"
#include "debug.h"
#include "output.h"
#include "malloc.h"
static void flist_expand_arrays(flist_t *fl);
static void flist_expand_structs(flist_t *fl, void *obj);
static flist_t *flist_replicate(flist_t *fl);
static ftok_t *flist_split(char *s);
static void ftok_free(ftok_t *ft);
static void
flist_expand_arrays(
flist_t *fl)
{
const field_t *f;
#ifdef DEBUG
const ftattr_t *fa;
#endif
int high;
int idx;
int low;
flist_t *new;
flist_t *prev;
flist_t *sib;
f = fl->fld;
#ifdef DEBUG
fa = &ftattrtab[f->ftyp];
#endif
ASSERT(fa->ftyp == f->ftyp);
ASSERT(f->flags & FLD_ARRAY);
low = fl->low;
high = fl->high;
fl->high = fl->low;
sib = fl->sibling;
for (idx = low + 1, prev = fl; idx <= high; idx++) {
new = flist_make(f->name);
new->fld = f;
new->low = new->high = idx;
new->flags |= FL_OKLOW | FL_OKHIGH;
new->child = flist_replicate(fl->child);
prev->sibling = new;
prev = new;
}
prev->sibling = sib;
}
static void
flist_expand_structs(
flist_t *fl,
void *obj)
{
const field_t *cf;
const field_t *f;
const ftattr_t *fa;
flist_t *new;
flist_t *prev;
f = fl->fld;
fa = &ftattrtab[f->ftyp];
ASSERT(fa->ftyp == f->ftyp);
ASSERT(fa->subfld != NULL);
ASSERT(fl->child == NULL);
for (cf = fa->subfld, prev = NULL; cf->name != NULL; cf++) {
if (fcount(cf, obj, fl->offset) == 0)
continue;
if (cf->flags & FLD_SKIPALL)
continue;
new = flist_make(cf->name);
new->fld = cf;
if (prev)
prev->sibling = new;
else
fl->child = new;
prev = new;
}
}
void
flist_free(
flist_t *fl)
{
if (fl->child)
flist_free(fl->child);
if (fl->sibling)
flist_free(fl->sibling);
if (fl->name)
xfree(fl->name);
xfree(fl);
}
flist_t *
flist_make(
char *name)
{
flist_t *fl;
fl = xmalloc(sizeof(*fl));
fl->name = xstrdup(name);
fl->fld = NULL;
fl->child = NULL;
fl->sibling = NULL;
fl->low = 0;
fl->high = 0;
fl->flags = 0;
fl->offset = 0;
return fl;
}
int
flist_parse(
const field_t *fields,
flist_t *fl,
void *obj,
int startoff)
{
const field_t *f;
const ftattr_t *fa;
int high;
int low;
while (fl) {
f = findfield(fl->name, fields, obj, startoff);
if (f == NULL) {
dbprintf(_("field %s not found\n"), fl->name);
return 0;
}
fl->fld = f;
fa = &ftattrtab[f->ftyp];
ASSERT(fa->ftyp == f->ftyp);
if (f->flags & FLD_ARRAY) {
low = (f->flags & FLD_ABASE1) != 0;
high = fcount(f, obj, startoff) + low - 1;
if (low > high) {
dbprintf(_("no elements in %s\n"), fl->name);
return 0;
}
if (fl->flags & FL_OKHIGH) {
if (fl->low < low || fl->low > high ||
fl->high < low || fl->high > high) {
dbprintf(_("indices %d-%d for field %s "
"out of range %d-%d\n"),
fl->low, fl->high, fl->name,
low, high);
return 0;
}
} else if (fl->flags & FL_OKLOW) {
if (fl->low < low || fl->low > high) {
dbprintf(_("index %d for field %s out of "
"range %d-%d\n"),
fl->low, fl->name, low, high);
return 0;
}
fl->high = fl->low;
fl->flags |= FL_OKHIGH;
} else {
fl->low = low;
fl->high = high;
fl->flags |= FL_OKLOW | FL_OKHIGH;
}
} else {
if (fl->flags & FL_OKLOW) {
dbprintf(_("field %s is not an array\n"),
fl->name);
return 0;
}
}
fl->offset = startoff + bitoffset(f, obj, startoff, fl->low);
if ((fl->child != NULL || fa->prfunc == NULL) &&
(f->flags & FLD_ARRAY) && fl->low != fl->high)
flist_expand_arrays(fl);
if (fa->prfunc == NULL && fl->child == NULL)
flist_expand_structs(fl, obj);
if (fl->child) {
if (fa->subfld == NULL) {
dbprintf(_("field %s has no subfields\n"),
fl->name);
return 0;
}
if (!flist_parse(fa->subfld, fl->child, obj,
fl->offset))
return 0;
}
fl = fl->sibling;
}
return 1;
}
void
flist_print(
flist_t *fl)
{
if (!(debug_state & DEBUG_FLIST))
return;
while (fl) {
dbprintf(_("fl@%p:\n"), fl);
dbprintf(_("\tname=%s, fld=%p, child=%p, sibling=%p\n"),
fl->name, fl->fld, fl->child, fl->sibling);
dbprintf(_("\tlow=%d, high=%d, flags=%d (%s%s), offset=%d\n"),
fl->low, fl->high, fl->flags,
fl->flags & FL_OKLOW ? _("oklow ") : "",
fl->flags & FL_OKHIGH ? _("okhigh") : "", fl->offset);
dbprintf(_("\tfld->name=%s, fld->ftyp=%d (%s)\n"),
fl->fld->name, fl->fld->ftyp,
ftattrtab[fl->fld->ftyp].name);
dbprintf(_("\tfld->flags=%d (%s%s%s%s%s)\n"), fl->fld->flags,
fl->fld->flags & FLD_ABASE1 ? "abase1 " : "",
fl->fld->flags & FLD_SKIPALL ? "skipall " : "",
fl->fld->flags & FLD_ARRAY ? "array " : "",
fl->fld->flags & FLD_OFFSET ? "offset " : "",
fl->fld->flags & FLD_COUNT ? "count " : "");
if (fl->child)
flist_print(fl->child);
fl = fl->sibling;
}
}
static flist_t *
flist_replicate(
flist_t *f)
{
flist_t *new;
if (f == NULL)
return NULL;
new = flist_make(f->name);
new->fld = f->fld;
new->child = flist_replicate(f->child);
new->sibling = flist_replicate(f->sibling);
new->low = f->low;
new->high = f->high;
new->flags = f->flags;
new->offset = f->offset;
return new;
}
flist_t *
flist_scan(
char *name)
{
flist_t *fl;
flist_t *lfl;
flist_t *nfl;
int num;
ftok_t *p;
ftok_t *v;
char *x;
v = flist_split(name);
if (!v)
return NULL;
p = v;
fl = lfl = NULL;
while (p->tokty != TT_END) {
if (p->tokty != TT_NAME)
goto bad;
nfl = flist_make(p->tok);
if (lfl)
lfl->child = nfl;
else
fl = nfl;
lfl = nfl;
p++;
if (p->tokty == TT_LB) {
p++;
if (p->tokty != TT_NUM)
goto bad;
num = (int)strtoul(p->tok, &x, 0);
if (*x != '\0')
goto bad;
nfl->flags |= FL_OKLOW;
nfl->low = num;
p++;
if (p->tokty == TT_DASH) {
p++;
if (p->tokty != TT_NUM)
goto bad;
num = (int)strtoul(p->tok, &x, 0);
if (*x != '\0')
goto bad;
nfl->flags |= FL_OKHIGH;
nfl->high = num;
p++;
}
if (p->tokty != TT_RB)
goto bad;
p++;
}
if (p->tokty == TT_DOT) {
p++;
if (p->tokty == TT_END)
goto bad;
}
}
ftok_free(v);
return fl;
bad:
dbprintf(_("bad syntax in field name %s\n"), name);
ftok_free(v);
if (fl)
flist_free(fl);
return NULL;
}
static ftok_t *
flist_split(
char *s)
{
char *a;
int i;
static char *idchars;
static char *initidchar;
int l;
int tailskip = 0;
static char *numchars;
static char *xnumchars; /* extended for hex conversion */
int nv;
static char punctchars[] = "[-].";
static tokty_t puncttypes[] = { TT_LB, TT_DASH, TT_RB, TT_DOT };
tokty_t t;
ftok_t *v;
if (idchars == NULL) {
idchars = xmalloc(26 + 10 + 1 + 1);
initidchar = xmalloc(26 + 1);
numchars = xmalloc(10 + 1);
xnumchars = xmalloc(12 + 1);
for (i = 'a'; i <= 'z'; i++) {
idchars[i - 'a'] = i;
initidchar[i - 'a'] = i;
}
for (i = '0'; i <= '9'; i++) {
idchars[26 + (i - '0')] = i;
numchars[i - '0'] = i;
xnumchars[i - '0'] = i;
}
idchars[26 + 10] = '_';
idchars[26 + 10 + 1] = '\0';
initidchar[26] = '\0';
numchars[10] = '\0';
xnumchars[10] = 'x';
xnumchars[11] = 'X';
xnumchars[12] = '\0';
}
nv = 0;
v = xmalloc(sizeof(*v));
v->tok = NULL;
while (*s) {
/* need to add string handling */
if (*s == '\"') {
s++; /* skip first quote */
if ((a = strrchr(s, '\"')) == NULL) {
dbprintf(_("missing closing quote %s\n"), s);
ftok_free(v);
return NULL;
}
tailskip = 1; /* skip remaing quote */
l = (int)(a - s);
t = TT_STRING;
} else if (strchr(initidchar, *s)) {
l = (int)strspn(s, idchars);
t = TT_NAME;
} else if (strchr(numchars, *s)) {
l = (int)strspn(s, xnumchars);
t = TT_NUM;
} else if ((a = strchr(punctchars, *s))) {
l = 1;
t = puncttypes[a - punctchars];
} else {
dbprintf(_("bad character in field %s\n"), s);
ftok_free(v);
return NULL;
}
a = xmalloc(l + 1);
strncpy(a, s, l);
a[l] = '\0';
v = xrealloc(v, (nv + 2) * sizeof(*v));
v[nv].tok = a;
v[nv].tokty = t;
nv++;
s += l + tailskip;
tailskip = 0;
}
v[nv].tok = NULL;
v[nv].tokty = TT_END;
return v;
}
static void
ftok_free(
ftok_t *ft)
{
ftok_t *p;
for (p = ft; p->tok; p++)
xfree(p->tok);
xfree(ft);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/flist.h 0000664 0000000 0000000 00000001367 12560572026 014513 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*/
struct field;
typedef struct flist {
char *name;
const struct field *fld;
struct flist *child;
struct flist *sibling;
int low;
int high;
int flags;
int offset;
} flist_t;
/*
* Flags for flist
*/
#define FL_OKLOW 1
#define FL_OKHIGH 2
typedef enum tokty {
TT_NAME, TT_NUM, TT_STRING, TT_LB, TT_RB, TT_DASH, TT_DOT, TT_END
} tokty_t;
typedef struct ftok {
char *tok;
tokty_t tokty;
} ftok_t;
extern void flist_free(flist_t *fl);
extern flist_t *flist_make(char *name);
extern int flist_parse(const struct field *fields, flist_t *fl, void *obj,
int startoff);
extern void flist_print(flist_t *fl);
extern flist_t *flist_scan(char *name);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/fprint.c 0000664 0000000 0000000 00000010632 12574431650 014664 0 ustar /*
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include
#include
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "inode.h"
#include "btblock.h"
#include "bit.h"
#include "print.h"
#include "output.h"
#include "sig.h"
#include "malloc.h"
#include "io.h"
int
fp_charns(
void *obj,
int bit,
int count,
char *fmtstr,
int size,
int arg,
int base,
int array)
{
int i;
char *p;
ASSERT(bitoffs(bit) == 0);
ASSERT(size == bitsz(char));
dbprintf("\"");
for (i = 0, p = (char *)obj + byteize(bit);
i < count && !seenint();
i++, p++) {
if (*p == '\\' || *p == '\'' || *p == '"' || *p == '\?')
dbprintf("\\%c", *p);
else if (isgraph((int)*p) || *p == ' ')
dbprintf("%c", *p);
else if (*p == '\a' || *p == '\b' || *p == '\f' || *p == '\n' ||
*p == '\r' || *p == '\t' || *p == '\v')
dbprintf("\\%c", *p + ('a' - '\a'));
else
dbprintf("\\%03o", *p & 0xff);
}
dbprintf("\"");
return 1;
}
int
fp_num(
void *obj,
int bit,
int count,
char *fmtstr,
int size,
int arg,
int base,
int array)
{
int bitpos;
int i;
int isnull;
__int64_t val;
for (i = 0, bitpos = bit;
i < count && !seenint();
i++, bitpos += size) {
val = getbitval(obj, bitpos, size,
(arg & FTARG_SIGNED) ? BVSIGNED : BVUNSIGNED);
if ((arg & FTARG_SKIPZERO) && val == 0)
continue;
isnull = (arg & FTARG_SIGNED) || size == 64 ?
val == -1LL : val == ((1LL << size) - 1LL);
if ((arg & FTARG_SKIPNULL) && isnull)
continue;
if (array)
dbprintf("%d:", i + base);
if ((arg & FTARG_DONULL) && isnull)
dbprintf(_("null"));
else if (size > 32)
dbprintf(fmtstr, val);
else
dbprintf(fmtstr, (__int32_t)val);
if (i < count - 1)
dbprintf(" ");
}
return 1;
}
/*ARGSUSED*/
int
fp_sarray(
void *obj,
int bit,
int count,
char *fmtstr,
int size,
int arg,
int base,
int array)
{
print_sarray(obj, bit, count, size, base, array,
(const field_t *)fmtstr, (arg & FTARG_SKIPNMS) != 0);
return 1;
}
/*ARGSUSED*/
int
fp_time(
void *obj,
int bit,
int count,
char *fmtstr,
int size,
int arg,
int base,
int array)
{
int bitpos;
char *c;
int i;
time_t t;
ASSERT(bitoffs(bit) == 0);
for (i = 0, bitpos = bit;
i < count && !seenint();
i++, bitpos += size) {
if (array)
dbprintf("%d:", i + base);
t=(time_t)getbitval((char *)obj + byteize(bitpos), 0, sizeof(int32_t)*8, 0);
c = ctime(&t);
dbprintf("%24.24s", c);
if (i < count - 1)
dbprintf(" ");
}
return 1;
}
/*ARGSUSED*/
int
fp_uuid(
void *obj,
int bit,
int count,
char *fmtstr,
int size,
int arg,
int base,
int array)
{
char bp[40]; /* UUID string is 36 chars + trailing '\0' */
int i;
uuid_t *p;
ASSERT(bitoffs(bit) == 0);
for (p = (uuid_t *)((char *)obj + byteize(bit)), i = 0;
i < count && !seenint();
i++, p++) {
if (array)
dbprintf("%d:", i + base);
platform_uuid_unparse(p, bp);
dbprintf("%s", bp);
if (i < count - 1)
dbprintf(" ");
}
return 1;
}
/*
* CRC is correct is the current buffer it is being pulled out
* of is not marked with a EFSCORRUPTED error.
*/
int
fp_crc(
void *obj,
int bit,
int count,
char *fmtstr,
int size,
int arg,
int base,
int array)
{
int bitpos;
int i;
__int64_t val;
char *ok;
switch (iocur_crc_valid()) {
case -1:
ok = "unchecked";
break;
case 0:
ok = "bad";
break;
case 1:
ok = "correct";
break;
default:
ok = "unknown state";
break;
}
for (i = 0, bitpos = bit;
i < count && !seenint();
i++, bitpos += size) {
if (array)
dbprintf("%d:", i + base);
val = getbitval(obj, bitpos, size, BVUNSIGNED);
if (size > 32)
dbprintf(fmtstr, val, ok);
else
dbprintf(fmtstr, (__int32_t)val, ok);
if (i < count - 1)
dbprintf(" ");
}
return 1;
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/fprint.h 0000664 0000000 0000000 00000002751 12560572026 014672 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
typedef int (*prfnc_t)(void *obj, int bit, int count, char *fmtstr, int size,
int arg, int base, int array);
extern int fp_charns(void *obj, int bit, int count, char *fmtstr, int size,
int arg, int base, int array);
extern int fp_num(void *obj, int bit, int count, char *fmtstr, int size,
int arg, int base, int array);
extern int fp_sarray(void *obj, int bit, int count, char *fmtstr, int size,
int arg, int base, int array);
extern int fp_time(void *obj, int bit, int count, char *fmtstr, int size,
int arg, int base, int array);
extern int fp_uuid(void *obj, int bit, int count, char *fmtstr, int size,
int arg, int base, int array);
extern int fp_crc(void *obj, int bit, int count, char *fmtstr, int size,
int arg, int base, int array);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/frag.c 0000664 0000000 0000000 00000026721 12574431650 014307 0 ustar /*
* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include
#include "bmap.h"
#include "command.h"
#include "frag.h"
#include "io.h"
#include "output.h"
#include "type.h"
#include "init.h"
#include "malloc.h"
typedef struct extent {
xfs_fileoff_t startoff;
xfs_filblks_t blockcount;
} extent_t;
typedef struct extmap {
int naents;
int nents;
extent_t ents[1];
} extmap_t;
#define EXTMAP_SIZE(n) \
(offsetof(extmap_t, ents) + (sizeof(extent_t) * (n)))
static int aflag;
static int dflag;
static __uint64_t extcount_actual;
static __uint64_t extcount_ideal;
static int fflag;
static int lflag;
static int qflag;
static int Rflag;
static int rflag;
static int vflag;
typedef void (*scan_lbtree_f_t)(struct xfs_btree_block *block,
int level,
extmap_t **extmapp,
typnm_t btype);
typedef void (*scan_sbtree_f_t)(struct xfs_btree_block *block,
int level,
xfs_agf_t *agf);
static extmap_t *extmap_alloc(xfs_extnum_t nex);
static xfs_extnum_t extmap_ideal(extmap_t *extmap);
static void extmap_set_ext(extmap_t **extmapp, xfs_fileoff_t o,
xfs_extlen_t c);
static int frag_f(int argc, char **argv);
static int init(int argc, char **argv);
static void process_bmbt_reclist(xfs_bmbt_rec_t *rp, int numrecs,
extmap_t **extmapp);
static void process_btinode(xfs_dinode_t *dip, extmap_t **extmapp,
int whichfork);
static void process_exinode(xfs_dinode_t *dip, extmap_t **extmapp,
int whichfork);
static void process_fork(xfs_dinode_t *dip, int whichfork);
static void process_inode(xfs_agf_t *agf, xfs_agino_t agino,
xfs_dinode_t *dip);
static void scan_ag(xfs_agnumber_t agno);
static void scan_lbtree(xfs_fsblock_t root, int nlevels,
scan_lbtree_f_t func, extmap_t **extmapp,
typnm_t btype);
static void scan_sbtree(xfs_agf_t *agf, xfs_agblock_t root,
int nlevels, scan_sbtree_f_t func,
typnm_t btype);
static void scanfunc_bmap(struct xfs_btree_block *block, int level,
extmap_t **extmapp, typnm_t btype);
static void scanfunc_ino(struct xfs_btree_block *block, int level,
xfs_agf_t *agf);
static const cmdinfo_t frag_cmd =
{ "frag", NULL, frag_f, 0, -1, 0,
"[-a] [-d] [-f] [-l] [-q] [-R] [-r] [-v]",
"get file fragmentation data", NULL };
static extmap_t *
extmap_alloc(
xfs_extnum_t nex)
{
extmap_t *extmap;
if (nex < 1)
nex = 1;
extmap = xmalloc(EXTMAP_SIZE(nex));
extmap->naents = nex;
extmap->nents = 0;
return extmap;
}
static xfs_extnum_t
extmap_ideal(
extmap_t *extmap)
{
extent_t *ep;
xfs_extnum_t rval;
for (ep = &extmap->ents[0], rval = 0;
ep < &extmap->ents[extmap->nents];
ep++) {
if (ep == &extmap->ents[0] ||
ep->startoff != ep[-1].startoff + ep[-1].blockcount)
rval++;
}
return rval;
}
static void
extmap_set_ext(
extmap_t **extmapp,
xfs_fileoff_t o,
xfs_extlen_t c)
{
extmap_t *extmap;
extent_t *ent;
extmap = *extmapp;
if (extmap->nents == extmap->naents) {
extmap->naents++;
extmap = xrealloc(extmap, EXTMAP_SIZE(extmap->naents));
*extmapp = extmap;
}
ent = &extmap->ents[extmap->nents];
ent->startoff = o;
ent->blockcount = c;
extmap->nents++;
}
void
frag_init(void)
{
add_command(&frag_cmd);
}
/*
* Get file fragmentation information.
*/
static int
frag_f(
int argc,
char **argv)
{
xfs_agnumber_t agno;
double answer;
if (!init(argc, argv))
return 0;
for (agno = 0; agno < mp->m_sb.sb_agcount; agno++)
scan_ag(agno);
if (extcount_actual)
answer = (double)(extcount_actual - extcount_ideal) * 100.0 /
(double)extcount_actual;
else
answer = 0.0;
dbprintf(_("actual %llu, ideal %llu, fragmentation factor %.2f%%\n"),
extcount_actual, extcount_ideal, answer);
return 0;
}
static int
init(
int argc,
char **argv)
{
int c;
aflag = dflag = fflag = lflag = qflag = Rflag = rflag = vflag = 0;
optind = 0;
while ((c = getopt(argc, argv, "adflqRrv")) != EOF) {
switch (c) {
case 'a':
aflag = 1;
break;
case 'd':
dflag = 1;
break;
case 'f':
fflag = 1;
break;
case 'l':
lflag = 1;
break;
case 'q':
qflag = 1;
break;
case 'R':
Rflag = 1;
break;
case 'r':
rflag = 1;
break;
case 'v':
vflag = 1;
break;
default:
dbprintf(_("bad option for frag command\n"));
return 0;
}
}
if (!aflag && !dflag && !fflag && !lflag && !qflag && !Rflag && !rflag)
aflag = dflag = fflag = lflag = qflag = Rflag = rflag = 1;
extcount_actual = extcount_ideal = 0;
return 1;
}
static void
process_bmbt_reclist(
xfs_bmbt_rec_t *rp,
int numrecs,
extmap_t **extmapp)
{
xfs_filblks_t c;
int f;
int i;
xfs_fileoff_t o;
xfs_fsblock_t s;
for (i = 0; i < numrecs; i++, rp++) {
convert_extent(rp, &o, &s, &c, &f);
extmap_set_ext(extmapp, (xfs_fileoff_t)o, (xfs_extlen_t)c);
}
}
static void
process_btinode(
xfs_dinode_t *dip,
extmap_t **extmapp,
int whichfork)
{
xfs_bmdr_block_t *dib;
int i;
xfs_bmbt_ptr_t *pp;
dib = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork);
if (be16_to_cpu(dib->bb_level) == 0) {
xfs_bmbt_rec_t *rp = XFS_BMDR_REC_ADDR(dib, 1);
process_bmbt_reclist(rp, be16_to_cpu(dib->bb_numrecs), extmapp);
return;
}
pp = XFS_BMDR_PTR_ADDR(dib, 1,
xfs_bmdr_maxrecs(XFS_DFORK_SIZE(dip, mp, whichfork), 0));
for (i = 0; i < be16_to_cpu(dib->bb_numrecs); i++)
scan_lbtree(be64_to_cpu(pp[i]), be16_to_cpu(dib->bb_level),
scanfunc_bmap, extmapp,
whichfork == XFS_DATA_FORK ? TYP_BMAPBTD : TYP_BMAPBTA);
}
static void
process_exinode(
xfs_dinode_t *dip,
extmap_t **extmapp,
int whichfork)
{
xfs_bmbt_rec_t *rp;
rp = (xfs_bmbt_rec_t *)XFS_DFORK_PTR(dip, whichfork);
process_bmbt_reclist(rp, XFS_DFORK_NEXTENTS(dip, whichfork), extmapp);
}
static void
process_fork(
xfs_dinode_t *dip,
int whichfork)
{
extmap_t *extmap;
int nex;
nex = XFS_DFORK_NEXTENTS(dip, whichfork);
if (!nex)
return;
extmap = extmap_alloc(nex);
switch (XFS_DFORK_FORMAT(dip, whichfork)) {
case XFS_DINODE_FMT_EXTENTS:
process_exinode(dip, &extmap, whichfork);
break;
case XFS_DINODE_FMT_BTREE:
process_btinode(dip, &extmap, whichfork);
break;
}
extcount_actual += extmap->nents;
extcount_ideal += extmap_ideal(extmap);
xfree(extmap);
}
static void
process_inode(
xfs_agf_t *agf,
xfs_agino_t agino,
xfs_dinode_t *dip)
{
__uint64_t actual;
__uint64_t ideal;
xfs_ino_t ino;
int skipa;
int skipd;
ino = XFS_AGINO_TO_INO(mp, be32_to_cpu(agf->agf_seqno), agino);
switch (be16_to_cpu(dip->di_mode) & S_IFMT) {
case S_IFDIR:
skipd = !dflag;
break;
case S_IFREG:
if (!rflag && (be16_to_cpu(dip->di_flags) & XFS_DIFLAG_REALTIME))
skipd = 1;
else if (!Rflag &&
(ino == mp->m_sb.sb_rbmino ||
ino == mp->m_sb.sb_rsumino))
skipd = 1;
else if (!qflag &&
(ino == mp->m_sb.sb_uquotino ||
ino == mp->m_sb.sb_gquotino ||
ino == mp->m_sb.sb_pquotino))
skipd = 1;
else
skipd = !fflag;
break;
case S_IFLNK:
skipd = !lflag;
break;
default:
skipd = 1;
break;
}
actual = extcount_actual;
ideal = extcount_ideal;
if (!skipd)
process_fork(dip, XFS_DATA_FORK);
skipa = !aflag || !XFS_DFORK_Q(dip);
if (!skipa)
process_fork(dip, XFS_ATTR_FORK);
if (vflag && (!skipd || !skipa))
dbprintf(_("inode %lld actual %lld ideal %lld\n"),
ino, extcount_actual - actual, extcount_ideal - ideal);
}
static void
scan_ag(
xfs_agnumber_t agno)
{
xfs_agf_t *agf;
xfs_agi_t *agi;
push_cur();
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(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();
pop_cur();
return;
}
scan_sbtree(agf, be32_to_cpu(agi->agi_root),
be32_to_cpu(agi->agi_level), scanfunc_ino, TYP_INOBT);
pop_cur();
pop_cur();
}
static void
scan_lbtree(
xfs_fsblock_t root,
int nlevels,
scan_lbtree_f_t func,
extmap_t **extmapp,
typnm_t btype)
{
push_cur();
set_cur(&typtab[btype], XFS_FSB_TO_DADDR(mp, root), blkbb, DB_RING_IGN,
NULL);
if (iocur_top->data == NULL) {
dbprintf(_("can't read btree block %u/%u\n"),
XFS_FSB_TO_AGNO(mp, root),
XFS_FSB_TO_AGBNO(mp, root));
return;
}
(*func)(iocur_top->data, nlevels - 1, extmapp, btype);
pop_cur();
}
static void
scan_sbtree(
xfs_agf_t *agf,
xfs_agblock_t root,
int nlevels,
scan_sbtree_f_t func,
typnm_t btype)
{
xfs_agnumber_t seqno = be32_to_cpu(agf->agf_seqno);
push_cur();
set_cur(&typtab[btype], XFS_AGB_TO_DADDR(mp, seqno, root),
blkbb, DB_RING_IGN, NULL);
if (iocur_top->data == NULL) {
dbprintf(_("can't read btree block %u/%u\n"), seqno, root);
return;
}
(*func)(iocur_top->data, nlevels - 1, agf);
pop_cur();
}
static void
scanfunc_bmap(
struct xfs_btree_block *block,
int level,
extmap_t **extmapp,
typnm_t btype)
{
int i;
xfs_bmbt_ptr_t *pp;
xfs_bmbt_rec_t *rp;
int nrecs;
nrecs = be16_to_cpu(block->bb_numrecs);
if (level == 0) {
if (nrecs > mp->m_bmap_dmxr[0]) {
dbprintf(_("invalid numrecs (%u) in %s block\n"),
nrecs, typtab[btype].name);
return;
}
rp = XFS_BMBT_REC_ADDR(mp, block, 1);
process_bmbt_reclist(rp, nrecs, extmapp);
return;
}
if (nrecs > mp->m_bmap_dmxr[1]) {
dbprintf(_("invalid numrecs (%u) in %s block\n"),
nrecs, typtab[btype].name);
return;
}
pp = XFS_BMBT_PTR_ADDR(mp, block, 1, mp->m_bmap_dmxr[0]);
for (i = 0; i < nrecs; i++)
scan_lbtree(be64_to_cpu(pp[i]), level, scanfunc_bmap, extmapp,
btype);
}
static void
scanfunc_ino(
struct xfs_btree_block *block,
int level,
xfs_agf_t *agf)
{
xfs_agino_t agino;
xfs_agnumber_t seqno = be32_to_cpu(agf->agf_seqno);
int i;
int j;
int off;
xfs_inobt_ptr_t *pp;
xfs_inobt_rec_t *rp;
if (level == 0) {
rp = XFS_INOBT_REC_ADDR(mp, block, 1);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++) {
agino = be32_to_cpu(rp[i].ir_startino);
off = XFS_INO_TO_OFFSET(mp, agino);
push_cur();
set_cur(&typtab[TYP_INODE],
XFS_AGB_TO_DADDR(mp, seqno,
XFS_AGINO_TO_AGBNO(mp, agino)),
XFS_FSB_TO_BB(mp, mp->m_ialloc_blks),
DB_RING_IGN, NULL);
if (iocur_top->data == NULL) {
dbprintf(_("can't read inode block %u/%u\n"),
seqno, XFS_AGINO_TO_AGBNO(mp, agino));
continue;
}
for (j = 0; j < XFS_INODES_PER_CHUNK; j++) {
if (XFS_INOBT_IS_FREE_DISK(&rp[i], j))
continue;
process_inode(agf, agino + j, (xfs_dinode_t *)
((char *)iocur_top->data +
((off + j) << mp->m_sb.sb_inodelog)));
}
pop_cur();
}
return;
}
pp = XFS_INOBT_PTR_ADDR(mp, block, 1, mp->m_inobt_mxr[1]);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++)
scan_sbtree(agf, be32_to_cpu(pp[i]), level, scanfunc_ino,
TYP_INOBT);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/frag.h 0000664 0000000 0000000 00000001365 12560572026 014307 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void frag_init(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/freesp.c 0000664 0000000 0000000 00000022325 12574431650 014650 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "command.h"
#include "freesp.h"
#include "io.h"
#include "type.h"
#include "output.h"
#include "init.h"
#include "malloc.h"
typedef struct histent
{
int low;
int high;
long long count;
long long blocks;
} histent_t;
static void addhistent(int h);
static void addtohist(xfs_agnumber_t agno, xfs_agblock_t agbno,
xfs_extlen_t len);
static int freesp_f(int argc, char **argv);
static void histinit(int maxlen);
static int init(int argc, char **argv);
static void printhist(void);
static void scan_ag(xfs_agnumber_t agno);
static void scanfunc_bno(struct xfs_btree_block *block, typnm_t typ, int level,
xfs_agf_t *agf);
static void scanfunc_cnt(struct xfs_btree_block *block, typnm_t typ, int level,
xfs_agf_t *agf);
static void scan_freelist(xfs_agf_t *agf);
static void scan_sbtree(xfs_agf_t *agf, xfs_agblock_t root, typnm_t typ,
int nlevels,
void (*func)(struct xfs_btree_block *block, typnm_t typ,
int level, xfs_agf_t *agf));
static int usage(void);
static int agcount;
static xfs_agnumber_t *aglist;
static int countflag;
static int dumpflag;
static int equalsize;
static histent_t *hist;
static int histcount;
static int multsize;
static int seen1;
static int summaryflag;
static long long totblocks;
static long long totexts;
static const cmdinfo_t freesp_cmd =
{ "freesp", NULL, freesp_f, 0, -1, 0,
"[-bcdfs] [-a agno]... [-e binsize] [-h h1]... [-m binmult]",
"summarize free space for filesystem", NULL };
static int
inaglist(
xfs_agnumber_t agno)
{
int i;
if (agcount == 0)
return 1;
for (i = 0; i < agcount; i++)
if (aglist[i] == agno)
return 1;
return 0;
}
/*
* Report on freespace usage in xfs filesystem.
*/
static int
freesp_f(
int argc,
char **argv)
{
xfs_agnumber_t agno;
if (!init(argc, argv))
return 0;
if (dumpflag)
dbprintf("%8s %8s %8s\n", "agno", "agbno", "len");
for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
if (inaglist(agno))
scan_ag(agno);
}
if (histcount)
printhist();
if (summaryflag) {
dbprintf(_("total free extents %lld\n"), totexts);
dbprintf(_("total free blocks %lld\n"), totblocks);
dbprintf(_("average free extent size %g\n"),
(double)totblocks / (double)totexts);
}
if (aglist)
xfree(aglist);
if (hist)
xfree(hist);
return 0;
}
void
freesp_init(void)
{
add_command(&freesp_cmd);
}
static void
aglistadd(
char *a)
{
aglist = xrealloc(aglist, (agcount + 1) * sizeof(*aglist));
aglist[agcount] = (xfs_agnumber_t)atoi(a);
agcount++;
}
static int
init(
int argc,
char **argv)
{
int c;
int speced = 0;
agcount = countflag = dumpflag = equalsize = multsize = optind = 0;
histcount = seen1 = summaryflag = 0;
totblocks = totexts = 0;
aglist = NULL;
hist = NULL;
while ((c = getopt(argc, argv, "a:bcde:h:m:s")) != EOF) {
switch (c) {
case 'a':
aglistadd(optarg);
break;
case 'b':
if (speced)
return usage();
multsize = 2;
speced = 1;
break;
case 'c':
countflag = 1;
break;
case 'd':
dumpflag = 1;
break;
case 'e':
if (speced)
return usage();
equalsize = atoi(optarg);
speced = 1;
break;
case 'h':
if (speced && !histcount)
return usage();
addhistent(atoi(optarg));
speced = 1;
break;
case 'm':
if (speced)
return usage();
multsize = atoi(optarg);
speced = 1;
break;
case 's':
summaryflag = 1;
break;
case '?':
return usage();
}
}
if (optind != argc)
return usage();
if (!speced)
multsize = 2;
histinit((int)mp->m_sb.sb_agblocks);
return 1;
}
static int
usage(void)
{
dbprintf(_("freesp arguments: [-bcds] [-a agno] [-e binsize] [-h h1]... "
"[-m binmult]\n"));
return 0;
}
static void
scan_ag(
xfs_agnumber_t agno)
{
xfs_agf_t *agf;
push_cur();
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)
scan_sbtree(agf, be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
TYP_CNTBT, be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
scanfunc_cnt);
else
scan_sbtree(agf, be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
TYP_BNOBT, be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
scanfunc_bno);
pop_cur();
}
static void
scan_freelist(
xfs_agf_t *agf)
{
xfs_agnumber_t seqno = be32_to_cpu(agf->agf_seqno);
xfs_agfl_t *agfl;
xfs_agblock_t bno;
int i;
__be32 *agfl_bno;
if (be32_to_cpu(agf->agf_flcount) == 0)
return;
push_cur();
set_cur(&typtab[TYP_AGFL], XFS_AG_DADDR(mp, seqno, XFS_AGFL_DADDR(mp)),
XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL);
agfl = iocur_top->data;
i = be32_to_cpu(agf->agf_flfirst);
/* open coded XFS_BUF_TO_AGFL_BNO */
agfl_bno = xfs_sb_version_hascrc(&mp->m_sb) ? &agfl->agfl_bno[0]
: (__be32 *)agfl;
/* verify agf values before proceeding */
if (be32_to_cpu(agf->agf_flfirst) >= XFS_AGFL_SIZE(mp) ||
be32_to_cpu(agf->agf_fllast) >= XFS_AGFL_SIZE(mp)) {
dbprintf(_("agf %d freelist blocks bad, skipping "
"freelist scan\n"), i);
pop_cur();
return;
}
for (;;) {
bno = be32_to_cpu(agfl_bno[i]);
addtohist(seqno, bno, 1);
if (i == be32_to_cpu(agf->agf_fllast))
break;
if (++i == XFS_AGFL_SIZE(mp))
i = 0;
}
pop_cur();
}
static void
scan_sbtree(
xfs_agf_t *agf,
xfs_agblock_t root,
typnm_t typ,
int nlevels,
void (*func)(struct xfs_btree_block *block,
typnm_t typ,
int level,
xfs_agf_t *agf))
{
xfs_agnumber_t seqno = be32_to_cpu(agf->agf_seqno);
push_cur();
set_cur(&typtab[typ], XFS_AGB_TO_DADDR(mp, seqno, root),
blkbb, DB_RING_IGN, NULL);
if (iocur_top->data == NULL) {
dbprintf(_("can't read btree block %u/%u\n"), seqno, root);
return;
}
(*func)(iocur_top->data, typ, nlevels - 1, agf);
pop_cur();
}
/*ARGSUSED*/
static void
scanfunc_bno(
struct xfs_btree_block *block,
typnm_t typ,
int level,
xfs_agf_t *agf)
{
int i;
xfs_alloc_ptr_t *pp;
xfs_alloc_rec_t *rp;
if (!(be32_to_cpu(block->bb_magic) == XFS_ABTB_MAGIC ||
be32_to_cpu(block->bb_magic) == XFS_ABTB_CRC_MAGIC))
return;
if (level == 0) {
rp = XFS_ALLOC_REC_ADDR(mp, block, 1);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++)
addtohist(be32_to_cpu(agf->agf_seqno),
be32_to_cpu(rp[i].ar_startblock),
be32_to_cpu(rp[i].ar_blockcount));
return;
}
pp = XFS_ALLOC_PTR_ADDR(mp, block, 1, mp->m_alloc_mxr[1]);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++)
scan_sbtree(agf, be32_to_cpu(pp[i]), typ, level, scanfunc_bno);
}
static void
scanfunc_cnt(
struct xfs_btree_block *block,
typnm_t typ,
int level,
xfs_agf_t *agf)
{
int i;
xfs_alloc_ptr_t *pp;
xfs_alloc_rec_t *rp;
if (!(be32_to_cpu(block->bb_magic) == XFS_ABTC_MAGIC ||
be32_to_cpu(block->bb_magic) == XFS_ABTC_CRC_MAGIC))
return;
if (level == 0) {
rp = XFS_ALLOC_REC_ADDR(mp, block, 1);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++)
addtohist(be32_to_cpu(agf->agf_seqno),
be32_to_cpu(rp[i].ar_startblock),
be32_to_cpu(rp[i].ar_blockcount));
return;
}
pp = XFS_ALLOC_PTR_ADDR(mp, block, 1, mp->m_alloc_mxr[1]);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++)
scan_sbtree(agf, be32_to_cpu(pp[i]), typ, level, scanfunc_cnt);
}
static void
addhistent(
int h)
{
hist = xrealloc(hist, (histcount + 1) * sizeof(*hist));
if (h == 0)
h = 1;
hist[histcount].low = h;
hist[histcount].count = hist[histcount].blocks = 0;
histcount++;
if (h == 1)
seen1 = 1;
}
static void
addtohist(
xfs_agnumber_t agno,
xfs_agblock_t agbno,
xfs_extlen_t len)
{
int i;
if (dumpflag)
dbprintf("%8d %8d %8d\n", agno, agbno, len);
totexts++;
totblocks += len;
for (i = 0; i < histcount; i++) {
if (hist[i].high >= len) {
hist[i].count++;
hist[i].blocks += len;
break;
}
}
}
static int
hcmp(
const void *a,
const void *b)
{
return ((histent_t *)a)->low - ((histent_t *)b)->low;
}
static void
histinit(
int maxlen)
{
int i;
if (equalsize) {
for (i = 1; i < maxlen; i += equalsize)
addhistent(i);
} else if (multsize) {
for (i = 1; i < maxlen; i *= multsize)
addhistent(i);
} else {
if (!seen1)
addhistent(1);
qsort(hist, histcount, sizeof(*hist), hcmp);
}
for (i = 0; i < histcount; i++) {
if (i < histcount - 1)
hist[i].high = hist[i + 1].low - 1;
else
hist[i].high = maxlen;
}
}
static void
printhist(void)
{
int i;
dbprintf("%7s %7s %7s %7s %6s\n",
_("from"), _("to"), _("extents"), _("blocks"), _("pct"));
for (i = 0; i < histcount; i++) {
if (hist[i].count)
dbprintf("%7d %7d %7lld %7lld %6.2f\n", hist[i].low,
hist[i].high, hist[i].count, hist[i].blocks,
hist[i].blocks * 100.0 / totblocks);
}
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/freesp.h 0000664 0000000 0000000 00000001367 12560572026 014656 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void freesp_init(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/hash.c 0000664 0000000 0000000 00000002752 12574431650 014311 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "addr.h"
#include "command.h"
#include "type.h"
#include "io.h"
#include "output.h"
static int hash_f(int argc, char **argv);
static void hash_help(void);
static const cmdinfo_t hash_cmd =
{ "hash", NULL, hash_f, 1, 1, 0, N_("string"),
N_("calculate hash value"), hash_help };
static void
hash_help(void)
{
dbprintf(_(
"\n"
" 'hash' prints out the calculated hash value for a string using the\n"
"directory/attribute code hash function.\n"
"\n"
" Usage: \"hash \"\n"
"\n"
));
}
/* ARGSUSED */
static int
hash_f(
int argc,
char **argv)
{
xfs_dahash_t hashval;
hashval = libxfs_da_hashname((unsigned char *)argv[1], (int)strlen(argv[1]));
dbprintf("0x%x\n", hashval);
return 0;
}
void
hash_init(void)
{
add_command(&hash_cmd);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/hash.h 0000664 0000000 0000000 00000001361 12560572026 014307 0 ustar /*
* 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 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void hash_init(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/help.c 0000664 0000000 0000000 00000004015 12574431650 014310 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "command.h"
#include "help.h"
#include "output.h"
static void help_all(void);
static void help_onecmd(const char *cmd, const cmdinfo_t *ct);
static int help_f(int argc, char **argv);
static void help_oneline(const char *cmd, const cmdinfo_t *ct);
static const cmdinfo_t help_cmd =
{ "help", "?", help_f, 0, 1, 0, N_("[command]"),
N_("help for one or all commands"), NULL };
static void
help_all(void)
{
const cmdinfo_t *ct;
for (ct = cmdtab; ct < &cmdtab[ncmds]; ct++)
help_oneline(ct->name, ct);
dbprintf(_("\nUse 'help commandname' for extended help.\n"));
}
static int
help_f(
int argc,
char **argv)
{
const cmdinfo_t *ct;
if (argc == 1) {
help_all();
return 0;
}
ct = find_command(argv[1]);
if (ct == NULL) {
dbprintf(_("command %s not found\n"), argv[1]);
return 0;
}
help_onecmd(argv[1], ct);
return 0;
}
void
help_init(void)
{
add_command(&help_cmd);
}
static void
help_onecmd(
const char *cmd,
const cmdinfo_t *ct)
{
help_oneline(cmd, ct);
if (ct->help)
ct->help();
}
static void
help_oneline(
const char *cmd,
const cmdinfo_t *ct)
{
if (cmd)
dbprintf("%s ", cmd);
else {
dbprintf("%s ", ct->name);
if (ct->altname)
dbprintf(_("(or %s) "), ct->altname);
}
if (ct->args)
dbprintf("%s ", ct->args);
dbprintf("-- %s\n", ct->oneline);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/help.h 0000664 0000000 0000000 00000001365 12560572026 014320 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void help_init(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/init.c 0000664 0000000 0000000 00000012143 12625713771 014330 0 ustar /*
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "libxlog.h"
#include
#include "command.h"
#include "init.h"
#include "input.h"
#include "io.h"
#include "init.h"
#include "sig.h"
#include "output.h"
#include "malloc.h"
#include "type.h"
static char **cmdline;
static int ncmdline;
char *fsdevice;
int blkbb;
int exitcode;
int expert_mode;
int force;
struct xfs_mount xmount;
struct xfs_mount *mp;
struct xlog xlog;
libxfs_init_t x;
xfs_agnumber_t cur_agno = NULLAGNUMBER;
static void
usage(void)
{
fprintf(stderr, _(
"Usage: %s [-ifFrxV] [-p prog] [-l logdev] [-c cmd]... device\n"
), progname);
exit(1);
}
void
init(
int argc,
char **argv)
{
struct xfs_sb *sbp;
struct xfs_buf *bp;
int c;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
progname = basename(argv[0]);
while ((c = getopt(argc, argv, "c:fFip:rxVl:")) != EOF) {
switch (c) {
case 'c':
cmdline = xrealloc(cmdline, (ncmdline+1)*sizeof(char*));
cmdline[ncmdline++] = optarg;
break;
case 'f':
x.disfile = 1;
break;
case 'F':
force = 1;
break;
case 'i':
x.isreadonly = (LIBXFS_ISREADONLY|LIBXFS_ISINACTIVE);
break;
case 'p':
progname = optarg;
break;
case 'r':
x.isreadonly = LIBXFS_ISREADONLY;
break;
case 'l':
x.logname = optarg;
break;
case 'x':
expert_mode = 1;
break;
case 'V':
printf(_("%s version %s\n"), progname, VERSION);
exit(0);
case '?':
usage();
/*NOTREACHED*/
}
}
if (optind + 1 != argc) {
usage();
/*NOTREACHED*/
}
fsdevice = argv[optind];
if (!x.disfile)
x.volname = fsdevice;
else
x.dname = fsdevice;
x.bcache_flags = CACHE_MISCOMPARE_PURGE;
if (!libxfs_init(&x)) {
fputs(_("\nfatal error -- couldn't initialize XFS library\n"),
stderr);
exit(1);
}
/*
* Read the superblock, but don't validate it - we are a diagnostic
* tool and so need to be able to mount busted filesystems.
*/
memset(&xmount, 0, sizeof(struct xfs_mount));
libxfs_buftarg_init(&xmount, x.ddev, x.logdev, x.rtdev);
bp = libxfs_readbuf(xmount.m_ddev_targp, XFS_SB_DADDR,
1 << (XFS_MAX_SECTORSIZE_LOG - BBSHIFT), 0, NULL);
if (!bp || bp->b_error) {
fprintf(stderr, _("%s: %s is invalid (cannot read first 512 "
"bytes)\n"), progname, fsdevice);
exit(1);
}
/* copy SB from buffer to in-core, converting architecture as we go */
libxfs_sb_from_disk(&xmount.m_sb, XFS_BUF_TO_SBP(bp));
libxfs_putbuf(bp);
libxfs_purgebuf(bp);
sbp = &xmount.m_sb;
if (sbp->sb_magicnum != XFS_SB_MAGIC) {
fprintf(stderr, _("%s: %s is not a valid XFS filesystem (unexpected SB magic number 0x%08x)\n"),
progname, fsdevice, sbp->sb_magicnum);
if (!force) {
fprintf(stderr, _("Use -F to force a read attempt.\n"));
exit(EXIT_FAILURE);
}
}
mp = libxfs_mount(&xmount, sbp, x.ddev, x.logdev, x.rtdev,
LIBXFS_MOUNT_DEBUGGER);
if (!mp) {
fprintf(stderr,
_("%s: device %s unusable (not an XFS filesystem?)\n"),
progname, fsdevice);
exit(1);
}
mp->m_log = &xlog;
blkbb = 1 << mp->m_blkbb_log;
/*
* xfs_check needs corrected incore superblock values
*/
if (sbp->sb_rootino != NULLFSINO &&
xfs_sb_version_haslazysbcount(&mp->m_sb)) {
int error = xfs_initialize_perag_data(mp, sbp->sb_agcount);
if (error) {
fprintf(stderr,
_("%s: cannot init perag data (%d). Continuing anyway.\n"),
progname, error);
}
}
if (xfs_sb_version_hassparseinodes(&mp->m_sb))
type_set_tab_spcrc();
else if (xfs_sb_version_hascrc(&mp->m_sb))
type_set_tab_crc();
push_cur();
init_commands();
init_sig();
}
int
main(
int argc,
char **argv)
{
int c, i, done = 0;
char *input;
char **v;
int start_iocur_sp;
pushfile(stdin);
init(argc, argv);
start_iocur_sp = iocur_sp;
for (i = 0; !done && i < ncmdline; i++) {
v = breakline(cmdline[i], &c);
if (c)
done = command(c, v);
xfree(v);
}
if (cmdline) {
xfree(cmdline);
goto close_devices;
}
while (!done) {
if ((input = fetchline()) == NULL)
break;
v = breakline(input, &c);
if (c)
done = command(c, v);
doneline(input, v);
}
close_devices:
/*
* Make sure that we pop the all the buffer contexts we hold so that
* they are released before we purge the caches during unmount.
*/
while (iocur_sp > start_iocur_sp)
pop_cur();
libxfs_umount(mp);
if (x.ddev)
libxfs_device_close(x.ddev);
if (x.logdev && x.logdev != x.ddev)
libxfs_device_close(x.logdev);
if (x.rtdev)
libxfs_device_close(x.rtdev);
return exitcode;
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/init.h 0000664 0000000 0000000 00000001602 12560572026 014325 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern char *fsdevice;
extern int blkbb;
extern int exitcode;
extern int expert_mode;
extern xfs_mount_t *mp;
extern libxfs_init_t x;
extern xfs_agnumber_t cur_agno;
xfsprogs-4.3.0+nmu1ubuntu1.1/db/inode.c 0000664 0000000 0000000 00000045200 12574431650 014457 0 ustar /*
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "command.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "inode.h"
#include "io.h"
#include "print.h"
#include "block.h"
#include "bit.h"
#include "output.h"
#include "init.h"
static int inode_a_bmbt_count(void *obj, int startoff);
static int inode_a_bmx_count(void *obj, int startoff);
static int inode_a_count(void *obj, int startoff);
static int inode_a_offset(void *obj, int startoff, int idx);
static int inode_a_sfattr_count(void *obj, int startoff);
static int inode_core_nlinkv2_count(void *obj, int startoff);
static int inode_core_onlink_count(void *obj, int startoff);
static int inode_core_projid_count(void *obj, int startoff);
static int inode_core_nlinkv1_count(void *obj, int startoff);
static int inode_f(int argc, char **argv);
static int inode_u_offset(void *obj, int startoff, int idx);
static int inode_u_bmbt_count(void *obj, int startoff);
static int inode_u_bmx_count(void *obj, int startoff);
static int inode_u_c_count(void *obj, int startoff);
static int inode_u_dev_count(void *obj, int startoff);
static int inode_u_muuid_count(void *obj, int startoff);
static int inode_u_sfdir2_count(void *obj, int startoff);
static int inode_u_sfdir3_count(void *obj, int startoff);
static int inode_u_symlink_count(void *obj, int startoff);
static const cmdinfo_t inode_cmd =
{ "inode", NULL, inode_f, 0, 1, 1, "[inode#]",
"set current inode", NULL };
const field_t inode_hfld[] = {
{ "", FLDT_INODE, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
const field_t inode_crc_hfld[] = {
{ "", FLDT_INODE_CRC, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
/* XXX: fix this up! */
#define OFF(f) bitize(offsetof(xfs_dinode_t, di_ ## f))
const field_t inode_flds[] = {
{ "core", FLDT_DINODE_CORE, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "next_unlinked", FLDT_AGINO, OI(OFF(next_unlinked)), C1, 0,
TYP_INODE },
{ "u", FLDT_DINODE_U, inode_u_offset, C1, FLD_OFFSET, TYP_NONE },
{ "a", FLDT_DINODE_A, inode_a_offset, inode_a_count,
FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ NULL }
};
const field_t inode_crc_flds[] = {
{ "core", FLDT_DINODE_CORE, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "next_unlinked", FLDT_AGINO, OI(OFF(next_unlinked)), C1, 0,
TYP_INODE },
{ "v3", FLDT_DINODE_V3, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "u3", FLDT_DINODE_U, inode_u_offset, C1, FLD_OFFSET, TYP_NONE },
{ "a", FLDT_DINODE_A, inode_a_offset, inode_a_count,
FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ NULL }
};
#define COFF(f) bitize(offsetof(xfs_dinode_t, di_ ## f))
const field_t inode_core_flds[] = {
{ "magic", FLDT_UINT16X, OI(COFF(magic)), C1, 0, TYP_NONE },
{ "mode", FLDT_UINT16O, OI(COFF(mode)), C1, 0, TYP_NONE },
{ "version", FLDT_INT8D, OI(COFF(version)), C1, 0, TYP_NONE },
{ "format", FLDT_DINODE_FMT, OI(COFF(format)), C1, 0, TYP_NONE },
{ "nlinkv1", FLDT_UINT16D, OI(COFF(onlink)), inode_core_nlinkv1_count,
FLD_COUNT, TYP_NONE },
{ "nlinkv2", FLDT_UINT32D, OI(COFF(nlink)), inode_core_nlinkv2_count,
FLD_COUNT, TYP_NONE },
{ "onlink", FLDT_UINT16D, OI(COFF(onlink)), inode_core_onlink_count,
FLD_COUNT, TYP_NONE },
{ "projid_lo", FLDT_UINT16D, OI(COFF(projid_lo)),
inode_core_projid_count, FLD_COUNT, TYP_NONE },
{ "projid_hi", FLDT_UINT16D, OI(COFF(projid_hi)),
inode_core_projid_count, FLD_COUNT, TYP_NONE },
{ "uid", FLDT_UINT32D, OI(COFF(uid)), C1, 0, TYP_NONE },
{ "gid", FLDT_UINT32D, OI(COFF(gid)), C1, 0, TYP_NONE },
{ "flushiter", FLDT_UINT16D, OI(COFF(flushiter)), C1, 0, TYP_NONE },
{ "atime", FLDT_TIMESTAMP, OI(COFF(atime)), C1, 0, TYP_NONE },
{ "mtime", FLDT_TIMESTAMP, OI(COFF(mtime)), C1, 0, TYP_NONE },
{ "ctime", FLDT_TIMESTAMP, OI(COFF(ctime)), C1, 0, TYP_NONE },
{ "size", FLDT_FSIZE, OI(COFF(size)), C1, 0, TYP_NONE },
{ "nblocks", FLDT_DRFSBNO, OI(COFF(nblocks)), C1, 0, TYP_NONE },
{ "extsize", FLDT_EXTLEN, OI(COFF(extsize)), C1, 0, TYP_NONE },
{ "nextents", FLDT_EXTNUM, OI(COFF(nextents)), C1, 0, TYP_NONE },
{ "naextents", FLDT_AEXTNUM, OI(COFF(anextents)), C1, 0, TYP_NONE },
{ "forkoff", FLDT_UINT8D, OI(COFF(forkoff)), C1, 0, TYP_NONE },
{ "aformat", FLDT_DINODE_FMT, OI(COFF(aformat)), C1, 0, TYP_NONE },
{ "dmevmask", FLDT_UINT32X, OI(COFF(dmevmask)), C1, 0, TYP_NONE },
{ "dmstate", FLDT_UINT16D, OI(COFF(dmstate)), C1, 0, TYP_NONE },
{ "flags", FLDT_UINT16X, OI(COFF(flags)), C1, FLD_SKIPALL, TYP_NONE },
{ "newrtbm", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_NEWRTBM_BIT - 1), C1,
0, TYP_NONE },
{ "prealloc", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_PREALLOC_BIT - 1), C1,
0, TYP_NONE },
{ "realtime", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_REALTIME_BIT - 1), C1,
0, TYP_NONE },
{ "immutable", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_IMMUTABLE_BIT-1), C1,
0, TYP_NONE },
{ "append", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_APPEND_BIT - 1), C1,
0, TYP_NONE },
{ "sync", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_SYNC_BIT - 1), C1,
0, TYP_NONE },
{ "noatime", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_NOATIME_BIT - 1), C1,
0, TYP_NONE },
{ "nodump", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_NODUMP_BIT - 1), C1,
0, TYP_NONE },
{ "rtinherit", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_RTINHERIT_BIT-1), C1,
0, TYP_NONE },
{ "projinherit", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_PROJINHERIT_BIT-1),C1,
0, TYP_NONE },
{ "nosymlinks", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_NOSYMLINKS_BIT-1), C1,
0, TYP_NONE },
{ "extsz", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_EXTSIZE_BIT-1),C1,
0, TYP_NONE },
{ "extszinherit", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_EXTSZINHERIT_BIT-1),C1,
0, TYP_NONE },
{ "nodefrag", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_NODEFRAG_BIT-1),C1,
0, TYP_NONE },
{ "filestream", FLDT_UINT1,
OI(COFF(flags) + bitsz(__uint16_t) - XFS_DIFLAG_FILESTREAM_BIT-1),C1,
0, TYP_NONE },
{ "gen", FLDT_UINT32D, OI(COFF(gen)), C1, 0, TYP_NONE },
{ NULL }
};
const field_t inode_v3_flds[] = {
{ "crc", FLDT_CRC, OI(COFF(crc)), C1, 0, TYP_NONE },
{ "change_count", FLDT_UINT64D, OI(COFF(changecount)), C1, 0, TYP_NONE },
{ "lsn", FLDT_UINT64X, OI(COFF(lsn)), C1, 0, TYP_NONE },
{ "flags2", FLDT_UINT64X, OI(COFF(flags2)), C1, 0, TYP_NONE },
{ "crtime", FLDT_TIMESTAMP, OI(COFF(crtime)), C1, 0, TYP_NONE },
{ "inumber", FLDT_INO, OI(COFF(ino)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(COFF(uuid)), C1, 0, TYP_NONE },
{ NULL }
};
#define TOFF(f) bitize(offsetof(xfs_timestamp_t, t_ ## f))
const field_t timestamp_flds[] = {
{ "sec", FLDT_TIME, OI(TOFF(sec)), C1, 0, TYP_NONE },
{ "nsec", FLDT_NSEC, OI(TOFF(nsec)), C1, 0, TYP_NONE },
{ NULL }
};
const field_t inode_u_flds[] = {
{ "bmbt", FLDT_BMROOTD, NULL, inode_u_bmbt_count, FLD_COUNT, TYP_NONE },
{ "bmx", FLDT_BMAPBTDREC, NULL, inode_u_bmx_count, FLD_ARRAY|FLD_COUNT,
TYP_NONE },
{ "c", FLDT_CHARNS, NULL, inode_u_c_count, FLD_COUNT, TYP_NONE },
{ "dev", FLDT_DEV, NULL, inode_u_dev_count, FLD_COUNT, TYP_NONE },
{ "muuid", FLDT_UUID, NULL, inode_u_muuid_count, FLD_COUNT, TYP_NONE },
{ "sfdir2", FLDT_DIR2SF, NULL, inode_u_sfdir2_count, FLD_COUNT, TYP_NONE },
{ "sfdir3", FLDT_DIR3SF, NULL, inode_u_sfdir3_count, FLD_COUNT, TYP_NONE },
{ "symlink", FLDT_CHARNS, NULL, inode_u_symlink_count, FLD_COUNT,
TYP_NONE },
{ NULL }
};
const field_t inode_a_flds[] = {
{ "bmbt", FLDT_BMROOTA, NULL, inode_a_bmbt_count, FLD_COUNT, TYP_NONE },
{ "bmx", FLDT_BMAPBTAREC, NULL, inode_a_bmx_count, FLD_ARRAY|FLD_COUNT,
TYP_NONE },
{ "sfattr", FLDT_ATTRSHORT, NULL, inode_a_sfattr_count, FLD_COUNT,
TYP_NONE },
{ NULL }
};
static const char *dinode_fmt_name[] =
{ "dev", "local", "extents", "btree", "uuid" };
static const int dinode_fmt_name_size =
sizeof(dinode_fmt_name) / sizeof(dinode_fmt_name[0]);
/*ARGSUSED*/
int
fp_dinode_fmt(
void *obj,
int bit,
int count,
char *fmtstr,
int size,
int arg,
int base,
int array)
{
int bitpos;
xfs_dinode_fmt_t f;
int i;
for (i = 0, bitpos = bit; i < count; i++, bitpos += size) {
f = (xfs_dinode_fmt_t)getbitval(obj, bitpos, size, BVSIGNED);
if (array)
dbprintf("%d:", i + base);
if (f < 0 || f >= dinode_fmt_name_size)
dbprintf("%d", (int)f);
else
dbprintf("%d (%s)", (int)f, dinode_fmt_name[(int)f]);
if (i < count - 1)
dbprintf(" ");
}
return 1;
}
static int
inode_a_bmbt_count(
void *obj,
int startoff)
{
xfs_dinode_t *dip;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
dip = obj;
if (!XFS_DFORK_Q(dip))
return 0;
ASSERT((char *)XFS_DFORK_APTR(dip) - (char *)dip == byteize(startoff));
return dip->di_aformat == XFS_DINODE_FMT_BTREE;
}
static int
inode_a_bmx_count(
void *obj,
int startoff)
{
xfs_dinode_t *dip;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
dip = obj;
if (!XFS_DFORK_Q(dip))
return 0;
ASSERT((char *)XFS_DFORK_APTR(dip) - (char *)dip == byteize(startoff));
return dip->di_aformat == XFS_DINODE_FMT_EXTENTS ?
be16_to_cpu(dip->di_anextents) : 0;
}
static int
inode_a_count(
void *obj,
int startoff)
{
xfs_dinode_t *dip;
ASSERT(startoff == 0);
dip = obj;
return XFS_DFORK_Q(dip);
}
static int
inode_a_offset(
void *obj,
int startoff,
int idx)
{
xfs_dinode_t *dip;
ASSERT(startoff == 0);
ASSERT(idx == 0);
dip = obj;
ASSERT(XFS_DFORK_Q(dip));
return bitize((int)((char *)XFS_DFORK_APTR(dip) - (char *)dip));
}
static int
inode_a_sfattr_count(
void *obj,
int startoff)
{
xfs_dinode_t *dip;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
dip = obj;
if (!XFS_DFORK_Q(dip))
return 0;
ASSERT((char *)XFS_DFORK_APTR(dip) - (char *)dip == byteize(startoff));
return dip->di_aformat == XFS_DINODE_FMT_LOCAL;
}
int
inode_a_size(
void *obj,
int startoff,
int idx)
{
xfs_attr_shortform_t *asf;
xfs_dinode_t *dip;
ASSERT(startoff == 0);
ASSERT(idx == 0);
dip = obj;
switch (dip->di_aformat) {
case XFS_DINODE_FMT_LOCAL:
asf = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip);
return bitize(be16_to_cpu(asf->hdr.totsize));
case XFS_DINODE_FMT_EXTENTS:
return (int)be16_to_cpu(dip->di_anextents) *
bitsz(xfs_bmbt_rec_t);
case XFS_DINODE_FMT_BTREE:
return bitize((int)XFS_DFORK_ASIZE(dip, mp));
default:
return 0;
}
}
static int
inode_core_nlinkv1_count(
void *obj,
int startoff)
{
xfs_dinode_t *dic;
ASSERT(startoff == 0);
ASSERT(obj == iocur_top->data);
dic = obj;
return dic->di_version == 1;
}
static int
inode_core_nlinkv2_count(
void *obj,
int startoff)
{
xfs_dinode_t *dic;
ASSERT(startoff == 0);
ASSERT(obj == iocur_top->data);
dic = obj;
return dic->di_version >= 2;
}
static int
inode_core_onlink_count(
void *obj,
int startoff)
{
xfs_dinode_t *dic;
ASSERT(startoff == 0);
ASSERT(obj == iocur_top->data);
dic = obj;
return dic->di_version >= 2;
}
static int
inode_core_projid_count(
void *obj,
int startoff)
{
xfs_dinode_t *dic;
ASSERT(startoff == 0);
ASSERT(obj == iocur_top->data);
dic = obj;
return dic->di_version >= 2;
}
static int
inode_f(
int argc,
char **argv)
{
xfs_ino_t ino;
char *p;
if (argc > 1) {
ino = strtoull(argv[1], &p, 0);
if (*p != '\0') {
dbprintf(_("bad value for inode number %s\n"), argv[1]);
return 0;
}
set_cur_inode(ino);
} else if (iocur_top->ino == NULLFSINO)
dbprintf(_("no current inode\n"));
else
dbprintf(_("current inode number is %lld\n"), iocur_top->ino);
return 0;
}
void
inode_init(void)
{
add_command(&inode_cmd);
}
typnm_t
inode_next_type(void)
{
switch (iocur_top->mode & S_IFMT) {
case S_IFDIR:
return TYP_DIR2;
case S_IFLNK:
return TYP_SYMLINK;
case S_IFREG:
if (iocur_top->ino == mp->m_sb.sb_rbmino)
return TYP_RTBITMAP;
else if (iocur_top->ino == mp->m_sb.sb_rsumino)
return TYP_RTSUMMARY;
else if (iocur_top->ino == mp->m_sb.sb_uquotino ||
iocur_top->ino == mp->m_sb.sb_gquotino ||
iocur_top->ino == mp->m_sb.sb_pquotino)
return TYP_DQBLK;
else
return TYP_DATA;
default:
return TYP_NONE;
}
}
int
inode_size(
void *obj,
int startoff,
int idx)
{
return bitize(mp->m_sb.sb_inodesize);
}
static int
inode_u_offset(
void *obj,
int startoff,
int idx)
{
xfs_dinode_t *dip;
ASSERT(startoff == 0);
ASSERT(idx == 0);
dip = obj;
return bitize((int)((char *)XFS_DFORK_DPTR(dip) - (char *)dip));
}
static int
inode_u_bmbt_count(
void *obj,
int startoff)
{
xfs_dinode_t *dip;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
dip = obj;
ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff));
return dip->di_format == XFS_DINODE_FMT_BTREE;
}
static int
inode_u_bmx_count(
void *obj,
int startoff)
{
xfs_dinode_t *dip;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
dip = obj;
ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff));
return dip->di_format == XFS_DINODE_FMT_EXTENTS ?
be32_to_cpu(dip->di_nextents) : 0;
}
static int
inode_u_c_count(
void *obj,
int startoff)
{
xfs_dinode_t *dip;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
dip = obj;
ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff));
return dip->di_format == XFS_DINODE_FMT_LOCAL &&
(be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFREG ?
(int)be64_to_cpu(dip->di_size) : 0;
}
static int
inode_u_dev_count(
void *obj,
int startoff)
{
xfs_dinode_t *dip;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
dip = obj;
ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff));
return dip->di_format == XFS_DINODE_FMT_DEV;
}
static int
inode_u_muuid_count(
void *obj,
int startoff)
{
xfs_dinode_t *dip;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
dip = obj;
ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff));
return dip->di_format == XFS_DINODE_FMT_UUID;
}
static int
inode_u_sfdir2_count(
void *obj,
int startoff)
{
xfs_dinode_t *dip;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
dip = obj;
ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff));
return dip->di_format == XFS_DINODE_FMT_LOCAL &&
(be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFDIR &&
!xfs_sb_version_hasftype(&mp->m_sb);
}
static int
inode_u_sfdir3_count(
void *obj,
int startoff)
{
xfs_dinode_t *dip;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
dip = obj;
ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff));
return dip->di_format == XFS_DINODE_FMT_LOCAL &&
(be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFDIR &&
xfs_sb_version_hasftype(&mp->m_sb);
}
int
inode_u_size(
void *obj,
int startoff,
int idx)
{
xfs_dinode_t *dip;
ASSERT(startoff == 0);
ASSERT(idx == 0);
dip = obj;
switch (dip->di_format) {
case XFS_DINODE_FMT_DEV:
return bitsz(xfs_dev_t);
case XFS_DINODE_FMT_LOCAL:
return bitize((int)be64_to_cpu(dip->di_size));
case XFS_DINODE_FMT_EXTENTS:
return (int)be32_to_cpu(dip->di_nextents) *
bitsz(xfs_bmbt_rec_t);
case XFS_DINODE_FMT_BTREE:
return bitize((int)XFS_DFORK_DSIZE(dip, mp));
case XFS_DINODE_FMT_UUID:
return bitsz(uuid_t);
default:
return 0;
}
}
static int
inode_u_symlink_count(
void *obj,
int startoff)
{
xfs_dinode_t *dip;
ASSERT(bitoffs(startoff) == 0);
ASSERT(obj == iocur_top->data);
dip = obj;
ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff));
return dip->di_format == XFS_DINODE_FMT_LOCAL &&
(be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFLNK ?
(int)be64_to_cpu(dip->di_size) : 0;
}
/*
* We are now using libxfs for our IO backend, so we should always try to use
* inode cluster buffers rather than filesystem block sized buffers for reading
* inodes. This means that we always use the same buffers as libxfs operations
* does, and that avoids buffer cache issues caused by overlapping buffers. This
* can be seen clearly when trying to read the root inode. Much of this logic is
* similar to libxfs_imap().
*/
void
set_cur_inode(
xfs_ino_t ino)
{
xfs_agblock_t agbno;
xfs_agino_t agino;
xfs_agnumber_t agno;
xfs_dinode_t *dip;
int offset;
int numblks = blkbb;
xfs_agblock_t cluster_agbno;
agno = XFS_INO_TO_AGNO(mp, ino);
agino = XFS_INO_TO_AGINO(mp, ino);
agbno = XFS_AGINO_TO_AGBNO(mp, agino);
offset = XFS_AGINO_TO_OFFSET(mp, agino);
if (agno >= mp->m_sb.sb_agcount || agbno >= mp->m_sb.sb_agblocks ||
offset >= mp->m_sb.sb_inopblock ||
XFS_AGINO_TO_INO(mp, agno, agino) != ino) {
dbprintf(_("bad inode number %lld\n"), ino);
return;
}
cur_agno = agno;
if (mp->m_inode_cluster_size > mp->m_sb.sb_blocksize &&
mp->m_inoalign_mask) {
xfs_agblock_t chunk_agbno;
xfs_agblock_t offset_agbno;
int blks_per_cluster;
blks_per_cluster = mp->m_inode_cluster_size >>
mp->m_sb.sb_blocklog;
offset_agbno = agbno & mp->m_inoalign_mask;
chunk_agbno = agbno - offset_agbno;
cluster_agbno = chunk_agbno +
((offset_agbno / blks_per_cluster) * blks_per_cluster);
offset += ((agbno - cluster_agbno) * mp->m_sb.sb_inopblock);
numblks = XFS_FSB_TO_BB(mp, blks_per_cluster);
} else
cluster_agbno = agbno;
/*
* First set_cur to the block with the inode
* then use off_cur to get the right part of the buffer.
*/
ASSERT(typtab[TYP_INODE].typnm == TYP_INODE);
/* ingore ring update here, do it explicitly below */
set_cur(&typtab[TYP_INODE], XFS_AGB_TO_DADDR(mp, agno, cluster_agbno),
numblks, DB_RING_IGN, NULL);
off_cur(offset << mp->m_sb.sb_inodelog, mp->m_sb.sb_inodesize);
if (!iocur_top->data)
return;
dip = iocur_top->data;
iocur_top->ino_buf = 1;
iocur_top->ino = ino;
iocur_top->mode = be16_to_cpu(dip->di_mode);
if ((iocur_top->mode & S_IFMT) == S_IFDIR)
iocur_top->dirino = ino;
if (xfs_sb_version_hascrc(&mp->m_sb)) {
iocur_top->ino_crc_ok = libxfs_verify_cksum((char *)dip,
mp->m_sb.sb_inodesize,
XFS_DINODE_CRC_OFF);
if (!iocur_top->ino_crc_ok)
dbprintf(
_("Metadata CRC error detected for ino %lld\n"),
ino);
}
/* track updated info in ring */
ring_add();
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/inode.h 0000664 0000000 0000000 00000002751 12560572026 014466 0 ustar /*
* Copyright (c) 2000-2001 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern const struct field inode_a_flds[];
extern const struct field inode_core_flds[];
extern const struct field inode_v3_flds[];
extern const struct field inode_flds[];
extern const struct field inode_crc_flds[];
extern const struct field inode_hfld[];
extern const struct field inode_crc_hfld[];
extern const struct field inode_u_flds[];
extern const struct field timestamp_flds[];
extern int fp_dinode_fmt(void *obj, int bit, int count, char *fmtstr,
int size, int arg, int base, int array);
extern int inode_a_size(void *obj, int startoff, int idx);
extern void inode_init(void);
extern typnm_t inode_next_type(void);
extern int inode_size(void *obj, int startoff, int idx);
extern int inode_u_size(void *obj, int startoff, int idx);
extern void set_cur_inode(xfs_ino_t ino);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/input.c 0000664 0000000 0000000 00000013500 12574431650 014516 0 ustar /*
* Copyright (c) 2000-2003 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include
#include "command.h"
#include "input.h"
#include "output.h"
#include "sig.h"
#include "malloc.h"
#include "init.h"
#if defined(ENABLE_READLINE)
# include
# include
#elif defined(ENABLE_EDITLINE)
# include
#endif
int inputstacksize;
FILE **inputstack;
FILE *curinput;
static void popfile(void);
static int source_f(int argc, char **argv);
static const cmdinfo_t source_cmd =
{ "source", NULL, source_f, 1, 1, 0, N_("source-file"),
N_("get commands from source-file"), NULL };
/* our homegrown strtok that understands strings */
static char *
tokenize(
char *inp)
{
static char *last_place = NULL;
char *start;
char *walk;
int in_string = 0;
int in_escape = 0;
if (inp) {
start = inp;
} else {
if (last_place == NULL)
return NULL;
/* we're done */
if (*last_place != '\0')
return NULL;
start = last_place + 1;
}
last_place = NULL;
/* eat whitespace */
while (*start == ' ' || *start == '\t')
start++;
walk = start;
for (;*walk != '\0'; walk++) {
if (in_escape) {
in_escape = 0;
continue;
}
if (*walk == '\\')
in_escape = 1;
else if (*walk == '\"')
in_string ^= 1;
if (!in_string && !in_escape &&
(*walk == ' ' || *walk == '\t')) {
last_place = walk;
*last_place = '\0';
break;
}
}
if (walk == start)
return NULL;
return start;
}
char **
breakline(
char *input,
int *count)
{
int c;
char *inp;
char *p;
char **rval;
c = 0;
inp = input;
rval = xcalloc(sizeof(char *), 1);
for (;;) {
p = tokenize(inp);
if (p == NULL)
break;
inp = NULL;
c++;
rval = xrealloc(rval, sizeof(*rval) * (c + 1));
rval[c - 1] = p;
rval[c] = NULL;
}
*count = c;
return rval;
}
void
doneline(
char *input,
char **vec)
{
xfree(input);
xfree(vec);
}
static char *
get_prompt(void)
{
static char prompt[FILENAME_MAX + 1];
if (!prompt[0])
snprintf(prompt, sizeof(prompt), "%s> ", progname);
return prompt;
}
static char *
fetchline_internal(void)
{
char buf[1024];
int iscont;
size_t len;
size_t rlen;
char *rval;
rval = NULL;
for (rlen = iscont = 0; ; ) {
if (inputstacksize == 1) {
if (iscont)
dbprintf("... ");
else
dbprintf(get_prompt(), progname);
fflush(stdin);
}
if (seenint() ||
(!fgets(buf, sizeof(buf), curinput) &&
ferror(curinput) && seenint())) {
clearint();
dbprintf("^C\n");
clearerr(curinput);
if (iscont) {
iscont = 0;
rlen = 0;
if (rval) {
xfree(rval);
rval = NULL;
}
}
continue;
}
if (ferror(curinput) || feof(curinput) ||
(len = strlen(buf)) == 0) {
popfile();
if (curinput == NULL) {
dbprintf("\n");
return NULL;
}
iscont = 0;
rlen = 0;
if (rval) {
xfree(rval);
rval = NULL;
}
continue;
}
if (inputstacksize == 1)
logprintf("%s", buf);
rval = xrealloc(rval, rlen + len + 1);
if (rlen == 0)
rval[0] = '\0';
rlen += len;
strcat(rval, buf);
if (buf[len - 1] == '\n') {
if (len > 1 && buf[len - 2] == '\\') {
rval[rlen - 2] = ' ';
rval[rlen - 1] = '\0';
rlen--;
iscont = 1;
} else {
rval[rlen - 1] = '\0';
rlen--;
break;
}
}
}
return rval;
}
#ifdef ENABLE_READLINE
char *
fetchline(void)
{
char *line;
if (inputstacksize == 1) {
line = readline(get_prompt());
if (line && *line) {
add_history(line);
logprintf("%s", line);
}
} else {
line = fetchline_internal();
}
return line;
}
#elif defined(ENABLE_EDITLINE)
static char *el_get_prompt(EditLine *e) { return get_prompt(); }
char *
fetchline(void)
{
static EditLine *el;
static History *hist;
HistEvent hevent;
char *line;
int count;
if (!el) {
hist = history_init();
history(hist, &hevent, H_SETSIZE, 100);
el = el_init(progname, stdin, stdout, stderr);
el_source(el, NULL);
el_set(el, EL_SIGNAL, 1);
el_set(el, EL_PROMPT, el_get_prompt);
el_set(el, EL_HIST, history, (const char *)hist);
}
if (inputstacksize == 1) {
line = xstrdup(el_gets(el, &count));
if (line) {
if (count > 0)
line[count-1] = '\0';
if (*line) {
history(hist, &hevent, H_ENTER, line);
logprintf("%s", line);
}
}
} else {
line = fetchline_internal();
}
return line;
}
#else
char * fetchline(void) { return fetchline_internal(); }
#endif
static void
popfile(void)
{
if (inputstacksize == 0) {
curinput = NULL;
return;
}
if (curinput != stdin)
fclose(curinput);
inputstacksize--;
if (inputstacksize) {
inputstack =
xrealloc(inputstack, inputstacksize * sizeof(*inputstack));
curinput = inputstack[inputstacksize - 1];
} else {
free(inputstack);
curinput = NULL;
inputstack = NULL;
}
}
void
pushfile(
FILE *file)
{
inputstack =
xrealloc(inputstack,
(inputstacksize + 1) * sizeof(*inputstack));
inputstacksize++;
curinput = inputstack[inputstacksize - 1] = file;
}
/* ARGSUSED */
static int
source_f(
int argc,
char **argv)
{
FILE *f;
f = fopen(argv[1], "r");
if (f == NULL)
dbprintf(_("can't open %s\n"), argv[0]);
else
pushfile(f);
return 0;
}
void
input_init(void)
{
add_command(&source_cmd);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/input.h 0000664 0000000 0000000 00000001627 12560572026 014530 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern char **breakline(char *input, int *count);
extern void doneline(char *input, char **vec);
extern char *fetchline(void);
extern void input_init(void);
extern void pushfile(FILE *file);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/io.c 0000664 0000000 0000000 00000032727 12574431650 014002 0 ustar /*
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "command.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "inode.h"
#include "io.h"
#include "output.h"
#include "init.h"
#include "malloc.h"
static int pop_f(int argc, char **argv);
static void pop_help(void);
static int push_f(int argc, char **argv);
static void push_help(void);
static int stack_f(int argc, char **argv);
static void stack_help(void);
static int forward_f(int argc, char **argv);
static void forward_help(void);
static int back_f(int argc, char **argv);
static void back_help(void);
static int ring_f(int argc, char **argv);
static void ring_help(void);
static const cmdinfo_t pop_cmd =
{ "pop", NULL, pop_f, 0, 0, 0, NULL,
N_("pop location from the stack"), pop_help };
static const cmdinfo_t push_cmd =
{ "push", NULL, push_f, 0, 2, 0, N_("[command]"),
N_("push location to the stack"), push_help };
static const cmdinfo_t stack_cmd =
{ "stack", NULL, stack_f, 0, 0, 0, NULL,
N_("view the location stack"), stack_help };
static const cmdinfo_t forward_cmd =
{ "forward", "f", forward_f, 0, 0, 0, NULL,
N_("move forward to next entry in the position ring"), forward_help };
static const cmdinfo_t back_cmd =
{ "back", "b", back_f, 0, 0, 0, NULL,
N_("move to the previous location in the position ring"), back_help };
static const cmdinfo_t ring_cmd =
{ "ring", NULL, ring_f, 0, 1, 0, NULL,
N_("show position ring or move to a specific entry"), ring_help };
iocur_t *iocur_base;
iocur_t *iocur_top;
int iocur_sp = -1;
int iocur_len;
#define RING_ENTRIES 20
static iocur_t iocur_ring[RING_ENTRIES];
static int ring_head = -1;
static int ring_tail = -1;
static int ring_current = -1;
void
io_init(void)
{
add_command(&pop_cmd);
add_command(&push_cmd);
add_command(&stack_cmd);
add_command(&forward_cmd);
add_command(&back_cmd);
add_command(&ring_cmd);
}
void
off_cur(
int off,
int len)
{
if (iocur_top == NULL || off + len > BBTOB(iocur_top->blen))
dbprintf(_("can't set block offset to %d\n"), off);
else {
iocur_top->boff = off;
iocur_top->off = ((xfs_off_t)iocur_top->bb << BBSHIFT) + off;
iocur_top->len = len;
iocur_top->data = (void *)((char *)iocur_top->buf + off);
}
}
void
pop_cur(void)
{
if (iocur_sp < 0) {
dbprintf(_("can't pop anything from I/O stack\n"));
return;
}
if (iocur_top->bp) {
libxfs_putbuf(iocur_top->bp);
iocur_top->bp = NULL;
}
if (iocur_top->bbmap) {
free(iocur_top->bbmap);
iocur_top->bbmap = NULL;
}
if (--iocur_sp >= 0) {
iocur_top = iocur_base + iocur_sp;
cur_typ = iocur_top->typ;
} else {
iocur_top = iocur_base;
iocur_sp = 0;
}
}
/*ARGSUSED*/
static int
pop_f(
int argc,
char **argv)
{
pop_cur();
return 0;
}
static void
pop_help(void)
{
dbprintf(_(
"\n"
" Changes the address and data type to the first entry on the stack.\n"
"\n"
));
}
void
print_iocur(
char *tag,
iocur_t *ioc)
{
int i;
dbprintf("%s\n", tag);
dbprintf(_("\tbyte offset %lld, length %d\n"), ioc->off, ioc->len);
dbprintf(_("\tbuffer block %lld (fsbno %lld), %d bb%s\n"), ioc->bb,
(xfs_fsblock_t)XFS_DADDR_TO_FSB(mp, ioc->bb), ioc->blen,
ioc->blen == 1 ? "" : "s");
if (ioc->bbmap) {
dbprintf(_("\tblock map"));
for (i = 0; i < ioc->bbmap->nmaps; i++)
dbprintf(" %lld:%d", ioc->bbmap->b[i].bm_bn,
ioc->bbmap->b[i].bm_len);
dbprintf("\n");
}
dbprintf(_("\tinode %lld, dir inode %lld, type %s\n"), ioc->ino,
ioc->dirino, ioc->typ == NULL ? _("none") : ioc->typ->name);
}
void
print_ring(void)
{
int i;
iocur_t *ioc;
if (ring_current == -1) {
dbprintf(_("no entries in location ring.\n"));
return;
}
dbprintf(_(" type bblock bblen fsbno inode\n"));
i = ring_head;
for (;;) {
ioc = &iocur_ring[i];
if (i == ring_current)
printf("*%2d: ", i);
else
printf(" %2d: ", i);
dbprintf("%-7.7s %8lld %5d %8lld %9lld\n",
ioc->typ == NULL ? "none" : ioc->typ->name,
ioc->bb,
ioc->blen,
(xfs_fsblock_t)XFS_DADDR_TO_FSB(mp, ioc->bb),
ioc->ino
);
if (i == ring_tail)
break;
i = (i+(RING_ENTRIES-1))%RING_ENTRIES;
}
}
void
push_cur(void)
{
if (iocur_sp + 1 >= iocur_len) {
iocur_base = xrealloc(iocur_base,
sizeof(*iocur_base) * (iocur_len + 1));
iocur_len++;
}
iocur_sp++;
iocur_top = iocur_base + iocur_sp;
memset(iocur_top, 0, sizeof(*iocur_base));
iocur_top->ino = iocur_sp > 0 ? iocur_top[-1].ino : NULLFSINO;
iocur_top->dirino = iocur_sp > 0 ? iocur_top[-1].dirino : NULLFSINO;
iocur_top->mode = iocur_sp > 0 ? iocur_top[-1].mode : 0;
cur_typ = NULL;
}
static int
push_f(
int argc,
char **argv)
{
const cmdinfo_t *ct;
if (argc > 1) {
/* check we can execute command */
ct = find_command(argv[1]);
if (ct == NULL) {
dbprintf(_("no such command %s\n"), argv[1]);
return 0;
}
if (!ct->canpush) {
dbprintf(_("no push form allowed for %s\n"), argv[1]);
return 0;
}
}
/* save current state */
push_cur();
if (iocur_top[-1].typ && iocur_top[-1].typ->typnm == TYP_INODE)
set_cur_inode(iocur_top[-1].ino);
else
set_cur(iocur_top[-1].typ, iocur_top[-1].bb,
iocur_top[-1].blen, DB_RING_IGN,
iocur_top[-1].bbmap);
/* run requested command */
if (argc>1)
(void)command(argc-1, argv+1);
return 0;
}
static void
push_help(void)
{
dbprintf(_(
"\n"
" Allows you to push the current address and data type on the stack for\n"
" later return. 'push' also accepts an additional command to execute after\n"
" storing the current address (ex: 'push a rootino' from the superblock).\n"
"\n"
));
}
/* move forward through the ring */
/* ARGSUSED */
static int
forward_f(
int argc,
char **argv)
{
if (ring_current == -1) {
dbprintf(_("ring is empty\n"));
return 0;
}
if (ring_current == ring_head) {
dbprintf(_("no further entries\n"));
return 0;
}
ring_current = (ring_current+1)%RING_ENTRIES;
set_cur(iocur_ring[ring_current].typ,
iocur_ring[ring_current].bb,
iocur_ring[ring_current].blen,
DB_RING_IGN,
iocur_ring[ring_current].bbmap);
return 0;
}
static void
forward_help(void)
{
dbprintf(_(
"\n"
" The 'forward' ('f') command moves to the next location in the position\n"
" ring, updating the current position and data type. If the current location\n"
" is the top entry in the ring, then the 'forward' command will have\n"
" no effect.\n"
"\n"
));
}
/* move backwards through the ring */
/* ARGSUSED */
static int
back_f(
int argc,
char **argv)
{
if (ring_current == -1) {
dbprintf(_("ring is empty\n"));
return 0;
}
if (ring_current == ring_tail) {
dbprintf(_("no previous entries\n"));
return 0;
}
ring_current = (ring_current+(RING_ENTRIES-1))%RING_ENTRIES;
set_cur(iocur_ring[ring_current].typ,
iocur_ring[ring_current].bb,
iocur_ring[ring_current].blen,
DB_RING_IGN,
iocur_ring[ring_current].bbmap);
return 0;
}
static void
back_help(void)
{
dbprintf(_(
"\n"
" The 'back' ('b') command moves to the previous location in the position\n"
" ring, updating the current position and data type. If the current location\n"
" is the last entry in the ring, then the 'back' command will have no effect.\n"
"\n"
));
}
/* show or go to specific point in ring */
static int
ring_f(
int argc,
char **argv)
{
int index;
if (argc == 1) {
print_ring();
return 0;
}
index = (int)strtoul(argv[1], NULL, 0);
if (index < 0 || index >= RING_ENTRIES) {
dbprintf(_("invalid entry: %d\n"), index);
return 0;
}
ring_current = index;
set_cur(iocur_ring[index].typ,
iocur_ring[index].bb,
iocur_ring[index].blen,
DB_RING_IGN,
iocur_ring[index].bbmap);
return 0;
}
static void
ring_help(void)
{
dbprintf(_(
"\n"
" The position ring automatically keeps track of each disk location and\n"
" structure type for each change of position you make during your xfs_db\n"
" session. The last %d most recent entries are kept in the ring.\n"
"\n"
" To display the current list of ring entries type 'ring' by itself on\n"
" the command line. The entry highlighted by an asterisk ('*') is the\n"
" current entry.\n"
"\n"
" To move to another entry in the ring type 'ring ' where is\n"
" your desired entry from the ring position list.\n"
"\n"
" You may also use the 'forward' ('f') or 'back' ('b') commands to move\n"
" to the previous or next entry in the ring, respectively.\n"
"\n"
" Note: Unlike the 'stack', 'push' and 'pop' commands, the ring tracks your\n"
" location implicitly. Use the 'push' and 'pop' commands if you wish to\n"
" store a specific location explicitly for later return.\n"
"\n"),
RING_ENTRIES);
}
void
ring_add(void)
{
if (ring_head == -1) {
/* only get here right after startup */
ring_head = 0;
ring_tail = 0;
ring_current = 0;
iocur_ring[0] = *iocur_top;
} else {
if (ring_current == ring_head) {
ring_head = (ring_head+1)%RING_ENTRIES;
iocur_ring[ring_head] = *iocur_top;
if (ring_head == ring_tail)
ring_tail = (ring_tail+1)%RING_ENTRIES;
ring_current = ring_head;
} else {
ring_current = (ring_current+1)%RING_ENTRIES;
iocur_ring[ring_current] = *iocur_top;
}
}
}
static void
write_cur_buf(void)
{
int ret;
ret = -libxfs_writebufr(iocur_top->bp);
if (ret != 0)
dbprintf(_("write error: %s\n"), strerror(ret));
/* re-read buffer from disk */
ret = -libxfs_readbufr(mp->m_ddev_targp, iocur_top->bb, iocur_top->bp,
iocur_top->blen, 0);
if (ret != 0)
dbprintf(_("read error: %s\n"), strerror(ret));
}
static void
write_cur_bbs(void)
{
int ret;
ret = -libxfs_writebufr(iocur_top->bp);
if (ret != 0)
dbprintf(_("write error: %s\n"), strerror(ret));
/* re-read buffer from disk */
ret = -libxfs_readbufr_map(mp->m_ddev_targp, iocur_top->bp, 0);
if (ret != 0)
dbprintf(_("read error: %s\n"), strerror(ret));
}
void
xfs_dummy_verify(
struct xfs_buf *bp)
{
return;
}
void
write_cur(void)
{
if (iocur_sp < 0) {
dbprintf(_("nothing to write\n"));
return;
}
if (xfs_sb_version_hascrc(&mp->m_sb) && iocur_top->ino_buf) {
libxfs_dinode_calc_crc(mp, iocur_top->data);
iocur_top->ino_crc_ok = 1;
}
if (iocur_top->dquot_buf)
xfs_update_cksum(iocur_top->data, sizeof(struct xfs_dqblk),
XFS_DQUOT_CRC_OFF);
if (iocur_top->bbmap)
write_cur_bbs();
else
write_cur_buf();
}
void
set_cur(
const typ_t *t,
__int64_t d,
int c,
int ring_flag,
bbmap_t *bbmap)
{
struct xfs_buf *bp;
xfs_ino_t dirino;
xfs_ino_t ino;
__uint16_t mode;
const struct xfs_buf_ops *ops = t ? t->bops : NULL;
if (iocur_sp < 0) {
dbprintf(_("set_cur no stack element to set\n"));
return;
}
ino = iocur_top->ino;
dirino = iocur_top->dirino;
mode = iocur_top->mode;
pop_cur();
push_cur();
if (bbmap) {
#ifdef DEBUG_BBMAP
int i;
printf(_("xfs_db got a bbmap for %lld\n"), (long long)d);
printf(_("\tblock map"));
for (i = 0; i < bbmap->nmaps; i++)
printf(" %lld:%d", (long long)bbmap->b[i].bm_bn,
bbmap->b[i].bm_len);
printf("\n");
#endif
iocur_top->bbmap = malloc(sizeof(struct bbmap));
if (!iocur_top->bbmap)
return;
memcpy(iocur_top->bbmap, bbmap, sizeof(struct bbmap));
bp = libxfs_readbuf_map(mp->m_ddev_targp, bbmap->b,
bbmap->nmaps, 0, ops);
} else {
bp = libxfs_readbuf(mp->m_ddev_targp, d, c, 0, ops);
iocur_top->bbmap = NULL;
}
/*
* Keep the buffer even if the verifier says it is corrupted.
* We're a diagnostic tool, after all.
*/
if (!bp || (bp->b_error && bp->b_error != -EFSCORRUPTED &&
bp->b_error != -EFSBADCRC))
return;
iocur_top->buf = bp->b_addr;
iocur_top->bp = bp;
if (!ops)
bp->b_flags |= LIBXFS_B_UNCHECKED;
iocur_top->bb = d;
iocur_top->blen = c;
iocur_top->boff = 0;
iocur_top->data = iocur_top->buf;
iocur_top->len = BBTOB(c);
iocur_top->off = d << BBSHIFT;
iocur_top->typ = cur_typ = t;
iocur_top->ino = ino;
iocur_top->dirino = dirino;
iocur_top->mode = mode;
iocur_top->ino_buf = 0;
iocur_top->dquot_buf = 0;
/* store location in ring */
if (ring_flag)
ring_add();
}
void
set_iocur_type(
const typ_t *t)
{
struct xfs_buf *bp = iocur_top->bp;
iocur_top->typ = t;
/* verify the buffer if the type has one. */
if (!bp)
return;
if (!t->bops) {
bp->b_ops = NULL;
bp->b_flags |= LIBXFS_B_UNCHECKED;
return;
}
if (!(bp->b_flags & LIBXFS_B_UPTODATE))
return;
bp->b_error = 0;
bp->b_ops = t->bops;
bp->b_ops->verify_read(bp);
bp->b_flags &= ~LIBXFS_B_UNCHECKED;
}
static void
stack_help(void)
{
dbprintf(_(
"\n"
" The stack is used to explicitly store your location and data type\n"
" for later return. The 'push' operation stores the current address\n"
" and type on the stack, the 'pop' operation returns you to the\n"
" position and datatype of the top entry on the stack.\n"
"\n"
" The 'stack' allows explicit location saves, see 'ring' for implicit\n"
" position tracking.\n"
"\n"
));
}
/*ARGSUSED*/
static int
stack_f(
int argc,
char **argv)
{
int i;
char tagbuf[8];
for (i = iocur_sp; i > 0; i--) {
snprintf(tagbuf, sizeof(tagbuf), "%d: ", i);
print_iocur(tagbuf, &iocur_base[i]);
}
return 0;
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/io.h 0000664 0000000 0000000 00000005242 12574431650 013777 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
struct typ;
#define BBMAP_SIZE (XFS_MAX_BLOCKSIZE / BBSIZE)
typedef struct bbmap {
int nmaps;
struct xfs_buf_map b[BBMAP_SIZE];
} bbmap_t;
typedef struct iocur {
__int64_t bb; /* BB number in filesystem of buf */
int blen; /* length of "buf", bb's */
int boff; /* data - buf */
void *buf; /* base address of buffer */
void *data; /* current interesting data */
xfs_ino_t dirino; /* current directory inode number */
xfs_ino_t ino; /* current inode number */
int len; /* length of "data", bytes */
__uint16_t mode; /* current inode's mode */
xfs_off_t off; /* fs offset of "data" in bytes */
const struct typ *typ; /* type of "data" */
bbmap_t *bbmap; /* map daddr if fragmented */
struct xfs_buf *bp; /* underlying buffer */
int ino_crc_ok:1;
int ino_buf:1;
int dquot_buf:1;
int need_crc:1;
} iocur_t;
#define DB_RING_ADD 1 /* add to ring on set_cur */
#define DB_RING_IGN 0 /* do not add to ring on set_cur */
extern iocur_t *iocur_base; /* base of stack */
extern iocur_t *iocur_top; /* top element of stack */
extern int iocur_sp; /* current top of stack */
extern int iocur_len; /* length of stack array */
extern void io_init(void);
extern void off_cur(int off, int len);
extern void pop_cur(void);
extern void print_iocur(char *tag, iocur_t *ioc);
extern void push_cur(void);
extern int read_buf(__int64_t daddr, int count, void *bufp);
extern void write_cur(void);
extern void set_cur(const struct typ *t, __int64_t d, int c, int ring_add,
bbmap_t *bbmap);
extern void ring_add(void);
extern void set_iocur_type(const struct typ *t);
extern void xfs_dummy_verify(struct xfs_buf *bp);
/*
* returns -1 for unchecked, 0 for bad and 1 for good
*/
static inline int
iocur_crc_valid()
{
if (!iocur_top->bp)
return -1;
if (iocur_top->bp->b_flags & LIBXFS_B_UNCHECKED)
return -1;
return (iocur_top->bp->b_error != -EFSBADCRC &&
(!iocur_top->ino_buf || iocur_top->ino_crc_ok));
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/malloc.c 0000664 0000000 0000000 00000002770 12574431650 014635 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "init.h"
#include "malloc.h"
#include "output.h"
static void
badmalloc(void)
{
dbprintf(_("%s: out of memory\n"), progname);
exit(4);
}
void *
xcalloc(
size_t nelem,
size_t elsize)
{
void *ptr;
ptr = calloc(nelem, elsize);
if (ptr)
return ptr;
badmalloc();
/* NOTREACHED */
return NULL;
}
void
xfree(
void *ptr)
{
free(ptr);
}
void *
xmalloc(
size_t size)
{
void *ptr;
ptr = valloc(size);
if (ptr)
return ptr;
badmalloc();
/* NOTREACHED */
return NULL;
}
void *
xrealloc(
void *ptr,
size_t size)
{
ptr = realloc(ptr, size);
if (ptr || !size)
return ptr;
badmalloc();
/* NOTREACHED */
return NULL;
}
char *
xstrdup(
const char *s1)
{
char *s;
s = strdup(s1);
if (s)
return s;
badmalloc();
/* NOTREACHED */
return NULL;
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/malloc.h 0000664 0000000 0000000 00000001641 12560572026 014634 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void *xcalloc(size_t nelem, size_t elsize);
extern void xfree(void *ptr);
extern void *xmalloc(size_t size);
extern void *xrealloc(void *ptr, size_t size);
extern char *xstrdup(const char *s1);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/metadump.c 0000664 0000000 0000000 00000207342 12625713771 015210 0 ustar /*
* Copyright (c) 2007, 2011 SGI
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "libxlog.h"
#include "bmap.h"
#include "command.h"
#include "metadump.h"
#include "io.h"
#include "output.h"
#include "type.h"
#include "init.h"
#include "sig.h"
#include "xfs_metadump.h"
#include "fprint.h"
#include "faddr.h"
#include "field.h"
#include "dir2.h"
#define DEFAULT_MAX_EXT_SIZE 1000
/*
* It's possible that multiple files in a directory (or attributes
* in a file) produce the same obfuscated name. If that happens, we
* try to create another one. After several rounds of this though,
* we just give up and leave the original name as-is.
*/
#define DUP_MAX 5 /* Max duplicates before we give up */
/* copy all metadata structures to/from a file */
static int metadump_f(int argc, char **argv);
static void metadump_help(void);
/*
* metadump commands issue info/wornings/errors to standard error as
* metadump supports stdout as a destination.
*
* All static functions return zero on failure, while the public functions
* return zero on success.
*/
static const cmdinfo_t metadump_cmd =
{ "metadump", NULL, metadump_f, 0, -1, 0,
N_("[-a] [-e] [-g] [-m max_extent] [-w] [-o] filename"),
N_("dump metadata to a file"), metadump_help };
static FILE *outf; /* metadump file */
static xfs_metablock_t *metablock; /* header + index + buffers */
static __be64 *block_index;
static char *block_buffer;
static int num_indicies;
static int cur_index;
static xfs_ino_t cur_ino;
static int show_progress = 0;
static int stop_on_read_error = 0;
static int max_extent_size = DEFAULT_MAX_EXT_SIZE;
static int obfuscate = 1;
static int zero_stale_data = 1;
static int show_warnings = 0;
static int progress_since_warning = 0;
void
metadump_init(void)
{
add_command(&metadump_cmd);
}
static void
metadump_help(void)
{
dbprintf(_(
"\n"
" The 'metadump' command dumps the known metadata to a compact file suitable\n"
" for compressing and sending to an XFS maintainer for corruption analysis \n"
" or xfs_repair failures.\n\n"
" Options:\n"
" -a -- Copy full metadata blocks without zeroing unused space\n"
" -e -- Ignore read errors and keep going\n"
" -g -- Display dump progress\n"
" -m -- Specify max extent size in blocks to copy (default = %d blocks)\n"
" -o -- Don't obfuscate names and extended attributes\n"
" -w -- Show warnings of bad metadata information\n"
"\n"), DEFAULT_MAX_EXT_SIZE);
}
static void
print_warning(const char *fmt, ...)
{
char buf[200];
va_list ap;
if (seenint())
return;
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
buf[sizeof(buf)-1] = '\0';
fprintf(stderr, "%s%s: %s\n", progress_since_warning ? "\n" : "",
progname, buf);
progress_since_warning = 0;
}
static void
print_progress(const char *fmt, ...)
{
char buf[60];
va_list ap;
FILE *f;
if (seenint())
return;
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
buf[sizeof(buf)-1] = '\0';
f = (outf == stdout) ? stderr : stdout;
fprintf(f, "\r%-59s", buf);
fflush(f);
progress_since_warning = 1;
}
/*
* A complete dump file will have a "zero" entry in the last index block,
* even if the dump is exactly aligned, the last index will be full of
* zeros. If the last index entry is non-zero, the dump is incomplete.
* Correspondingly, the last chunk will have a count < num_indicies.
*
* Return 0 for success, -1 for failure.
*/
static int
write_index(void)
{
/*
* write index block and following data blocks (streaming)
*/
metablock->mb_count = cpu_to_be16(cur_index);
if (fwrite(metablock, (cur_index + 1) << BBSHIFT, 1, outf) != 1) {
print_warning("error writing to file: %s", strerror(errno));
return -errno;
}
memset(block_index, 0, num_indicies * sizeof(__be64));
cur_index = 0;
return 0;
}
/*
* Return 0 for success, -errno for failure.
*/
static int
write_buf_segment(
char *data,
__int64_t off,
int len)
{
int i;
int ret;
for (i = 0; i < len; i++, off++, data += BBSIZE) {
block_index[cur_index] = cpu_to_be64(off);
memcpy(&block_buffer[cur_index << BBSHIFT], data, BBSIZE);
if (++cur_index == num_indicies) {
ret = write_index();
if (ret)
return -EIO;
}
}
return 0;
}
/*
* we want to preserve the state of the metadata in the dump - whether it is
* intact or corrupt, so even if the buffer has a verifier attached to it we
* don't want to run it prior to writing the buffer to the metadump image.
*
* The only reason for running the verifier is to recalculate the CRCs on a
* buffer that has been obfuscated. i.e. a buffer than metadump modified itself.
* In this case, we only run the verifier if the buffer was not corrupt to begin
* with so that we don't accidentally correct buffers with CRC or errors in them
* when we are obfuscating them.
*/
static int
write_buf(
iocur_t *buf)
{
struct xfs_buf *bp = buf->bp;
int i;
int ret;
/*
* Run the write verifier to recalculate the buffer CRCs and check
* metadump didn't introduce a new corruption. Warn if the verifier
* failed, but still continue to dump it into the output file.
*/
if (buf->need_crc && bp && bp->b_ops && !bp->b_error) {
bp->b_ops->verify_write(bp);
if (bp->b_error) {
print_warning(
"obfuscation corrupted block at %s bno 0x%llx/0x%x",
bp->b_ops->name,
(long long)bp->b_bn, bp->b_bcount);
}
}
/* handle discontiguous buffers */
if (!buf->bbmap) {
ret = write_buf_segment(buf->data, buf->bb, buf->blen);
if (ret)
return ret;
} else {
int len = 0;
for (i = 0; i < buf->bbmap->nmaps; i++) {
ret = write_buf_segment(buf->data + BBTOB(len),
buf->bbmap->b[i].bm_bn,
buf->bbmap->b[i].bm_len);
if (ret)
return ret;
len += buf->bbmap->b[i].bm_len;
}
}
return seenint() ? -EINTR : 0;
}
static void
zero_btree_node(
struct xfs_btree_block *block,
typnm_t btype)
{
int nrecs;
xfs_bmbt_ptr_t *bpp;
xfs_bmbt_key_t *bkp;
xfs_inobt_ptr_t *ipp;
xfs_inobt_key_t *ikp;
xfs_alloc_ptr_t *app;
xfs_alloc_key_t *akp;
void *zp1, *zp2;
int zlen1, zlen2;
nrecs = be16_to_cpu(block->bb_numrecs);
switch (btype) {
case TYP_BMAPBTA:
case TYP_BMAPBTD:
bkp = XFS_BMBT_KEY_ADDR(mp, block, 1);
bpp = XFS_BMBT_PTR_ADDR(mp, block, 1, mp->m_bmap_dmxr[1]);
zp1 = &bkp[nrecs];
zlen1 = (char *)&bpp[0] - (char *)&bkp[nrecs];
zp2 = &bpp[nrecs];
zlen2 = (char *)block + mp->m_sb.sb_blocksize -
(char *)&bpp[nrecs];
break;
case TYP_INOBT:
case TYP_FINOBT:
ikp = XFS_INOBT_KEY_ADDR(mp, block, 1);
ipp = XFS_INOBT_PTR_ADDR(mp, block, 1, mp->m_inobt_mxr[1]);
zp1 = &ikp[nrecs];
zlen1 = (char *)&ipp[0] - (char *)&ikp[nrecs];
zp2 = &ipp[nrecs];
zlen2 = (char *)block + mp->m_sb.sb_blocksize -
(char *)&ipp[nrecs];
break;
case TYP_BNOBT:
case TYP_CNTBT:
akp = XFS_ALLOC_KEY_ADDR(mp, block, 1);
app = XFS_ALLOC_PTR_ADDR(mp, block, 1, mp->m_alloc_mxr[1]);
zp1 = &akp[nrecs];
zlen1 = (char *)&app[0] - (char *)&akp[nrecs];
zp2 = &app[nrecs];
zlen2 = (char *)block + mp->m_sb.sb_blocksize -
(char *)&app[nrecs];
break;
default:
zp1 = NULL;
break;
}
if (zp1 && zp2) {
/* Zero from end of keys to beginning of pointers */
memset(zp1, 0, zlen1);
/* Zero from end of pointers to end of block */
memset(zp2, 0, zlen2);
}
}
static void
zero_btree_leaf(
struct xfs_btree_block *block,
typnm_t btype)
{
int nrecs;
struct xfs_bmbt_rec *brp;
struct xfs_inobt_rec *irp;
struct xfs_alloc_rec *arp;
void *zp;
int zlen;
nrecs = be16_to_cpu(block->bb_numrecs);
switch (btype) {
case TYP_BMAPBTA:
case TYP_BMAPBTD:
brp = XFS_BMBT_REC_ADDR(mp, block, 1);
zp = &brp[nrecs];
zlen = (char *)block + mp->m_sb.sb_blocksize - (char *)&brp[nrecs];
break;
case TYP_INOBT:
case TYP_FINOBT:
irp = XFS_INOBT_REC_ADDR(mp, block, 1);
zp = &irp[nrecs];
zlen = (char *)block + mp->m_sb.sb_blocksize - (char *)&irp[nrecs];
break;
case TYP_BNOBT:
case TYP_CNTBT:
arp = XFS_ALLOC_REC_ADDR(mp, block, 1);
zp = &arp[nrecs];
zlen = (char *)block + mp->m_sb.sb_blocksize - (char *)&arp[nrecs];
break;
default:
zp = NULL;
break;
}
/* Zero from end of records to end of block */
if (zp && zlen < mp->m_sb.sb_blocksize)
memset(zp, 0, zlen);
}
static void
zero_btree_block(
struct xfs_btree_block *block,
typnm_t btype)
{
int level;
level = be16_to_cpu(block->bb_level);
if (level > 0)
zero_btree_node(block, btype);
else
zero_btree_leaf(block, btype);
}
static int
scan_btree(
xfs_agnumber_t agno,
xfs_agblock_t agbno,
int level,
typnm_t btype,
void *arg,
int (*func)(struct xfs_btree_block *block,
xfs_agnumber_t agno,
xfs_agblock_t agbno,
int level,
typnm_t btype,
void *arg))
{
int rval = 0;
push_cur();
set_cur(&typtab[btype], XFS_AGB_TO_DADDR(mp, agno, agbno), blkbb,
DB_RING_IGN, NULL);
if (iocur_top->data == NULL) {
print_warning("cannot read %s block %u/%u", typtab[btype].name,
agno, agbno);
rval = !stop_on_read_error;
goto pop_out;
}
if (zero_stale_data) {
zero_btree_block(iocur_top->data, btype);
iocur_top->need_crc = 1;
}
if (write_buf(iocur_top))
goto pop_out;
if (!(*func)(iocur_top->data, agno, agbno, level - 1, btype, arg))
goto pop_out;
rval = 1;
pop_out:
pop_cur();
return rval;
}
/* free space tree copy routines */
static int
valid_bno(
xfs_agnumber_t agno,
xfs_agblock_t agbno)
{
if (agno < (mp->m_sb.sb_agcount - 1) && agbno > 0 &&
agbno <= mp->m_sb.sb_agblocks)
return 1;
if (agno == (mp->m_sb.sb_agcount - 1) && agbno > 0 &&
agbno <= (mp->m_sb.sb_dblocks -
(xfs_rfsblock_t)(mp->m_sb.sb_agcount - 1) *
mp->m_sb.sb_agblocks))
return 1;
return 0;
}
static int
scanfunc_freesp(
struct xfs_btree_block *block,
xfs_agnumber_t agno,
xfs_agblock_t agbno,
int level,
typnm_t btype,
void *arg)
{
xfs_alloc_ptr_t *pp;
int i;
int numrecs;
if (level == 0)
return 1;
numrecs = be16_to_cpu(block->bb_numrecs);
if (numrecs > mp->m_alloc_mxr[1]) {
if (show_warnings)
print_warning("invalid numrecs (%u) in %s block %u/%u",
numrecs, typtab[btype].name, agno, agbno);
return 1;
}
pp = XFS_ALLOC_PTR_ADDR(mp, block, 1, mp->m_alloc_mxr[1]);
for (i = 0; i < numrecs; i++) {
if (!valid_bno(agno, be32_to_cpu(pp[i]))) {
if (show_warnings)
print_warning("invalid block number (%u/%u) "
"in %s block %u/%u",
agno, be32_to_cpu(pp[i]),
typtab[btype].name, agno, agbno);
continue;
}
if (!scan_btree(agno, be32_to_cpu(pp[i]), level, btype, arg,
scanfunc_freesp))
return 0;
}
return 1;
}
static int
copy_free_bno_btree(
xfs_agnumber_t agno,
xfs_agf_t *agf)
{
xfs_agblock_t root;
int levels;
root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]);
levels = be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]);
/* validate root and levels before processing the tree */
if (root == 0 || root > mp->m_sb.sb_agblocks) {
if (show_warnings)
print_warning("invalid block number (%u) in bnobt "
"root in agf %u", root, agno);
return 1;
}
if (levels >= XFS_BTREE_MAXLEVELS) {
if (show_warnings)
print_warning("invalid level (%u) in bnobt root "
"in agf %u", levels, agno);
return 1;
}
return scan_btree(agno, root, levels, TYP_BNOBT, agf, scanfunc_freesp);
}
static int
copy_free_cnt_btree(
xfs_agnumber_t agno,
xfs_agf_t *agf)
{
xfs_agblock_t root;
int levels;
root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]);
levels = be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]);
/* validate root and levels before processing the tree */
if (root == 0 || root > mp->m_sb.sb_agblocks) {
if (show_warnings)
print_warning("invalid block number (%u) in cntbt "
"root in agf %u", root, agno);
return 1;
}
if (levels >= XFS_BTREE_MAXLEVELS) {
if (show_warnings)
print_warning("invalid level (%u) in cntbt root "
"in agf %u", levels, agno);
return 1;
}
return scan_btree(agno, root, levels, TYP_CNTBT, agf, scanfunc_freesp);
}
/* filename and extended attribute obfuscation routines */
struct name_ent {
struct name_ent *next;
xfs_dahash_t hash;
int namelen;
unsigned char name[1];
};
#define NAME_TABLE_SIZE 4096
static struct name_ent *nametable[NAME_TABLE_SIZE];
static void
nametable_clear(void)
{
int i;
struct name_ent *ent;
for (i = 0; i < NAME_TABLE_SIZE; i++) {
while ((ent = nametable[i])) {
nametable[i] = ent->next;
free(ent);
}
}
}
/*
* See if the given name is already in the name table. If so,
* return a pointer to its entry, otherwise return a null pointer.
*/
static struct name_ent *
nametable_find(xfs_dahash_t hash, int namelen, unsigned char *name)
{
struct name_ent *ent;
for (ent = nametable[hash % NAME_TABLE_SIZE]; ent; ent = ent->next) {
if (ent->hash == hash && ent->namelen == namelen &&
!memcmp(ent->name, name, namelen))
return ent;
}
return NULL;
}
/*
* Add the given name to the name table. Returns a pointer to the
* name's new entry, or a null pointer if an error occurs.
*/
static struct name_ent *
nametable_add(xfs_dahash_t hash, int namelen, unsigned char *name)
{
struct name_ent *ent;
ent = malloc(sizeof *ent + namelen);
if (!ent)
return NULL;
ent->namelen = namelen;
memcpy(ent->name, name, namelen);
ent->hash = hash;
ent->next = nametable[hash % NAME_TABLE_SIZE];
nametable[hash % NAME_TABLE_SIZE] = ent;
return ent;
}
#define is_invalid_char(c) ((c) == '/' || (c) == '\0')
#define rol32(x,y) (((x) << (y)) | ((x) >> (32 - (y))))
static inline unsigned char
random_filename_char(void)
{
static unsigned char filename_alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789-_";
return filename_alphabet[random() % (sizeof filename_alphabet - 1)];
}
#define ORPHANAGE "lost+found"
#define ORPHANAGE_LEN (sizeof (ORPHANAGE) - 1)
static inline int
is_orphanage_dir(
struct xfs_mount *mp,
xfs_ino_t dir_ino,
size_t name_len,
unsigned char *name)
{
return dir_ino == mp->m_sb.sb_rootino &&
name_len == ORPHANAGE_LEN &&
!memcmp(name, ORPHANAGE, ORPHANAGE_LEN);
}
/*
* Determine whether a name is one we shouldn't obfuscate because
* it's an orphan (or the "lost+found" directory itself). Note
* "cur_ino" is the inode for the directory currently being
* processed.
*
* Returns 1 if the name should NOT be obfuscated or 0 otherwise.
*/
static int
in_lost_found(
xfs_ino_t ino,
int namelen,
unsigned char *name)
{
static xfs_ino_t orphanage_ino = 0;
char s[24]; /* 21 is enough (64 bits in decimal) */
int slen;
/* Record the "lost+found" inode if we haven't done so already */
ASSERT(ino != 0);
if (!orphanage_ino && is_orphanage_dir(mp, cur_ino, namelen, name))
orphanage_ino = ino;
/* We don't obfuscate the "lost+found" directory itself */
if (ino == orphanage_ino)
return 1;
/* Most files aren't in "lost+found" at all */
if (cur_ino != orphanage_ino)
return 0;
/*
* Within "lost+found", we don't obfuscate any file whose
* name is the same as its inode number. Any others are
* stray files and can be obfuscated.
*/
slen = snprintf(s, sizeof (s), "%llu", (unsigned long long) ino);
return slen == namelen && !memcmp(name, s, namelen);
}
/*
* Given a name and its hash value, massage the name in such a way
* that the result is another name of equal length which shares the
* same hash value.
*/
static void
obfuscate_name(
xfs_dahash_t hash,
size_t name_len,
unsigned char *name)
{
unsigned char *newp = name;
int i;
xfs_dahash_t new_hash = 0;
unsigned char *first;
unsigned char high_bit;
int shift;
/*
* Our obfuscation algorithm requires at least 5-character
* names, so don't bother if the name is too short. We
* work backward from a hash value to determine the last
* five bytes in a name required to produce a new name
* with the same hash.
*/
if (name_len < 5)
return;
/*
* The beginning of the obfuscated name can be pretty much
* anything, so fill it in with random characters.
* Accumulate its new hash value as we go.
*/
for (i = 0; i < name_len - 5; i++) {
*newp = random_filename_char();
new_hash = *newp ^ rol32(new_hash, 7);
newp++;
}
/*
* Compute which five bytes need to be used at the end of
* the name so the hash of the obfuscated name is the same
* as the hash of the original. If any result in an invalid
* character, flip a bit and arrange for a corresponding bit
* in a neighboring byte to be flipped as well. For the
* last byte, the "neighbor" to change is the first byte
* we're computing here.
*/
new_hash = rol32(new_hash, 3) ^ hash;
first = newp;
high_bit = 0;
for (shift = 28; shift >= 0; shift -= 7) {
*newp = (new_hash >> shift & 0x7f) ^ high_bit;
if (is_invalid_char(*newp)) {
*newp ^= 1;
high_bit = 0x80;
} else
high_bit = 0;
ASSERT(!is_invalid_char(*newp));
newp++;
}
/*
* If we flipped a bit on the last byte, we need to fix up
* the matching bit in the first byte. The result will
* be a valid character, because we know that first byte
* has 0's in its upper four bits (it was produced by a
* 28-bit right-shift of a 32-bit unsigned value).
*/
if (high_bit) {
*first ^= 0x10;
ASSERT(!is_invalid_char(*first));
}
ASSERT(libxfs_da_hashname(name, name_len) == hash);
}
/*
* Flip a bit in each of two bytes at the end of the given name.
* This is used in generating a series of alternate names to be used
* in the event a duplicate is found.
*
* The bits flipped are selected such that they both affect the same
* bit in the name's computed hash value, so flipping them both will
* preserve the hash.
*
* The following diagram aims to show the portion of a computed
* hash that a given byte of a name affects.
*
* 31 28 24 21 14 8 7 3 0
* +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
* hash: | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
* +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
* last-4 ->| |<-- last-2 --->| |<--- last ---->|
* |<-- last-3 --->| |<-- last-1 --->| |<- last-4
* |<-- last-7 --->| |<-- last-5 --->|
* |<-- last-8 --->| |<-- last-6 --->|
* . . . and so on
*
* The last byte of the name directly affects the low-order byte of
* the hash. The next-to-last affects bits 7-14, the next one back
* affects bits 14-21, and so on. The effect wraps around when it
* goes beyond the top of the hash (as happens for byte last-4).
*
* Bits that are flipped together "overlap" on the hash value. As
* an example of overlap, the last two bytes both affect bit 7 in
* the hash. That pair of bytes (and their overlapping bits) can be
* used for this "flip bit" operation (it's the first pair tried,
* actually).
*
* A table defines overlapping pairs--the bytes involved and bits
* within them--that can be used this way. The byte offset is
* relative to a starting point within the name, which will be set
* to affect the bytes at the end of the name. The function is
* called with a "bitseq" value which indicates which bit flip is
* desired, and this translates directly into selecting which entry
* in the bit_to_flip[] table to apply.
*
* The function returns 1 if the operation was successful. It
* returns 0 if the result produced a character that's not valid in
* a name (either '/' or a '\0'). Finally, it returns -1 if the bit
* sequence number is beyond what is supported for a name of this
* length.
*
* Discussion
* ----------
* (Also see the discussion above find_alternate(), below.)
*
* In order to make this function work for any length name, the
* table is ordered by increasing byte offset, so that the earliest
* entries can apply to the shortest strings. This way all names
* are done consistently.
*
* When bit flips occur, they can convert printable characters
* into non-printable ones. In an effort to reduce the impact of
* this, the first bit flips are chosen to affect bytes the end of
* the name (and furthermore, toward the low bits of a byte). Those
* bytes are often non-printable anyway because of the way they are
* initially selected by obfuscate_name()). This is accomplished,
* using later table entries first.
*
* Each row in the table doubles the number of alternates that
* can be generated. A two-byte name is limited to using only
* the first row, so it's possible to generate two alternates
* (the original name, plus the alternate produced by flipping
* the one pair of bits). In a 5-byte name, the effect of the
* first byte overlaps the last by 4 its, and there are 8 bits
* to flip, allowing for 256 possible alternates.
*
* Short names (less than 5 bytes) are never even obfuscated, so for
* such names the relatively small number of alternates should never
* really be a problem.
*
* Long names (more than 6 bytes, say) are not likely to exhaust
* the number of available alternates. In fact, the table could
* probably have stopped at 8 entries, on the assumption that 256
* alternates should be enough for most any situation. The entries
* beyond those are present mostly for demonstration of how it could
* be populated with more entries, should it ever be necessary to do
* so.
*/
static int
flip_bit(
size_t name_len,
unsigned char *name,
uint32_t bitseq)
{
int index;
size_t offset;
unsigned char *p0, *p1;
unsigned char m0, m1;
struct {
int byte; /* Offset from start within name */
unsigned char bit; /* Bit within that byte */
} bit_to_flip[][2] = { /* Sorted by second entry's byte */
{ { 0, 0 }, { 1, 7 } }, /* Each row defines a pair */
{ { 1, 0 }, { 2, 7 } }, /* of bytes and a bit within */
{ { 2, 0 }, { 3, 7 } }, /* each byte. Each bit in */
{ { 0, 4 }, { 4, 0 } }, /* a pair affects the same */
{ { 0, 5 }, { 4, 1 } }, /* bit in the hash, so flipping */
{ { 0, 6 }, { 4, 2 } }, /* both will change the name */
{ { 0, 7 }, { 4, 3 } }, /* while preserving the hash. */
{ { 3, 0 }, { 4, 7 } },
{ { 0, 0 }, { 5, 3 } }, /* The first entry's byte offset */
{ { 0, 1 }, { 5, 4 } }, /* must be less than the second. */
{ { 0, 2 }, { 5, 5 } },
{ { 0, 3 }, { 5, 6 } }, /* The table can be extended to */
{ { 0, 4 }, { 5, 7 } }, /* an arbitrary number of entries */
{ { 4, 0 }, { 5, 7 } }, /* but there's not much point. */
/* . . . */
};
/* Find the first entry *not* usable for name of this length */
for (index = 0; index < ARRAY_SIZE(bit_to_flip); index++)
if (bit_to_flip[index][1].byte >= name_len)
break;
/*
* Back up to the last usable entry. If that number is
* smaller than the bit sequence number, inform the caller
* that nothing this large (or larger) will work.
*/
if (bitseq > --index)
return -1;
/*
* We will be switching bits at the end of name, with a
* preference for affecting the last bytes first. Compute
* where in the name we'll start applying the changes.
*/
offset = name_len - (bit_to_flip[index][1].byte + 1);
index -= bitseq; /* Use later table entries first */
p0 = name + offset + bit_to_flip[index][0].byte;
p1 = name + offset + bit_to_flip[index][1].byte;
m0 = 1 << bit_to_flip[index][0].bit;
m1 = 1 << bit_to_flip[index][1].bit;
/* Only change the bytes if it produces valid characters */
if (is_invalid_char(*p0 ^ m0) || is_invalid_char(*p1 ^ m1))
return 0;
*p0 ^= m0;
*p1 ^= m1;
return 1;
}
/*
* This function generates a well-defined sequence of "alternate"
* names for a given name. An alternate is a name having the same
* length and same hash value as the original name. This is needed
* because the algorithm produces only one obfuscated name to use
* for a given original name, and it's possible that result matches
* a name already seen. This function checks for this, and if it
* occurs, finds another suitable obfuscated name to use.
*
* Each bit in the binary representation of the sequence number is
* used to select one possible "bit flip" operation to perform on
* the name. So for example:
* seq = 0: selects no bits to flip
* seq = 1: selects the 0th bit to flip
* seq = 2: selects the 1st bit to flip
* seq = 3: selects the 0th and 1st bit to flip
* ... and so on.
*
* The flip_bit() function takes care of the details of the bit
* flipping within the name. Note that the "1st bit" in this
* context is a bit sequence number; i.e. it doesn't necessarily
* mean bit 0x02 will be changed.
*
* If a valid name (one that contains no '/' or '\0' characters) is
* produced by this process for the given sequence number, this
* function returns 1. If the result is not valid, it returns 0.
* Returns -1 if the sequence number is beyond the the maximum for
* names of the given length.
*
*
* Discussion
* ----------
* The number of alternates available for a given name is dependent
* on its length. A "bit flip" involves inverting two bits in
* a name--the two bits being selected such that their values
* affect the name's hash value in the same way. Alternates are
* thus generated by inverting the value of pairs of such
* "overlapping" bits in the original name. Each byte after the
* first in a name adds at least one bit of overlap to work with.
* (See comments above flip_bit() for more discussion on this.)
*
* So the number of alternates is dependent on the number of such
* overlapping bits in a name. If there are N bit overlaps, there
* 2^N alternates for that hash value.
*
* Here are the number of overlapping bits available for generating
* alternates for names of specific lengths:
* 1 0 (must have 2 bytes to have any overlap)
* 2 1 One bit overlaps--so 2 possible alternates
* 3 2 Two bits overlap--so 4 possible alternates
* 4 4 Three bits overlap, so 2^3 alternates
* 5 8 8 bits overlap (due to wrapping), 256 alternates
* 6 18 2^18 alternates
* 7 28 2^28 alternates
* ...
* It's clear that the number of alternates grows very quickly with
* the length of the name. But note that the set of alternates
* includes invalid names. And for certain (contrived) names, the
* number of valid names is a fairly small fraction of the total
* number of alternates.
*
* The main driver for this infrastructure for coming up with
* alternate names is really related to names 5 (or possibly 6)
* bytes in length. 5-byte obfuscated names contain no randomly-
* generated bytes in them, and the chance of an obfuscated name
* matching an already-seen name is too high to just ignore. This
* methodical selection of alternates ensures we don't produce
* duplicate names unless we have exhausted our options.
*/
static int
find_alternate(
size_t name_len,
unsigned char *name,
uint32_t seq)
{
uint32_t bitseq = 0;
uint32_t bits = seq;
if (!seq)
return 1; /* alternate 0 is the original name */
if (name_len < 2) /* Must have 2 bytes to flip */
return -1;
for (bitseq = 0; bits; bitseq++) {
uint32_t mask = 1 << bitseq;
int fb;
if (!(bits & mask))
continue;
fb = flip_bit(name_len, name, bitseq);
if (fb < 1)
return fb ? -1 : 0;
bits ^= mask;
}
return 1;
}
/*
* Look up the given name in the name table. If it is already
* present, iterate through a well-defined sequence of alternate
* names and attempt to use an alternate name instead.
*
* Returns 1 if the (possibly modified) name is not present in the
* name table. Returns 0 if the name and all possible alternates
* are already in the table.
*/
static int
handle_duplicate_name(xfs_dahash_t hash, size_t name_len, unsigned char *name)
{
unsigned char new_name[name_len + 1];
uint32_t seq = 1;
if (!nametable_find(hash, name_len, name))
return 1; /* No duplicate */
/* Name is already in use. Need to find an alternate. */
do {
int found;
/* Only change incoming name if we find an alternate */
do {
memcpy(new_name, name, name_len);
found = find_alternate(name_len, new_name, seq++);
if (found < 0)
return 0; /* No more to check */
} while (!found);
} while (nametable_find(hash, name_len, new_name));
/*
* The alternate wasn't in the table already. Pass it back
* to the caller.
*/
memcpy(name, new_name, name_len);
return 1;
}
static void
generate_obfuscated_name(
xfs_ino_t ino,
int namelen,
unsigned char *name)
{
xfs_dahash_t hash;
/*
* We don't obfuscate "lost+found" or any orphan files
* therein. When the name table is used for extended
* attributes, the inode number provided is 0, in which
* case we don't need to make this check.
*/
if (ino && in_lost_found(ino, namelen, name))
return;
/*
* If the name starts with a slash, just skip over it. It
* isn't included in the hash and we don't record it in the
* name table. Note that the namelen value passed in does
* not count the leading slash (if one is present).
*/
if (*name == '/')
name++;
/* Obfuscate the name (if possible) */
hash = libxfs_da_hashname(name, namelen);
obfuscate_name(hash, namelen, name);
/*
* Make sure the name is not something already seen. If we
* fail to find a suitable alternate, we're dealing with a
* very pathological situation, and we may end up creating
* a duplicate name in the metadump, so issue a warning.
*/
if (!handle_duplicate_name(hash, namelen, name)) {
print_warning("duplicate name for inode %llu "
"in dir inode %llu\n",
(unsigned long long) ino,
(unsigned long long) cur_ino);
return;
}
/* Create an entry for the new name in the name table. */
if (!nametable_add(hash, namelen, name))
print_warning("unable to record name for inode %llu "
"in dir inode %llu\n",
(unsigned long long) ino,
(unsigned long long) cur_ino);
}
static void
process_sf_dir(
xfs_dinode_t *dip)
{
struct xfs_dir2_sf_hdr *sfp;
xfs_dir2_sf_entry_t *sfep;
__uint64_t ino_dir_size;
int i;
sfp = (struct xfs_dir2_sf_hdr *)XFS_DFORK_DPTR(dip);
ino_dir_size = be64_to_cpu(dip->di_size);
if (ino_dir_size > XFS_DFORK_DSIZE(dip, mp)) {
ino_dir_size = XFS_DFORK_DSIZE(dip, mp);
if (show_warnings)
print_warning("invalid size in dir inode %llu",
(long long)cur_ino);
}
sfep = xfs_dir2_sf_firstentry(sfp);
for (i = 0; (i < sfp->count) &&
((char *)sfep - (char *)sfp < ino_dir_size); i++) {
/*
* first check for bad name lengths. If they are bad, we
* have limitations to how much can be obfuscated.
*/
int namelen = sfep->namelen;
if (namelen == 0) {
if (show_warnings)
print_warning("zero length entry in dir inode "
"%llu", (long long)cur_ino);
if (i != sfp->count - 1)
break;
namelen = ino_dir_size - ((char *)&sfep->name[0] -
(char *)sfp);
} else if ((char *)sfep - (char *)sfp +
M_DIROPS(mp)->sf_entsize(sfp, sfep->namelen) >
ino_dir_size) {
if (show_warnings)
print_warning("entry length in dir inode %llu "
"overflows space", (long long)cur_ino);
if (i != sfp->count - 1)
break;
namelen = ino_dir_size - ((char *)&sfep->name[0] -
(char *)sfp);
}
if (obfuscate)
generate_obfuscated_name(
M_DIROPS(mp)->sf_get_ino(sfp, sfep),
namelen, &sfep->name[0]);
sfep = (xfs_dir2_sf_entry_t *)((char *)sfep +
M_DIROPS(mp)->sf_entsize(sfp, namelen));
}
/* zero stale data in rest of space in data fork, if any */
if (zero_stale_data && (ino_dir_size < XFS_DFORK_DSIZE(dip, mp)))
memset(sfep, 0, XFS_DFORK_DSIZE(dip, mp) - ino_dir_size);
}
/*
* The pathname may not be null terminated. It may be terminated by the end of
* a buffer or inode literal area, and the start of the next region contains
* unknown data. Therefore, when we get to the last component of the symlink, we
* cannot assume that strlen() will give us the right result. Hence we need to
* track the remaining pathname length and use that instead.
*/
static void
obfuscate_path_components(
char *buf,
__uint64_t len)
{
unsigned char *comp = (unsigned char *)buf;
unsigned char *end = comp + len;
xfs_dahash_t hash;
while (comp < end) {
char *slash;
int namelen;
/* find slash at end of this component */
slash = strchr((char *)comp, '/');
if (!slash) {
/* last (or single) component */
namelen = strnlen((char *)comp, len);
hash = libxfs_da_hashname(comp, namelen);
obfuscate_name(hash, namelen, comp);
break;
}
namelen = slash - (char *)comp;
/* handle leading or consecutive slashes */
if (!namelen) {
comp++;
len--;
continue;
}
hash = libxfs_da_hashname(comp, namelen);
obfuscate_name(hash, namelen, comp);
comp += namelen + 1;
len -= namelen + 1;
}
}
static void
process_sf_symlink(
xfs_dinode_t *dip)
{
__uint64_t len;
char *buf;
len = be64_to_cpu(dip->di_size);
if (len > XFS_DFORK_DSIZE(dip, mp)) {
if (show_warnings)
print_warning("invalid size (%d) in symlink inode %llu",
len, (long long)cur_ino);
len = XFS_DFORK_DSIZE(dip, mp);
}
buf = (char *)XFS_DFORK_DPTR(dip);
if (obfuscate)
obfuscate_path_components(buf, len);
/* zero stale data in rest of space in data fork, if any */
if (zero_stale_data && len < XFS_DFORK_DSIZE(dip, mp))
memset(&buf[len], 0, XFS_DFORK_DSIZE(dip, mp) - len);
}
static void
process_sf_attr(
xfs_dinode_t *dip)
{
/*
* with extended attributes, obfuscate the names and fill the actual
* values with 'v' (to see a valid string length, as opposed to NULLs)
*/
xfs_attr_shortform_t *asfp;
xfs_attr_sf_entry_t *asfep;
int ino_attr_size;
int i;
asfp = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip);
if (asfp->hdr.count == 0)
return;
ino_attr_size = be16_to_cpu(asfp->hdr.totsize);
if (ino_attr_size > XFS_DFORK_ASIZE(dip, mp)) {
ino_attr_size = XFS_DFORK_ASIZE(dip, mp);
if (show_warnings)
print_warning("invalid attr size in inode %llu",
(long long)cur_ino);
}
asfep = &asfp->list[0];
for (i = 0; (i < asfp->hdr.count) &&
((char *)asfep - (char *)asfp < ino_attr_size); i++) {
int namelen = asfep->namelen;
if (namelen == 0) {
if (show_warnings)
print_warning("zero length attr entry in inode "
"%llu", (long long)cur_ino);
break;
} else if ((char *)asfep - (char *)asfp +
XFS_ATTR_SF_ENTSIZE(asfep) > ino_attr_size) {
if (show_warnings)
print_warning("attr entry length in inode %llu "
"overflows space", (long long)cur_ino);
break;
}
if (obfuscate) {
generate_obfuscated_name(0, asfep->namelen,
&asfep->nameval[0]);
memset(&asfep->nameval[asfep->namelen], 'v',
asfep->valuelen);
}
asfep = (xfs_attr_sf_entry_t *)((char *)asfep +
XFS_ATTR_SF_ENTSIZE(asfep));
}
/* zero stale data in rest of space in attr fork, if any */
if (zero_stale_data && (ino_attr_size < XFS_DFORK_ASIZE(dip, mp)))
memset(asfep, 0, XFS_DFORK_ASIZE(dip, mp) - ino_attr_size);
}
static void
process_dir_data_block(
char *block,
xfs_fileoff_t offset,
int is_block_format)
{
/*
* we have to rely on the fileoffset and signature of the block to
* handle it's contents. If it's invalid, leave it alone.
* for multi-fsblock dir blocks, if a name crosses an extent boundary,
* ignore it and continue.
*/
int dir_offset;
char *ptr;
char *endptr;
int end_of_data;
int wantmagic;
struct xfs_dir2_data_hdr *datahdr;
datahdr = (struct xfs_dir2_data_hdr *)block;
if (is_block_format) {
xfs_dir2_leaf_entry_t *blp;
xfs_dir2_block_tail_t *btp;
btp = xfs_dir2_block_tail_p(mp->m_dir_geo, datahdr);
blp = xfs_dir2_block_leaf_p(btp);
if ((char *)blp > (char *)btp)
blp = (xfs_dir2_leaf_entry_t *)btp;
end_of_data = (char *)blp - block;
if (xfs_sb_version_hascrc(&mp->m_sb))
wantmagic = XFS_DIR3_BLOCK_MAGIC;
else
wantmagic = XFS_DIR2_BLOCK_MAGIC;
} else { /* leaf/node format */
end_of_data = mp->m_dir_geo->fsbcount << mp->m_sb.sb_blocklog;
if (xfs_sb_version_hascrc(&mp->m_sb))
wantmagic = XFS_DIR3_DATA_MAGIC;
else
wantmagic = XFS_DIR2_DATA_MAGIC;
}
if (be32_to_cpu(datahdr->magic) != wantmagic) {
if (show_warnings)
print_warning(
"invalid magic in dir inode %llu block %ld",
(long long)cur_ino, (long)offset);
return;
}
dir_offset = M_DIROPS(mp)->data_entry_offset;
ptr = block + dir_offset;
endptr = block + mp->m_dir_geo->blksize;
while (ptr < endptr && dir_offset < end_of_data) {
xfs_dir2_data_entry_t *dep;
xfs_dir2_data_unused_t *dup;
int length;
dup = (xfs_dir2_data_unused_t *)ptr;
if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
int length = be16_to_cpu(dup->length);
if (dir_offset + length > end_of_data ||
!length || (length & (XFS_DIR2_DATA_ALIGN - 1))) {
if (show_warnings)
print_warning(
"invalid length for dir free space in inode %llu",
(long long)cur_ino);
return;
}
if (be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)) !=
dir_offset)
return;
dir_offset += length;
ptr += length;
/*
* Zero the unused space up to the tag - the tag is
* actually at a variable offset, so zeroing &dup->tag
* is zeroing the free space in between
*/
if (zero_stale_data) {
int zlen = length -
sizeof(xfs_dir2_data_unused_t);
if (zlen > 0) {
memset(&dup->tag, 0, zlen);
iocur_top->need_crc = 1;
}
}
if (dir_offset >= end_of_data || ptr >= endptr)
return;
}
dep = (xfs_dir2_data_entry_t *)ptr;
length = M_DIROPS(mp)->data_entsize(dep->namelen);
if (dir_offset + length > end_of_data ||
ptr + length > endptr) {
if (show_warnings)
print_warning(
"invalid length for dir entry name in inode %llu",
(long long)cur_ino);
return;
}
if (be16_to_cpu(*M_DIROPS(mp)->data_entry_tag_p(dep)) !=
dir_offset)
return;
if (obfuscate)
generate_obfuscated_name(be64_to_cpu(dep->inumber),
dep->namelen, &dep->name[0]);
dir_offset += length;
ptr += length;
/* Zero the unused space after name, up to the tag */
if (zero_stale_data) {
/* 1 byte for ftype; don't bother with conditional */
int zlen =
(char *)M_DIROPS(mp)->data_entry_tag_p(dep) -
(char *)&dep->name[dep->namelen] - 1;
if (zlen > 0) {
memset(&dep->name[dep->namelen] + 1, 0, zlen);
iocur_top->need_crc = 1;
}
}
}
}
static void
process_symlink_block(
char *block)
{
char *link = block;
if (xfs_sb_version_hascrc(&(mp)->m_sb))
link += sizeof(struct xfs_dsymlink_hdr);
if (obfuscate)
obfuscate_path_components(link, XFS_SYMLINK_BUF_SPACE(mp,
mp->m_sb.sb_blocksize));
if (zero_stale_data) {
size_t linklen, zlen;
linklen = strlen(link);
zlen = mp->m_sb.sb_blocksize - linklen;
if (xfs_sb_version_hascrc(&mp->m_sb))
zlen -= sizeof(struct xfs_dsymlink_hdr);
if (zlen < mp->m_sb.sb_blocksize)
memset(link + linklen, 0, zlen);
}
}
#define MAX_REMOTE_VALS 4095
static struct attr_data_s {
int remote_val_count;
xfs_dablk_t remote_vals[MAX_REMOTE_VALS];
} attr_data;
static inline void
add_remote_vals(
xfs_dablk_t blockidx,
int length)
{
while (length > 0 && attr_data.remote_val_count < MAX_REMOTE_VALS) {
attr_data.remote_vals[attr_data.remote_val_count] = blockidx;
attr_data.remote_val_count++;
blockidx++;
length -= mp->m_sb.sb_blocksize;
}
if (attr_data.remote_val_count >= MAX_REMOTE_VALS) {
print_warning(
"Overflowed attr obfuscation array. No longer obfuscating remote attrs.");
}
}
/* Handle remote and leaf attributes */
static void
process_attr_block(
char *block,
xfs_fileoff_t offset)
{
struct xfs_attr_leafblock *leaf;
struct xfs_attr3_icleaf_hdr hdr;
int i;
int nentries;
xfs_attr_leaf_entry_t *entry;
xfs_attr_leaf_name_local_t *local;
xfs_attr_leaf_name_remote_t *remote;
__uint32_t bs = mp->m_sb.sb_blocksize;
char *first_name;
leaf = (xfs_attr_leafblock_t *)block;
/* Remote attributes - attr3 has XFS_ATTR3_RMT_MAGIC, attr has none */
if ((be16_to_cpu(leaf->hdr.info.magic) != XFS_ATTR_LEAF_MAGIC) &&
(be16_to_cpu(leaf->hdr.info.magic) != XFS_ATTR3_LEAF_MAGIC)) {
for (i = 0; i < attr_data.remote_val_count; i++) {
if (obfuscate && attr_data.remote_vals[i] == offset)
/* Macros to handle both attr and attr3 */
memset(block +
(bs - XFS_ATTR3_RMT_BUF_SPACE(mp, bs)),
'v', XFS_ATTR3_RMT_BUF_SPACE(mp, bs));
}
return;
}
/* Ok, it's a leaf - get header; accounts for crc & non-crc */
xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &hdr, leaf);
nentries = hdr.count;
if (nentries * sizeof(xfs_attr_leaf_entry_t) +
xfs_attr3_leaf_hdr_size(leaf) >
XFS_ATTR3_RMT_BUF_SPACE(mp, bs)) {
if (show_warnings)
print_warning("invalid attr count in inode %llu",
(long long)cur_ino);
return;
}
entry = xfs_attr3_leaf_entryp(leaf);
/* We will move this as we parse */
first_name = NULL;
for (i = 0; i < nentries; i++, entry++) {
int nlen, vlen, zlen;
/* Grows up; if this name is topmost, move first_name */
if (!first_name || xfs_attr3_leaf_name(leaf, i) < first_name)
first_name = xfs_attr3_leaf_name(leaf, i);
if (be16_to_cpu(entry->nameidx) > mp->m_sb.sb_blocksize) {
if (show_warnings)
print_warning(
"invalid attr nameidx in inode %llu",
(long long)cur_ino);
break;
}
if (entry->flags & XFS_ATTR_LOCAL) {
local = xfs_attr3_leaf_name_local(leaf, i);
if (local->namelen == 0) {
if (show_warnings)
print_warning(
"zero length for attr name in inode %llu",
(long long)cur_ino);
break;
}
if (obfuscate) {
generate_obfuscated_name(0, local->namelen,
&local->nameval[0]);
memset(&local->nameval[local->namelen], 'v',
be16_to_cpu(local->valuelen));
}
/* zero from end of nameval[] to next name start */
nlen = local->namelen;
vlen = be16_to_cpu(local->valuelen);
zlen = xfs_attr_leaf_entsize_local(nlen, vlen) -
(sizeof(xfs_attr_leaf_name_local_t) - 1 +
nlen + vlen);
if (zero_stale_data)
memset(&local->nameval[nlen + vlen], 0, zlen);
} else {
remote = xfs_attr3_leaf_name_remote(leaf, i);
if (remote->namelen == 0 || remote->valueblk == 0) {
if (show_warnings)
print_warning(
"invalid attr entry in inode %llu",
(long long)cur_ino);
break;
}
if (obfuscate) {
generate_obfuscated_name(0, remote->namelen,
&remote->name[0]);
add_remote_vals(be32_to_cpu(remote->valueblk),
be32_to_cpu(remote->valuelen));
}
/* zero from end of name[] to next name start */
nlen = remote->namelen;
zlen = xfs_attr_leaf_entsize_remote(nlen) -
(sizeof(xfs_attr_leaf_name_remote_t) - 1 +
nlen);
if (zero_stale_data)
memset(&remote->name[nlen], 0, zlen);
}
}
/* Zero from end of entries array to the first name/val */
if (zero_stale_data) {
struct xfs_attr_leaf_entry *entries;
entries = xfs_attr3_leaf_entryp(leaf);
memset(&entries[nentries], 0,
first_name - (char *)&entries[nentries]);
}
}
/* Processes symlinks, attrs, directories ... */
static int
process_single_fsb_objects(
xfs_fileoff_t o,
xfs_fsblock_t s,
xfs_filblks_t c,
typnm_t btype,
xfs_fileoff_t last)
{
char *dp;
int ret = 0;
int i;
for (i = 0; i < c; i++) {
push_cur();
set_cur(&typtab[btype], XFS_FSB_TO_DADDR(mp, s), blkbb,
DB_RING_IGN, NULL);
if (!iocur_top->data) {
xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, s);
xfs_agblock_t agbno = XFS_FSB_TO_AGBNO(mp, s);
print_warning("cannot read %s block %u/%u (%llu)",
typtab[btype].name, agno, agbno, s);
if (stop_on_read_error)
ret = -EIO;
goto out_pop;
}
if (!obfuscate && !zero_stale_data)
goto write;
/* Zero unused part of interior nodes */
if (zero_stale_data) {
xfs_da_intnode_t *node = iocur_top->data;
int magic = be16_to_cpu(node->hdr.info.magic);
if (magic == XFS_DA_NODE_MAGIC ||
magic == XFS_DA3_NODE_MAGIC) {
struct xfs_da3_icnode_hdr hdr;
int used;
M_DIROPS(mp)->node_hdr_from_disk(&hdr, node);
used = M_DIROPS(mp)->node_hdr_size;
used += hdr.count
* sizeof(struct xfs_da_node_entry);
if (used < mp->m_sb.sb_blocksize) {
memset((char *)node + used, 0,
mp->m_sb.sb_blocksize - used);
iocur_top->need_crc = 1;
}
}
}
/* Handle leaf nodes */
dp = iocur_top->data;
switch (btype) {
case TYP_DIR2:
if (o >= mp->m_dir_geo->leafblk)
break;
process_dir_data_block(dp, o,
last == mp->m_dir_geo->fsbcount);
iocur_top->need_crc = 1;
break;
case TYP_SYMLINK:
process_symlink_block(dp);
iocur_top->need_crc = 1;
break;
case TYP_ATTR:
process_attr_block(dp, o);
iocur_top->need_crc = 1;
break;
default:
break;
}
write:
ret = write_buf(iocur_top);
out_pop:
pop_cur();
if (ret)
break;
o++;
s++;
}
return ret;
}
/*
* Static map to aggregate multiple extents into a single directory block.
*/
static struct bbmap mfsb_map;
static int mfsb_length;
static int
process_multi_fsb_objects(
xfs_fileoff_t o,
xfs_fsblock_t s,
xfs_filblks_t c,
typnm_t btype,
xfs_fileoff_t last)
{
int ret = 0;
switch (btype) {
case TYP_DIR2:
break;
default:
print_warning("bad type for multi-fsb object %d", btype);
return -EINVAL;
}
while (c > 0) {
unsigned int bm_len;
if (mfsb_length + c >= mp->m_dir_geo->fsbcount) {
bm_len = mp->m_dir_geo->fsbcount - mfsb_length;
mfsb_length = 0;
} else {
mfsb_length += c;
bm_len = c;
}
mfsb_map.b[mfsb_map.nmaps].bm_bn = XFS_FSB_TO_DADDR(mp, s);
mfsb_map.b[mfsb_map.nmaps].bm_len = XFS_FSB_TO_BB(mp, bm_len);
mfsb_map.nmaps++;
if (mfsb_length == 0) {
push_cur();
set_cur(&typtab[btype], 0, 0, DB_RING_IGN, &mfsb_map);
if (!iocur_top->data) {
xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, s);
xfs_agblock_t agbno = XFS_FSB_TO_AGBNO(mp, s);
print_warning("cannot read %s block %u/%u (%llu)",
typtab[btype].name, agno, agbno, s);
if (stop_on_read_error)
ret = -1;
goto out_pop;
}
if ((!obfuscate && !zero_stale_data) ||
o >= mp->m_dir_geo->leafblk) {
ret = write_buf(iocur_top);
goto out_pop;
}
process_dir_data_block(iocur_top->data, o,
last == mp->m_dir_geo->fsbcount);
iocur_top->need_crc = 1;
ret = write_buf(iocur_top);
out_pop:
pop_cur();
mfsb_map.nmaps = 0;
if (ret)
break;
}
c -= bm_len;
s += bm_len;
}
return ret;
}
/* inode copy routines */
static int
process_bmbt_reclist(
xfs_bmbt_rec_t *rp,
int numrecs,
typnm_t btype)
{
int i;
xfs_fileoff_t o, op = NULLFILEOFF;
xfs_fsblock_t s;
xfs_filblks_t c, cp = NULLFILEOFF;
int f;
xfs_fileoff_t last;
xfs_agnumber_t agno;
xfs_agblock_t agbno;
int error;
if (btype == TYP_DATA)
return 1;
convert_extent(&rp[numrecs - 1], &o, &s, &c, &f);
last = o + c;
for (i = 0; i < numrecs; i++, rp++) {
convert_extent(rp, &o, &s, &c, &f);
/*
* ignore extents that are clearly bogus, and if a bogus
* one is found, stop processing remaining extents
*/
if (i > 0 && op + cp > o) {
if (show_warnings)
print_warning("bmap extent %d in %s ino %llu "
"starts at %llu, previous extent "
"ended at %llu", i,
typtab[btype].name, (long long)cur_ino,
o, op + cp - 1);
break;
}
if (c > max_extent_size) {
/*
* since we are only processing non-data extents,
* large numbers of blocks in a metadata extent is
* extremely rare and more than likely to be corrupt.
*/
if (show_warnings)
print_warning("suspicious count %u in bmap "
"extent %d in %s ino %llu", c, i,
typtab[btype].name, (long long)cur_ino);
break;
}
op = o;
cp = c;
agno = XFS_FSB_TO_AGNO(mp, s);
agbno = XFS_FSB_TO_AGBNO(mp, s);
if (!valid_bno(agno, agbno)) {
if (show_warnings)
print_warning("invalid block number %u/%u "
"(%llu) in bmap extent %d in %s ino "
"%llu", agno, agbno, s, i,
typtab[btype].name, (long long)cur_ino);
break;
}
if (!valid_bno(agno, agbno + c - 1)) {
if (show_warnings)
print_warning("bmap extent %i in %s inode %llu "
"overflows AG (end is %u/%u)", i,
typtab[btype].name, (long long)cur_ino,
agno, agbno + c - 1);
break;
}
/* multi-extent blocks require special handling */
if (btype != TYP_DIR2 || mp->m_dir_geo->fsbcount == 1) {
error = process_single_fsb_objects(o, s, c, btype, last);
} else {
error = process_multi_fsb_objects(o, s, c, btype, last);
}
if (error)
return 0;
}
return 1;
}
static int
scanfunc_bmap(
struct xfs_btree_block *block,
xfs_agnumber_t agno,
xfs_agblock_t agbno,
int level,
typnm_t btype,
void *arg) /* ptr to itype */
{
int i;
xfs_bmbt_ptr_t *pp;
int nrecs;
nrecs = be16_to_cpu(block->bb_numrecs);
if (level == 0) {
if (nrecs > mp->m_bmap_dmxr[0]) {
if (show_warnings)
print_warning("invalid numrecs (%u) in %s "
"block %u/%u", nrecs,
typtab[btype].name, agno, agbno);
return 1;
}
return process_bmbt_reclist(XFS_BMBT_REC_ADDR(mp, block, 1),
nrecs, *(typnm_t*)arg);
}
if (nrecs > mp->m_bmap_dmxr[1]) {
if (show_warnings)
print_warning("invalid numrecs (%u) in %s block %u/%u",
nrecs, typtab[btype].name, agno, agbno);
return 1;
}
pp = XFS_BMBT_PTR_ADDR(mp, block, 1, mp->m_bmap_dmxr[1]);
for (i = 0; i < nrecs; i++) {
xfs_agnumber_t ag;
xfs_agblock_t bno;
ag = XFS_FSB_TO_AGNO(mp, get_unaligned_be64(&pp[i]));
bno = XFS_FSB_TO_AGBNO(mp, get_unaligned_be64(&pp[i]));
if (bno == 0 || bno > mp->m_sb.sb_agblocks ||
ag > mp->m_sb.sb_agcount) {
if (show_warnings)
print_warning("invalid block number (%u/%u) "
"in %s block %u/%u", ag, bno,
typtab[btype].name, agno, agbno);
continue;
}
if (!scan_btree(ag, bno, level, btype, arg, scanfunc_bmap))
return 0;
}
return 1;
}
static int
process_btinode(
xfs_dinode_t *dip,
typnm_t itype)
{
xfs_bmdr_block_t *dib;
int i;
xfs_bmbt_ptr_t *pp;
int level;
int nrecs;
int maxrecs;
int whichfork;
typnm_t btype;
whichfork = (itype == TYP_ATTR) ? XFS_ATTR_FORK : XFS_DATA_FORK;
btype = (itype == TYP_ATTR) ? TYP_BMAPBTA : TYP_BMAPBTD;
dib = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork);
level = be16_to_cpu(dib->bb_level);
nrecs = be16_to_cpu(dib->bb_numrecs);
if (level > XFS_BM_MAXLEVELS(mp, whichfork)) {
if (show_warnings)
print_warning("invalid level (%u) in inode %lld %s "
"root", level, (long long)cur_ino,
typtab[btype].name);
return 1;
}
if (level == 0) {
return process_bmbt_reclist(XFS_BMDR_REC_ADDR(dib, 1),
nrecs, itype);
}
maxrecs = xfs_bmdr_maxrecs(XFS_DFORK_SIZE(dip, mp, whichfork), 0);
if (nrecs > maxrecs) {
if (show_warnings)
print_warning("invalid numrecs (%u) in inode %lld %s "
"root", nrecs, (long long)cur_ino,
typtab[btype].name);
return 1;
}
pp = XFS_BMDR_PTR_ADDR(dib, 1, maxrecs);
for (i = 0; i < nrecs; i++) {
xfs_agnumber_t ag;
xfs_agblock_t bno;
ag = XFS_FSB_TO_AGNO(mp, get_unaligned_be64(&pp[i]));
bno = XFS_FSB_TO_AGBNO(mp, get_unaligned_be64(&pp[i]));
if (bno == 0 || bno > mp->m_sb.sb_agblocks ||
ag > mp->m_sb.sb_agcount) {
if (show_warnings)
print_warning("invalid block number (%u/%u) "
"in inode %llu %s root", ag,
bno, (long long)cur_ino,
typtab[btype].name);
continue;
}
if (!scan_btree(ag, bno, level, btype, &itype, scanfunc_bmap))
return 0;
}
return 1;
}
static int
process_exinode(
xfs_dinode_t *dip,
typnm_t itype)
{
int whichfork;
int used;
xfs_extnum_t nex;
whichfork = (itype == TYP_ATTR) ? XFS_ATTR_FORK : XFS_DATA_FORK;
nex = XFS_DFORK_NEXTENTS(dip, whichfork);
used = nex * sizeof(xfs_bmbt_rec_t);
if (nex < 0 || used > XFS_DFORK_SIZE(dip, mp, whichfork)) {
if (show_warnings)
print_warning("bad number of extents %d in inode %lld",
nex, (long long)cur_ino);
return 1;
}
/* Zero unused data fork past used extents */
if (zero_stale_data && (used < XFS_DFORK_SIZE(dip, mp, whichfork)))
memset(XFS_DFORK_PTR(dip, whichfork) + used, 0,
XFS_DFORK_SIZE(dip, mp, whichfork) - used);
return process_bmbt_reclist((xfs_bmbt_rec_t *)XFS_DFORK_PTR(dip,
whichfork), nex, itype);
}
static int
process_inode_data(
xfs_dinode_t *dip,
typnm_t itype)
{
switch (dip->di_format) {
case XFS_DINODE_FMT_LOCAL:
if (obfuscate || zero_stale_data)
switch (itype) {
case TYP_DIR2:
process_sf_dir(dip);
break;
case TYP_SYMLINK:
process_sf_symlink(dip);
break;
default: ;
}
break;
case XFS_DINODE_FMT_EXTENTS:
return process_exinode(dip, itype);
case XFS_DINODE_FMT_BTREE:
return process_btinode(dip, itype);
}
return 1;
}
/*
* when we process the inode, we may change the data in the data and/or
* attribute fork if they are in short form and we are obfuscating names.
* In this case we need to recalculate the CRC of the inode, but we should
* only do that if the CRC in the inode is good to begin with. If the crc
* is not ok, we just leave it alone.
*/
static int
process_inode(
xfs_agnumber_t agno,
xfs_agino_t agino,
xfs_dinode_t *dip,
bool free_inode)
{
int success;
bool crc_was_ok = false; /* no recalc by default */
bool need_new_crc = false;
success = 1;
cur_ino = XFS_AGINO_TO_INO(mp, agno, agino);
/* we only care about crc recalculation if we will modify the inode. */
if (obfuscate || zero_stale_data) {
crc_was_ok = xfs_verify_cksum((char *)dip,
mp->m_sb.sb_inodesize,
offsetof(struct xfs_dinode, di_crc));
}
if (free_inode) {
if (zero_stale_data) {
/* Zero all of the inode literal area */
memset(XFS_DFORK_DPTR(dip), 0,
XFS_LITINO(mp, dip->di_version));
}
goto done;
}
/* copy appropriate data fork metadata */
switch (be16_to_cpu(dip->di_mode) & S_IFMT) {
case S_IFDIR:
success = process_inode_data(dip, TYP_DIR2);
if (dip->di_format == XFS_DINODE_FMT_LOCAL)
need_new_crc = 1;
break;
case S_IFLNK:
success = process_inode_data(dip, TYP_SYMLINK);
if (dip->di_format == XFS_DINODE_FMT_LOCAL)
need_new_crc = 1;
break;
case S_IFREG:
success = process_inode_data(dip, TYP_DATA);
break;
default: ;
}
nametable_clear();
/* copy extended attributes if they exist and forkoff is valid */
if (success &&
XFS_DFORK_DSIZE(dip, mp) < XFS_LITINO(mp, dip->di_version)) {
attr_data.remote_val_count = 0;
switch (dip->di_aformat) {
case XFS_DINODE_FMT_LOCAL:
need_new_crc = 1;
if (obfuscate || zero_stale_data)
process_sf_attr(dip);
break;
case XFS_DINODE_FMT_EXTENTS:
success = process_exinode(dip, TYP_ATTR);
break;
case XFS_DINODE_FMT_BTREE:
success = process_btinode(dip, TYP_ATTR);
break;
}
nametable_clear();
}
done:
/* Heavy handed but low cost; just do it as a catch-all. */
if (zero_stale_data)
need_new_crc = 1;
if (crc_was_ok && need_new_crc)
libxfs_dinode_calc_crc(mp, dip);
return success;
}
static __uint32_t inodes_copied = 0;
static int
copy_inode_chunk(
xfs_agnumber_t agno,
xfs_inobt_rec_t *rp)
{
xfs_agino_t agino;
int off;
xfs_agblock_t agbno;
xfs_agblock_t end_agbno;
int i;
int rval = 0;
int blks_per_buf;
int inodes_per_buf;
int ioff;
agino = be32_to_cpu(rp->ir_startino);
agbno = XFS_AGINO_TO_AGBNO(mp, agino);
end_agbno = agbno + mp->m_ialloc_blks;
off = XFS_INO_TO_OFFSET(mp, agino);
/*
* If the fs supports sparse inode records, we must process inodes a
* cluster at a time because that is the sparse allocation granularity.
* Otherwise, we risk CRC corruption errors on reads of inode chunks.
*
* Also make sure that that we don't process more than the single record
* we've been passed (large block sizes can hold multiple inode chunks).
*/
if (xfs_sb_version_hassparseinodes(&mp->m_sb))
blks_per_buf = xfs_icluster_size_fsb(mp);
else
blks_per_buf = mp->m_ialloc_blks;
inodes_per_buf = min(blks_per_buf << mp->m_sb.sb_inopblog,
XFS_INODES_PER_CHUNK);
/*
* Sanity check that we only process a single buffer if ir_startino has
* a buffer offset. A non-zero offset implies that the entire chunk lies
* within a block.
*/
if (off && inodes_per_buf != XFS_INODES_PER_CHUNK) {
print_warning("bad starting inode offset %d", off);
return 0;
}
if (agino == 0 || agino == NULLAGINO || !valid_bno(agno, agbno) ||
!valid_bno(agno, XFS_AGINO_TO_AGBNO(mp,
agino + XFS_INODES_PER_CHUNK - 1))) {
if (show_warnings)
print_warning("bad inode number %llu (%u/%u)",
XFS_AGINO_TO_INO(mp, agno, agino), agno, agino);
return 1;
}
/*
* check for basic assumptions about inode chunks, and if any
* assumptions fail, don't process the inode chunk.
*/
if ((mp->m_sb.sb_inopblock <= XFS_INODES_PER_CHUNK && off != 0) ||
(mp->m_sb.sb_inopblock > XFS_INODES_PER_CHUNK &&
off % XFS_INODES_PER_CHUNK != 0) ||
(xfs_sb_version_hasalign(&mp->m_sb) &&
mp->m_sb.sb_inoalignmt != 0 &&
agbno % mp->m_sb.sb_inoalignmt != 0)) {
if (show_warnings)
print_warning("badly aligned inode (start = %llu)",
XFS_AGINO_TO_INO(mp, agno, agino));
return 1;
}
push_cur();
ioff = 0;
while (agbno < end_agbno && ioff < XFS_INODES_PER_CHUNK) {
if (xfs_inobt_is_sparse_disk(rp, ioff))
goto next_bp;
set_cur(&typtab[TYP_INODE], XFS_AGB_TO_DADDR(mp, agno, agbno),
XFS_FSB_TO_BB(mp, blks_per_buf), DB_RING_IGN, NULL);
if (iocur_top->data == NULL) {
print_warning("cannot read inode block %u/%u",
agno, agbno);
rval = !stop_on_read_error;
goto pop_out;
}
for (i = 0; i < inodes_per_buf; i++) {
xfs_dinode_t *dip;
dip = (xfs_dinode_t *)((char *)iocur_top->data +
((off + i) << mp->m_sb.sb_inodelog));
/* process_inode handles free inodes, too */
if (!process_inode(agno, agino + ioff + i, dip,
XFS_INOBT_IS_FREE_DISK(rp, i)))
goto pop_out;
inodes_copied++;
}
if (write_buf(iocur_top))
goto pop_out;
next_bp:
agbno += blks_per_buf;
ioff += inodes_per_buf;
}
if (show_progress)
print_progress("Copied %u of %u inodes (%u of %u AGs)",
inodes_copied, mp->m_sb.sb_icount, agno,
mp->m_sb.sb_agcount);
rval = 1;
pop_out:
pop_cur();
return rval;
}
static int
scanfunc_ino(
struct xfs_btree_block *block,
xfs_agnumber_t agno,
xfs_agblock_t agbno,
int level,
typnm_t btype,
void *arg)
{
xfs_inobt_rec_t *rp;
xfs_inobt_ptr_t *pp;
int i;
int numrecs;
int finobt = *(int *) arg;
numrecs = be16_to_cpu(block->bb_numrecs);
if (level == 0) {
if (numrecs > mp->m_inobt_mxr[0]) {
if (show_warnings)
print_warning("invalid numrecs %d in %s "
"block %u/%u", numrecs,
typtab[btype].name, agno, agbno);
numrecs = mp->m_inobt_mxr[0];
}
/*
* Only copy the btree blocks for the finobt. The inobt scan
* copies the inode chunks.
*/
if (finobt)
return 1;
rp = XFS_INOBT_REC_ADDR(mp, block, 1);
for (i = 0; i < numrecs; i++, rp++) {
if (!copy_inode_chunk(agno, rp))
return 0;
}
return 1;
}
if (numrecs > mp->m_inobt_mxr[1]) {
if (show_warnings)
print_warning("invalid numrecs %d in %s block %u/%u",
numrecs, typtab[btype].name, agno, agbno);
numrecs = mp->m_inobt_mxr[1];
}
pp = XFS_INOBT_PTR_ADDR(mp, block, 1, mp->m_inobt_mxr[1]);
for (i = 0; i < numrecs; i++) {
if (!valid_bno(agno, be32_to_cpu(pp[i]))) {
if (show_warnings)
print_warning("invalid block number (%u/%u) "
"in %s block %u/%u",
agno, be32_to_cpu(pp[i]),
typtab[btype].name, agno, agbno);
continue;
}
if (!scan_btree(agno, be32_to_cpu(pp[i]), level,
btype, arg, scanfunc_ino))
return 0;
}
return 1;
}
static int
copy_inodes(
xfs_agnumber_t agno,
xfs_agi_t *agi)
{
xfs_agblock_t root;
int levels;
int finobt = 0;
root = be32_to_cpu(agi->agi_root);
levels = be32_to_cpu(agi->agi_level);
/* validate root and levels before processing the tree */
if (root == 0 || root > mp->m_sb.sb_agblocks) {
if (show_warnings)
print_warning("invalid block number (%u) in inobt "
"root in agi %u", root, agno);
return 1;
}
if (levels >= XFS_BTREE_MAXLEVELS) {
if (show_warnings)
print_warning("invalid level (%u) in inobt root "
"in agi %u", levels, agno);
return 1;
}
if (!scan_btree(agno, root, levels, TYP_INOBT, &finobt, scanfunc_ino))
return 0;
if (xfs_sb_version_hasfinobt(&mp->m_sb)) {
root = be32_to_cpu(agi->agi_free_root);
levels = be32_to_cpu(agi->agi_free_level);
finobt = 1;
if (!scan_btree(agno, root, levels, TYP_INOBT, &finobt,
scanfunc_ino))
return 0;
}
return 1;
}
static int
scan_ag(
xfs_agnumber_t agno)
{
xfs_agf_t *agf;
xfs_agi_t *agi;
int stack_count = 0;
int rval = 0;
/* copy the superblock of the AG */
push_cur();
stack_count++;
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) {
print_warning("cannot read superblock for ag %u", agno);
if (stop_on_read_error)
goto pop_out;
} else {
/* Replace any filesystem label with "L's" */
if (obfuscate) {
struct xfs_sb *sb = iocur_top->data;
memset(sb->sb_fname, 'L',
min(strlen(sb->sb_fname), sizeof(sb->sb_fname)));
iocur_top->need_crc = 1;
}
if (write_buf(iocur_top))
goto pop_out;
}
/* copy the AG free space btree root */
push_cur();
stack_count++;
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;
if (iocur_top->data == NULL) {
print_warning("cannot read agf block for ag %u", agno);
if (stop_on_read_error)
goto pop_out;
} else {
if (write_buf(iocur_top))
goto pop_out;
}
/* copy the AG inode btree root */
push_cur();
stack_count++;
set_cur(&typtab[TYP_AGI], XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL);
agi = iocur_top->data;
if (iocur_top->data == NULL) {
print_warning("cannot read agi block for ag %u", agno);
if (stop_on_read_error)
goto pop_out;
} else {
if (write_buf(iocur_top))
goto pop_out;
}
/* copy the AG free list header */
push_cur();
stack_count++;
set_cur(&typtab[TYP_AGFL], XFS_AG_DADDR(mp, agno, XFS_AGFL_DADDR(mp)),
XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL);
if (iocur_top->data == NULL) {
print_warning("cannot read agfl block for ag %u", agno);
if (stop_on_read_error)
goto pop_out;
} else {
if (agf && zero_stale_data) {
/* Zero out unused bits of agfl */
int i;
__be32 *agfl_bno;
agfl_bno = XFS_BUF_TO_AGFL_BNO(mp, iocur_top->bp);
i = be32_to_cpu(agf->agf_fllast);
for (;;) {
if (++i == XFS_AGFL_SIZE(mp))
i = 0;
if (i == be32_to_cpu(agf->agf_flfirst))
break;
agfl_bno[i] = cpu_to_be32(NULLAGBLOCK);
}
iocur_top->need_crc = 1;
}
if (write_buf(iocur_top))
goto pop_out;
}
/* copy AG free space btrees */
if (agf) {
if (show_progress)
print_progress("Copying free space trees of AG %u",
agno);
if (!copy_free_bno_btree(agno, agf))
goto pop_out;
if (!copy_free_cnt_btree(agno, agf))
goto pop_out;
}
/* copy inode btrees and the inodes and their associated metadata */
if (agi) {
if (!copy_inodes(agno, agi))
goto pop_out;
}
rval = 1;
pop_out:
while (stack_count--)
pop_cur();
return rval;
}
static int
copy_ino(
xfs_ino_t ino,
typnm_t itype)
{
xfs_agnumber_t agno;
xfs_agblock_t agbno;
xfs_agino_t agino;
int offset;
int rval = 0;
if (ino == 0 || ino == NULLFSINO)
return 1;
agno = XFS_INO_TO_AGNO(mp, ino);
agino = XFS_INO_TO_AGINO(mp, ino);
agbno = XFS_AGINO_TO_AGBNO(mp, agino);
offset = XFS_AGINO_TO_OFFSET(mp, agino);
if (agno >= mp->m_sb.sb_agcount || agbno >= mp->m_sb.sb_agblocks ||
offset >= mp->m_sb.sb_inopblock) {
if (show_warnings)
print_warning("invalid %s inode number (%lld)",
typtab[itype].name, (long long)ino);
return 1;
}
push_cur();
set_cur(&typtab[TYP_INODE], XFS_AGB_TO_DADDR(mp, agno, agbno),
blkbb, DB_RING_IGN, NULL);
if (iocur_top->data == NULL) {
print_warning("cannot read %s inode %lld",
typtab[itype].name, (long long)ino);
rval = !stop_on_read_error;
goto pop_out;
}
off_cur(offset << mp->m_sb.sb_inodelog, mp->m_sb.sb_inodesize);
cur_ino = ino;
rval = process_inode_data(iocur_top->data, itype);
pop_out:
pop_cur();
return rval;
}
static int
copy_sb_inodes(void)
{
if (!copy_ino(mp->m_sb.sb_rbmino, TYP_RTBITMAP))
return 0;
if (!copy_ino(mp->m_sb.sb_rsumino, TYP_RTSUMMARY))
return 0;
if (!copy_ino(mp->m_sb.sb_uquotino, TYP_DQBLK))
return 0;
if (!copy_ino(mp->m_sb.sb_gquotino, TYP_DQBLK))
return 0;
return copy_ino(mp->m_sb.sb_pquotino, TYP_DQBLK);
}
static int
copy_log(void)
{
struct xlog log;
int dirty;
xfs_daddr_t logstart;
int logblocks;
int logversion;
int cycle = XLOG_INIT_CYCLE;
if (show_progress)
print_progress("Copying log");
push_cur();
set_cur(&typtab[TYP_LOG], XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart),
mp->m_sb.sb_logblocks * blkbb, DB_RING_IGN, NULL);
if (iocur_top->data == NULL) {
pop_cur();
print_warning("cannot read log");
return !stop_on_read_error;
}
/* If not obfuscating or zeroing, just copy the log as it is */
if (!obfuscate && !zero_stale_data)
goto done;
dirty = xlog_is_dirty(mp, &log, &x, 0);
switch (dirty) {
case 0:
/* clear out a clean log */
if (show_progress)
print_progress("Zeroing clean log");
logstart = XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart);
logblocks = XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
logversion = xfs_sb_version_haslogv2(&mp->m_sb) ? 2 : 1;
if (xfs_sb_version_hascrc(&mp->m_sb))
cycle = log.l_curr_cycle + 1;
libxfs_log_clear(NULL, iocur_top->data, logstart, logblocks,
&mp->m_sb.sb_uuid, logversion,
mp->m_sb.sb_logsunit, XLOG_FMT, cycle);
break;
case 1:
/* keep the dirty log */
print_warning(
_("Filesystem log is dirty; image will contain unobfuscated metadata in log."));
break;
case -1:
/* log detection error */
print_warning(
_("Could not discern log; image will contain unobfuscated metadata in log."));
break;
}
done:
return !write_buf(iocur_top);
}
static int
metadump_f(
int argc,
char **argv)
{
xfs_agnumber_t agno;
int c;
int start_iocur_sp;
char *p;
exitcode = 1;
show_progress = 0;
show_warnings = 0;
stop_on_read_error = 0;
if (mp->m_sb.sb_magicnum != XFS_SB_MAGIC) {
print_warning("bad superblock magic number %x, giving up",
mp->m_sb.sb_magicnum);
return 0;
}
while ((c = getopt(argc, argv, "aegm:ow")) != EOF) {
switch (c) {
case 'a':
zero_stale_data = 0;
break;
case 'e':
stop_on_read_error = 1;
break;
case 'g':
show_progress = 1;
break;
case 'm':
max_extent_size = (int)strtol(optarg, &p, 0);
if (*p != '\0' || max_extent_size <= 0) {
print_warning("bad max extent size %s",
optarg);
return 0;
}
break;
case 'o':
obfuscate = 0;
break;
case 'w':
show_warnings = 1;
break;
default:
print_warning("bad option for metadump command");
return 0;
}
}
if (optind != argc - 1) {
print_warning("too few options for metadump (no filename given)");
return 0;
}
metablock = (xfs_metablock_t *)calloc(BBSIZE + 1, BBSIZE);
if (metablock == NULL) {
print_warning("memory allocation failure");
return 0;
}
metablock->mb_blocklog = BBSHIFT;
metablock->mb_magic = cpu_to_be32(XFS_MD_MAGIC);
block_index = (__be64 *)((char *)metablock + sizeof(xfs_metablock_t));
block_buffer = (char *)metablock + BBSIZE;
num_indicies = (BBSIZE - sizeof(xfs_metablock_t)) / sizeof(__be64);
cur_index = 0;
start_iocur_sp = iocur_sp;
if (strcmp(argv[optind], "-") == 0) {
if (isatty(fileno(stdout))) {
print_warning("cannot write to a terminal");
free(metablock);
return 0;
}
outf = stdout;
} else {
outf = fopen(argv[optind], "wb");
if (outf == NULL) {
print_warning("cannot create dump file");
free(metablock);
return 0;
}
}
exitcode = 0;
for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
if (!scan_ag(agno)) {
exitcode = 1;
break;
}
}
/* copy realtime and quota inode contents */
if (!exitcode)
exitcode = !copy_sb_inodes();
/* copy log if it's internal */
if ((mp->m_sb.sb_logstart != 0) && !exitcode)
exitcode = !copy_log();
/* write the remaining index */
if (!exitcode)
exitcode = write_index() < 0;
if (progress_since_warning)
fputc('\n', (outf == stdout) ? stderr : stdout);
if (outf != stdout)
fclose(outf);
/* cleanup iocur stack */
while (iocur_sp > start_iocur_sp)
pop_cur();
free(metablock);
return 0;
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/metadump.h 0000664 0000000 0000000 00000001357 12560572026 015205 0 ustar /*
* Copyright (c) 2007 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void metadump_init(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/output.c 0000664 0000000 0000000 00000004516 12574431650 014726 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include
#include "command.h"
#include "output.h"
#include "sig.h"
#include "malloc.h"
#include "init.h"
static int log_f(int argc, char **argv);
static const cmdinfo_t log_cmd =
{ "log", NULL, log_f, 0, 2, 0, N_("[stop|start ]"),
N_("start or stop logging to a file"), NULL };
int dbprefix;
static FILE *log_file;
static char *log_file_name;
int
dbprintf(const char *fmt, ...)
{
va_list ap;
int i;
if (seenint())
return 0;
va_start(ap, fmt);
blockint();
i = 0;
if (dbprefix)
i += printf("%s: ", fsdevice);
i += vprintf(fmt, ap);
unblockint();
va_end(ap);
if (log_file) {
va_start(ap, fmt);
vfprintf(log_file, fmt, ap);
va_end(ap);
}
return i;
}
static int
log_f(
int argc,
char **argv)
{
if (argc == 1) {
if (log_file)
dbprintf(_("logging to %s\n"), log_file_name);
else
dbprintf(_("no log file\n"));
} else if (argc == 2 && strcmp(argv[1], "stop") == 0) {
if (log_file) {
xfree(log_file_name);
fclose(log_file);
log_file = NULL;
} else
dbprintf(_("no log file\n"));
} else if (argc == 3 && strcmp(argv[1], "start") == 0) {
if (log_file)
dbprintf(_("already logging to %s\n"), log_file_name);
else {
log_file = fopen(argv[2], "a");
if (log_file == NULL)
dbprintf(_("can't open %s for writing\n"),
argv[2]);
else
log_file_name = xstrdup(argv[1]);
}
} else
dbprintf(_("bad log command, ignored\n"));
return 0;
}
void
logprintf(const char *fmt, ...)
{
va_list ap;
if (log_file) {
va_start(ap, fmt);
(void)vfprintf(log_file, fmt, ap);
va_end(ap);
}
}
void
output_init(void)
{
add_command(&log_cmd);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/output.h 0000664 0000000 0000000 00000001537 12560572026 014731 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern int dbprefix;
extern int dbprintf(const char *, ...);
extern void logprintf(const char *, ...);
extern void output_init(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/print.c 0000664 0000000 0000000 00000013364 12574431650 014523 0 ustar /*
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "command.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "io.h"
#include "print.h"
#include "bit.h"
#include "flist.h"
#include "strvec.h"
#include "output.h"
#include "sig.h"
#include "write.h"
static void print_allfields(const struct field *fields);
static int print_f(int argc, char **argv);
static void print_flist_1(struct flist *flist, char **pfx, int parentoff);
static void print_somefields(const struct field *fields, int argc,
char **argv);
static const cmdinfo_t print_cmd =
{ "print", "p", print_f, 0, -1, 0, N_("[value]..."),
N_("print field values"), NULL };
static void
print_allfields(
const field_t *fields)
{
flist_t *flist;
#ifdef DEBUG
int i;
#endif
flist = flist_make("");
flist->fld = fields;
#ifndef DEBUG
(void)flist_parse(fields, flist, iocur_top->data, 0);
#else
i = flist_parse(fields, flist, iocur_top->data, 0);
ASSERT(i == 1);
#endif
flist_print(flist);
print_flist(flist);
flist_free(flist);
}
static int
print_f(
int argc,
char **argv)
{
pfunc_t pf;
if (cur_typ == NULL) {
dbprintf(_("no current type\n"));
return 0;
}
pf = cur_typ->pfunc;
if (pf == NULL) {
dbprintf(_("no print function for type %s\n"), cur_typ->name);
return 0;
}
argc--;
argv++;
(*pf)(DB_READ, cur_typ->fields, argc, argv);
return 0;
}
void
print_flist(
flist_t *flist)
{
char **pfx;
pfx = new_strvec(0);
print_flist_1(flist, pfx, 0);
free_strvec(pfx);
}
static void
print_flist_1(
flist_t *flist,
char **ppfx,
int parentoff)
{
char buf[16];
const field_t *f;
const ftattr_t *fa;
flist_t *fl;
int low;
int neednl;
char **pfx;
for (fl = flist; fl && !seenint(); fl = fl->sibling) {
pfx = copy_strvec(ppfx);
if (fl->name[0])
add_strvec(&pfx, fl->name);
if (fl->flags & FL_OKLOW) {
add_strvec(&pfx, "[");
snprintf(buf, sizeof(buf), "%d", fl->low);
add_strvec(&pfx, buf);
if (fl->low != fl->high) {
add_strvec(&pfx, "-");
snprintf(buf, sizeof(buf), "%d", fl->high);
add_strvec(&pfx, buf);
}
add_strvec(&pfx, "]");
}
if (fl->child) {
if (fl->name[0])
add_strvec(&pfx, ".");
print_flist_1(fl->child, pfx, fl->offset);
} else {
f = fl->fld;
fa = &ftattrtab[f->ftyp];
ASSERT(fa->ftyp == f->ftyp);
print_strvec(pfx);
dbprintf(" = ");
if (fl->flags & FL_OKLOW)
low = fl->low;
else
low = 0;
if (fa->prfunc) {
neednl = fa->prfunc(iocur_top->data, fl->offset,
fcount(f, iocur_top->data, parentoff),
fa->fmtstr,
fsize(f, iocur_top->data, parentoff, 0),
fa->arg, low,
(f->flags & FLD_ARRAY) != 0);
if (neednl)
dbprintf("\n");
} else {
ASSERT(fa->arg & FTARG_OKEMPTY);
dbprintf(_("(empty)\n"));
}
}
free_strvec(pfx);
}
}
void
print_init(void)
{
add_command(&print_cmd);
}
void
print_sarray(
void *obj,
int bit,
int count,
int size,
int base,
int array,
const field_t *flds,
int skipnms)
{
int bitoff;
const field_t *f;
const ftattr_t *fa;
int first;
int i;
ASSERT(bitoffs(bit) == 0);
if (skipnms == 0) {
for (f = flds, first = 1; f->name; f++) {
if (f->flags & FLD_SKIPALL)
continue;
dbprintf("%c%s", first ? '[' : ',', f->name);
first = 0;
}
dbprintf("] ");
}
for (i = 0, bitoff = bit;
i < count && !seenint();
i++, bitoff += size) {
if (array)
dbprintf("%d:", i + base);
for (f = flds, first = 1; f->name; f++) {
if (f->flags & FLD_SKIPALL)
continue;
fa = &ftattrtab[f->ftyp];
ASSERT(fa->ftyp == f->ftyp);
dbprintf("%c", first ? '[' : ',');
first = 0;
if (fa->prfunc)
fa->prfunc(obj,
bitoff +
bitoffset(f, obj, bitoff, i + base),
fcount(f, obj, bitoff), fa->fmtstr,
fsize(f, obj, bitoff, i + base),
fa->arg, (f->flags & FLD_ABASE1) != 0,
f->flags & FLD_ARRAY);
else {
ASSERT(fa->arg & FTARG_OKEMPTY);
dbprintf(_("(empty)"));
}
}
dbprintf("]");
if (i < count - 1)
dbprintf(" ");
}
}
static void
print_somefields(
const field_t *fields,
int argc,
char **argv)
{
const ftattr_t *fa;
flist_t *fl;
flist_t *lfl;
flist_t *nfl;
fl = lfl = NULL;
while (argc > 0) {
nfl = flist_scan(*argv);
if (!nfl) {
if (fl)
flist_free(fl);
return;
}
if (lfl)
lfl->sibling = nfl;
else
fl = nfl;
lfl = nfl;
argc--;
argv++;
}
if (fields->name[0] == '\0') {
fa = &ftattrtab[fields->ftyp];
ASSERT(fa->ftyp == fields->ftyp);
fields = fa->subfld;
}
if (!flist_parse(fields, fl, iocur_top->data, 0)) {
flist_free(fl);
return;
}
flist_print(fl);
print_flist(fl);
flist_free(fl);
}
/*ARGSUSED*/
void
print_string(
const field_t *fields,
int argc,
char **argv)
{
char *cp;
if (argc != 0)
dbprintf(_("no arguments allowed\n"));
dbprintf("\"");
for (cp = iocur_top->data;
cp < (char *)iocur_top->data + iocur_top->len && *cp &&
!seenint();
cp++)
dbprintf("%c", *cp);
dbprintf("\"\n");
}
void
print_struct(
const field_t *fields,
int argc,
char **argv)
{
if (argc == 0)
print_allfields(fields);
else
print_somefields(fields, argc, argv);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/print.h 0000664 0000000 0000000 00000002135 12560572026 014520 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
struct field;
struct flist;
extern void print_flist(struct flist *flist);
extern void print_init(void);
extern void print_sarray(void *obj, int bit, int count, int size, int base,
int array, const field_t *flds, int skipnms);
extern void print_struct(const struct field *fields, int argc, char **argv);
extern void print_string(const struct field *fields, int argc, char **argv);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/quit.c 0000664 0000000 0000000 00000002025 12574431650 014341 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "command.h"
#include "quit.h"
static int quit_f(int argc, char **argv);
static const cmdinfo_t quit_cmd =
{ "quit", "q", quit_f, 0, 0, 0, NULL,
N_("exit xfs_db"), NULL };
static int
quit_f(
int argc,
char **argv)
{
return 1;
}
void
quit_init(void)
{
add_command(&quit_cmd);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/quit.h 0000664 0000000 0000000 00000001365 12560572026 014352 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void quit_init(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/sb.c 0000664 0000000 0000000 00000056533 12625713771 014004 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "libxlog.h"
#include "command.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "io.h"
#include "sb.h"
#include "bit.h"
#include "output.h"
#include "init.h"
#define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0)
static int sb_f(int argc, char **argv);
static void sb_help(void);
static int uuid_f(int argc, char **argv);
static void uuid_help(void);
static int label_f(int argc, char **argv);
static void label_help(void);
static int version_f(int argc, char **argv);
static void version_help(void);
static const cmdinfo_t sb_cmd =
{ "sb", NULL, sb_f, 0, 1, 1, N_("[agno]"),
N_("set current address to sb header"), sb_help };
static const cmdinfo_t uuid_cmd =
{ "uuid", NULL, uuid_f, 0, 1, 1, N_("[uuid]"),
N_("write/print FS uuid"), uuid_help };
static const cmdinfo_t label_cmd =
{ "label", NULL, label_f, 0, 1, 1, N_("[label]"),
N_("write/print FS label"), label_help };
static const cmdinfo_t version_cmd =
{ "version", NULL, version_f, 0, -1, 1, N_("[feature | [vnum fnum]]"),
N_("set feature bit(s) in the sb version field"), version_help };
void
sb_init(void)
{
add_command(&sb_cmd);
add_command(&uuid_cmd);
add_command(&label_cmd);
add_command(&version_cmd);
}
#define OFF(f) bitize(offsetof(xfs_sb_t, sb_ ## f))
#define SZC(f) szcount(xfs_sb_t, sb_ ## f)
const field_t sb_flds[] = {
{ "magicnum", FLDT_UINT32X, OI(OFF(magicnum)), C1, 0, TYP_NONE },
{ "blocksize", FLDT_UINT32D, OI(OFF(blocksize)), C1, 0, TYP_NONE },
{ "dblocks", FLDT_DRFSBNO, OI(OFF(dblocks)), C1, 0, TYP_NONE },
{ "rblocks", FLDT_DRFSBNO, OI(OFF(rblocks)), C1, 0, TYP_NONE },
{ "rextents", FLDT_DRTBNO, OI(OFF(rextents)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(uuid)), C1, 0, TYP_NONE },
{ "logstart", FLDT_DFSBNO, OI(OFF(logstart)), C1, 0, TYP_LOG },
{ "rootino", FLDT_INO, OI(OFF(rootino)), C1, 0, TYP_INODE },
{ "rbmino", FLDT_INO, OI(OFF(rbmino)), C1, 0, TYP_INODE },
{ "rsumino", FLDT_INO, OI(OFF(rsumino)), C1, 0, TYP_INODE },
{ "rextsize", FLDT_AGBLOCK, OI(OFF(rextsize)), C1, 0, TYP_NONE },
{ "agblocks", FLDT_AGBLOCK, OI(OFF(agblocks)), C1, 0, TYP_NONE },
{ "agcount", FLDT_AGNUMBER, OI(OFF(agcount)), C1, 0, TYP_NONE },
{ "rbmblocks", FLDT_EXTLEN, OI(OFF(rbmblocks)), C1, 0, TYP_NONE },
{ "logblocks", FLDT_EXTLEN, OI(OFF(logblocks)), C1, 0, TYP_NONE },
{ "versionnum", FLDT_UINT16X, OI(OFF(versionnum)), C1, 0, TYP_NONE },
{ "sectsize", FLDT_UINT16D, OI(OFF(sectsize)), C1, 0, TYP_NONE },
{ "inodesize", FLDT_UINT16D, OI(OFF(inodesize)), C1, 0, TYP_NONE },
{ "inopblock", FLDT_UINT16D, OI(OFF(inopblock)), C1, 0, TYP_NONE },
{ "fname", FLDT_CHARNS, OI(OFF(fname)), CI(SZC(fname)), 0, TYP_NONE },
{ "blocklog", FLDT_UINT8D, OI(OFF(blocklog)), C1, 0, TYP_NONE },
{ "sectlog", FLDT_UINT8D, OI(OFF(sectlog)), C1, 0, TYP_NONE },
{ "inodelog", FLDT_UINT8D, OI(OFF(inodelog)), C1, 0, TYP_NONE },
{ "inopblog", FLDT_UINT8D, OI(OFF(inopblog)), C1, 0, TYP_NONE },
{ "agblklog", FLDT_UINT8D, OI(OFF(agblklog)), C1, 0, TYP_NONE },
{ "rextslog", FLDT_UINT8D, OI(OFF(rextslog)), C1, 0, TYP_NONE },
{ "inprogress", FLDT_UINT8D, OI(OFF(inprogress)), C1, 0, TYP_NONE },
{ "imax_pct", FLDT_UINT8D, OI(OFF(imax_pct)), C1, 0, TYP_NONE },
{ "icount", FLDT_UINT64D, OI(OFF(icount)), C1, 0, TYP_NONE },
{ "ifree", FLDT_UINT64D, OI(OFF(ifree)), C1, 0, TYP_NONE },
{ "fdblocks", FLDT_UINT64D, OI(OFF(fdblocks)), C1, 0, TYP_NONE },
{ "frextents", FLDT_UINT64D, OI(OFF(frextents)), C1, 0, TYP_NONE },
{ "uquotino", FLDT_INO, OI(OFF(uquotino)), C1, 0, TYP_INODE },
{ "gquotino", FLDT_INO, OI(OFF(gquotino)), C1, 0, TYP_INODE },
{ "qflags", FLDT_UINT16X, OI(OFF(qflags)), C1, 0, TYP_NONE },
{ "flags", FLDT_UINT8X, OI(OFF(flags)), C1, 0, TYP_NONE },
{ "shared_vn", FLDT_UINT8D, OI(OFF(shared_vn)), C1, 0, TYP_NONE },
{ "inoalignmt", FLDT_EXTLEN, OI(OFF(inoalignmt)), C1, 0, TYP_NONE },
{ "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 },
{ "features2", FLDT_UINT32X, OI(OFF(features2)), C1, 0, TYP_NONE },
{ "bad_features2", FLDT_UINT32X, OI(OFF(bad_features2)),
C1, 0, TYP_NONE },
{ "features_compat", FLDT_UINT32X, OI(OFF(features_compat)),
C1, 0, TYP_NONE },
{ "features_ro_compat", FLDT_UINT32X, OI(OFF(features_ro_compat)),
C1, 0, TYP_NONE },
{ "features_incompat", FLDT_UINT32X, OI(OFF(features_incompat)),
C1, 0, TYP_NONE },
{ "features_log_incompat", FLDT_UINT32X, OI(OFF(features_log_incompat)),
C1, 0, TYP_NONE },
{ "crc", FLDT_CRC, OI(OFF(crc)), C1, 0, TYP_NONE },
{ "spino_align", FLDT_EXTLEN, OI(OFF(spino_align)), C1, 0, TYP_NONE },
{ "pquotino", FLDT_INO, OI(OFF(pquotino)), C1, 0, TYP_INODE },
{ "lsn", FLDT_UINT64X, OI(OFF(lsn)), C1, 0, TYP_NONE },
{ "meta_uuid", FLDT_UUID, OI(OFF(meta_uuid)), C1, 0, TYP_NONE },
{ NULL }
};
const field_t sb_hfld[] = {
{ "", FLDT_SB, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
static void
sb_help(void)
{
dbprintf(_(
"\n"
" set allocation group superblock\n"
"\n"
" Example:\n"
"\n"
" 'sb 7' - set location to 7th allocation group superblock, set type to 'sb'\n"
"\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"
"\n"
));
}
static int
sb_f(
int argc,
char **argv)
{
xfs_agnumber_t agno;
char *p;
if (argc > 1) {
agno = (xfs_agnumber_t)strtoul(argv[1], &p, 0);
if (*p != '\0' || agno >= mp->m_sb.sb_agcount) {
dbprintf(_("bad allocation group number %s\n"), argv[1]);
return 0;
}
cur_agno = agno;
} 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),
XFS_FSS_TO_BB(mp, 1), DB_RING_ADD, NULL);
return 0;
}
/*ARGSUSED*/
int
sb_size(
void *obj,
int startoff,
int idx)
{
return bitize(mp->m_sb.sb_sectsize);
}
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),
XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL);
if (!iocur_top->data) {
dbprintf(_("can't read superblock for AG %u\n"), agno);
pop_cur();
return 0;
}
libxfs_sb_from_disk(sb, iocur_top->data);
if (sb->sb_magicnum != XFS_SB_MAGIC) {
dbprintf(_("bad sb magic # %#x in AG %u\n"),
sb->sb_magicnum, agno);
return 0;
}
if (!xfs_sb_good_version(sb)) {
dbprintf(_("bad sb version # %#x in AG %u\n"),
sb->sb_versionnum, agno);
return 0;
}
if (agno == 0 && sb->sb_inprogress != 0) {
dbprintf(_("mkfs not completed successfully\n"));
return 0;
}
return 1;
}
/* workaround craziness in the xlog routines */
int xlog_recover_do_trans(struct xlog *log, xlog_recover_t *t, int p)
{
return 0;
}
int
sb_logcheck(void)
{
int dirty;
if (mp->m_sb.sb_logstart) {
if (x.logdev && x.logdev != x.ddev) {
dbprintf(_("aborting - external log specified for FS "
"with an internal log\n"));
return 0;
}
} else {
if (!x.logdev || (x.logdev == x.ddev)) {
dbprintf(_("aborting - no external log specified for FS "
"with an external log\n"));
return 0;
}
}
libxfs_buftarg_init(mp, x.ddev, x.logdev, x.rtdev);
dirty = xlog_is_dirty(mp, mp->m_log, &x, 0);
if (dirty == -1) {
dbprintf(_("ERROR: cannot find log head/tail, run xfs_repair\n"));
return 0;
} else if (dirty == 1) {
dbprintf(_(
"ERROR: The filesystem has valuable metadata changes in a log which needs to\n"
"be replayed. Mount the filesystem to replay the log, and unmount it before\n"
"re-running %s. If you are unable to mount the filesystem, then use\n"
"the xfs_repair -L option to destroy the log and attempt a repair.\n"
"Note that destroying the log may cause corruption -- please attempt a mount\n"
"of the filesystem before doing this.\n"), progname);
return 0;
}
/* Log is clean */
return 1;
}
static int
sb_logzero(uuid_t *uuidp)
{
int cycle = XLOG_INIT_CYCLE;
int error;
if (!sb_logcheck())
return 0;
/*
* The log must always move forward on v5 superblocks. Bump it to the
* next cycle.
*/
if (xfs_sb_version_hascrc(&mp->m_sb))
cycle = mp->m_log->l_curr_cycle + 1;
dbprintf(_("Clearing log and setting UUID\n"));
error = libxfs_log_clear(mp->m_logdev_targp, NULL,
XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart),
(xfs_extlen_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks),
uuidp,
xfs_sb_version_haslogv2(&mp->m_sb) ? 2 : 1,
mp->m_sb.sb_logsunit, XLOG_FMT, cycle);
if (error) {
dbprintf(_("ERROR: cannot clear the log\n"));
return 0;
}
return 1;
}
static void
uuid_help(void)
{
dbprintf(_(
"\n"
" write/print FS uuid\n"
"\n"
" Example:\n"
"\n"
" 'uuid' - print UUID\n"
" 'uuid 01234567-0123-0123-0123-0123456789ab' - write UUID\n"
" 'uuid generate' - generate and write\n"
" 'uuid rewrite' - copy UUID from SB 0\n"
"\n"
"The print function checks the UUID in each SB and will warn if the UUIDs\n"
"differ between AGs (the log is not checked). The write commands will\n"
"set the uuid in all AGs to either a specified value, a newly generated\n"
"value or the value found in the first superblock (SB 0) respectively.\n"
"As a side effect of writing the UUID, the log is cleared (which is fine\n"
"on a CLEANLY unmounted FS).\n"
"\n"
));
}
static uuid_t *
do_uuid(xfs_agnumber_t agno, uuid_t *uuid)
{
xfs_sb_t tsb;
static uuid_t uu;
if (!get_sb(agno, &tsb))
return NULL;
if (!uuid) { /* get uuid */
memcpy(&uu, &tsb.sb_uuid, sizeof(uuid_t));
pop_cur();
return &uu;
}
/* set uuid */
if (!xfs_sb_version_hascrc(&tsb))
goto write;
/*
* If we have CRCs, and this UUID differs from that stamped in the
* metadata, set the incompat flag and copy the old one to the
* metadata-specific location.
*
* If we are setting the user-visible UUID back to match the metadata
* UUID, clear the metadata-specific location and the incompat flag.
*/
if (!xfs_sb_version_hasmetauuid(&tsb) &&
!uuid_equal(uuid, &mp->m_sb.sb_meta_uuid)) {
mp->m_sb.sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_META_UUID;
tsb.sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_META_UUID;
memcpy(&tsb.sb_meta_uuid, &tsb.sb_uuid, sizeof(uuid_t));
} else if (xfs_sb_version_hasmetauuid(&tsb) &&
uuid_equal(uuid, &mp->m_sb.sb_meta_uuid)) {
memset(&tsb.sb_meta_uuid, 0, sizeof(uuid_t));
/* Write those zeros now; it's ignored once we clear the flag */
libxfs_sb_to_disk(iocur_top->data, &tsb);
mp->m_sb.sb_features_incompat &=
~XFS_SB_FEAT_INCOMPAT_META_UUID;
tsb.sb_features_incompat &= ~XFS_SB_FEAT_INCOMPAT_META_UUID;
}
write:
memcpy(&tsb.sb_uuid, uuid, sizeof(uuid_t));
libxfs_sb_to_disk(iocur_top->data, &tsb);
write_cur();
return uuid;
}
static int
uuid_f(
int argc,
char **argv)
{
char bp[40];
xfs_agnumber_t agno;
uuid_t uu;
uuid_t *uup = NULL;
if (argc != 1 && argc != 2) {
dbprintf(_("invalid parameters\n"));
return 0;
}
if (argc == 2) { /* WRITE UUID */
if ((x.isreadonly & LIBXFS_ISREADONLY) || !expert_mode) {
dbprintf(_("%s: not in expert mode, writing disabled\n"),
progname);
return 0;
}
if (!strcasecmp(argv[1], "generate")) {
platform_uuid_generate(&uu);
} else if (!strcasecmp(argv[1], "nil")) {
platform_uuid_clear(&uu);
} else if (!strcasecmp(argv[1], "rewrite")) {
uup = do_uuid(0, NULL);
if (!uup) {
dbprintf(_("failed to read UUID from AG 0\n"));
return 0;
}
memcpy(&uu, uup, sizeof(uuid_t));
platform_uuid_unparse(&uu, bp);
dbprintf(_("old UUID = %s\n"), bp);
} else if (!strcasecmp(argv[1], "restore")) {
xfs_sb_t tsb;
if (!get_sb(0, &tsb))
return 0;
/* Not set; nothing to do. Success! */
if (!xfs_sb_version_hasmetauuid(&tsb))
return 0;
memcpy(&uu, mp->m_sb.sb_meta_uuid, sizeof(uuid_t));
} else {
if (platform_uuid_parse(argv[1], &uu)) {
dbprintf(_("invalid UUID\n"));
return 0;
}
}
/* clear the log (setting uuid) if it's not dirty */
if (!sb_logzero(&uu))
return 0;
dbprintf(_("writing all SBs\n"));
for (agno = 0; agno < mp->m_sb.sb_agcount; agno++)
if (!do_uuid(agno, &uu)) {
dbprintf(_("failed to set UUID in AG %d\n"), agno);
break;
}
platform_uuid_unparse(&uu, bp);
dbprintf(_("new UUID = %s\n"), bp);
return 0;
} else { /* READ+CHECK UUID */
for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
uup = do_uuid(agno, NULL);
if (!uup) {
dbprintf(_("failed to read UUID from AG %d\n"),
agno);
return 0;
}
if (agno) {
if (memcmp(&uu, uup, sizeof(uuid_t))) {
dbprintf(_("warning: UUID in AG %d "
"differs to the primary SB\n"),
agno);
break;
}
} else {
memcpy(&uu, uup, sizeof(uuid_t));
}
}
if (mp->m_sb.sb_logstart) {
if (x.logdev && x.logdev != x.ddev)
dbprintf(_("warning - external log specified "
"for FS with an internal log\n"));
} else if (!x.logdev || (x.logdev == x.ddev)) {
dbprintf(_("warning - no external log specified "
"for FS with an external log\n"));
}
platform_uuid_unparse(&uu, bp);
dbprintf(_("UUID = %s\n"), bp);
}
return 0;
}
static void
label_help(void)
{
dbprintf(_(
"\n"
" write/print FS label\n"
"\n"
" Example:\n"
"\n"
" 'label' - print label\n"
" 'label 123456789012' - write label\n"
" 'label --' - write an empty label\n"
"\n"
"The print function checks the label in each SB and will warn if the labels\n"
"differ between AGs. The write commands will set the label in all AGs to the\n"
"specified value. The maximum length of a label is 12 characters - use of a\n"
"longer label will result in truncation and a warning will be issued.\n"
"\n"
));
}
static char *
do_label(xfs_agnumber_t agno, char *label)
{
size_t len;
xfs_sb_t tsb;
static char lbl[sizeof(tsb.sb_fname) + 1];
if (!get_sb(agno, &tsb))
return NULL;
memset(&lbl[0], 0, sizeof(lbl));
if (!label) { /* get label */
pop_cur();
memcpy(&lbl[0], &tsb.sb_fname, sizeof(tsb.sb_fname));
return &lbl[0];
}
/* set label */
if ((len = strlen(label)) > sizeof(tsb.sb_fname)) {
if (agno == 0)
dbprintf(_("%s: truncating label length from %d to %d\n"),
progname, (int)len, (int)sizeof(tsb.sb_fname));
len = sizeof(tsb.sb_fname);
}
if ( len == 2 &&
(strcmp(label, "\"\"") == 0 ||
strcmp(label, "''") == 0 ||
strcmp(label, "--") == 0) )
label[0] = label[1] = '\0';
memset(&tsb.sb_fname, 0, sizeof(tsb.sb_fname));
memcpy(&tsb.sb_fname, label, len);
memcpy(&lbl[0], &tsb.sb_fname, sizeof(tsb.sb_fname));
libxfs_sb_to_disk(iocur_top->data, &tsb);
write_cur();
return &lbl[0];
}
static int
label_f(
int argc,
char **argv)
{
char *p = NULL;
xfs_sb_t sb;
xfs_agnumber_t ag;
if (argc != 1 && argc != 2) {
dbprintf(_("invalid parameters\n"));
return 0;
}
if (argc == 2) { /* WRITE LABEL */
if ((x.isreadonly & LIBXFS_ISREADONLY) || !expert_mode) {
dbprintf(_("%s: not in expert mode, writing disabled\n"),
progname);
return 0;
}
dbprintf(_("writing all SBs\n"));
for (ag = 0; ag < mp->m_sb.sb_agcount; ag++)
if ((p = do_label(ag, argv[1])) == NULL) {
dbprintf(_("failed to set label in AG %d\n"), ag);
break;
}
dbprintf(_("new label = \"%s\"\n"), p);
} else { /* READ LABEL */
for (ag = 0; ag < mp->m_sb.sb_agcount; ag++) {
p = do_label(ag, NULL);
if (!p) {
dbprintf(_("failed to read label in AG %d\n"), ag);
return 0;
}
if (!ag)
memcpy(&sb.sb_fname, p, sizeof(sb.sb_fname));
else if (memcmp(&sb.sb_fname, p, sizeof(sb.sb_fname)))
dbprintf(_("warning: AG %d label differs\n"), ag);
}
dbprintf(_("label = \"%s\"\n"), p);
}
return 0;
}
static void
version_help(void)
{
dbprintf(_(
"\n"
" set/print feature bits in sb version\n"
"\n"
" Example:\n"
"\n"
" 'version' - print current feature bits\n"
" 'version extflg' - enable unwritten extents\n"
" 'version attr1' - enable v1 inline extended attributes\n"
" 'version attr2' - enable v2 inline extended attributes\n"
" 'version log2' - enable v2 log format\n"
"\n"
"The version function prints currently enabled features for a filesystem\n"
"according to the version field of its primary superblock.\n"
"It can also be used to enable selected features, such as support for\n"
"unwritten extents. The updated version is written into all AGs.\n"
"\n"
));
}
static int
do_version(xfs_agnumber_t agno, __uint16_t version, __uint32_t features)
{
xfs_sb_t tsb;
if (!get_sb(agno, &tsb))
return 0;
if (xfs_sb_has_mismatched_features2(&tsb)) {
dbprintf(_("Superblock has mismatched features2 fields, "
"skipping modification\n"));
return 0;
}
if ((version & XFS_SB_VERSION_LOGV2BIT) &&
!xfs_sb_version_haslogv2(&tsb)) {
tsb.sb_logsunit = 1;
}
tsb.sb_versionnum = version;
tsb.sb_features2 = features;
tsb.sb_bad_features2 = features;
libxfs_sb_to_disk(iocur_top->data, &tsb);
write_cur();
return 1;
}
static char *
version_string(
xfs_sb_t *sbp)
{
static char s[1024];
if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_1)
strcpy(s, "V1");
else if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_2)
strcpy(s, "V2");
else if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_3)
strcpy(s, "V3");
else if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4)
strcpy(s, "V4");
else if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5)
strcpy(s, "V5");
/*
* We assume the state of these features now, so macros don't exist for
* them any more.
*/
if (sbp->sb_versionnum & XFS_SB_VERSION_NLINKBIT)
strcat(s, ",NLINK");
if (sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT)
strcat(s, ",SHARED");
if (sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT)
strcat(s, ",DIRV2");
if (xfs_sb_version_hasattr(sbp))
strcat(s, ",ATTR");
if (xfs_sb_version_hasquota(sbp))
strcat(s, ",QUOTA");
if (xfs_sb_version_hasalign(sbp))
strcat(s, ",ALIGN");
if (xfs_sb_version_hasdalign(sbp))
strcat(s, ",DALIGN");
if (xfs_sb_version_haslogv2(sbp))
strcat(s, ",LOGV2");
if (xfs_sb_version_hasextflgbit(sbp))
strcat(s, ",EXTFLG");
if (xfs_sb_version_hassector(sbp))
strcat(s, ",SECTOR");
if (xfs_sb_version_hasasciici(sbp))
strcat(s, ",ASCII_CI");
if (xfs_sb_version_hasmorebits(sbp))
strcat(s, ",MOREBITS");
if (xfs_sb_version_hasattr2(sbp))
strcat(s, ",ATTR2");
if (xfs_sb_version_haslazysbcount(sbp))
strcat(s, ",LAZYSBCOUNT");
if (xfs_sb_version_hasprojid32bit(sbp))
strcat(s, ",PROJID32BIT");
if (xfs_sb_version_hascrc(sbp))
strcat(s, ",CRC");
if (xfs_sb_version_hasftype(sbp))
strcat(s, ",FTYPE");
if (xfs_sb_version_hasfinobt(sbp))
strcat(s, ",FINOBT");
if (xfs_sb_version_hassparseinodes(sbp))
strcat(s, ",SPARSE_INODES");
if (xfs_sb_version_hasmetauuid(sbp))
strcat(s, ",META_UUID");
return s;
}
/*
* XXX: this only supports reading and writing to version 4 superblock fields.
* V5 superblocks always define certain V4 feature bits - they are blocked from
* being changed if a V5 sb is detected, but otherwise v5 superblock features
* are not handled here.
*/
static int
version_f(
int argc,
char **argv)
{
__uint16_t version = 0;
__uint32_t features = 0;
xfs_agnumber_t ag;
if (argc == 2) { /* WRITE VERSION */
if ((x.isreadonly & LIBXFS_ISREADONLY) || !expert_mode) {
dbprintf(_("%s: not in expert mode, writing disabled\n"),
progname);
return 0;
}
/* Logic here derived from the IRIX xfs_chver(1M) script. */
if (!strcasecmp(argv[1], "extflg")) {
switch (XFS_SB_VERSION_NUM(&mp->m_sb)) {
case XFS_SB_VERSION_1:
version = 0x0004 | XFS_SB_VERSION_EXTFLGBIT;
break;
case XFS_SB_VERSION_2:
version = 0x0014 | XFS_SB_VERSION_EXTFLGBIT;
break;
case XFS_SB_VERSION_3:
version = 0x0034 | XFS_SB_VERSION_EXTFLGBIT;
break;
case XFS_SB_VERSION_4:
if (xfs_sb_version_hasextflgbit(&mp->m_sb))
dbprintf(
_("unwritten extents flag is already enabled\n"));
else
version = mp->m_sb.sb_versionnum |
XFS_SB_VERSION_EXTFLGBIT;
break;
case XFS_SB_VERSION_5:
dbprintf(
_("unwritten extents always enabled for v5 superblocks.\n"));
break;
}
} else if (!strcasecmp(argv[1], "log2")) {
switch (XFS_SB_VERSION_NUM(&mp->m_sb)) {
case XFS_SB_VERSION_1:
version = 0x0004 | XFS_SB_VERSION_LOGV2BIT;
break;
case XFS_SB_VERSION_2:
version = 0x0014 | XFS_SB_VERSION_LOGV2BIT;
break;
case XFS_SB_VERSION_3:
version = 0x0034 | XFS_SB_VERSION_LOGV2BIT;
break;
case XFS_SB_VERSION_4:
if (xfs_sb_version_haslogv2(&mp->m_sb))
dbprintf(
_("version 2 log format is already in use\n"));
else
version = mp->m_sb.sb_versionnum |
XFS_SB_VERSION_LOGV2BIT;
break;
case XFS_SB_VERSION_5:
dbprintf(
_("Version 2 logs always enabled for v5 superblocks.\n"));
break;
}
} else if (XFS_SB_VERSION_NUM(&mp->m_sb) == XFS_SB_VERSION_5) {
dbprintf(
_("%s: Cannot change %s on v5 superblocks.\n"),
progname, argv[1]);
return 0;
} else if (!strcasecmp(argv[1], "attr1")) {
if (xfs_sb_version_hasattr2(&mp->m_sb)) {
if (!(mp->m_sb.sb_features2 &=
~XFS_SB_VERSION2_ATTR2BIT))
mp->m_sb.sb_versionnum &=
~XFS_SB_VERSION_MOREBITSBIT;
}
xfs_sb_version_addattr(&mp->m_sb);
version = mp->m_sb.sb_versionnum;
features = mp->m_sb.sb_features2;
} else if (!strcasecmp(argv[1], "attr2")) {
xfs_sb_version_addattr(&mp->m_sb);
xfs_sb_version_addattr2(&mp->m_sb);
version = mp->m_sb.sb_versionnum;
features = mp->m_sb.sb_features2;
} else if (!strcasecmp(argv[1], "projid32bit")) {
xfs_sb_version_addprojid32bit(&mp->m_sb);
version = mp->m_sb.sb_versionnum;
features = mp->m_sb.sb_features2;
} else {
dbprintf(_("%s: invalid version change command \"%s\"\n"),
progname, argv[1]);
return 0;
}
if (version) {
dbprintf(_("writing all SBs\n"));
for (ag = 0; ag < mp->m_sb.sb_agcount; ag++)
if (!do_version(ag, version, features)) {
dbprintf(_("failed to set versionnum "
"in AG %d\n"), ag);
break;
}
mp->m_sb.sb_versionnum = version;
mp->m_sb.sb_features2 = features;
}
}
if (argc == 3) { /* VERSIONNUM + FEATURES2 */
char *sp;
version = mp->m_sb.sb_versionnum;
features = mp->m_sb.sb_features2;
mp->m_sb.sb_versionnum = strtoul(argv[1], &sp, 0);
mp->m_sb.sb_features2 = strtoul(argv[2], &sp, 0);
}
dbprintf(_("versionnum [0x%x+0x%x] = %s\n"), mp->m_sb.sb_versionnum,
mp->m_sb.sb_features2, version_string(&mp->m_sb));
if (argc == 3) { /* now reset... */
mp->m_sb.sb_versionnum = version;
mp->m_sb.sb_features2 = features;
return 0;
}
return 0;
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/sb.h 0000664 0000000 0000000 00000001622 12560572026 013770 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern const struct field sb_flds[];
extern const struct field sb_hfld[];
extern void sb_init(void);
extern int sb_logcheck(void);
extern int sb_size(void *obj, int startoff, int idx);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/sig.c 0000664 0000000 0000000 00000002443 12574431650 014145 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include
#include "sig.h"
static int gotintr;
static sigset_t intrset;
static void
interrupt(int sig, siginfo_t *info, void *uc)
{
gotintr = 1;
}
void
blockint(void)
{
sigprocmask(SIG_BLOCK, &intrset, NULL);
}
void
clearint(void)
{
gotintr = 0;
}
void
init_sig(void)
{
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_sigaction = interrupt;
sigaction(SIGINT, &sa, NULL);
sigemptyset(&intrset);
sigaddset(&intrset, SIGINT);
}
int
seenint(void)
{
return gotintr;
}
void
unblockint(void)
{
sigprocmask(SIG_UNBLOCK, &intrset, NULL);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/sig.h 0000664 0000000 0000000 00000001544 12560572026 014151 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void blockint(void);
extern void clearint(void);
extern void init_sig(void);
extern int seenint(void);
extern void unblockint(void);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/strvec.c 0000664 0000000 0000000 00000003276 12574431650 014676 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "strvec.h"
#include "output.h"
#include "malloc.h"
static int count_strvec(char **vec);
void
add_strvec(
char ***vecp,
char *str)
{
char *dup;
int i;
char **vec;
dup = xstrdup(str);
vec = *vecp;
i = count_strvec(vec);
vec = xrealloc(vec, sizeof(*vec) * (i + 2));
vec[i] = dup;
vec[i + 1] = NULL;
*vecp = vec;
}
char **
copy_strvec(
char **vec)
{
int i;
char **rval;
i = count_strvec(vec);
rval = new_strvec(i);
for (i = 0; vec[i] != NULL; i++)
rval[i] = xstrdup(vec[i]);
return rval;
}
static int
count_strvec(
char **vec)
{
int i;
for (i = 0; vec[i] != NULL; i++)
continue;
return i;
}
void
free_strvec(
char **vec)
{
int i;
for (i = 0; vec[i] != NULL; i++)
xfree(vec[i]);
xfree(vec);
}
char **
new_strvec(
int count)
{
char **rval;
rval = xmalloc(sizeof(*rval) * (count + 1));
rval[count] = NULL;
return rval;
}
void
print_strvec(
char **vec)
{
int i;
for (i = 0; vec[i] != NULL; i++)
dbprintf("%s", vec[i]);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/strvec.h 0000664 0000000 0000000 00000001640 12560572026 014672 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void add_strvec(char ***vecp, char *str);
extern char **copy_strvec(char **vec);
extern void free_strvec(char **vec);
extern char **new_strvec(int count);
extern void print_strvec(char **vec);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/symlink.c 0000664 0000000 0000000 00000004477 12574431650 015062 0 ustar /*
* Copyright (c) 2013 Red Hat, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "bit.h"
#include "init.h"
/*
* XXX: no idea how to handle multiple contiguous block symlinks here.
*/
static int
symlink_count(
void *obj,
int startoff)
{
struct xfs_dsymlink_hdr *hdr = obj;
ASSERT(startoff == 0);
if (hdr->sl_magic != cpu_to_be32(XFS_SYMLINK_MAGIC))
return 0;
if (be32_to_cpu(hdr->sl_bytes) + sizeof(*hdr) > mp->m_sb.sb_blocksize)
return mp->m_sb.sb_blocksize - sizeof(*hdr);
return be32_to_cpu(hdr->sl_bytes);
}
int
symlink_size(
void *obj,
int startoff,
int idx)
{
struct xfs_dsymlink_hdr *hdr = obj;
ASSERT(startoff == 0);
if (hdr->sl_magic != cpu_to_be32(XFS_SYMLINK_MAGIC))
return 0;
return be32_to_cpu(hdr->sl_bytes) + sizeof(*hdr);
}
const struct field symlink_crc_hfld[] = {
{ "", FLDT_SYMLINK_CRC, OI(0), C1, 0, TYP_NONE },
{ NULL }
};
#define OFF(f) bitize(offsetof(struct xfs_dsymlink_hdr, sl_ ## f))
#define SZOF(f) bitize(sizeof(struct xfs_dsymlink_hdr))
const struct field symlink_crc_flds[] = {
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "offset", FLDT_UINT32D, OI(OFF(offset)), C1, 0, TYP_NONE },
{ "bytes", FLDT_UINT32D, OI(OFF(bytes)), C1, 0, TYP_NONE },
{ "crc", FLDT_CRC, OI(OFF(crc)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_INO, OI(OFF(owner)), C1, 0, TYP_NONE },
{ "bno", FLDT_DFSBNO, OI(OFF(blkno)), C1, 0, TYP_BMAPBTD },
{ "lsn", FLDT_UINT64X, OI(OFF(lsn)), C1, 0, TYP_NONE },
{ "data", FLDT_CHARNS, OI(bitize(sizeof(struct xfs_dsymlink_hdr))),
symlink_count, FLD_COUNT, TYP_NONE },
{ NULL }
};
xfsprogs-4.3.0+nmu1ubuntu1.1/db/symlink.h 0000664 0000000 0000000 00000001664 12560572026 015060 0 ustar /*
* Copyright (c) 2013 Red Hat, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __XFS_DB_SYMLINK_H
#define __XFS_DB_SYMLINK_H
extern const struct field symlink_crc_hfld[];
extern const struct field symlink_crc_flds[];
extern int symlink_size(void *obj, int startoff, int idx);
#endif /* __XFS_DB_SYMLINK_H */
xfsprogs-4.3.0+nmu1ubuntu1.1/db/text.c 0000664 0000000 0000000 00000003515 12574431650 014350 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include
#include "block.h"
#include "bmap.h"
#include "command.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "inode.h"
#include "io.h"
#include "output.h"
#include "init.h"
static void print_rawtext(void *data, int len);
void
print_text(
const field_t *fields,
int argc,
char **argv)
{
print_rawtext(iocur_top->data, iocur_top->len);
}
static void
print_rawtext(
void *data,
int len)
{
int i;
int j;
int lastaddr;
int offchars;
unsigned char *p;
lastaddr = (len - 1) & ~(16 - 1);
if (lastaddr < 0x10)
offchars = 1;
else if (lastaddr < 0x100)
offchars = 2;
else if (lastaddr < 0x1000)
offchars = 3;
else
offchars = 4;
for (i = 0, p = data; i < len; i += 16) {
unsigned char *s = p;
dbprintf("%-0*.*x: ", offchars, offchars, i);
for (j = 0; j < 16 && i + j < len; j++, p++) {
dbprintf("%02x ", *p);
}
dbprintf(" ");
for (j = 0; j < 16 && i + j < len; j++, s++) {
if (isalnum(*s))
dbprintf("%c", *s);
else
dbprintf(".", *s);
}
dbprintf("\n");
}
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/text.h 0000664 0000000 0000000 00000001447 12560572026 014355 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
extern void print_text(const struct field *fields, int argc, char **argv);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/type.c 0000664 0000000 0000000 00000017033 12625713771 014351 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include "block.h"
#include "command.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "print.h"
#include "sb.h"
#include "inode.h"
#include "btblock.h"
#include "bmroot.h"
#include "agf.h"
#include "agfl.h"
#include "agi.h"
#include "io.h"
#include "output.h"
#include "write.h"
#include "attr.h"
#include "dquot.h"
#include "dir2.h"
#include "text.h"
#include "symlink.h"
static const typ_t *findtyp(char *name);
static int type_f(int argc, char **argv);
const typ_t *cur_typ;
static const cmdinfo_t type_cmd =
{ "type", NULL, type_f, 0, 1, 1, N_("[newtype]"),
N_("set/show current data type"), NULL };
static const typ_t __typtab[] = {
{ TYP_AGF, "agf", handle_struct, agf_hfld, NULL },
{ TYP_AGFL, "agfl", handle_struct, agfl_hfld, NULL },
{ TYP_AGI, "agi", handle_struct, agi_hfld, NULL },
{ TYP_ATTR, "attr", handle_struct, attr_hfld, NULL },
{ TYP_BMAPBTA, "bmapbta", handle_struct, bmapbta_hfld, NULL },
{ TYP_BMAPBTD, "bmapbtd", handle_struct, bmapbtd_hfld, NULL },
{ TYP_BNOBT, "bnobt", handle_struct, bnobt_hfld, NULL },
{ TYP_CNTBT, "cntbt", handle_struct, cntbt_hfld, NULL },
{ TYP_DATA, "data", handle_block, NULL, NULL },
{ TYP_DIR2, "dir2", handle_struct, dir2_hfld, NULL },
{ TYP_DQBLK, "dqblk", handle_struct, dqblk_hfld, NULL },
{ TYP_INOBT, "inobt", handle_struct, inobt_hfld, NULL },
{ TYP_INODATA, "inodata", NULL, NULL, NULL },
{ TYP_INODE, "inode", handle_struct, inode_hfld, NULL },
{ TYP_LOG, "log", NULL, NULL, NULL },
{ TYP_RTBITMAP, "rtbitmap", NULL, NULL, NULL },
{ TYP_RTSUMMARY, "rtsummary", NULL, NULL, NULL },
{ TYP_SB, "sb", handle_struct, sb_hfld, NULL },
{ TYP_SYMLINK, "symlink", handle_string, NULL, NULL },
{ TYP_TEXT, "text", handle_text, NULL, NULL },
{ TYP_FINOBT, "finobt", handle_struct, inobt_hfld, NULL },
{ TYP_NONE, NULL }
};
static const typ_t __typtab_crc[] = {
{ TYP_AGF, "agf", handle_struct, agf_hfld, &xfs_agf_buf_ops },
{ TYP_AGFL, "agfl", handle_struct, agfl_crc_hfld, &xfs_agfl_buf_ops },
{ TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agi_buf_ops },
{ TYP_ATTR, "attr3", handle_struct, attr3_hfld,
&xfs_attr3_db_buf_ops },
{ TYP_BMAPBTA, "bmapbta", handle_struct, bmapbta_crc_hfld,
&xfs_bmbt_buf_ops },
{ TYP_BMAPBTD, "bmapbtd", handle_struct, bmapbtd_crc_hfld,
&xfs_bmbt_buf_ops },
{ TYP_BNOBT, "bnobt", handle_struct, bnobt_crc_hfld,
&xfs_allocbt_buf_ops },
{ TYP_CNTBT, "cntbt", handle_struct, cntbt_crc_hfld,
&xfs_allocbt_buf_ops },
{ TYP_DATA, "data", handle_block, NULL, NULL },
{ TYP_DIR2, "dir3", handle_struct, dir3_hfld,
&xfs_dir3_db_buf_ops },
{ TYP_DQBLK, "dqblk", handle_struct, dqblk_hfld,
&xfs_dquot_buf_ops },
{ TYP_INOBT, "inobt", handle_struct, inobt_crc_hfld,
&xfs_inobt_buf_ops },
{ TYP_INODATA, "inodata", NULL, NULL, NULL },
{ TYP_INODE, "inode", handle_struct, inode_crc_hfld,
&xfs_inode_buf_ops },
{ TYP_LOG, "log", NULL, NULL, NULL },
{ TYP_RTBITMAP, "rtbitmap", NULL, NULL, NULL },
{ TYP_RTSUMMARY, "rtsummary", NULL, NULL, NULL },
{ TYP_SB, "sb", handle_struct, sb_hfld, &xfs_sb_buf_ops },
{ TYP_SYMLINK, "symlink", handle_struct, symlink_crc_hfld,
&xfs_symlink_buf_ops },
{ TYP_TEXT, "text", handle_text, NULL, NULL },
{ TYP_FINOBT, "finobt", handle_struct, inobt_crc_hfld,
&xfs_inobt_buf_ops },
{ TYP_NONE, NULL }
};
static const typ_t __typtab_spcrc[] = {
{ TYP_AGF, "agf", handle_struct, agf_hfld, &xfs_agf_buf_ops },
{ TYP_AGFL, "agfl", handle_struct, agfl_crc_hfld, &xfs_agfl_buf_ops },
{ TYP_AGI, "agi", handle_struct, agi_hfld, &xfs_agi_buf_ops },
{ TYP_ATTR, "attr3", handle_struct, attr3_hfld,
&xfs_attr3_db_buf_ops },
{ TYP_BMAPBTA, "bmapbta", handle_struct, bmapbta_crc_hfld,
&xfs_bmbt_buf_ops },
{ TYP_BMAPBTD, "bmapbtd", handle_struct, bmapbtd_crc_hfld,
&xfs_bmbt_buf_ops },
{ TYP_BNOBT, "bnobt", handle_struct, bnobt_crc_hfld,
&xfs_allocbt_buf_ops },
{ TYP_CNTBT, "cntbt", handle_struct, cntbt_crc_hfld,
&xfs_allocbt_buf_ops },
{ TYP_DATA, "data", handle_block, NULL, NULL },
{ TYP_DIR2, "dir3", handle_struct, dir3_hfld,
&xfs_dir3_db_buf_ops },
{ TYP_DQBLK, "dqblk", handle_struct, dqblk_hfld,
&xfs_dquot_buf_ops },
{ TYP_INOBT, "inobt", handle_struct, inobt_spcrc_hfld,
&xfs_inobt_buf_ops },
{ TYP_INODATA, "inodata", NULL, NULL, NULL },
{ TYP_INODE, "inode", handle_struct, inode_crc_hfld,
&xfs_inode_buf_ops },
{ TYP_LOG, "log", NULL, NULL, NULL },
{ TYP_RTBITMAP, "rtbitmap", NULL, NULL, NULL },
{ TYP_RTSUMMARY, "rtsummary", NULL, NULL, NULL },
{ TYP_SB, "sb", handle_struct, sb_hfld, &xfs_sb_buf_ops },
{ TYP_SYMLINK, "symlink", handle_struct, symlink_crc_hfld,
&xfs_symlink_buf_ops },
{ TYP_TEXT, "text", handle_text, NULL, NULL },
{ TYP_FINOBT, "finobt", handle_struct, inobt_crc_hfld,
&xfs_inobt_buf_ops },
{ TYP_NONE, NULL }
};
const typ_t *typtab = __typtab;
void
type_set_tab_crc(void)
{
typtab = __typtab_crc;
}
void
type_set_tab_spcrc(void)
{
typtab = __typtab_spcrc;
}
static const typ_t *
findtyp(
char *name)
{
const typ_t *tt;
for (tt = typtab; tt->typnm != TYP_NONE; tt++) {
ASSERT(tt->typnm == (typnm_t)(tt - typtab));
if (tt->name && strcmp(tt->name, name) == 0)
return tt;
}
return NULL;
}
static int
type_f(
int argc,
char **argv)
{
const typ_t *tt;
int count = 0;
if (argc == 1) {
if (cur_typ == NULL)
dbprintf(_("no current type\n"));
else
dbprintf(_("current type is \"%s\"\n"), cur_typ->name);
dbprintf(_("\n supported types are:\n "));
for (tt = typtab, count = 0; tt->typnm != TYP_NONE; tt++) {
if (tt->name == NULL)
continue;
if ((tt+1)->name != NULL) {
dbprintf("%s, ", tt->name);
if ((++count % 8) == 0)
dbprintf("\n ");
} else if ((tt+1)->typnm == TYP_NONE) {
dbprintf("%s\n", tt->name);
}
}
} else {
tt = findtyp(argv[1]);
if (tt == NULL) {
dbprintf(_("no such type %s\n"), argv[1]);
} else {
if (iocur_top->typ == NULL)
dbprintf(_("no current object\n"));
else {
cur_typ = tt;
set_iocur_type(tt);
}
}
}
return 0;
}
void
type_init(void)
{
add_command(&type_cmd);
}
/* read/write selectors for each major data type */
void
handle_struct(
int action,
const field_t *fields,
int argc,
char **argv)
{
if (action == DB_WRITE)
write_struct(fields, argc, argv);
else
print_struct(fields, argc, argv);
}
void
handle_string(
int action,
const field_t *fields,
int argc,
char **argv)
{
if (action == DB_WRITE)
write_string(fields, argc, argv);
else
print_string(fields, argc, argv);
}
void
handle_block(
int action,
const field_t *fields,
int argc,
char **argv)
{
if (action == DB_WRITE)
write_block(fields, argc, argv);
else
print_block(fields, argc, argv);
}
void
handle_text(
int action,
const field_t *fields,
int argc,
char **argv)
{
if (action != DB_WRITE)
print_text(fields, argc, argv);
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/type.h 0000664 0000000 0000000 00000003700 12574431650 014346 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
struct field;
#define szof(x,y) sizeof(((x *)0)->y)
#define szcount(x,y) (szof(x,y) / szof(x,y[0]))
typedef enum typnm
{
TYP_AGF, TYP_AGFL, TYP_AGI, TYP_ATTR, TYP_BMAPBTA,
TYP_BMAPBTD, TYP_BNOBT, TYP_CNTBT, TYP_DATA,
TYP_DIR2, TYP_DQBLK, TYP_INOBT, TYP_INODATA, TYP_INODE,
TYP_LOG, TYP_RTBITMAP, TYP_RTSUMMARY, TYP_SB, TYP_SYMLINK,
TYP_TEXT, TYP_FINOBT, TYP_NONE
} typnm_t;
#define DB_WRITE 1
#define DB_READ 0
typedef void (*opfunc_t)(const struct field *fld, int argc, char **argv);
typedef void (*pfunc_t)(int action, const struct field *fld, int argc, char **argv);
typedef struct typ
{
typnm_t typnm;
char *name;
pfunc_t pfunc;
const struct field *fields;
const struct xfs_buf_ops *bops;
} typ_t;
extern const typ_t *typtab, *cur_typ;
extern void type_init(void);
extern void type_set_tab_crc(void);
extern void type_set_tab_spcrc(void);
extern void handle_block(int action, const struct field *fields, int argc,
char **argv);
extern void handle_string(int action, const struct field *fields, int argc,
char **argv);
extern void handle_struct(int action, const struct field *fields, int argc,
char **argv);
extern void handle_text(int action, const struct field *fields, int argc,
char **argv);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/write.c 0000664 0000000 0000000 00000040243 12574431650 014515 0 ustar /*
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libxfs.h"
#include
#include
#include "bit.h"
#include "block.h"
#include "command.h"
#include "type.h"
#include "faddr.h"
#include "fprint.h"
#include "field.h"
#include "flist.h"
#include "io.h"
#include "init.h"
#include "output.h"
#include "print.h"
#include "write.h"
#include "malloc.h"
static int write_f(int argc, char **argv);
static void write_help(void);
static const cmdinfo_t write_cmd =
{ "write", NULL, write_f, 0, -1, 0, N_("[-c] [field or value]..."),
N_("write value to disk"), write_help };
void
write_init(void)
{
if (!expert_mode)
return;
add_command(&write_cmd);
srand48(clock());
}
static void
write_help(void)
{
dbprintf(_(
"\n"
" The 'write' command takes on different personalities depending on the\n"
" type of object being worked with.\n\n"
" Write has 3 modes:\n"
" 'struct mode' - is active anytime you're looking at a filesystem object\n"
" which contains individual fields (ex: an inode).\n"
" 'data mode' - is active anytime you set a disk address directly or set\n"
" the type to 'data'.\n"
" 'string mode' - only used for writing symlink blocks.\n"
"\n"
" Examples:\n"
" Struct mode: 'write core.uid 23' - set an inode uid field to 23.\n"
" 'write fname \"hello\\000\"' - write superblock fname.\n"
" (note: in struct mode strings are not null terminated)\n"
" 'write fname #6669736800' - write superblock fname with hex.\n"
" 'write uuid 00112233-4455-6677-8899-aabbccddeeff'\n"
" - write superblock uuid.\n"
" Data mode: 'write fill 0xff' - fill the entire block with 0xff's\n"
" 'write lshift 3' - shift the block 3 bytes to the left\n"
" 'write sequence 1 5' - write a cycle of number [1-5] through\n"
" the entire block.\n"
" String mode: 'write \"This_is_a_filename\" - write null terminated string.\n"
"\n"
" In data mode type 'write' by itself for a list of specific commands.\n\n"
" Specifying the -c option will allow writes of invalid (corrupt) data.\n\n"
));
}
static int
write_f(
int argc,
char **argv)
{
pfunc_t pf;
extern char *progname;
int c;
int corrupt = 0; /* Allow write of corrupt data; skip verification */
struct xfs_buf_ops nowrite_ops;
const struct xfs_buf_ops *stashed_ops = NULL;
if (x.isreadonly & LIBXFS_ISREADONLY) {
dbprintf(_("%s started in read only mode, writing disabled\n"),
progname);
return 0;
}
if (cur_typ == NULL) {
dbprintf(_("no current type\n"));
return 0;
}
pf = cur_typ->pfunc;
if (pf == NULL) {
dbprintf(_("no handler function for type %s, write unsupported.\n"),
cur_typ->name);
return 0;
}
while ((c = getopt(argc, argv, "c")) != EOF) {
switch (c) {
case 'c':
corrupt = 1;
break;
default:
dbprintf(_("bad option for write command\n"));
return 0;
}
}
argc -= optind;
argv += optind;
if (iocur_top->bp->b_ops && corrupt) {
/* Temporarily remove write verifier to write bad data */
stashed_ops = iocur_top->bp->b_ops;
nowrite_ops.verify_read = stashed_ops->verify_read;
nowrite_ops.verify_write = xfs_dummy_verify;
iocur_top->bp->b_ops = &nowrite_ops;
dbprintf(_("Allowing write of corrupted data\n"));
}
(*pf)(DB_WRITE, cur_typ->fields, argc, argv);
if (stashed_ops)
iocur_top->bp->b_ops = stashed_ops;
return 0;
}
/* compare significant portions of commands */
static int
sigcmp(
char *s1,
char *s2,
int sig)
{
int sigcnt;
if (!s1 || !s2)
return 0;
for (sigcnt = 0; *s1 == *s2; s1++, s2++) {
sigcnt++;
if (*s1 == '\0')
return 1;
}
if (*s1 && *s2)
return 0;
if (sig && (sigcnt >= sig))
return 1;
return 0;
}
/* ARGSUSED */
static void
bwrite_lshift(
int start,
int len,
int shift,
int from,
int to)
{
char *base;
if (shift == -1)
shift = 1;
if (start == -1)
start = 0;
if (len == -1)
len = iocur_top->len - start;
if (len+start > iocur_top->len) {
dbprintf(_("length (%d) too large for data block size (%d)"),
len, iocur_top->len);
}
base = (char *)iocur_top->data + start;
memcpy(base, base+shift, len-shift);
memset(base+(len-shift), 0, shift);
}
/* ARGSUSED */
static void
bwrite_rshift(
int start,
int len,
int shift,
int from,
int to)
{
char *base;
if (shift == -1)
shift = 1;
if (start == -1)
start = 0;
if (len == -1)
len = iocur_top->len - start;
if (len+start > iocur_top->len) {
dbprintf(_("length (%d) too large for data block size (%d)"),
len, iocur_top->len);
}
base = (char *)iocur_top->data + start;
memcpy(base+shift, base, len-shift);
memset(base, 0, shift);
}
/* ARGSUSED */
static void
bwrite_lrot(
int start,
int len,
int shift,
int from,
int to)
{
char *base;
char *hold_region;
if (shift == -1)
shift = 1;
if (start == -1)
start = 0;
if (len == -1)
len = iocur_top->len - start;
if (len+start > iocur_top->len) {
dbprintf(_("length (%d) too large for data block size (%d)"),
len, iocur_top->len);
}
base = (char *)iocur_top->data + start;
hold_region = xmalloc(shift);
memcpy(hold_region, base, shift);
memcpy(base, base+shift, len-shift);
memcpy(base+(len-shift), hold_region, shift);
free(hold_region);
}
/* ARGSUSED */
static void
bwrite_rrot(
int start,
int len,
int shift,
int from,
int to)
{
char *base;
char *hold_region;
if (shift == -1)
shift = 1;
if (start == -1)
start = 0;
if (len == -1)
len = iocur_top->len - start;
if (len+start > iocur_top->len) {
dbprintf(_("length (%d) too large for data block size (%d)"),
len, iocur_top->len);
}
base = (char *)iocur_top->data + start;
hold_region = xmalloc(shift);
memcpy(hold_region, base+(len-shift), shift);
memmove(base+shift, base, len-shift);
memcpy(base, hold_region, shift);
free(hold_region);
}
/* ARGSUSED */
static void
bwrite_seq(
int start,
int len,
int step,
int from,
int to)
{
int i;
int tmp;
int base;
int range;
int top;
char *buf;
if (start == -1)
start = 0;
if (len == -1)
len = iocur_top->len - start;
if (len+start > iocur_top->len) {
dbprintf(_("length (%d) too large for data block size (%d)"),
len, iocur_top->len);
}
if (from == -1 || from > 255)
from = 0;
if (to == -1 || to > 255)
to = 255;
if (step == -1)
step = 1;
base = from;
top = to;
if (from > to) {
base = to;
top = from;
if (step > 0)
step = -step;
}
range = top - base;
buf = (char *)iocur_top->data + start;
tmp = 0;
for (i = start; i < start+len; i++) {
*buf++ = tmp + base;
tmp = (tmp + step)%(range+1);
}
}
/* ARGSUSED */
static void
bwrite_random(
int start,
int len,
int shift,
int from,
int to)
{
int i;
char *buf;
if (start == -1)
start = 0;
if (len == -1)
len = iocur_top->len - start;
if (len+start > iocur_top->len) {
dbprintf(_("length (%d) too large for data block size (%d)"),
len, iocur_top->len);
}
buf = (char *)iocur_top->data + start;
for (i = start; i < start+len; i++)
*buf++ = (char)lrand48();
}
/* ARGSUSED */
static void
bwrite_fill(
int start,
int len,
int value,
int from,
int to)
{
char *base;
if (value == -1)
value = 0;
if (start == -1)
start = 0;
if (len == -1)
len = iocur_top->len - start;
if (len+start > iocur_top->len) {
dbprintf(_("length (%d) too large for data block size (%d)"),
len, iocur_top->len);
}
base = (char *)iocur_top->data + start;
memset(base, value, len);
}
static struct bw_cmd {
void (*cmdfunc)(int,int,int,int,int);
char *cmdstr;
int sig_chars;
int argmin;
int argmax;
int shiftcount_arg;
int from_arg;
int to_arg;
int start_arg;
int len_arg;
char *usage;
} bw_cmdtab[] = {
/* cmd sig min max sh frm to start len */
{ bwrite_lshift, "lshift", 2, 0, 3, 1, 0, 0, 2, 3,
"[shiftcount] [start] [len]", },
{ bwrite_rshift, "rshift", 2, 0, 3, 1, 0, 0, 2, 3,
"[shiftcount] [start] [len]", },
{ bwrite_lrot, "lrot", 2, 0, 3, 1, 0, 0, 2, 3,
"[shiftcount] [start] [len]", },
{ bwrite_rrot, "rrot", 2, 0, 3, 1, 0, 0, 2, 3,
"[shiftcount] [start] [len]", },
{ bwrite_seq, "sequence", 3, 0, 4, 0, 1, 2, 3, 4,
"[from] [to] [start] [len]", },
{ bwrite_random, "random", 3, 0, 2, 0, 0, 0, 1, 2,
"[start] [len]", },
{ bwrite_fill, "fill", 1, 1, 3, 1, 0, 0, 2, 3,
"num [start] [len]" }
};
#define BWRITE_CMD_MAX (sizeof(bw_cmdtab)/sizeof(bw_cmdtab[0]))
static int
convert_oct(
char *arg,
int *ret)
{
int count;
int i;
int val = 0;
/* only allow 1 case, '\' and 3 octal digits (or less) */
for (count = 0; count < 3; count++) {
if (arg[count] == '\0')
break;
if ((arg[count] < '0') && (arg[count] > '7'))
break;
}
for (i = 0; i < count; i++) {
val |= ((arg[(count-1)-i]-'0')&0x07)<<(i*3);
}
*ret = val&0xff;
return(count);
}
#define NYBBLE(x) (isdigit(x)?(x-'0'):(tolower(x)-'a'+0xa))
/*
* convert_arg allows input in the following forms:
*
* - A string ("ABTB") whose ASCII value is placed in an array in the order
* matching the input.
*
* - An even number of hex numbers. If the length is greater than 64 bits,
* then the output is an array of bytes whose top nibble is the first hex
* digit in the input, the lower nibble is the second hex digit in the
* input. UUID entries are entered in this manner.
*
* - A decimal or hexadecimal integer to be used with setbitval().
*
* Numbers that are passed to setbitval() need to be in big endian format and
* are adjusted in the buffer so that the first input bit is to be be written to
* the first bit in the output.
*/
static char *
convert_arg(
char *arg,
int bit_length)
{
int i;
int alloc_size;
int octval;
int offset;
int ret;
static char *buf = NULL;
char *endp;
char *rbuf;
char *ostr;
__u64 *value;
__u64 val = 0;
if (bit_length <= 64)
alloc_size = 8;
else
alloc_size = (bit_length + 7) / 8;
buf = xrealloc(buf, alloc_size);
memset(buf, 0, alloc_size);
value = (__u64 *)buf;
rbuf = buf;
if (*arg == '\"') {
/* input a string and output ASCII array of characters */
/* zap closing quote if there is one */
ostr = strrchr(arg + 1, '\"');
if (ostr)
*ostr = '\0';
ostr = arg + 1;
for (i = 0; i < alloc_size; i++) {
if (!*ostr)
break;
/* do octal conversion */
if (*ostr == '\\') {
if (*(ostr + 1) >= '0' || *(ostr + 1) <= '7') {
ret = convert_oct(ostr + 1, &octval);
*rbuf++ = octval;
ostr += ret + 1;
continue;
}
}
*rbuf++ = *ostr++;
}
return buf;
}
if (arg[0] == '#' || ((arg[0] != '-') && strchr(arg,'-'))) {
/*
* handle hex blocks ie
* #00112233445566778899aabbccddeeff
* and uuids ie
* 1122334455667788-99aa-bbcc-ddee-ff00112233445566778899
*
* (but if it starts with "-" assume it's just an integer)
*/
int bytes = bit_length / NBBY;
/* is this an array of hec numbers? */
if (bit_length % NBBY)
return NULL;
/* skip leading hash */
if (*arg == '#')
arg++;
while (*arg && bytes--) {
/* skip hypens */
while (*arg == '-')
arg++;
/* get first nybble */
if (!isxdigit((int)*arg))
return NULL;
*rbuf = NYBBLE((int)*arg) << 4;
arg++;
/* skip more hyphens */
while (*arg == '-')
arg++;
/* get second nybble */
if (!isxdigit((int)*arg))
return NULL;
*rbuf++ |= NYBBLE((int)*arg);
arg++;
}
if (bytes < 0 && *arg)
return NULL;
return buf;
}
/* handle decimal / hexadecimal integers */
val = strtoll(arg, &endp, 0);
/* return if not a clean number */
if (*endp != '\0')
return NULL;
/* Does the value fit into the range of the destination bitfield? */
if (bit_length < 64 && (val >> bit_length) > 0)
return NULL;
/*
* If the length of the field is not a multiple of a byte, push
* the bits up in the field, so the most signicant field bit is
* the most significant bit in the byte:
*
* before:
* val |----|----|----|----|----|--MM|mmmm|llll|
* after
* val |----|----|----|----|----|MMmm|mmll|ll00|
*/
offset = bit_length % NBBY;
if (offset)
val <<= (NBBY - offset);
/*
* convert to big endian and copy into the array
* rbuf |----|----|----|----|----|MMmm|mmll|ll00|
*/
*value = cpu_to_be64(val);
/*
* Align the array to point to the field in the array.
* rbuf = |MMmm|mmll|ll00|
*/
offset = sizeof(__be64) - 1 - ((bit_length - 1) / sizeof(__be64));
rbuf += offset;
return rbuf;
}
/* ARGSUSED */
void
write_struct(
const field_t *fields,
int argc,
char **argv)
{
const ftattr_t *fa;
flist_t *fl;
flist_t *sfl;
int bit_length;
char *buf;
int parentoffset;
if (argc != 2) {
dbprintf(_("usage: write fieldname value\n"));
return;
}
fl = flist_scan(argv[0]);
if (!fl) {
dbprintf(_("unable to parse '%s'.\n"), argv[0]);
return;
}
/* if we're a root field type, go down 1 layer to get field list */
if (fields->name[0] == '\0') {
fa = &ftattrtab[fields->ftyp];
ASSERT(fa->ftyp == fields->ftyp);
fields = fa->subfld;
}
/* run down the field list and set offsets into the data */
if (!flist_parse(fields, fl, iocur_top->data, 0)) {
flist_free(fl);
dbprintf(_("parsing error\n"));
return;
}
sfl = fl;
parentoffset = 0;
while (sfl->child) {
parentoffset = sfl->offset;
sfl = sfl->child;
}
bit_length = fsize(sfl->fld, iocur_top->data, parentoffset, 0);
bit_length *= fcount(sfl->fld, iocur_top->data, parentoffset);
/* convert this to a generic conversion routine */
/* should be able to handle str, num, or even labels */
buf = convert_arg(argv[1], bit_length);
if (!buf) {
dbprintf(_("unable to convert value '%s'.\n"), argv[1]);
flist_free(fl);
return;
}
setbitval(iocur_top->data, sfl->offset, bit_length, buf);
write_cur();
flist_print(fl);
print_flist(fl);
flist_free(fl);
}
/* ARGSUSED */
void
write_string(
const field_t *fields,
int argc,
char **argv)
{
char *buf;
int i;
if (argc != 1) {
dbprintf(_("usage (in string mode): write \"string...\"\n"));
return;
}
buf = convert_arg(argv[0], (int)((strlen(argv[0])+1)*8));
for (i = 0; i < iocur_top->len; i++) {
((char *)iocur_top->data)[i] = *buf;
if (*buf++ == '\0')
break;
}
/* write back to disk */
write_cur();
}
/* ARGSUSED */
void
write_block(
const field_t *fields,
int argc,
char **argv)
{
int i;
int shiftcount = -1;
int start = -1;
int len = -1;
int from = -1;
int to = -1;
struct bw_cmd *cmd = NULL;
if (argc <= 1 || argc > 5)
goto block_usage;
for (i = 0; i < BWRITE_CMD_MAX; i++) {
if (sigcmp(argv[0], bw_cmdtab[i].cmdstr,
bw_cmdtab[i].sig_chars)) {
cmd = &bw_cmdtab[i];
break;
}
}
if (!cmd) {
dbprintf(_("write: invalid subcommand\n"));
goto block_usage;
}
if ((argc < cmd->argmin + 1) || (argc > cmd->argmax + 1)) {
dbprintf(_("write %s: invalid number of arguments\n"),
cmd->cmdstr);
goto block_usage;
}
if (cmd->shiftcount_arg && (cmd->shiftcount_arg < argc))
shiftcount = (int)strtoul(argv[cmd->shiftcount_arg], NULL, 0);
if (cmd->start_arg && (cmd->start_arg < argc))
start = (int)strtoul(argv[cmd->start_arg], NULL, 0);
if (cmd->len_arg && (cmd->len_arg < argc))
len = (int)strtoul(argv[cmd->len_arg], NULL, 0);
if (cmd->from_arg && (cmd->len_arg < argc))
from = (int)strtoul(argv[cmd->from_arg], NULL, 0);
if (cmd->to_arg && (cmd->len_arg < argc))
to = (int)strtoul(argv[cmd->to_arg], NULL, 0);
cmd->cmdfunc(start, len, shiftcount, from, to);
/* write back to disk */
write_cur();
return;
block_usage:
dbprintf(_("usage: write (in data mode)\n"));
for (i = 0; i < BWRITE_CMD_MAX; i++) {
dbprintf(" %-9.9s %s\n",
bw_cmdtab[i].cmdstr, bw_cmdtab[i].usage);
}
dbprintf("\n");
return;
}
xfsprogs-4.3.0+nmu1ubuntu1.1/db/write.h 0000664 0000000 0000000 00000001734 12560572026 014522 0 ustar /*
* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
struct field;
extern void write_init(void);
extern void write_block(const field_t *fields, int argc, char **argv);
extern void write_string(const field_t *fields, int argc, char **argv);
extern void write_struct(const field_t *fields, int argc, char **argv);
xfsprogs-4.3.0+nmu1ubuntu1.1/db/xfs_admin.sh 0000775 0000000 0000000 00000002544 12560572026 015526 0 ustar #!/bin/sh -f
#
# Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
#
status=0
DB_OPTS=""
REPAIR_OPTS=""
USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device"
while getopts "efjlpuc:L:U:V" c
do
case $c in
c) REPAIR_OPTS=$REPAIR_OPTS" -c lazycount="$OPTARG;;
e) DB_OPTS=$DB_OPTS" -c 'version extflg'";;
f) DB_OPTS=$DB_OPTS" -f";;
j) DB_OPTS=$DB_OPTS" -c 'version log2'";;
l) DB_OPTS=$DB_OPTS" -r -c label";;
L) DB_OPTS=$DB_OPTS" -c 'label "$OPTARG"'";;
p) DB_OPTS=$DB_OPTS" -c 'version projid32bit'";;
u) DB_OPTS=$DB_OPTS" -r -c uuid";;
U) DB_OPTS=$DB_OPTS" -c 'uuid "$OPTARG"'";;
V) xfs_db -p xfs_admin -V
status=$?
exit $status
;;
\?) echo $USAGE 1>&2
exit 2
;;
esac
done
set -- extra $@
shift $OPTIND
case $# in
1) if [ -n "$DB_OPTS" ]
then
eval xfs_db -x -p xfs_admin $DB_OPTS $1
status=$?
fi
if [ -n "$REPAIR_OPTS" ]
then
# Hide normal repair output which is sent to stderr
# assuming the filesystem is fine when a user is
# running xfs_admin.
# Ideally, we need to improve the output behaviour
# of repair for this purpose (say a "quiet" mode).
eval xfs_repair $REPAIR_OPTS $1 2> /dev/null
status=`expr $? + $status`
if [ $status -ne 0 ]
then
echo "Conversion failed, is the filesystem unmounted?"
fi
fi
;;
*) echo $USAGE 1>&2
exit 2
;;
esac
exit $status
xfsprogs-4.3.0+nmu1ubuntu1.1/db/xfs_metadump.sh 0000775 0000000 0000000 00000001353 12560572026 016247 0 ustar #!/bin/sh -f
#
# Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved.
#
OPTS=" "
DBOPTS=" "
USAGE="Usage: xfs_metadump [-aefFogwV] [-m max_extents] [-l logdev] source target"
while getopts "aefgl:m:owFV" c
do
case $c in
a) OPTS=$OPTS"-a ";;
e) OPTS=$OPTS"-e ";;
g) OPTS=$OPTS"-g ";;
m) OPTS=$OPTS"-m "$OPTARG" ";;
o) OPTS=$OPTS"-o ";;
w) OPTS=$OPTS"-w ";;
f) DBOPTS=$DBOPTS" -f";;
l) DBOPTS=$DBOPTS" -l "$OPTARG" ";;
F) DBOPTS=$DBOPTS" -F";;
V) xfs_db -p xfs_metadump -V
status=$?
exit $status
;;
\?) echo $USAGE 1>&2
exit 2
;;
esac
done
set -- extra $@
shift $OPTIND
case $# in
2) xfs_db$DBOPTS -i -p xfs_metadump -c "metadump$OPTS $2" $1
status=$?
;;
*) echo $USAGE 1>&2
exit 2
;;
esac
exit $status
xfsprogs-4.3.0+nmu1ubuntu1.1/db/xfs_ncheck.sh 0000775 0000000 0000000 00000001212 12560572026 015660 0 ustar #!/bin/sh -f
#
# Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
#
OPTS=" "
DBOPTS=" "
USAGE="usage: xfs_ncheck [-sfV] [-l logdev] [-i ino]... special"
while getopts "b:fi:l:svV" c
do
case $c in
s) OPTS=$OPTS"-s ";;
i) OPTS=$OPTS"-i "$OPTARG" ";;
v) OPTS=$OPTS"-v ";;
f) DBOPTS=$DBOPTS" -f";;
l) DBOPTS=$DBOPTS" -l "$OPTARG" ";;
V) xfs_db -p xfs_ncheck -V
status=$?
exit $status
;;
\?) echo $USAGE 1>&2
exit 2
;;
esac
done
set -- extra $@
shift $OPTIND
case $# in
1) xfs_db$DBOPTS -r -p xfs_ncheck -c "blockget -ns" -c "ncheck$OPTS" $1
status=$?
;;
*) echo $USAGE 1>&2
exit 2
;;
esac
exit $status
xfsprogs-4.3.0+nmu1ubuntu1.1/debian/ 0000775 0000000 0000000 00000000000 13153553735 014054 5 ustar xfsprogs-4.3.0+nmu1ubuntu1.1/debian/Makefile 0000664 0000000 0000000 00000001720 12560572026 015507 0 ustar #
# Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
#
TOPDIR = ..
include $(TOPDIR)/include/builddefs
LSRCFILES = changelog compat control copyright rules watch
DEV_DOC_DIR = $(PKG_DOC_DIR)/../xfslibs-dev
BOOT_MKFS_BIN = $(TOPDIR)/mkfs/mkfs.xfs-xfsprogs-udeb
LDIRDIRT = xfslibs-dev xfsprogs xfsprogs-udeb
LDIRT = files *.log *.substvars *.debhelper
default:
include $(BUILDRULES)
install: default
ifeq ($(PKG_DISTRIBUTION), debian)
$(INSTALL) -m 755 -d $(PKG_DOC_DIR)
$(INSTALL) -m 644 changelog $(PKG_DOC_DIR)/changelog.Debian
endif
install-dev: default
ifeq ($(PKG_DISTRIBUTION), debian)
$(INSTALL) -m 755 -d $(PKG_DOC_DIR)
$(INSTALL) -m 755 -d $(DEV_DOC_DIR)
$(INSTALL) -m 644 copyright $(DEV_DOC_DIR)
$(INSTALL) -m 644 changelog $(DEV_DOC_DIR)/changelog.Debian
endif
install-d-i: default
ifeq ($(PKG_DISTRIBUTION), debian)
$(INSTALL) -m 755 -d $(PKG_ROOT_SBIN_DIR)
$(INSTALL) -m 755 $(BOOT_MKFS_BIN) $(PKG_ROOT_SBIN_DIR)/mkfs.xfs
endif
xfsprogs-4.3.0+nmu1ubuntu1.1/debian/changelog 0000664 0000000 0000000 00000060562 13153553735 015737 0 ustar xfsprogs (4.3.0+nmu1ubuntu1.1) xenial; urgency=medium
* xfs_copy: Fix meta UUID handling on multiple copies upstream fix
cbca895541facb. (LP: #1696102)
-- Brian Murray Tue, 05 Sep 2017 09:59:09 -0700
xfsprogs (4.3.0+nmu1ubuntu1) xenial; urgency=medium
* Enable blkid in d-i, by dropping explicitly passed configure option
(broken configure). (LP: #1544574).
* Drop trying to create upstream distribution.
-- Dimitri John Ledkov Tue, 16 Feb 2016 00:20:02 +0000
xfsprogs (4.3.0+nmu1) unstable; urgency=medium
* Non-maintainer upload.
* Disabled the code in include/buildmacros which creates bogus symlinks
for libraries. (Closes: #766811)
-- Marco d'Itri Wed, 10 Feb 2016 04:24:23 +0100
xfsprogs (4.3.0) unstable; urgency=low
* New upstream release
* Add a postinst to update the initramfs on install/upgrade.
(Closes: #804255)
-- Nathan Scott Mon, 23 Nov 2015 15:22:56 +1100
xfsprogs (4.2.0) unstable; urgency=low
* New upstream release
-- Nathan Scott Mon, 07 Sep 2015 10:13:54 +1000
xfsprogs (3.2.4) unstable; urgency=low
* New upstream release
* Fix xfs_metadump information leak (CVE-2012-2150)
-- Nathan Scott Wed, 29 Jul 2015 15:31:27 +1000
xfsprogs (3.2.3) unstable; urgency=low
* New upstream release
-- Nathan Scott Mon, 01 Jun 2015 11:35:02 +1000
xfsprogs (3.2.2) unstable; urgency=low
* New upstream release
* Rework dh-autoreconf invocation (closes: #757455)
* Update licensing words for headers (closes: #751511)
-- Nathan Scott Mon, 10 Nov 2014 20:35:27 +1100
xfsprogs (3.2.1) unstable; urgency=low
* New upstream release (closes: #747080)
* Add a watch file (closes: #748483)
-- Nathan Scott Wed, 16 Jul 2014 13:47:49 +1000
xfsprogs (3.2.0) unstable; urgency=low
* New upstream release
* Add dh-autoreconf invocation (closes: #725971)
-- Nathan Scott Sat, 03 May 2014 15:59:55 +1000
xfsprogs (3.1.11) unstable; urgency=low
* New upstream release
-- Nathan Scott Wed, 08 May 2013 12:59:56 -0500
xfsprogs (3.1.9) unstable; urgency=low
* New upstream release
-- Nathan Scott Wed, 31 Oct 2012 13:29:00 +1100
xfsprogs (3.1.8) unstable; urgency=low
* New upstream release
* Numerous xfs_repair fixes
-- Nathan Scott Mon, 19 Mar 2012 14:21:00 +1100
xfsprogs (3.1.7) unstable; urgency=low
* New upstream release
* Fix libreadline build dependency (closes: #553875)
-- Nathan Scott Thu, 17 Nov 2011 08:47:00 +1100
xfsprogs (3.1.6) unstable; urgency=low
* New upstream release
* Handle upcoming libreadline5-dev removal (closes: #553875)
-- Nathan Scott Wed, 11 Oct 2011 16:47:10 +1100
xfsprogs (3.1.5) unstable; urgency=low
* New upstream release
* No more xfsquota error message for non-quota mounts (closes: #618730)
-- Nathan Scott Wed, 31 Mar 2011 09:00:00 +1100
xfsprogs (3.1.4) unstable; urgency=low
* New upstream release (32 projid resolution, fsr uses /proc/mounts)
* Annotate Debian packages as being team maintained now.
* Resolve Lenny upgrade issue with xfsdump (closes: #601988, #601710)
-- Nathan Scott Tue, 09 Nov 2010 22:39:04 +1100
xfsprogs (3.1.3) unstable; urgency=low
* New upstream release
* Enforce building with libblkid (closes: #593320)
-- Nathan Scott Thu, 26 Aug 2010 23:06:46 +1000
xfsprogs (3.1.2) unstable; urgency=low
* New upstream release
* Allow for building on GNU/kFreeBSD (closes: #485796)
-- Nathan Scott Mon, 3 May 2010 14:25:43 +1100
xfsprogs (3.1.1) unstable; urgency=low
* New upstream release
-- Nathan Scott Thu, 28 Jan 2010 20:54:22 +1100
xfsprogs (3.1.0) unstable; urgency=low
* New upstream release
* Merged German translation (closes: #521389)
* Merged German translation update (closes: #557100)
* Uptodate po file is provided now (closes: #538962)
* Fixed typos in xfs_quota man page (closes: #481715)
* Tighten permissions on temp fsr files (closes: #559490)
-- Nathan Scott Thu, 10 Dec 2009 09:19:37 +1100
xfsprogs (3.0.4) unstable; urgency=low
* New bugfix release
* Resolve a libxfs unaligned access (closes: #517553)
-- Nathan Scott Thu, 17 Sep 2009 14:32:48 +1000
xfsprogs (3.0.2) unstable; urgency=low
* New bugfix release
-- Nathan Scott Wed, 06 May 2009 11:29:18 +1000
xfsprogs (3.0.0-1) unstable; urgency=low
* New upstream release (closes: #263170)
* Remove watch file, xfsprogs is native
* Updated dependencies as this requires xfsdump 3 also
-- Nathan Scott Wed, 28 Jan 2009 21:15:07 +1100
xfsprogs (2.10.2-1) unstable; urgency=low
* New upstream release
* No longer ignore -i maxpct option in mkfs.xfs (closes: #500593)
* Correct features2 superblock field handling (closes: #473135)
* 32 bit emulation on 64 bit kernels works (closes: #485020)
* Fix up large sector handling in mkfs (closes: #489421)
-- Nathan Scott Sat, 20 Dec 2008 10:14:27 +1100
xfsprogs (2.9.10-1) unstable; urgency=low
* New upstream release
-- Anibal Monsalve Salazar Fri, 05 Sep 2008 14:02:20 +1000
xfsprogs (2.9.8-1) unstable; urgency=low
* New upstream release
* xfsprogs and xfsprogs-udeb depend on ${misc:Depends}
* Add Homepage control header
* Add watch file
* Fix the following lintian issues:
W: xfsprogs source: package-uses-deprecated-debhelper-compat-version 1
W: xfsprogs source: ancient-standards-version 3.5.9 (current is 3.7.3)
W: xfslibs-dev: package-contains-empty-directory usr/share/doc/xfsprogs/
-- Anibal Monsalve Salazar Tue, 22 Apr 2008 13:04:05 +1000
xfsprogs (2.9.7-1) unstable; urgency=high
* New upstream release.
* Add -y fsck option (closes: #463810)
* Lazy superblock counters not yet mkfs default (closes: #465737, #468184)
* xfs_repair memory requirements significantly reduced (closes: #289665)
-- Nathan Scott Sat, 01 Mar 2008 06:24:21 +1100
xfsprogs (2.9.5-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Tue, 22 Jan 2008 16:46:18 +1100
xfsprogs (2.9.0-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Tue, 12 Jun 2007 07:22:21 +1000
xfsprogs (2.8.20-1) unstable; urgency=low
* New upstream release (closes: #414079)
* Fixed up autoconf version dependency (closes: #414073)
-- Nathan Scott Fri, 16 Mar 2007 08:24:33 +1100
xfsprogs (2.8.19-1) unstable; urgency=low
* New upstream release (closes: #409063)
-- Nathan Scott Wed, 31 Jan 2007 08:53:32 +1100
xfsprogs (2.8.18-1) unstable; urgency=low
* New upstream release (closes: #399888)
-- Nathan Scott Fri, 08 Dec 2006 08:30:29 +1100
xfsprogs (2.8.12-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Tue, 29 Aug 2006 14:28:05 +1000
xfsprogs (2.8.11-1) unstable; urgency=low
* New upstream release.
* More efficient use of buffer cache memory (closes: #382935)
-- Nathan Scott Tue, 08 Aug 2006 17:06:58 +1000
xfsprogs (2.8.10-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Wed, 02 Aug 2006 11:17:07 +1000
xfsprogs (2.8.4-1) unstable; urgency=low
* New upstream release.
* Improved udeb packaging, thanks to Frans Pop (closes: #375439)
* Fix filesystem-from-path detection logic (closes: #374687)
-- Nathan Scott Mon, 26 Jun 2006 10:04:18 +1000
xfsprogs (2.8.3-1) unstable; urgency=low
* New upstream release.
* Fix segv in xfs_growfs command (closes: #374686)
* Ensure source tarball in correct location (closes: #374696)
-- Nathan Scott Wed, 21 Jun 2006 15:19:56 +1000
xfsprogs (2.7.16-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Wed, 05 Apr 2006 11:45:58 +1000
xfsprogs (2.7.14-1) unstable; urgency=low
* New upstream release.
* Switch from debmake to debhelper
-- Nathan Scott Wed, 15 Feb 2006 20:04:55 +1100
xfsprogs (2.7.12-1) unstable; urgency=low
* New upstream release.
* Includes polish translation from Jakub Bogusz.
-- Nathan Scott Tue, 31 Jan 2006 13:35:39 +1100
xfsprogs (2.7.7-1) unstable; urgency=low
* New upstream release.
* Add support for (optional) ATTR2 format extension (closes: #336350)
* Allow gcc -pedantic option for C++ users (closes: #249429)
* Fix segv in xfs_db frag command (closes: #338207)
-- Nathan Scott Wed, 16 Nov 2005 16:32:35 +1100
xfsprogs (2.7.4-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Sat, 08 Oct 2005 10:34:10 +1000
xfsprogs (2.6.36-1) unstable; urgency=low
* New upstream release.
* Fix xfs_repair secondary SB search 32 bit wrap (closes: #320081)
-- Nathan Scott Thu, 28 Jul 2005 14:01:50 +1000
xfsprogs (2.6.28-1) unstable; urgency=low
* New upstream release.
* Fix compilation with gcc version 4 (closes: #300544)
-- Nathan Scott Wed, 30 Mar 2005 10:52:07 +1000
xfsprogs (2.6.26-2) unstable; urgency=low
* No code differences, recompiled with a more recent gcc version.
-- Nathan Scott Tue, 29 Mar 2005 11:57:57 +1000
xfsprogs (2.6.26-1) unstable; urgency=low
* New upstream release.
* Man page updates (closes: #295397)
* Fix compilation with gcc version 4 (closes: #297876)
* Switch build dependency from readline4 to readline5.
-- Nathan Scott Tue, 08 Mar 2005 16:56:35 +1100
xfsprogs (2.6.23-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Fri, 17 Sep 2004 17:04:45 +1000
xfsprogs (2.6.21-1) unstable; urgency=low
* New upstream release.
* Fix xfs_io build for older glibc versions (current stable).
-- Nathan Scott Mon, 09 Aug 2004 16:09:42 +1000
xfsprogs (2.6.20-1) unstable; urgency=low
* New upstream release.
* Fix xfs_io segfault on non-XFS files. (closes: #260470)
* Fix packaging botch, deleted files included. (closes: #260491)
-- Nathan Scott Wed, 28 Jul 2004 21:11:38 +1000
xfsprogs (2.6.19-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Sat, 17 Jul 2004 11:28:39 +1000
xfsprogs (2.6.18-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Fri, 25 Jun 2004 16:57:09 +1000
xfsprogs (2.6.15-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Wed, 09 Jun 2004 21:10:14 +1000
xfsprogs (2.6.14-1) unstable; urgency=low
* New upstream release.
* Add a Provides: fsck-backend clause as requested in the context
of bug number 111651.
-- Nathan Scott Thu, 13 May 2004 09:56:19 +1000
xfsprogs (2.6.11-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Fri, 16 Apr 2004 11:50:56 +1000
xfsprogs (2.6.5-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Thu, 26 Feb 2004 14:44:41 +1100
xfsprogs (2.6.3-1) unstable; urgency=low
* New upstream release.
* Add support for debian-installer. (closes: #225444)
Author: Steve Langasek.
* Use debhelper instead of debmake, for proper udeb building.
Author: Steve Langasek.
* Drop boot-floppies support. (closes: #112715)
Author: Steve Langasek.
* Add support for the security attribute namespace.
-- Nathan Scott Mon, 19 Jan 2004 10:08:59 +1100
xfsprogs (2.6.0-1) unstable; urgency=low
* New upstream release.
* Note: change in the mkfs algorithm for sizing allocation groups.
-- Nathan Scott Tue, 28 Oct 2003 15:23:48 +1100
xfsprogs (2.5.11-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Fri, 10 Oct 2003 09:37:57 +1000
xfsprogs (2.5.6-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Tue, 19 Aug 2003 09:44:48 +1000
xfsprogs (2.5.5-1) unstable; urgency=low
* New upstream release.
-- Nathan Scott Thu, 07 Aug 2003 12:58:36 +1000
xfsprogs (2.5.4-1) unstable; urgency=low
* New upstream release, includes xfs_copy command
* Fix shell quoting in xfs_bmap, from Kai S. Juse (closes: #202588)
-- Nathan Scott Wed, 23 Jul 2003 10:36:28 +1000
xfsprogs (2.5.3-1) unstable; urgency=low
* New upstream release
* Changed mkfs.xfs default log size scaling algorithm slightly, to
create larger logs at smaller filesystem sizes by default
* Enable support for sector sizes larger than 512 bytes
-- Nathan Scott Mon, 7 Jul 2003 16:06:21 +1000
xfsprogs (2.4.12-1) unstable; urgency=low
* New upstream release
-- Nathan Scott Mon, 2 Jun 2003 13:51:06 +1000
xfsprogs (2.4.10-1) unstable; urgency=low
* New upstream release
* Add missing xfslibs-dev dependency on uuid-dev (closes: #193309)
-- Nathan Scott Thu, 15 May 2003 08:50:22 +1000
xfsprogs (2.4.9-1) unstable; urgency=low
* New upstream release
-- Nathan Scott Fri, 2 May 2003 09:34:17 +1000
xfsprogs (2.4.4-1) unstable; urgency=low
* New upstream release
* Dependencies on libreadline4 and libreadline4-dev added
-- Nathan Scott Sun, 30 Mar 2003 10:30:18 +1000
xfsprogs (2.4.1-1) unstable; urgency=low
* New upstream release
* Updated policy version to which this package conforms
* Note: unwritten extents are now enabled by default in mkfs.xfs
-- Nathan Scott Tue, 18 Mar 2003 16:16:43 +1100
xfsprogs (2.3.11-1) unstable; urgency=low
* Add missing build dependency on gettext (closes: #181331)
-- Nathan Scott Tue, 18 Feb 2003 08:57:46 +1100
xfsprogs (2.3.10-1) unstable; urgency=low
* New upstream release
-- Nathan Scott Mon, 17 Feb 2003 14:52:20 +1100
xfsprogs (2.3.6-1) unstable; urgency=low
* New upstream release
-- Nathan Scott Thu, 31 Oct 2002 17:26:44 +1100
xfsprogs (2.3.5-1) unstable; urgency=low
* New upstream release
* Fix mkfs bug, patch from Anton Blanchard (closes: #163897)
-- Nathan Scott Mon, 7 Oct 2002 05:19:51 +1000
xfsprogs (2.3.4-1) unstable; urgency=low
* New upstream release
-- Nathan Scott Mon, 7 Oct 2002 05:19:51 +1000
xfsprogs (2.3.0-1) unstable; urgency=low
* New upstream release
* Improve backwards compatibility of tools using the XFS geometry
ioctl for older kernel versions which don't support the new ioctl
-- Nathan Scott Tue, 3 Sep 2002 09:55:48 +1000
xfsprogs (2.2.1-1) unstable; urgency=low
* New upstream release
* Default mkfs.xfs blocksize is now 4096 bytes, not getpagesize(2)
* Fix to allow install process to work for newer autoconf versions
-- Nathan Scott Wed, 7 Aug 2002 11:37:23 +1000
xfsprogs (2.1.2-1) unstable; urgency=low
* New upstream release
* Support for the XFS version 2 log format
-- Nathan Scott Tue, 30 Jul 2002 09:49:08 +1000
xfsprogs (2.0.6-2) unstable; urgency=low
* Fix a problem in xfs_repair's handling of ACLs
-- Nathan Scott Thu, 30 May 2002 17:22:05 +1000
xfsprogs (2.0.6-1) unstable; urgency=low
* New upstream release
-- Nathan Scott Thu, 30 May 2002 14:31:30 +1000
xfsprogs (2.0.4-1) unstable; urgency=low
* New upstream release, minor changes only
-- Nathan Scott Wed, 17 Apr 2002 15:30:52 +1000
xfsprogs (2.0.3-1) unstable; urgency=low
* New upstream bugfix release
-- Nathan Scott Sat, 13 Apr 2002 09:45:06 +1000
xfsprogs (2.0.2-1) unstable; urgency=low
* New upstream bugfix release
-- Nathan Scott Thu, 4 Apr 2002 12:11:01 +1100
xfsprogs (2.0.1-1) unstable; urgency=low
* New upstream bugfix (minor) release
-- Nathan Scott Tue, 12 Mar 2002 13:25:32 +1100
xfsprogs (2.0.0-1) unstable; urgency=low
* New upstream release with support for new libhandle interfaces
* Major release for switch to official extended attributes syscalls
-- Nathan Scott Thu, 7 Feb 2002 13:25:26 +1100
xfsprogs (1.3.18-1) unstable; urgency=low
* New upstream bugfix (minor) release
-- Nathan Scott Thu, 17 Jan 2002 11:13:19 +1100
xfsprogs (1.3.17-1) unstable; urgency=low
* New upstream release
* mkfs.xfs overwrites other filesystem signatures
* xfs_repair fix for "avl_insert: duplicate range" bug
-- Nathan Scott Mon, 14 Jan 2002 10:59:50 +1100
xfsprogs (1.3.16-1) unstable; urgency=low
* Remove temporary file use in xfs_db
* Add "type text" command into xfs_db
-- Nathan Scott Mon, 17 Dec 2001 12:17:54 +1100
xfsprogs (1.3.15-1) unstable; urgency=low
* Fix minor package version numbering issue (closes: #117545)
* Fix bug in mkfs.xfs device size cross-check for realtime device
* Reenable use of the BLKBSZSET ioctl in libxfs
-- Nathan Scott Wed, 12 Dec 2001 09:25:42 +1100
xfsprogs (1.3.14-1) unstable; urgency=low
* Fix minor package version numbering issue (closes: #117545)
* Fix bug in mkfs.xfs device size cross-check for realtime device
-- Nathan Scott Wed, 5 Dec 2001 17:13:06 +1100
xfsprogs (1.3.13-0) unstable; urgency=low
* New upstream release
* Fixes an important mkfs.xfs bug for >1TB filesystems
* xfs_repair will no longer blindly zero a dirty log
-- Nathan Scott Fri, 26 Oct 2001 10:42:26 +1000
xfsprogs (1.3.11-0) unstable; urgency=low
* Upstream release fixing several issues on 64 bit platforms
-- Nathan Scott Wed, 17 Oct 2001 10:00:35 +1000
xfsprogs (1.3.10-0) unstable; urgency=low
* New upstream release
* Fix up some issues building the bootfloppies package
-- Nathan Scott Fri, 12 Oct 2001 17:43:20 +1000
xfsprogs (1.3.9-0) unstable; urgency=low
* Upstream bug fix release
* Additional and updated manual page entries
-- Nathan Scott Fri, 5 Oct 2001 14:39:47 +1000
xfsprogs (1.3.8-0) unstable; urgency=low
* New upstream release
* Fix inclusion of mkfs man page in boot floppies package (closes: #112634)
-- Nathan Scott Wed, 19 Sep 2001 14:49:30 +1000
xfsprogs (1.3.7-0) unstable; urgency=low
* New upstream release
* Change to libhandle licensing (was GPL, now LGPL-2.1)
* Create a boot-floppies package with smaller mkfs.xfs (closes: #111426)
* Make install-sh posix compliant so ash as /bin/sh works (closes: #111985)
-- Nathan Scott Mon, 10 Sep 2001 10:52:04 +1000
xfsprogs (1.3.5-0) unstable; urgency=low
* Upstream bugfix release; fixes listed below
* Fix bug in xfs_db bit handling on big endian platforms
* Fix mkfs.xfs bug related to too-small final allocation group
* Fix signedness bug in DMAPI ioctl structure definition
-- Nathan Scott Mon, 13 Aug 2001 09:38:27 +1000
xfsprogs (1.3.4-0) unstable; urgency=low
* Upstream bugfix release; fixes listed below
* Fix endian bug in xfs_db "frag" command
* Several man pages updated to document external log usage
* IA64 build issues fixed (use -fno-strict-aliasing for libraries)
* Fixed several minor compiler warnings when building on IA64
* Added a Suggests entry for dvhtool (for those using SGI disks)
* configure.in changes to allow cross compilation
-- Nathan Scott Sat, 4 Aug 2001 10:32:00 +1000
xfsprogs (1.3.3-0) unstable; urgency=low
* New upstream release
-- Nathan Scott Fri, 27 Jul 2001 07:59:49 +1000
xfsprogs (1.3.2-0) unstable; urgency=low
* New upstream release
-- Nathan Scott Mon, 23 Jul 2001 10:27:37 +1000
xfsprogs (1.3.1-0) unstable; urgency=low
* Reworked package slightly so that it's not Debian native
* Debian-specific changes now documented in changelog.Debian.gz
* New upstream release (see /usr/share/doc/xfsprogs/changelog.gz)
* Checked standards compliance - update standards version to 3.5.5
-- Nathan Scott Sat, 15 Jul 2001 16:34:43 +1000
xfsprogs (1.3.0) unstable; urgency=low
* Reworked Makefiles to use libtool
* New libdisk to allow sharing of generic mount/disk code and
* Also abstracts individual driver support (LVM, MD, XVM..)
* Partition table detection so mkfs.xfs doesn't blindly overwrite
* Small xfs_repair bug fix from Steve
-- Nathan Scott Thu, 19 Jul 2001 10:12:03 +1000
xfsprogs (1.2.8) unstable; urgency=low
* Fixed a bug in libxfs /etc/mtab read-only mount detection
* First try procfs, fall back to /etc/mtab, for read-only mounts
* Sync with recent mount code changes for reiserfs and ext3 probes
* Fix logprint build problem under gcc 3.0
-- Nathan Scott Mon, 2 Jul 2001 13:59:08 +1000
xfsprogs (1.2.7) unstable; urgency=low
* New xfs_freeze(8) command - volume manager snapshot helper
-- Nathan Scott Tue, 22 May 2001 17:22:32 +1000
xfsprogs (1.2.6) unstable; urgency=low
* Merge support for -d agsize=/su=/sw= (AG, stripe unit/width size)
* Merge support for dynamic configuration of default log size
* Document these updates, and fix a couple of man page typos too
-- Nathan Scott Tue, 15 May 2001 12:34:17 +1000
xfsprogs (1.2.5) unstable; urgency=low
* Fix missing Makefile include entries for LVM headers
* Add experimental xfs_rtcp (realtime copy) command
* PowerPC build failure fixups - thanks to Robert Ramiega
* Cleanup arch-specific code, esp. the byteswab routines
* Suggests xfsdump and attr packages
-- Nathan Scott Tue, 8 May 2001 15:50:27 +1000
xfsprogs (1.2.4) unstable; urgency=low
* Add -L option to mkfs.xfs (filesystem label)
-- Nathan Scott Tue, 1 May 2001 14:03:14 +1000
xfsprogs (1.2.3) unstable; urgency=low
* Add dquot and quotaoff log item support into xfs_logprint
* Fix logprint core dump reporting AGI in "continue"'d transactions
-- Nathan Scott Fri, 27 Apr 2001 10:17:25 +1000
xfsprogs (1.2.2) unstable; urgency=low
* Fix problem in xfs_db (check) group quota logic
* Fixes to warnings from recent gcc and/or 64-bit builds
-- Nathan Scott Fri, 13 Apr 2001 09:50:37 +1000
xfsprogs (1.2.1) unstable; urgency=low
* Support for group quota added
* Stripe unit/stripe width extraction for MD devices
* Added mkfs.xfs heuristics for size of internal log
* Sync up with recent changes to XFS kernel headers
-- Nathan Scott Wed, 4 Apr 2001 13:54:00 +1000
xfsprogs (1.1.6) unstable; urgency=low
* Fix sparc build failure - fcntl.h missing O_DIRECT (closes: #90211)
* Added README.quota describing the use of quota with XFS
-- Nathan Scott Tue, 20 Mar 2001 11:25:03 +1100
xfsprogs (1.1.5) unstable; urgency=low
* Upgraded LVM stripe unit/width support to 0.9beta2 (IOP 10)
* Kernel now supports O_DIRECT - re-enable its use in xfs_mkfile
* BLKSETSIZE ioctl replaced by BLKBSZSET ioctl in libxfs
* libxfs_init extended so only mkfs and xfs_repair use BLKBSZSET
* NOTE: this requires an XFS kernel from 9 March '01 or later
-- Nathan Scott Sun, 18 Mar 2001 14:31:17 +1100
xfsprogs (1.1.3) unstable; urgency=low
* Minor changes to xfs_logprint tail verification
* Update build Makefile to pick up extra dirt before packaging
-- Nathan Scott Thu, 1 Mar 2001 12:24:28 +1100
xfsprogs (1.1.2) unstable; urgency=low
* Fix stdarg.h issue causing build failure with glibc 2.2.2
* Changes to libhandle for supporting extended attributes
-- Nathan Scott Tue, 20 Feb 2001 08:29:36 +1100
xfsprogs (1.1.0) unstable; urgency=low
* Initial release (closes: #83829)
-- Nathan Scott Thu, 4 Jan 2001 11:15:11 -0500
Local variables:
mode: debian-changelog
End:
xfsprogs-4.3.0+nmu1ubuntu1.1/debian/compat 0000664 0000000 0000000 00000000002 12560572026 015245 0 ustar 5
xfsprogs-4.3.0+nmu1ubuntu1.1/debian/control 0000664 0000000 0000000 00000004722 12660613750 015460 0 ustar Source: xfsprogs
Section: admin
Priority: optional
Maintainer: Ubuntu Developers
XSBC-Original-Maintainer: XFS Development Team
Uploaders: Nathan Scott , Anibal Monsalve Salazar
Build-Depends: uuid-dev, dh-autoreconf, debhelper (>= 5), gettext, libtool, libreadline-gplv2-dev | libreadline5-dev, libblkid-dev (>= 2.17), linux-libc-dev
Standards-Version: 3.9.1
Homepage: http://oss.sgi.com/projects/xfs/
Package: xfsprogs
Depends: ${shlibs:Depends}, ${misc:Depends}
Provides: fsck-backend
Suggests: xfsdump, acl, attr, quota
Breaks: xfsdump (<< 3.0.0)
Replaces: xfsdump (<< 3.0.0)
Architecture: any
Description: Utilities for managing the XFS filesystem
A set of commands to use the XFS filesystem, including mkfs.xfs.
.
XFS is a high performance journaling filesystem which originated
on the SGI IRIX platform. It is completely multi-threaded, can
support large files and large filesystems, extended attributes,
variable block sizes, is extent based, and makes extensive use of
Btrees (directories, extents, free space) to aid both performance
and scalability.
.
Refer to the documentation at http://oss.sgi.com/projects/xfs/
for complete details.
Package: xfslibs-dev
Section: libdevel
Priority: extra
Depends: libc6-dev | libc-dev, uuid-dev, xfsprogs (>= 3.0.0), ${misc:Depends}
Breaks: xfsprogs (<< 3.0.0)
Architecture: any
Description: XFS filesystem-specific static libraries and headers
xfslibs-dev contains the libraries and header files needed to
develop XFS filesystem-specific programs.
.
XFS is a high performance journaling filesystem which originated
on the SGI IRIX platform. It is completely multi-threaded, can
support large files and large filesystems, extended attributes,
variable block sizes, is extent based, and makes extensive use of
Btrees (directories, extents, free space) to aid both performance
and scalability.
.
Refer to the documentation at http://oss.sgi.com/projects/xfs/
for complete details.
Package: xfsprogs-udeb
XC-Package-Type: udeb
Section: debian-installer
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: A stripped-down version of xfsprogs, for debian-installer
This package is an xfsprogs package built for reduced size, so that it
can help to save space in debian-installer.
.
Don't attempt to install this package, it has no support for a couple of
features you surely want. Anyway, it should fail to install.
xfsprogs-4.3.0+nmu1ubuntu1.1/debian/copyright 0000664 0000000 0000000 00000001334 12560572026 016003 0 ustar This package was debianized by Nathan Scott nathans@debian.org on
Sun, 19 Nov 2000 07:37:09 -0500.
It can be downloaded from ftp://oss.sgi.com/projects/xfs/download/
Copyright:
Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
You are free to distribute this software under the terms of
the GNU General Public License.
On Debian systems, the complete text of the GNU General Public
License can be found in /usr/share/common-licenses/GPL file.
The library named "libhandle" and the headers in "xfslibs-dev" are
licensed under Version 2.1 of the GNU Lesser General Public License.
On Debian systems, refer to /usr/share/common-licenses/LGPL-2.1
for the complete text of the GNU Lesser General Public License.
xfsprogs-4.3.0+nmu1ubuntu1.1/debian/postinst 0000664 0000000 0000000 00000000511 12625713771 015660 0 ustar #!/bin/sh
set -e
case "${1}" in
configure)
if [ -x /usr/sbin/update-initramfs ] && [ -e /etc/initramfs-tools/initramfs.conf ]
then
update-initramfs -u
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`${1}'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
xfsprogs-4.3.0+nmu1ubuntu1.1/debian/rules 0000775 0000000 0000000 00000004663 12660613750 015141 0 ustar #!/usr/bin/make -f
export DH_VERBOSE=1
package = xfsprogs
develop = xfslibs-dev
bootpkg = xfsprogs-udeb
version = $(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
target ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
udebpkg = $(bootpkg)_$(version)_$(target).udeb
dirme = debian/$(package)
dirdev = debian/$(develop)
dirdi = debian/$(bootpkg)
pkgme = DIST_ROOT=`pwd`/$(dirme); export DIST_ROOT;
pkgdev = DIST_ROOT=`pwd`/$(dirdev); export DIST_ROOT;
pkgdi = DIST_ROOT=`pwd`/$(dirdi); export DIST_ROOT;
stdenv = @GZIP=-q; export GZIP;
options = export DEBUG=-DNDEBUG DISTRIBUTION=debian \
INSTALL_USER=root INSTALL_GROUP=root \
LOCAL_CONFIGURE_OPTIONS="--enable-readline=yes --enable-blkid=yes" ;
diopts = $(options) \
export OPTIMIZER=-Os LOCAL_CONFIGURE_OPTIONS="--enable-gettext=no" ;
checkdir = test -f debian/rules
build: built
built: reconf dibuild config
@echo "== dpkg-buildpackage: build" 1>&2
$(MAKE) default
touch built
reconf: .reconf
.reconf:
$(checkdir)
AUTOHEADER=/bin/true dh_autoreconf
touch $@
config: .census .reconf
.census:
@echo "== dpkg-buildpackage: configure" 1>&2
$(checkdir)
$(options) $(MAKE) include/platform_defs.h
touch .census
dibuild: .reconf
$(checkdir)
@echo "== dpkg-buildpackage: installer" 1>&2
if [ ! -f mkfs/mkfs.xfs-$(bootpkg) ]; then \
$(diopts) $(MAKE) include/platform_defs.h; \
mkdir -p include/xfs; \
for dir in include libxfs; do \
$(MAKE) -C $$dir NODEP=1 install-headers; \
done; \
for dir in include libxfs mkfs; do \
$(MAKE) -C $$dir; \
done; \
mv mkfs/mkfs.xfs mkfs/mkfs.xfs-$(bootpkg); \
$(MAKE) distclean; \
fi
clean:
@echo "== dpkg-buildpackage: clean" 1>&2
$(checkdir)
-rm -f built .census .reconf mkfs/mkfs.xfs-$(bootpkg)
$(MAKE) distclean
-rm -rf $(dirme) $(dirdev) $(dirdi)
-rm -f debian/*substvars debian/files* debian/*.debhelper
dh_autoreconf_clean
dh_clean
binary-indep:
binary-arch: checkroot built
@echo "== dpkg-buildpackage: binary-arch" 1>&2
$(checkdir)
-rm -rf $(dirme) $(dirdev) $(dirdi)
$(pkgme) $(MAKE) -C . install
$(pkgdev) $(MAKE) -C . install-dev
$(pkgdi) $(MAKE) -C debian install-d-i
rmdir debian/xfslibs-dev/usr/share/doc/xfsprogs
dh_installdocs
dh_installchangelogs
dh_strip
dh_compress
dh_fixperms
dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
checkroot:
test 0 -eq `id -u`
.PHONY: binary binary-arch binary-indep clean checkroot
xfsprogs-4.3.0+nmu1ubuntu1.1/debian/watch 0000664 0000000 0000000 00000000227 12560572026 015101 0 ustar version=3
opts=uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/ \
ftp://oss.sgi.com/projects/xfs/cmd_tars/xfsprogs-(.+)\.tar\.gz
xfsprogs-4.3.0+nmu1ubuntu1.1/doc/ 0000775 0000000 0000000 00000000000 12625722130 013365 5 ustar xfsprogs-4.3.0+nmu1ubuntu1.1/doc/CHANGES 0000664 0000000 0000000 00000223274 12625713771 014405 0 ustar xfsprogs-4.3.0 (23 Nov 2015)
- xfs_fsr: cleanups to recent changes (Eric Sandeen)
- xfs_fsr: improved temp file attr fork handling (Eric Sandeen)
- libxfs: output verifier names in warnings (Eric Sandeen)
- xfs_repair: enable verifier corruption warnings on very verbose
output settings (Eric Sandeen)
- debian: update initramfs in postinst script (Steve McIntyre)
xfsprogs-4.3.0-rc2 (10 Nov 2015)
- xfs_fsr: abstract mntinfo/mntent differences (Jan Tulak)
- xfs_io: update reflink/dedupe ioctl definitions and implementation
(Darrick Wong)
- libxcmd: factoring of runtime reporting (Darrick Wong)
- man page fixes (Ville Skyttä)
- removal of ASSERT from exported headers
xfsprogs-4.3.0-rc1 (14 Oct 2015)
- xfs_io: reflink and dedupe operation support (Darrick Wong)
- xfs_db: blockget/blocktrash support for v5 filesystems
(Darrick Wong)
- xfs_repair: many directory/attr cleanups and fixes (Eric Sandeen)
- More OS X build improvements (Jan Tulak)
- Log zeroing rework for v5 filesystems to prevent log sequence
numbers from going backwards (Brain Foster)
xfsprogs-4.2.0 (7 Sep 2015)
- repair: fix crashes due to missing geometry pointer (Eric Sandeen)
- repair: fix node handling on large attribute btrees (Brian Foster)
- repair: attribute block header verification fixes (Darrick Wong)
- libxfs: more error negation fixes (Darrick Wong)
- libxfs: cancelled readahead buffer state initialisation fixes
(Darrick Wong)
- build: include/xfs header path fix (Lucas Stach)
xfsprogs-4.2.0-rc3 (25 Aug 2015)
- xfs_repair: directory verification fixes (Darrick Wong)
- libxfs: errno negation fixes (Darrick Wong)
- xfs_db: corrupt inode handling fixes (Darrick Wong)
- repair: memory leak fixes (Eric Sandeen)
- libxfs: directory corruption fix (Jan Kara)
- libxfs: gcc miscompile fixes (Jan Kara)
- libxfs: merge across bug fixes from 4.2 kernel code
- man pages: minor updates (Eric Sandeen)
xfsprogs-4.2.0-rc2 (18 Aug 2015)
- OS X build improvements (Jan Tulak)
- libxfs: fix code miscompilation w/ gcc 4.8.3 (Jan Kara)
- mkfs.xfs: default to using ftype=1 for all filesystems
- mkfs.xfs: CLI options parsing order fix (Eric Sandeen)
- xfs_repair: improve inode version checks (Roger Willcocks)
- libxfs: remove excessive EXPERIMENTAL feature warnings
for sparse inodes (Brian Foster)
- xfs_db: fix new gcc 4.9.3 build warnings
xfsprogs-4.2.0-rc1 (4 Aug 2015)
- update libxfs to match kernel 4.2-rc1
- libxfs and include restructuring to match kernel code
- sparse inode support (Brian Foster)
- Android build support (Ted Tso)
- Mac OS X build fixes (Jan Tulak)
- changing UUIDs on v5 filesystems (Eric Sandeen)
- libxfs-apply script for keeping kernel/progs libxfs in sync
(Eric Sandeen)
- lots of header and type cleanups (Christoph Hellwig)
- libblkid now mandatory (Jan Tulak)
- lots of bug fixes (Brian Foster, Eric Sandeen, Christoph Hellwig,
Mike Grant)
xfsprogs-3.2.4 (30 Jul 2015)
- xfs_metadump: information leakage fixes (CVE-2012-2150) (Eric Sandeen)
xfsprogs-3.2.3 (10 Jun 2015)
- Debian packaging updates (Nathan Scott)
xfsprogs-3.2.3-rc2 (1 Jun 2015)
- xfs_repair: handle speciall atribute names correctly (Eric Sandeen)
- xfs_repair: handle v5 format feature flags correctly (Darrick Wong)
- xfs_repair: Better v5 format validation for directories (Darrick Wong)
xfsprogs-3.2.3-rc1 (11 May 2015)
- mkfs.xfs: enable metadata CRCs by default
- mkfs.xfs: enable free inode btrees by default
- build: glibc support updates (Jan Tulak)
- man page updates (Sage Weil, Namjae Jeon, Eric Sandeen)
- xfs_admin: Changing UUIDs disable for CRC enabled filesystems
(Eric Sandeen)
- xfs_repair: Separate pquota inode fixes (Brian Foster)
- xfs_db: inode alignment fixes (Brian Foster)
- mkfs.xfs: fix failures creating file images (Brian Foster)
- libxfs: zero new buffers before use (Darrick J. Wong)
- xfs_repair: handle directory leaf CRC errors gracefully
(Darrick J. Wong)
- xfs_repair: validate and repair inode CRCs (Eric Sandeen)
- xfs_repair: lots of broken directory repair fixes (Eric Sandeen)
- xfs_db: handle v3 inodes properly (Eric Sandeen)
- xfs_db: allow writing corrupted metadata on CRC enabled filesystems
(Eric Sandeen)
- xfs_repair: gracefully handle > 512 byte sector superblocks
- mkfs.xfs: take into acocunt log stripe unit when sizing log
- xfs_metadump: inode alignment and null inode fixes (Brian Foster)
- xfs_io: FALLOC_FL_INSERT_RANGE support (Namjae Jeon)
- build: libtool static library build fixes (Romain Naour)
- mkfs.xfs: large block size inode alignment fixes (Brian Foster)
- xfs_repair: secondary superblock scan fixes (Brian Foster)
- xfs_repair: don't care about symlink compenent lengths
(Eric Sandeen)
xfsprogs-3.2.2 (4 December 2014)
- Debian packaging updates (Nathan Scott)
- xfs_repair, mkfs.xfs stripe geometry fixes (Eric Sandeen)
- libxcmd path handling fixes (Eric Sandeen)
- xfs_crash crash fix (Jie Liu)
- xfs_logprint AGI/AGF handling improvements (Jan Kara)
- libhandle support for symlinked /usr (Jan Tulak)
- fix multiple Coverity and sparse reported issues (Eric Sandeen)
- new mremap, sync, syncfs commands for xfs_io (Eric Sandeen)
- man page updates (Eric Sandeen, Mark Tinguely)
- xfs_repair sets ftype in lost+found dirents (Jan Kara)
- xfs_repair handles bad inodes better (Eric Sandeen)
- xfs_repair freelist rebuild improvements
- xfs_repair finobt crash fixes (Brian Foster)
- xfs_copy handles 4k sector devices better (Eric Sandeen)
xfsprogs-3.2.1 (15 July 2014)
- Added support for new on-disk free inode btree (Brian Foster)
- libxfs inode use-after free fixes (Mark Tinguely)
- xfs_copy threading cleanups (Junxiao Bi)
- xfs_check has been removed
- C++ header compiler fixes (Roger Willcocks)
- xfs_repair prefetch fixes (Eric Sandeen)
- xfs_repair directory block CRC detection fixes (Jan Kara)
- xfs_repair directory rebuild fixes
- libxfs buffer error handling fixes
- xfs_repair quota inode handling fixes
- removed incorrect asserts from phase 2 of xfs_repair
- updated Polish translations (Jakub Bogusz)
- xfs_mkfs 4k sector device fixes (Eric Sandeen)
- xfs_fsr cleanups nd fixes (Eric Sandeen)
- mount options described in xfs(5) man page (Eric Sandeen)
xfsprogs-3.2.0 (16 May 2014)
- First release with full support of CRC enabled filesystems
- No code changes from 3.2.0-rc3
xfsprogs-3.2.0-rc3 (9 May 2014)
- Third release candidate for full support of CRC enabled filesystems
- Updated Debian change logs in preparation for release (Nathan Scott)
- Build warning fixes (Nathan Scott)
- xfs_repair prefetch fix (Eric Sandeen)
- xfs_repair block tracking scalability fix
xfsprogs-3.2.0-rc2 (2 May 2014)
- Second release candidate for full support of CRC enabled filesystems
- xfs_repair has full CRC validation and repair
- Coverity related cleanups and fixes
xfsprogs-3.2.0-rc1 (14 April 2014)
- First release candidate for full support of CRC enabled filesystems
- Large number of Coverity related fixes and cleanups
- disambiguous of CRC validation errors from IO errors.
- Improved dangerous mode handling in repair
- repair handles garbage in zeroed areas of superblocks better
- repair validates dirent ftype field fully
- metadump fully supports discontiguous directory blocks
- metadump only recalculates CRCs on metadata it obfuscates so as to
preserve errors in the metadata where possible.
- default log size that mkfs creates is now reverted to the same size
as 3.1.x releases create.
- mkfs sets the ftype on directory entries correctly during protofile
population
- xfs_io support O_TMPFILE, flink, FALLOC_FL_ZERO_RANGE and
FALLOC_FL_COLLAPSE_RANGE,
- logprint handles split entries better
xfsprogs-3.2.0-alpha2 (25 November 2013)
- Alpha release for the purpose of testing the CRC feature in
kernels 3.10 and newer.
- Enable xfs_db write support and xfs_metadump support for CRC
enabled filesystems.
- Add directory entry filetype support for non-CRC filesystems.
- Remove experimental warnings for CRC filesystems.
- Ensure all inodes created by xfs_repair have a proper d_type set.
- Fix build on big endian machines.
- Properly handle symlinks to devices on various tool commandlines.
- Fix xfs_repair's dirty log detection for 4k sector logs, broken
in Alpha1.
- Fix a potential segfault in xfs_repair when issuing progress
reports.
- Fix potential xfs_fsr failures when running w/ selinux.
- Update config.guess/config.sub for arm64, thanks to Colin Watson.
- Stop wasting memory by caching inode structures in xfs_repair -
they are never re-used. Thanks to Christoph Hellwig.
- Fix several Coverity-found defects, thanks to Li Zhong.
- Fix platform_test_xfs_fd to return false on special files which
cannot take an xfs ioctl.
- Sync up libxfs with kernel code.
- Improved xfs_repair performance on large filesystems
(always use prefetch and strided AG scanning functionality)
xfsprogs-3.2.0-alpha1 (26 September 2013)
- Alpha release for the purpose of testing the CRC feature in
kernels 3.10 and newer.
- Remove all vestiges of old, unsupported version 1 directory code.
- Add a "readdir" command to xfs_io, thanks to Brian Foster.
- Fix potential segfault in xfs_repair when creating lost+found.
- Zero out unused parts of on-disk superblocks during repair, to
avoid metadata verifier failures at runtime.
- Add directory entry type support to mkfs.xfs and xfs_db.
- Add the icreate transaction to xfs_logprint, and fix continuation
transactions.
- Add the lseek SEEK_DATA/SEEK_HOLE support into xfs_io.
- Print all AGI unlinked buckets in xfs_logprint.
- Fix mkfs.xfs ENOSPC with protofile which creates a very large
directory.
- Fix several Coverity-found defects, thanks to Li Zhong.
- Do all file reads in xfs_fsr using O_DIRECT.
- Sync up libxfs with kernel code.
- Add support for concurrent group and project quota usage on CRC
enabled filesystems.
- Ensure mkfs creates log sizes that are always large enough for
the configured fileystem geometry.
xfsprogs-3.1.11 (8 May 2013)
- Support for relative paths in xfs_quota thanks to Satoru Takeuchi.
- mkfs.xfs will always go into multidisk mode when filesystem
geometry is specified on the command line.
- Document all commands in xfs_io.
- Remove setfl command from xfs_io.
- xfs_metadump will obfuscate symlinks by path component.
- mkfs.xfs no longer accepts geometry settings smaller than the
physical sector size.
- xfs_logprint now supports multiply-logged inode fields and
handles continued inode transactions correctly.
- kill XLOG_SET
- Update release scripts to use git archive to address a
missing source file reported by Arkadiusz Mi?kiewicz
- Fix a build error with -Werror=format-security, reported
by Arkadiusz Mi?kiewicz
- mkfs.xfs no longer attempts to discard when -N option is used.
- Update 'make deb' to use tarball
- Sync up with log reservation changes in the kernel.
- Fix possible unallocated memory access in fiemap.
- Guard against string overflow in path_to_fspath.
- Fix setup_cursor array allocation.
- Fix free of unintialized pointer in xfs_acl_valid error path.
- Guard against path string overflows.
- Check strdup results properly in initallfs().
- Fix attribute no_change_count logic.
- Remove extraneous close() in fsrallfs().
- xfs_repair now skips the freelist scan of a corrupt agf
when in no-modify mode.
- xfs_db now skips freelist scans of corrupt agfs.
- Remove unconditional ASSERT(0) in xfs_repair.
- Reduce bb_numrecs in bno/cnt btrees when log consumes all agf space.
- Add depraction message for xfs_check.
- xfs_quota allow user or group names beginning with digits reported
by James Carter.
- Fix manpages and usage() spelling, errors and omissions.
- Validate the extent count is at least within the positive
range of a signed 32 bit integer before using it.
xfsprogs-3.1.10 (13 December 2012)
- Update release script to make a source tarball.
xfsprogs-3.1.9 (31 October 2012)
- Print nice details if agsize is out of bounds in mkfs.xfs.
- Various fixes for fragmented multi-block dir2 handling in
xfs_repair.
- Fix extent record printing in xfs_db on big endian arches.
- Use the correct macros when dumping block maps in extent
form in xfs_db, thanks to Peter Watkins.
- Add sync file range support to xfs_io.
- Implement preadv/pwritev in xfs_io.
- Link against libreadline for libxcmd, thanks to Mike Frysinger.
- Clean up mkfs.xfs output on invalid inode size.
- Various build fixes, thanks to Mike Frysinger and Jan Engelhardt.
xfsprogs-3.1.8 (20 March 2012)
- Fix xfs_repair segfault on a corrupted filesystem by validating the
acl count before reading it.
- Avoid xfs_repair deadlocks on prefetched buffers.
- Fix various incorrect printf formats, thanks to Jakub Bogusz for
reporting.
- Polish translation update, thanks to Jakub Bogusz.
- Refuse mkfs.xfs on misaligned devices when using 4k sectors, unless
the -f option is specified, and then force 512b sector size,
thanks to Carlos Maiolino.
- Avoid a possible loop on the unlinked inode list in phase 3 of
xfs_repair, thanks to Stefan Pfetzing for reporting.
- Allocate inode and free extent records individually in xfs_repair.
- Fix a possible deadlock btree nodes in xfs_repair by using recursive
locking, thanks to Arkadiusz Miśkiewicz for reporting and testing.
- Fix possible xfs_repair deadlocks in inode prefetching, thanks to
Arkadiusz Miśkiewicz for reporting and testing.
- Make xfs_repair handle filesystems with the log in ag 0, thanks to
Sindre Skogen for reporting.
- Deprecate the -F foreign flag to xfs_io.
- Add debian linux-libc-dev build dependancy.
- Add an extended fiemap configure check.
- Various cleanups in xfs_repair.
- Update xfs_check man page to recommend xfs_repair over xfs_check,
thanks to Arkadiusz Miśkiewicz.
- Update the on-disk extent count as part of inode repair when moving
inodes to lost+found to avoid to avoid tripping over a check in
xfs_iformat, thanks to Arkadiusz Miśkiewicz for reporting and
testing.
- Check for size parsing errors in xfs_quota, thanks to James Lawrie
for reporting.
- Fix fiemap loop continuation in xfs_io.
- Make mkfs.xfs properly handle physical sector size.
- Fix /proc/mounts parsing in xfs_fsr.
- Fix xfs_repair when ag_stride options with attributes and dirv1 code,
thanks to Tom Crane for reporting and testing.
- Fix message formats in process_dinode_int.
- Fix xfs_repair handling of link counts when the on-disk count
overflows 8 bits.
- Fix messages from set_nlinks in xfs_repair.
xfsprogs-3.1.7 (17 November 2011)
- Pull in fix for debian/control
- Polish translation update, thanks to Jakub Bogusz
- Fix xfs_repair link count on lost+found, thanks to Carlos Maiolino
- Fix various incorrect printf formats
xfsprogs-3.1.6 (14 October 2011)
- Re-synch of the header and libxfs files with the kernel
code as of Linux 2.6.37, including reviving xfs_repair
radix tree code.
- Fix a xfs_repair phase 4 hang, thanks to Ajeet Yadav.
- Subcommand names within various programs are no longer
translated/localized, thanks to Arkadiusz Mi?kiewicz.
- Build system fixes, thanks to Ted Ts'o.
- Updates to teh xfs_info(8)/xfs_growfs(8) man page, thanks
to Roman Ovchinnikov.
- xfs_quota "df" no longer reports values twice what they
should have been for project quotas.
- mkfs.xfs now requires that sub-options are non-empty
strings; thanks to Chris Pearson for reporting.
- Better handling of short reads in libxfs.
- xfs_quota now prints "N/A" rather than a large number for
the quota file inode number for disabled quota types.
- Bogus (unrelated) mount point entries no longer cause
xfs_growfs, xfs_quota, and xfs_io to quit early.
- xfs_repair no longer fails when the sector size of an
underlying device is larger than the sector size in a
hosted filesystem image.
- Various other internal improvements, including refactoring
and eliminating more build warnings.
xfsprogs-3.1.5 (30 March 2011)
- Polish translation update, thanks to Jakub Bogusz
- xfs_repair now warns if running in low memory mode
- Phase 2 of xfs_repair is now multithreaded
- xfs_quota no longer attempts to get quota information if
not enabled
- Inode flags are now properly validated by xfs_repair
- Metadump now obfuscates all file names reliably
- xfs_io now supports the "fiemap" command, a more generic
form of the "bmap" command
- xfs_io now supports the "fpunch" command, as well as a
"-p" flag to the "fallocate command. Both implement hole
punching. Thanks to Josef Bacik
- A number of other bug fixes thanks to Ajeet Yadav
xfsprogs-3.1.4 (9 November 2010)
- Add projid32bit handling to userspace, resolving type
sizing issues when dealing with 32 bit project ids.
- Make xfs_fsr use /proc/mounts if available.
- Annotate that Debian packages are group maintained.
- Fix a Debian packaging issue causing upgrade pain.
xfsprogs-3.1.3 (26 August 2010)
- Add xfs_io support for XFS_IOC_ZERO_RANGE
- Fix depend targets.
- Allow xfs_io resvsp command for foreign filesystems.
- Fix configure --prefix.
- Make xfs_db check for valid inode data pointer before dereferencing.
- Validate btree block magic in the xfs_db freesp command,
thanks to Peter Watkins.
- Unbreak make update-po, permissions problem,
thanks to Arkadiusz Miśkiewicz.
- Fix linking of libxfs and librt detection (needs pthread),
thanks to Arkadiusz Miśkiewicz.
- Add a platform_discard_blocks stub for GNU/kFreebsd.
xfsprogs-3.1.2 (6 May 2010)
- Fix missing thread synchronization in xfs_repair duplicate
extent tracking.
- Fix handling of dynamic attribute fork roots in xfs_fsr.
- Fix sb_bad_features2 manipulations when tweaking the lazy count
flag.
- Add support for building on Debian GNU/kFreeBSD, thanks
to Petr Salinger.
- Improvements to the mkfs.xfs manpage, thanks to Wengang Wang.
- Various small blkid integration fixes in mkfs.xfs.
- Fix build against stricter system headers.
xfsprogs-3.1.1 (29 January 2010)
- Fix various blkid topology support problems in mkfs.xfs.
- Fix various build warnings.
- Add automatic build dependency calculations.
- Cleaner build system output.
- Add missing aclocal m4 file to the package generation.
- Arrange for release tags to be digitally signed.
xfsprogs-3.1.0 (13 January 2010)
- Reduce memory usage in xfs_repair by using better data structures.
- Add additional checks in xfs_repair to detect freespace btree
corruption instead of only rebuilding the btrees. Useful for the
no-modify mode.
- Fix libhandle to use the right path to issue by-handle ioctls for
symbolic links and special files.
- Use lazy superblock counters by default. At least kernel 2.6.22 is
needed for this feature.
- Use physical device sector size if available in mkfs.xfs,
so 4K sector devices are handed more gracefully.
- Add a German translation, thanks to Chris Leick.
- Enable the madvise and mincor commands in xfs_io.
- Fix unsafe temporary file creation in xfs_fsr.
- Add support for discarding unused space on SSDs or thin provisioned
arrays in mkfs.xfs.
- Allow linking against libblkid for topology information.
- Add symbol versioning for libhandle.
- Remove the included RPM and binary tarball built infrastructure.
- Various build system improvements.
- Small fixes to xfs_db and xfs_io.
xfsprogs-3.0.4 (17 September 2009)
- Fix a memory leak in xfsprogs.
- Increase hash chain length in xfsprogs when running out of memory.
- Fix dmsetup invocation in libdisk to avoid warnings during mkfs
on multipath devices.
- Fix the -V option to various installed tools.
- Small internal fixes to please the clang semantical analysis tool.
- Debian packaging updates.
- Rework Makepkgs and Makefiles to improve deb generation.
xfsprogs-3.0.3 (30 August 2009)
- Fix unaligned accesses in libxfs.
- Various small fixes to xfs_db, xfs_repair and xfs_io.
- Add fallocate command to xfs_io.
- Enable readline support in xfs_io and xfs_quota.
- Allow log sizes up to 2GiB (minus 1 byte) in xfs_mkfs.
- Open the block device in xfs_repair exclusively, thanks to
Nathaniel W. Turner.
xfsprogs-3.0.2 (6 May 2009)
- Updates to Debian build process after recent autoconf tweaks.
- Fix a couple of minor man page syntax issues.
xfsprogs-3.0.1 (4 May 2009)
- Update the Makepkgs script to generate proper source tarballs.
- New project(5) and projid(5) man pages.
- Fix extent array reallocation in the xfs_io bmap command,
thanks to Tomasz Majkowski.
- Small specfile improvements, thanks to Jan Engelhardt.
- Allow xfs_freeze to freeze non-XFS filesystems.
- Fix the xfs_db bmbta command.
- Fix parallel builds, thanks to Mike Frysinger.
- Various autoconf/libtool fixes, thanks to Andreas Gruenbacher.
xfsprogs-3.0.0 (4 February 2009)
- Various smaller xfs_repair improvements.
- Various gettext improvements, thanks to Jakub Bogusz.
- Polish translation update, thanks to Jakub Bogusz.
- Various xfs_quota fixes, thanks to Arkadiusz Miskiewicz.
- Support parallel builds.
- Detection of btrfs, gfs and gfs2 in libdisk.
- Addition of the xfs_fsr and xfs_estimate tools previous found
in the xfsdump package.
- Resync libxfs to latest kernel implemenation.
- Update all of xfsprogs to latest kernel interfaces.
- Add sparse support to xfsprogs build.
- Cleanup devel package for xfsctl, libhandle and libdisk only
(remove libxfs interfaces).
xfsprogs-2.10.1 (5 September 2008)
- Improve xfs_repair -P option to disable xfs_buf_t locking.
- Fix inode cluster I/O size for > 8KB block size filesystems.
- Fix up ASCII CI output for mkfs.xfs and xfs_growfs.
- Fix buffer handling in error cases in xfs_db (includes xfs_check
and xfs_metadump).
- Add packed on-disk shortform directory for ARM's old ABI, thanks to
Eric Sandeen.
- Increase default valid block count for a directory extent in
xfs_metadump (from 20 to 1000).
- Fix up mkfs.xfs -N option with "-d file" so it doesn't resize the
target file (thanks to Michal Marek).
- Improve libxfs cache handling with (un)referenced blocks.
- Check that directory size is not too big in xfs_repair.
- Improve xfs_repair to restore bad or missing ".." entries.
xfsprogs-2.10.0 (26 May 2008)
- Add ASCII case-insensitive support to xfsprogs.
xfsprogs-2.9.8 (21 April 2008)
- Add support for sb_features2 in wrong location in mkfs.xfs,
xfs_repair and xfs_db.
- Improve memory limits for libxfs cache in xfs_repair and added
a -m option to manually limit usage of xfs_repair.
- Add -c option to xfs_admin to turn lazy-counters on/off.
- Added support for mdp in libdisk/mkfs.xfs, thanks to
Hubert Verstraete.
- Add -p option to fsck.xfs, thanks to Markus Rothe.
- Cleanup sys v3 bzero/bcopy calls, thanks to Nigel Kukard.
xfsprogs-2.9.7 (1 Mar 2008)
- Lazy superblock counters not yet the default with mkfs.xfs.
- Add -y (another no-op) fsck option.
- Resolve mkfs allocation group count issue with small devices.
- Fix mkfs to sector align the device size so zeroing the end
of the device doesn't fail.
xfsprogs-2.9.6 (7 Feb 2008)
- Fix regression introduced by changing the mkfs.xfs defaults.
- Made lazy superblock counters the default with mkfs.xfs.
xfsprogs-2.9.5 (21 Jan 2008)
- Updated mkfs.xfs defaults.
- Make xfs_info handle mount points with spaces.
- Improve xfs_repair's handling of invalid freespace btree extents.
- Rebuild directories in xfs_repair if "." and ".." aren't the first
two directory entries. This guarantees a directory is deletable.
- Changed mkfs.xfs -f to wipe all old AG headers, not just the ones
up to the end of the new filesystem size.
- Purged the end of device whack buffer in mkfs.xfs to prevent a
warning in certain device sizes.
- Man page fixes. Thanks to Utako Kusaka
for this.
- Disable the ability to turn off unwritten extents in mkfs.
xfsprogs-2.9.4 (7 Sep 2007)
- Fixed xfs_repair segfaulting with directory block size different
to the filesystem blocksize.
- Fixed xfs_quota disable, enable, off and remove commands.
Thanks to Utako Kusaka for this.
- Improved the robustness of xfs_metadump.
- Fix link issues with pthread library.
xfsprogs-2.9.3 (23 July 2007)
- Make xfs_repair support > 512 byte sector sizes.
- Fixed include Makefile for new common header (xfs_metadump.h).
- Fixed xfs_quota state command segfaulting with no mounted
XFS filesystems.
- Fixed xfs_quota printing out unusual message with "path n" command
with no mounted XFS filesystems.
- Fixed "quota -n" command with project IDs.
- Improved "free" output when project quotas are defined, but
haven't been enable on the filesystem.
Thanks to Utako Kusaka for the above four
fixes.
xfsprogs-2.9.2 (18 July 2007)
- Next major round of xfs_repair performance improvements:
- Cache disk nlink values in Phase 3 for Phase 7.
- Do multithreaded prefetch/processing based on AG stride
option (ie. for concats).
- Don't trash lost+found at the start of Phase 4, eliminates
repeated "moving disconnected inode to lost+found" with
successive xfs_repair runs.
- Do multi-threaded sequential metadata prefetch.
Method based on Agami patches posted for 2.7.18 xfsprogs.
- Improve the libxfs cache with priority tagging to keep
blocks around that have unfavourable I/O characteristics.
- Make mkfs.xfs -f zero the old secondary superblocks before writing
the new superblocks.
- Fix up xfs_info and xfs_quota's -c handling with global commands.
- Improve xfs_bmap -vp output to always show the FLAGS column.
- Update man pages.
xfsprogs-2.9.1 (28 June 2007)
- Added filestreams support to xfs_io.
- Fix up libattr Makefile to append to LTLDFLAGS. Thanks to
Arfrever Frehtes Taifersar Arahesis for this.
- Fix up build not to ignore LDFLAGS generated by configure.
Thanks to SpanKY for this.
xfsprogs-2.9.0 (5 June 2007)
- Added new tools: xfs_metadump and xfs_mdrestore.
- Fix up the HAVE___U32 fix from 2.8.20
Thanks to Eric Sandeen for pointing this out.
xfsprogs-2.8.21 (28 May 2007)
- Add support for lazy superblock counters in mkfs.xfs, xfs_db,
xfs_repair, xfs_growfs and also libxfs.
- Fix xfs_quota project command to stop it operating on special files.
Thanks to Leo Baltus.
xfsprogs-2.8.20 (23 February 2007)
- Fix xfs_repair not detecting invalid btree root in inodes.
- Fix xfs_repair restoring corrupted superblock after repairing it.
- Fix xfs_repair crashing on invalid quota inode values.
- Fix xfs_quota gracetime reporting.
Thanks to Utako Kusaka for this.
- Fix libxfs IO_DEBUG output.
- Instead of using AC_CHECK_TYPES which isn't supported for
older versions of autoconf, add our own type check in the
m4/package_types.m4 file for __u32.
Suggested by Nathan Scott and discovered by wookey@aleph1.co.uk.
xfsprogs-2.8.19 (31 January 2007)
- Fix pthread stack size setting in xfs_repair.
- Fix xfs_bmap -n option displaying a truncated extent.
- Fix xfs_io mwrite segfault. Thanks to Utako Kusaka for these two
fixes.
- Fix errors in xfs_quota(8) man page.
xfsprogs-2.8.18 (8 December 2006)
- is an installed file, we cannot simply rename it,
as other applications using it (accidentally or not) may break.
The xfs_list.h name was inconsistent with everything else too.
- Fix "pointer targets in assignment differ in signedness" warnings
- Update Debian packaging.
- Fix up two issues with xfs_db and bmap. If the data/attr fork is
local, it either infinite loops or crashes. If both are displayed,
the attrs are wrong.
- Fix up xfs_io mmap read that read from the wrong offset.
- Updated xfs_io man page.
Thanks to Utako Kusaka for the above three
fixes.
xfsprogs-2.8.17 (5 December 2006)
- Fix up libxfs SEGV when attempting to mount a non-XFS filesystem.
Thanks to Utako Kusaka for this.
- Fix up xfs_repair aborting if it finds an inode with an invalid
inode type.
- Fix up default realtime extent size for large block sizes.
- Rename include/list.h to xfs_list.h so that other applications
do not accidentally use it.
xfsprogs-2.8.16 (30 October 2006)
- Fix up an endian problem for nlink setting in phase 7 for xfs_repair.
xfsprogs-2.8.15 (19 October 2006)
- Fix up nlink checks and repairs in phase 7 for xfs_repair.
- Remove a bogus LEAFN warning for a single leaf node v2 dir.
Thanks to Roger Willcocks for this.
xfsprogs-2.8.14 (6 October 2006)
- Fix up the ring command in xfs_db,
Thanks to Utako Kusaka for this.
- Set the blocksize on the device to the given sector
size which is _not_ necessarily 512 bytes;
idea suggested by Shailendra Tripathi.
- Fix up xfs_copy and its variable argument handling
around vfprintf; xfs_copy was seg faulting on x86_64.
xfsprogs-2.8.13 (21 September 2006)
- Fix v2 directory checking with holes and unreadable blocks.
- Fix a memory leak in dir2 checking.
- Update libdisk/md support to work out the stripe width
based on (# raid-disks - # parity disks) which
doesn't include any spare disks (which we mistakenly did before).
Thanks to Shailendra Tripathi's suggestions.
- Get the kernel int types of __u32 and friends from
if we can, otherwise define them ourselves.
xfsprogs-2.8.12 (29 August 2006)
- Multi-thread modifications to xfs_repair.
- Updated Polish translation, thanks to Jakub Bogusz.
- Change default mkfs realtime extent size setting to
perform better for buffered writes.
xfsprogs-2.8.11 (08 August 2006)
- xfs_repair prefetch optimisations.
- Make many tools use direct I/O on Linux if the underlying
device supports it. Mainly for speeding up xfs_repair as
libxfs does its own internal metadata buffering now.
- Fix warnings from mkfs.xfs on ramdisk devices.
- Fix issues with symbolic link handling in Makefiles.
xfsprogs-2.8.10 (02 August 2006)
- Fix v2 directory rebuilds in phase6 of xfs_repair.
- Fix buffer sizing issue for large pagesize systems,
affecting mkfs auto-device-type-detection heuristics.
xfsprogs-2.8.9 (18 July 2006)
- Fix rpm issue with install targets as uid/gid zero (we now
using symbolic names rather than the numeric versions).
xfsprogs-2.8.8 (14 July 2006)
- Fix issues with makedepend on libtool libraries.
xfsprogs-2.8.7 (10 July 2006)
- Fix build of xfs_logprint for different uuid_t definitions;
thanks to Craig Rodrigues.
xfsprogs-2.8.6 (07 July 2006)
- Fixed xfs_repair handling of duplicate names in a directory.
xfsprogs-2.8.5 (05 July 2006)
- Update translation Makefile to work better with the Ubuntu
translation system. Thanks to feedback from Martin Pitt.
- Fix annoying "ignores datarootdir" warning from configure.
- Fix issues with makedepend build infrastructure.
- Add prefetch code for improved xfs_repair run times.
xfsprogs-2.8.4 (23 June 2006)
- Improve Debian udeb package handling, thanks to Frans Pop.
- Fix a situation where xfs_growfs can fail to match a block
device to a filesystem correctly; thanks to Bastian Kleineidam.
- Minor corrections to the xfs_growfs man page.
xfsprogs-2.8.3 (21 June 2006)
- Fix a possible segv in xfs_growfs; thanks to Bastian Kleineidam.
xfsprogs-2.8.2 (17 June 2006)
- More updates to repair/libxfs for improving performance
- Incorporate librt into the build process for lio_listio
- Minor xfs_logprint tweaks and fixes.
- Small updates to xfs_io manual page.
- Several fixes from earler 2.8 releases with respect to
inode/buffer cache refcounting.
xfsprogs-2.8.1 (29 May 2006)
- Fix endianness issues on FreeBSD.
xfsprogs-2.8.0 (18 May 2006)
- Initial pass at user space caching, ultimately provides
a starting point for a faster, parallel version of repair.
- Fix several inode/buffer reference counting issues.
- Fix compiler warnings, and builds on certain glibc versions
having issues with the device major() macro.
- Added code to xfs_db and xfs_admin to allow conversion
from version 1 to version 2 logs.
xfsprogs-2.7.18 (16 May 2006)
- Fixed a case where xfs_repair was reporting a valid used
block as a duplicate during phase 4.
- Fixed a case where xfs_repair could incorrectly flag extent
b+tree nodes as corrupt.
- Portability changes, get xfs_repair compiling on IRIX.
- Parent pointer updates in xfs_io checker command.
- Allow LDFLAGS to be overridden, for Gentoo punters.
xfsprogs-2.7.17 (05 April 2006)
- Fix libxfs access(2) check on /proc/mounts, which was
causing issues when xfs_check/xfs_repair run on readonly
root filesystem mounts.
- Fix Debian packaging for libc-dev build dependency.
- Fix up auto lib64 install detection for x86_64 platforms.
xfsprogs-2.7.16 (22 March 2006)
- Fix freespace accounting in xfs_quota(8) df command.
- Fix a typo on the xfs_quota(8) man page.
- Make -O2 (cc optimisation level) the default.
xfsprogs-2.7.15 (03 March 2006)
- Fix the way external log/realtime devices were handled in
userspace with older kernels (subtely different in procfs)
- Fix a corruption problem in xfs_copy(8) when attempting to
zero the (old) log, a section was sometimes missed (depends
on log and I/O buffer (mis)alignment).
xfsprogs-2.7.14 (15 February 2006)
- Debian packaging updates (debmake out, debhelper in).
- Fix a header to work with additional compiler variants.
xfsprogs-2.7.13 (08 February 2006)
- Convert fsck into a shell script and make it provide a
hint to run repair/check (in non-auto fsck modes).
Thanks to Marian Jancar for this.
- Fix compilation botch on non-Linux platforms (duplicate
type definitions).
xfsprogs-2.7.12 (31 January 2006)
- Added initial Polish translation.
Thanks to Jakub Bogusz for this.
- Fixed rpm specfile with respect to INSTALL_{USER,GROUP}.
xfsprogs-2.7.11 (16 January 2006)
- Fix a problem with the generated source tarballs and a
missing parent.h header file.
xfsprogs-2.7.10 (16 December 2005)
- Make xfs_db keep trying when root inode can't be read.
- Make xfs_db check AGF BNO and CNT btree consistency.
- Tweak a couple of libxfs headers so they can be used by
C++ programs (removes nested struct declarations, which
are used outside the scope they're declared in).
- Fix a rounding issue in xfs_quota time reporting, making
it more consistent with the standard quota utilities.
- Fix dopey libxfs message "Unmount and run xfs_repair.",
especially annoying when printed by xfs_repair itself.
- Fix a dir2 xfs_repair bug, misdiagnosing a valid dir as
corrupt. Thanks to Masanori Tsuda.
xfsprogs-2.7.9 (08 December 2005)
- Fix thinko in libxcmd cvtnum routine
- Fix EFI/EFD printing in xfs_logprint
xfsprogs-2.7.8 (05 December 2005)
- Extend xfs_io to do aligned direct IO automatically
- Report direct IO parameters (dioinfo) in xfs_io
- Make xfs_mkfile a shell script wrapper around xfs_io
xfsprogs-2.7.7 (16 November 2005)
- Fix some gcc compiler warnings on 64 bit platforms.
- Remove last reference to a (kernel) header.
- Updated aclocal.m4
- Fix a bug in xfs_io lsproj/chproj recursive modes.
- Add xfs_io recursive modes for the extsize command.
- Add xfs_db version command modes for attr1 and attr2.
xfsprogs-2.7.6 (31 October 2005)
- Add support for the inode extent size hint for the regular
data device (previously was realtime only), and allow the
optional inheritance of this property.
- Add support for additional read/write patterns in xfs_io
(reverse and random, in addition to sequential forwards).
- Add some mkfs debugging options to aid testing inheritance
of realtime, project ID, and extsize inode attributes.
- Add mkfs option for forcing use of ATTR2, and make growfs
report its use.
- Fix use of cursor in attr_list_by_handle() libhandle code.
- Fix several compiler warnings when building on IRIX.
xfsprogs-2.7.5 (26 October 2005)
- Fix an endian bug in xfs_db "frag" command.
- Fix some errors on the xfs_quota(8) man page.
xfsprogs-2.7.4 (08 October 2005)
- Fix read and write calls in xfs_io to allow buffers larger
than 4GiB on 64 bit platforms.
- FreeBSD build tweaks from Craig Rodrigues.
- Fixed a few minor compiler warnings.
xfsprogs-2.7.3 (29 September 2005)
- Fix xfs_repair handling of the morebits bit.
- Merge back several kernel changes related to attr2.
- Extended xfs_db expert mode commands
- Clean up some fsxattr uses to reduce number of syscalls,
now that IRIX also supports project identifiers via this
interface.
xfsprogs-2.7.2 (28 September 2005)
- Fix up xfs_repair segmentation fault due to wrong allocation
size.
xfsprogs-2.7.1 (20 September 2005)
- Fix up reporting of devices in xfs_growfs - now uses
/proc/mounts in preference to /etc/mtab.
- Fix a strtok-related bug in the extraction of device names,
also only affecting xfs_growfs.
xfsprogs-2.7.0 (16 September 2005)
- Support for updated extended attributes format (attr2)
- Make xfs_quota tool issue a quota sync in all the needed
places, before reporting, to counter affects of delayed
allocation.
- Quota-related ID signedness issue fixes.
- Expert mode xfs_db commands to set/remove attributes.
xfsprogs-2.6.37 (11 August 2005)
- Fix FreeBSD builds (getmntinfo), thanks to Craig Rodrigues.
xfsprogs-2.6.36 (28 July 2005)
- Fix mkfs stripe unit alignment checks for external logs
- Fix running xfs_db on non-XFS devices (was segfaulting)
- Fix a 32 bit wrap in xfs_repair searching for secondary
superblocks.
xfsprogs-2.6.35 (01 July 2005)
- Add back fd_to_handle() to libhandle.
- Add handle call mappings to xfsctl() for IRIX.
xfsprogs-2.6.34 (20 June 2005)
- Switch to the fsxattr xfsctl for getting/setting project
identifiers on inodes, remove the short-lived specialised
ioctls for doing this.
- Make the "blocktrash" xfs_db command available in expert-
mode only.
xfsprogs-2.6.33 (13 June 2005)
- Another libhandle fix on 64bit, Big Endian systems.
xfsprogs-2.6.32 (08 June 2005)
- Minor endian cleanups in some tools.
- Fix a couple of xfs_quota double-reporting issues when
issuing commands via the -c (command line) 0option.
xfsprogs-2.6.31 (06 June 2005)
- Fix previous MD driver-specific change to correctly handle
(i.e. not "stripe align") linear arrays.
- Add MD RAID level 4, 6, and 10 support.
- Make mkfs.xfs automatically adjiust the geometry to use
a sector size that matches the block size when MD RAID
level 4/5/6 are in use.
- Couple of minor man page fixups, including patch botch on
initial revision of xfs_quota(8).
xfsprogs-2.6.30 (03 June 2005)
- Add xfs_quota(8) command which knows how to do all things
quota related, and can also do the XFS specific extensions
like project quota, realtime device quota, etc.
- Created a library of common code (libxcmd.a) shared by
xfs_growfs, xfs_io and xfs_quota.
- Fix use of regular files for realtime subvolumes (debugging
only, really).
- Fix bug in xfs_io command line option handling when commands
where specified for multiple files at once.
- Allow xfs_io to specify O_NONBLOCK for regular file IO.
- Fix MD driver-specific code to not attempt stripe alignment
for volumes that are not stripes (e.g. concat/mirror).
xfsprogs-2.6.29 (19 April 2005)
- Fix mkfs.xfs -dfile.
- Fix libhandle on 64bit, Big Endian systems.
xfsprogs-2.6.28 (30 March 2005)
- Fix compiler warning in repair/dir.c size checks.
- Fix more compilation problem with version 4 of gcc
(thanks to Andreas Jochens).
- Make xfs_db and xfs_repair cope with filesystems that
have project quota enabled.
xfsprogs-2.6.27 (23 March 2005)
- Fix default mkfs allocation group size calculations
for filesystem sizes in the range 32 - 64 terabytes.
- Add noalign mkfs suboptions for -d/-r to disable the
sunit/swidth auto-alignment (based on logical volume
geometry, extracted from the driver).
xfsprogs-2.6.26 (08 March 2005)
- Fix compilation problem with version 4 of gcc
(thanks to Andreas Jochens).
- Added a streamlined