From fc49813f3dae98293ea4011056abe8a910f4b479 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Mon, 15 Jan 2001 06:52:52 +0000 Subject: [PATCH] initial version for reworked xfsprogs build environment. --- Makefile | 76 ++++++++ Makepkgs | 110 ++++++++++++ README | 15 ++ VERSION | 7 + bmap/Makefile | 5 +- build/Makefile | 18 +- build/rpm/Makefile | 26 ++- build/rpm/xfsprogs.spec.in | 91 ++++++++++ build/tar/Makefile | 4 +- configure.in | 240 +++++++++++++++++++++++++ db/Makefile | 13 +- db/input.c | 1 - debian/Makefile | 40 +++++ debian/changelog | 9 + debian/control | 33 ++++ debian/copyright | 14 ++ debian/rules | 60 +++++++ doc/CHANGES | 55 ++++++ doc/COPYING | 346 +++++++++++++++++++++++++++++++++++++ doc/CREDITS | 22 +++ doc/INSTALL | 52 ++++++ doc/Makefile | 20 ++- doc/PORTING | 86 +++++++++ fsck/Makefile | 5 +- growfs/Makefile | 9 +- include/Makefile | 11 +- include/builddefs.in | 37 ++-- include/buildrules | 7 +- install-sh | 273 +++++++++++++++++++++++++++++ libhandle/Makefile | 24 ++- libxfs/Makefile | 30 +++- libxfs/xfs.h | 2 +- logprint/Makefile | 7 +- man/Makefile | 4 +- man/man3/Makefile | 50 ++++++ man/man3/handle.3 | 196 +++++++++++++++++++++ man/man5/Makefile | 4 +- man/man8/Makefile | 3 +- mkfile/Makefile | 5 +- mkfs/Makefile | 14 +- repair/Makefile | 7 +- repair/attr_repair.c | 2 +- repair/attr_repair.h | 34 +++- 43 files changed, 1965 insertions(+), 102 deletions(-) create mode 100644 Makefile create mode 100755 Makepkgs create mode 100644 README create mode 100644 VERSION create mode 100644 build/rpm/xfsprogs.spec.in create mode 100644 configure.in create mode 100644 debian/Makefile create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 doc/CHANGES create mode 100644 doc/COPYING create mode 100644 doc/CREDITS create mode 100644 doc/INSTALL create mode 100644 doc/PORTING create mode 100755 install-sh create mode 100644 man/man3/Makefile create mode 100644 man/man3/handle.3 diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..bc1ddb87d --- /dev/null +++ b/Makefile @@ -0,0 +1,76 @@ +# +# Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Further, this software is distributed without any warranty that it is +# free of the rightful claim of any third person regarding infringement +# or the like. Any license provided herein, whether implied or +# otherwise, applies only to this software file. Patent licenses, if +# any, provided herein do not apply to combinations of this program with +# other software, or any other product whatsoever. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write the Free Software Foundation, Inc., 59 +# Temple Place - Suite 330, Boston MA 02111-1307, USA. +# +# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, +# Mountain View, CA 94043, or: +# +# http://www.sgi.com +# +# For further information regarding this notice, see: +# +# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ +# + +TOPDIR = . +HAVE_BUILDDEFS = $(shell test -f $(TOPDIR)/include/builddefs && echo yes || echo no) + +ifeq ($(HAVE_BUILDDEFS), yes) +include $(TOPDIR)/include/builddefs +endif + +CONFIGURE = configure include/builddefs include/platform_defs.h +LSRCFILES = configure configure.in Makepkgs install-sh README VERSION +LDIRT = config.* conftest* Logs/* built install.* install-dev.* *.gz + +SUBDIRS = include libxfs libhandle \ + bmap db fsck growfs logprint mkfile mkfs repair \ + man doc debian build + +default: $(CONFIGURE) +ifeq ($(HAVE_BUILDDEFS), no) + $(MAKE) -C . $@ +else + $(SUBDIRS_MAKERULE) +endif + +ifeq ($(HAVE_BUILDDEFS), yes) +include $(BUILDRULES) +else +clean: # if configure hasn't run, nothing to clean +endif + +$(CONFIGURE): configure.in include/builddefs.in VERSION + rm -f config.cache + autoconf + ./configure + +install: default + $(SUBDIRS_MAKERULE) + $(INSTALL) -m 755 -d $(PKG_DOC_DIR) + $(INSTALL) -m 644 README $(PKG_DOC_DIR) + +install-dev: default + $(SUBDIRS_MAKERULE) + +realclean distclean: clean + rm -f $(LDIRT) $(CONFIGURE) + [ ! -d Logs ] || rmdir Logs diff --git a/Makepkgs b/Makepkgs new file mode 100755 index 000000000..9f7bfa13d --- /dev/null +++ b/Makepkgs @@ -0,0 +1,110 @@ +#! /bin/sh +# +# Make whichever packages the system supports +# +LOGDIR=Logs + +clean=false +debian=false +verbose=false + +MAKE=${MAKE:-make} +test ! -z "$MAKE" && make=$MAKE + +for opt in $* +do + case "$opt" in + clean) + clean=true + ;; + debian) + debian=true + ;; + verbose) + verbose=true + ;; + *) + echo "Usage: Makepkgs [clean] [verbose] [debian]" + exit 1 + ;; + esac +done + +# start with a clean manifest +test -f files.rpm && rm -f files.rpm +test -f filesdevel.rpm && rm -f filesdevel.rpm + +test ! -d $LOGDIR && mkdir $LOGDIR +rm -rf $LOGDIR/* > /dev/null 2>&1 + +if $clean ; then + echo "== clean, log is $LOGDIR/clean" + if $verbose ; then + $MAKE clean 2>&1 | tee $LOGDIR/clean + else + $MAKE clean > $LOGDIR/clean 2>&1 + fi + if [ $? -ne 0 ] ; then + echo \"$MAKE clean\" failed, see log in $LOGDIR/clean + tail $LOGDIR/clean + exit 1 + fi +fi + +SUDO=${SUDO:-sudo} +test ! -z "$SUDO" && sudo=$SUDO +if $debian ; then + echo + echo "== Debian build, log is $LOGDIR/debian" + if $verbose ; then + exec dpkg-buildpackage -r$SUDO | tee $LOGDIR/debian + else + exec dpkg-buildpackage -r$SUDO > $LOGDIR/debian + fi +fi + +echo +echo "== configure, log is $LOGDIR/configure" +if $verbose ; then + autoconf 2>&1 | tee $LOGDIR/configure + ./configure 2>&1 | tee -a $LOGDIR/configure +else + autoconf > $LOGDIR/configure 2>&1 + ./configure >> $LOGDIR/configure 2>&1 +fi +if [ $? -ne 0 ] ; then + echo \"configure\" failed, see log in $LOGDIR/configure + tail $LOGDIR/configure + exit 1 +fi + +echo +echo "== default, log is $LOGDIR/default" +if $verbose ; then + $MAKE default 2>&1 | tee $LOGDIR/default +else + $MAKE default > $LOGDIR/default 2>&1 +fi +if [ $? -ne 0 ] ; then + echo \"$MAKE default\" failed, see log in $LOGDIR/default + tail $LOGDIR/default + exit 1 +fi + +echo +echo "== dist, log is $LOGDIR/dist" +[ ! -f .census ] && touch .census +if $verbose ; then + $MAKE -C build dist 2>&1 | tee $LOGDIR/dist +else + $MAKE -C build dist > $LOGDIR/dist 2>&1 +fi +if [ $? -ne 0 ] ; then + echo $MAKE dist failed, see log in $LOGDIR/dist + tail $LOGDIR/dist + exit 1 +else + grep '^Wrote:' $LOGDIR/dist | sed -e 's/\.\.\/\.\.\///' +fi + +exit 0 diff --git a/README b/README new file mode 100644 index 000000000..87713270e --- /dev/null +++ b/README @@ -0,0 +1,15 @@ +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/ + +For more information on the build process, please refer to +the doc/PORTING document. diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..5679d10fc --- /dev/null +++ b/VERSION @@ -0,0 +1,7 @@ +# +# This file is used by configure to get version information +# +PKG_MAJOR=1 +PKG_MINOR=1 +PKG_REVISION=0 +PKG_BUILD=0 diff --git a/bmap/Makefile b/bmap/Makefile index 741ae5682..bbb2adbbe 100644 --- a/bmap/Makefile +++ b/bmap/Makefile @@ -41,5 +41,6 @@ default: $(CMDTARGET) include $(BUILDRULES) install: default - $(INSTALL) -m 755 -d $(XFS_CMDS_BIN_DIR) - $(INSTALL) -m 755 $(CMDTARGET) $(XFS_CMDS_BIN_DIR) + $(INSTALL) -m 755 -d $(PKG_BIN_DIR) + $(INSTALL) -m 755 $(CMDTARGET) $(PKG_BIN_DIR) +install-dev: diff --git a/build/Makefile b/build/Makefile index 7e336de44..0411a6d2a 100644 --- a/build/Makefile +++ b/build/Makefile @@ -34,34 +34,32 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs MANIFEST=src-manifest -SRCTAR=$(PACKAGE_NAME)-$(PACKAGE_VERSION).src.tar.gz -SRCTAR2=$(PACKAGE_NAME)_$(PACKAGE_VERSION).orig.tar.gz +SRCTAR=$(PKG_NAME)-$(PKG_VERSION).src.tar.gz -LDIRT = $(MANIFEST) $(SRCTAR) $(SRCTAR2) bin-manifest $(TOPDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +LDIRT = $(MANIFEST) $(SRCTAR) bin-manifest $(TOPDIR)/$(PKG_NAME)-$(PKG_VERSION) # for clean and clobber -SUBDIRS = tar rpm deb +SUBDIRS = tar rpm # nothing to build here (it's all packaging) -default install : +default install install-dev : include $(BUILDRULES) # Symlink in the TOPDIR is used to pack files relative to # product-version directory. $(MANIFEST) : $(_FORCE) - @if [ ! -L $(TOPDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) ] ; then \ - $(LN_S) . $(TOPDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) ; \ + @if [ ! -L $(TOPDIR)/$(PKG_NAME)-$(PKG_VERSION) ] ; then \ + $(LN_S) . $(TOPDIR)/$(PKG_NAME)-$(PKG_VERSION) ; \ fi @CDIR=`pwd`; cd $(TOPDIR); \ $(MAKE) --no-print-directory source | \ - sed -e 's/^\./$(PACKAGE_NAME)-$(PACKAGE_VERSION)/' > $$CDIR/$@ ;\ - if [ $$? -ne 0 ] ; then \ + sed -e 's/^\./$(PKG_NAME)-$(PKG_VERSION)/' > $$CDIR/$@ ;\ + if [ $$? -ne 0 ] ; then \ exit 1; \ else \ unset TAPE; \ $(TAR) -T $$CDIR/$@ -cf - | $(ZIP) --best > $$CDIR/$(SRCTAR); \ - $(LN_S) $$CDIR/$(SRCTAR) $$CDIR/$(SRCTAR2); \ fi dist : default $(MANIFEST) diff --git a/build/rpm/Makefile b/build/rpm/Makefile index 26253705d..bd7eefe6f 100644 --- a/build/rpm/Makefile +++ b/build/rpm/Makefile @@ -34,14 +34,12 @@ TOPDIR = ../.. TREEROOT = $(shell cd ${TOPDIR}; pwd) include $(TOPDIR)/include/builddefs -SPECF = xfs-cmds.spec - -LDIRT = $(PACKAGE_NAME)-$(PACKAGE_VERSION)-[0-9]*.*.rpm $(SPECF) \ - rpmmacros rpm-$(RPM_VERSION).rc +SPECF = $(PKG_NAME).spec +LDIRT = $(PKG_NAME)*.rpm $(SPECF) rpmmacros rpm-*.rc $(TOPDIR)/files*.rpm LSRCFILES = macros.template $(SPECF).in rpm-2.rc.template -default install : +default install install-dev : include $(BUILDRULES) @@ -64,15 +62,15 @@ endif .PHONY: $(SPECF) ${SPECF} : ${SPECF}.in - sed -e's|@package_name@|$(PACKAGE_NAME)|g' \ - -e's|@package_version@|$(PACKAGE_VERSION)|g' \ - -e's|@package_release@|$(PACKAGE_RELEASE)|g' \ - -e's|@package_distribution@|$(PACKAGE_DISTRIBUTION)|g' \ - -e's|@package_builder@|$(PACKAGE_BUILDER)|g' \ + sed -e's|@pkg_name@|$(PKG_NAME)|g' \ + -e's|@pkg_version@|$(PKG_VERSION)|g' \ + -e's|@pkg_release@|$(PKG_RELEASE)|g' \ + -e's|@pkg_distribution@|$(PKG_DISTRIBUTION)|g' \ + -e's|@pkg_builder@|$(PKG_BUILDER)|g' \ -e's|@build_root@|$(DIST_ROOT)|g' \ -e'/^BuildRoot: *$$/d' \ - -e's|@xfs_cmds_var_dir@|$(XFS_CMDS_VAR_DIR)|g' \ - -e's|@xfs_cmds_share_dir@|$(XFS_CMDS_SHARE_DIR)|g' \ - -e's|@xfs_cmds_log_dir@|$(XFS_CMDS_LOG_DIR)|g' \ - -e's|@xfs_cmds_tmp_dir@|$(XFS_CMDS_TMP_DIR)|g' \ + -e's|@pkg_var_dir@|$(PKG_VAR_DIR)|g' \ + -e's|@pkg_share_dir@|$(PKG_SHARE_DIR)|g' \ + -e's|@pkg_log_dir@|$(PKG_LOG_DIR)|g' \ + -e's|@pkg_tmp_dir@|$(PKG_TMP_DIR)|g' \ -e's|@make@|$(MAKE)|g' < $< > $@ diff --git a/build/rpm/xfsprogs.spec.in b/build/rpm/xfsprogs.spec.in new file mode 100644 index 000000000..0d1b2129f --- /dev/null +++ b/build/rpm/xfsprogs.spec.in @@ -0,0 +1,91 @@ +Summary: Utilities for managing the XFS filesystem. +Name: @pkg_name@ +Version: @pkg_version@ +Release: @pkg_release@ +Distribution: @pkg_distribution@ +Packager: @pkg_builder@ +BuildRoot: @build_root@ +Conflicts: xfs-cmds +Prereq: /sbin/ldconfig +Source: @pkg_name@-@pkg_version@.src.tar.gz +Copyright: Copyright (C) 2000 Silicon Graphics, Inc. +Vendor: Silicon Graphics, Inc. +URL: http://oss.sgi.com/projects/xfs/ +Group: System Environment/Base + +%description +A set of commands to use the XFS file system, including mkfs.xfs. + +XFS is a high performance journalled 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. This implementation is on-disk compatible +with the IRIX version of XFS. + +%package devel +Summary: XFS filesystem-specific static libraries and headers. +Group: Development/Libraries +Requires: @pkg_name@ +Conflicts: xfs-cmds + +%description devel +xfsprogs-devel contains the libraries and header files needed to +develop XFS filesystem-specific programs. + +You should install xfsprogs-devel if you want to develop XFS +filesystem-specific programs, If you install xfsprogs-devel, you'll +also want to install xfsprogs. + +# If .census exists, then no setup is necessary, just go and do the build, +# otherwise run setup +%prep +if [ -f .census ] ; then + if [ ! -d ${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION} ] ; then + ln -s . ${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION} + fi +else +%setup +touch .census +./configure +fi + +%build +@make@ + +%install +DIST_ROOT="$RPM_BUILD_ROOT" +DIST_INSTALL=`pwd`/install.manifest +DIST_INSTALL_DEV=`pwd`/install-dev.manifest +export DIST_ROOT DIST_INSTALL DIST_INSTALL_DEV +@make@ install DIST_MANIFEST="$DIST_INSTALL" +@make@ install-dev DIST_MANIFEST="$DIST_INSTALL_DEV" +files() +{ + sort | uniq | awk ' +$1 == "d" { printf ("%%%%dir %%%%attr(%s,%s,%s) %s\n", $2, $3, $4, $5); } +$1 == "f" { if (match ($6, "@pkg_man_dir@") || match ($6, "@pkg_doc_dir@")) { + printf ("%%%%doc "); + } + printf ("%%%%attr(%s,%s,%s) %s\n", $2, $3, $4, $6); } +$1 == "l" { print "%attr(0777,root,root)", $3; }' +} +set +x +files < "$DIST_INSTALL" > files.rpm +files < "$DIST_INSTALL_DEV" > filesdevel.rpm +set -x + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files -f files.rpm + +%files devel -f filesdevel.rpm diff --git a/build/tar/Makefile b/build/tar/Makefile index e010d9736..63540f9f8 100644 --- a/build/tar/Makefile +++ b/build/tar/Makefile @@ -33,10 +33,10 @@ TOPDIR = ../.. include $(TOPDIR)/include/builddefs -BINTAR=$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz +BINTAR=$(PKG_NAME)-$(PKG_VERSION).tar.gz LDIRT = $(BINTAR) -default install : +default install install-dev : include $(BUILDRULES) diff --git a/configure.in b/configure.in new file mode 100644 index 000000000..1a13b105e --- /dev/null +++ b/configure.in @@ -0,0 +1,240 @@ +dnl unpacking check - this file must exist +AC_INIT(include/libxfs.h) +pkg_name="xfsprogs" +AC_SUBST(pkg_name) + +# +# Note: the following environment variables may be set to override the +# defaults (to change paths and/or executables, build parameters, etc): +# +# DEBUG OPTIMIZER MAKE CC LD TAR ZIP RPM AWK SED ECHO +# MALLOCLIB DISTRIBUTION PACKAGE_BUILDER PREFIX ROOT_PREFIX +# + +DEBUG=${DEBUG:-'-DDEBUG'} # -DNDEBUG +OPTIMIZER=${OPTIMIZER:-'-g'} # -O2 +MALLOCLIB=${MALLOCLIB:-''} # /usr/lib/libefence.a + +dnl Debug build? +debug_build="$DEBUG" +AC_SUBST(debug_build) + +dnl Optimization options? +opt_build="$OPTIMIZER" +AC_SUBST(opt_build) + +dnl Alternate malloc library? +malloc_lib="$MALLOCLIB" +AC_SUBST(malloc_lib) + +dnl Set version +. VERSION + +pkg_version=${PKG_MAJOR}.${PKG_MINOR}.${PKG_REVISION} +pkg_release=$PKG_BUILD +AC_SUBST(pkg_version) +AC_SUBST(pkg_release) + +pkg_distribution="SGI ProPack" +test -z "$DISTRIBUTION" || pkg_distribution="$DISTRIBUTION" +AC_SUBST(pkg_distribution) + +pkg_builder=`id -u -n`@`hostname -f` +test -z "$PACKAGE_BUILDER" || pkg_builder="$PACKAGE_BUILDER" +AC_SUBST(pkg_builder) + + +dnl output header with cpp defs HAVE_*, etc +AC_CONFIG_HEADER(include/platform_defs.h) + +dnl check if user wants their own C compiler +test -z "$CC" && AC_PROG_CC +cc=$CC +AC_SUBST(cc) + +dnl check if users wants their own make +test -z "$MAKE" && AC_PATH_PROG(MAKE, make, /usr/bin/make) +make=$MAKE +AC_SUBST(make) + +dnl check if users wants their own linker +test -z "$LD" && AC_PATH_PROG(LD, ld, /usr/bin/ld) +ld=$LD +AC_SUBST(ld) + +dnl check if the tar program is available +test -z "$TAR" && AC_PATH_PROG(TAR, tar) +tar=$TAR +AC_SUBST(tar) + +dnl check if the gzip program is available +test -z "$ZIP" && AC_PATH_PROG(ZIP, gzip, /bin/gzip) +zip=$ZIP +AC_SUBST(zip) + +dnl check if the rpm program is available +test -z "$RPM" && AC_PATH_PROG(RPM, rpm, /bin/rpm) +rpm=$RPM +AC_SUBST(rpm) + +dnl .. and what version is rpm +rpm_version=0 +test -x $RPM && \ + rpm_version=`$RPM --version | awk '{print $NF}' | awk -F. '{print $1}'` +AC_SUBST(rpm_version) + +dnl check if the makedepend program is available +test -z "$MAKEDEPEND" && AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true) +makedepend=$MAKEDEPEND +AC_SUBST(makedepend) + +dnl check if symbolic links are supported +AC_PROG_LN_S + +dnl check if user wants their own awk, sed and echo +test -z "$AWK" && AC_PATH_PROG(AWK, awk, /bin/awk) +awk=$AWK +AC_SUBST(awk) +test -z "$SED" && AC_PATH_PROG(SED, sed, /bin/sed) +sed=$SED +AC_SUBST(sed) +test -z "$ECHO" && AC_PATH_PROG(ECHO, echo, /bin/echo) +echo=$ECHO +AC_SUBST(echo) + +dnl Checks for libraries. +AC_CHECK_LIB(uuid, uuid_generate,,[ + echo + echo "FATAL ERROR: could not find a valid UUID library." + echo "Install either the e2fsprogs-devel (rpm) or the uuid-dev (deb) package." + exit 1 +]) + +dnl Checks for LVM library +AC_MSG_CHECKING([for liblvm.a]) +liblvm="" +for dir in /usr/local/lib /usr/lib /lib; do + if test -f $dir/liblvm.a; then + liblvm=$dir/liblvm.a + fi +done +if test -n "$liblvm"; then + AC_MSG_RESULT(yes) + have_liblvm=1 +else + AC_MSG_RESULT(no) + have_liblvm=0 +fi +AC_SUBST(liblvm) +AC_SUBST(have_liblvm) + +dnl Check if we have a type for the pointer's size integer (__psint_t) +AC_MSG_CHECKING([for __psint_t ]) +AC_TRY_COMPILE( +[ + #include + #include + #include +], +[ + __psint_t psint; +], AC_DEFINE(HAVE___PSINT_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no)) + +dnl Check if we have a type for the pointer's size unsigned (__psunsigned_t) +AC_MSG_CHECKING([for __psunsigned_t ]) +AC_TRY_COMPILE( +[ + #include + #include + #include +], +[ + __psunsigned_t psuint; +], AC_DEFINE(HAVE___PSUNSIGNED_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no)) + + +dnl check sizeof long +AC_MSG_CHECKING([sizeof long]) +cat <conftest.c +#include +main() { printf("%d\n", sizeof(long)); } +End-of-File +(eval $ac_compile) 2>&5 +(eval $ac_link) 2>&5 +ans=`./conftest` +echo "./conftest -> \"$ans\"" >&5 +AC_MSG_RESULT($ans) +test $ans -eq 4 && AC_DEFINE(HAVE_32BIT_LONG) +test $ans -eq 8 && AC_DEFINE(HAVE_64BIT_LONG) +rm -f conftest conftest.* + +dnl check sizeof pointer +AC_MSG_CHECKING([sizeof pointer]) +cat <conftest.c +#include +main() { printf("%d\n", sizeof(char *)); } +End-of-File +(eval $ac_compile) 2>&5 +(eval $ac_link) 2>&5 +ans=`./conftest` +echo "./conftest -> \"$ans\"" >&5 +AC_MSG_RESULT($ans) +test $ans -eq 4 && AC_DEFINE(HAVE_32BIT_PTR) +test $ans -eq 8 && AC_DEFINE(HAVE_64BIT_PTR) +rm -f conftest conftest.* + + +dnl alternate root and usr prefixes +test -z "$ROOT_PREFIX" && ROOT_PREFIX="" +root_prefix="$ROOT_PREFIX" +test -z "$PREFIX" && PREFIX="/usr" +prefix="$PREFIX" + +dnl man pages (source) +dnl also check if man page source is gzipped +dnl (usually on Debian, but not Redhat pre-7.0) +have_zipped_manpages=false +for d in ${prefix}/share/man ${prefix}/man ; do + if test -f $d/man1/man.1.gz + then + pkg_man_dir=$d + have_zipped_manpages=true + break + fi +done +AC_SUBST(pkg_man_dir) +AC_SUBST(have_zipped_manpages) + +dnl binaries +pkg_bin_dir=${prefix}/sbin +AC_SUBST(pkg_bin_dir) + +dnl static libraries +pkg_lib_dir=${prefix}/lib +AC_SUBST(pkg_lib_dir) + +dnl runtime shared system libraries +pkg_slib_dir=${root_prefix}/lib +AC_SUBST(pkg_slib_dir) + +dnl system binaries +pkg_sbin_dir=${root_prefix}/sbin +AC_SUBST(pkg_sbin_dir) + +dnl include files +pkg_inc_dir=${prefix}/include/xfs +AC_SUBST(pkg_inc_dir) + +dnl doc directory +pkg_doc_dir=${prefix}/share/doc/${pkg_name} +AC_SUBST(pkg_doc_dir) + + +dnl +dnl output files +dnl + +AC_OUTPUT( \ +dnl Build definitions for use in Makefiles + include/builddefs \ +) diff --git a/db/Makefile b/db/Makefile index 74cacbae3..666c7918f 100644 --- a/db/Makefile +++ b/db/Makefile @@ -34,7 +34,6 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs CMDTARGET = xfs_db -CMDDEPS = $(LIBXFS) HFILES = addr.h agf.h agfl.h agi.h attr.h attrshort.h bit.h block.h bmap.h \ bmapbt.h bmroot.h bnobt.h check.h cntbt.h command.h convert.h data.h \ @@ -45,14 +44,16 @@ HFILES = addr.h agf.h agfl.h agi.h attr.h attrshort.h bit.h block.h bmap.h \ CFILES = $(HFILES:.h=.c) main.c LSRCFILES = xfs_admin.sh xfs_check.sh xfs_ncheck.sh LLDLIBS = $(LIBXFS) $(LIBUUID) +LLDFLAGS = -L$(TOPDIR)/libxfs default: $(CMDTARGET) include $(BUILDRULES) install: default - $(INSTALL) -m 755 -d $(XFS_CMDS_BIN_DIR) - $(INSTALL) -m 755 $(CMDTARGET) $(XFS_CMDS_BIN_DIR) - $(INSTALL) -m 755 xfs_admin.sh $(XFS_CMDS_BIN_DIR)/xfs_admin - $(INSTALL) -m 755 xfs_check.sh $(XFS_CMDS_BIN_DIR)/xfs_check - $(INSTALL) -m 755 xfs_ncheck.sh $(XFS_CMDS_BIN_DIR)/xfs_ncheck + $(INSTALL) -m 755 -d $(PKG_BIN_DIR) + $(INSTALL) -m 755 $(CMDTARGET) $(PKG_BIN_DIR) + $(INSTALL) -m 755 xfs_admin.sh $(PKG_BIN_DIR)/xfs_admin + $(INSTALL) -m 755 xfs_check.sh $(PKG_BIN_DIR)/xfs_check + $(INSTALL) -m 755 xfs_ncheck.sh $(PKG_BIN_DIR)/xfs_ncheck +install-dev: diff --git a/db/input.c b/db/input.c index 1394f101b..cf8edba79 100644 --- a/db/input.c +++ b/db/input.c @@ -32,7 +32,6 @@ #include #include -#include #include "command.h" #include "data.h" #include "input.h" diff --git a/debian/Makefile b/debian/Makefile new file mode 100644 index 000000000..59870426b --- /dev/null +++ b/debian/Makefile @@ -0,0 +1,40 @@ +# +# Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Further, this software is distributed without any warranty that it is +# free of the rightful claim of any third person regarding infringement +# or the like. Any license provided herein, whether implied or +# otherwise, applies only to this software file. Patent licenses, if +# any, provided herein do not apply to combinations of this program with +# other software, or any other product whatsoever. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write the Free Software Foundation, Inc., 59 +# Temple Place - Suite 330, Boston MA 02111-1307, USA. +# +# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, +# Mountain View, CA 94043, or: +# +# http://www.sgi.com +# +# For further information regarding this notice, see: +# +# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ +# + +TOPDIR = .. +include $(TOPDIR)/include/builddefs + +LSRCFILES = changelog control copyright rules + +default install install-dev: + +include $(BUILDRULES) diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 000000000..1b4e1c3d5 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,9 @@ +xfsprogs (1.1.0) unstable; urgency=low + + * Initial release. + + -- Nathan Scott Thu, 4 Jan 2001 11:15:11 -0500 + +Local variables: +mode: debian-changelog +End: diff --git a/debian/control b/debian/control new file mode 100644 index 000000000..4883e1d9a --- /dev/null +++ b/debian/control @@ -0,0 +1,33 @@ +Source: xfsprogs +Section: admin +Priority: optional +Maintainer: Nathan Scott +Build-Depends: uuid-dev, autoconf, debmake +Standards-Version: 3.1.1 + +Package: xfsprogs +Depends: ${shlibs:Depends} +Architecture: any +Description: Utilities for managing the XFS filesystem + A set of commands to use the XFS file system, including mkfs.xfs. + . + XFS is a high performance journalled 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. This implementation is on-disk compatible + with the IRIX version of XFS. + +Package: xfslibs-dev +Section: devel +Priority: extra +Depends: libc6-dev, xfsprogs +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. + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 000000000..d956166f1 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,14 @@ +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 Silicon Graphics, Inc. + +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. + diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..d3ae58ad8 --- /dev/null +++ b/debian/rules @@ -0,0 +1,60 @@ +#!/usr/bin/make -f + +package = xfsprogs +develop = xfslibs-dev + +dirtmp = debian/tmp +dirdev = debian/$(develop) +doctmp = /usr/share/doc/$(package) +docdev = /usr/share/doc/$(develop) +pkgtmp = DIST_ROOT=`pwd`/$(dirtmp); export DIST_ROOT; +pkgdev = DIST_ROOT=`pwd`/$(dirdev); export DIST_ROOT; +stdenv = GZIP=-q; export GZIP; + +options = DEBUG="-DNDEBUG"; OPTIMIZER="-O2 -g"; export DEBUG OPTIMIZER; +checkdir = test -f debian/rules + +build: built +built: + @echo "== dpkg-buildpackage: build" 1>&2 + $(checkdir) + autoconf + $(options) ./configure + $(MAKE) default + touch built + +clean: + @echo "== dpkg-buildpackage: clean" 1>&2 + $(checkdir) + -rm -f built + $(MAKE) distclean + -rm -rf $(dirtmp) $(dirdev) debian/*substvars debian/files* + +binary-indep: + +binary-arch: checkroot built + @echo "== dpkg-buildpackage: binary-arch" 1>&2 + $(checkdir) + -rm -rf $(dirtmp) $(dirdev) + $(pkgtmp) $(MAKE) -C . install + $(pkgdev) $(MAKE) -C . install-dev + $(pkgtmp) $(MAKE) -C build src-manifest + $(pkgdev) ./install-sh -m 755 -d $(doctmp) + $(pkgdev) ./install-sh -m 755 -d $(docdev) + $(pkgdev) ./install-sh -m 644 debian/copyright $(docdev) + $(pkgdev) ./install-sh -m 644 debian/changelog $(docdev) + @echo "== dpkg-buildpackage: debstd" 1>&2 + $(stdenv) debstd -m + dpkg-gencontrol -isp -p$(package) -P$(dirtmp) + dpkg-gencontrol -isp -p$(develop) -P$(dirdev) + chown -R root.root $(dirtmp) $(dirdev) + chmod -R go=rX $(dirtmp) $(dirdev) + dpkg --build $(dirtmp) .. + dpkg --build $(dirdev) .. + +binary: binary-indep binary-arch + +checkroot: + test 0 -eq `id -u` + +.PHONY: binary binary-arch binary-indep clean checkroot diff --git a/doc/CHANGES b/doc/CHANGES new file mode 100644 index 000000000..9b293d337 --- /dev/null +++ b/doc/CHANGES @@ -0,0 +1,55 @@ + +xfsprogs-1.1.0 (15 January 2001) + - rework xfs-cmds package into base, devel and dump packages + - completed Debian packaging + - late beta code + +xfs-cmds-1.0.7 (02 January 2001) + - added mkfs support for extracting LVM stripe unit/width + - libattr (*experimental* extended attributes interface) added + - removed xfs_fstab.5 man page (merged into mount.8) + - install xfs_repair into /sbin, not /usr/sbin + +xfs-cmds-1.0.6 (04 October 2000) + - reworked external log format to be IRIX compatible + - mkfs, repair, db, logprint now work with new format + - xfs_admin added for setting filesystem label + +xfs-cmds-1.0.5 (18 September 2000) + - minor bug fixes + - first beta release + +xfs-cmds-1.0.4 (18 August 2000) + - minor bug fixes + - xfs_growfs added + - xfs_info added + - late alpha code + +xfs-cmds-1.0.3 (16 August 2000) + - numerous bug fixes + - xfsdump and xfsrestore added + - xfsstats added + - fsck.xfs (symlink to /bin/true) added + - demise of sim library complete, mkfs and repair reworked + - no longer need to have an XFS kernel handy for building xfs-cmds + - xfs_copy compiles on Linux + - dump/restore README added + - late alpha code + +xfs-cmds-1.0.2 (27 July 2000) + - numerous bug fixes + - xfs_attr (extended attributes) command added + - fsr_xfs added (ported by jones@tacc.utexas.edu) + - LVM+XFS README added + - early alpha code + +xfs-cmds-1.0.1 (5 July 2000) + - numerous bug fixes + - reworked build environment + - begun work on user/kernel separation + - early alpha code + +xfs-cmds-1.0.0 (16 June 2000) + - initial release for USENIX CDs + - early alpha code + diff --git a/doc/COPYING b/doc/COPYING new file mode 100644 index 000000000..85aab8299 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,346 @@ +---------------------------------------------------------------------- + + + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + 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; either version 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + +---------------------------------------------------------------------- diff --git a/doc/CREDITS b/doc/CREDITS new file mode 100644 index 000000000..2a2023194 --- /dev/null +++ b/doc/CREDITS @@ -0,0 +1,22 @@ + + This is a credits-file of people that have contributed to + the Linux/XFS project. It is sorted by name and formatted + to allow easy grepping and beautification by scripts (i.e. + it follows the same format Linus has used in the kernel). + The fields are: name (N), email (E), web-address (W), PGP + key ID and fingerprint (P), description (D), and snail-mail + address (S). + +---------- + +N: Thomas Graichen +E: thomas.graichen@innominate.de +D: XFS FAQ ( http://oss.sgi.com/projects/xfs/faq.html ) maintainer +D: PowerPC and Alpha porting +S: Berlin, Germany + +N: Bill Jones +E: jones@tacc.utexas.edu +D: fsr port to Linux +S: Austin, Texas, USA + diff --git a/doc/INSTALL b/doc/INSTALL new file mode 100644 index 000000000..83facca26 --- /dev/null +++ b/doc/INSTALL @@ -0,0 +1,52 @@ +This document describes how to configure and build the open source XFS +commands and utilites ("xfsprogs") from source, and how to install and +run them. + +0. If you have the binary rpm, simply install it and skip to step 2 (below). + The rpm command to do this is: + # rpm -Uvh xfsprogs + + The Debian command to do this is: + # dpkg -i xfsprogs + or, if you have apt configured (don't need the binary package): + # apt-get install xfsprogs + +1. Configure, build and install the package + + The xfsprogs package uses autoconf/configure and expects a GNU build + environment (your platform must at least have both autoconf and gmake). + You will also need to have installed either the e2fsprogs-devel package + (on an RPM based system) or the uuid-dev package (on a Debian system) + as some of the commands make use of the UUID library provided by these. + + If you just want to spin an RPM and/or tar file, use the Makepkgs + script in the top level directory. This will configure and build + the package and leave binary and src RPMs in the build/rpm + directory. It will also leave a tar file in the build/tar + directory. + + # ./Makepkgs verbose + + If you want to build the package and install it manually, use the + following steps: + + # make configure (or run autoconf; ./configure) + # make + # su root + # make install + + Note that there are so many "install" variants out there that we + wrote our own script (see "install-sh" in the top level directory). + + If you wish to turn off debugging asserts in the command build and + turn on the optimizer then set the shell environment variables: + + OPTIMIZER=-O + DEBUG=-DNDEBUG + + before running make configure or Makepkgs. + +2. How to Contribute + + See the README file in this directory for details about how to + contribute to the XFS project. diff --git a/doc/Makefile b/doc/Makefile index abd968598..dcccaeb53 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -33,13 +33,23 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs -DOCFILES = README.LVM README.xfsdump Porting-Guide -LSRCFILES = $(DOCFILES) +# [don't install COPYING for Debian builds - use Debian preferred method] +HAVE_DEBIAN = $(shell test -f /etc/debian_version && echo yes || echo no) -default: $(CMDTARGET) +LSRCFILES = INSTALL PORTING CHANGES COPYING CREDITS README.LVM +LDIRT = *.gz + +default: $(CMDTARGET) CHANGES.gz include $(BUILDRULES) +CHANGES.gz: + $(ZIP) --best -c < CHANGES > $@ + install: default - $(INSTALL) -m 755 -d $(XFS_CMDS_DOC_DIR) - $(INSTALL) -m 644 $(DOCFILES) $(XFS_CMDS_DOC_DIR) + $(INSTALL) -m 755 -d $(PKG_DOC_DIR) +ifeq ($(HAVE_DEBIAN), no) + $(INSTALL) -m 644 COPYING $(PKG_DOC_DIR) +endif + $(INSTALL) -m 644 PORTING CHANGES.gz CREDITS README.LVM $(PKG_DOC_DIR) +install-dev: diff --git a/doc/PORTING b/doc/PORTING new file mode 100644 index 000000000..190cdbf6f --- /dev/null +++ b/doc/PORTING @@ -0,0 +1,86 @@ + +1. unpack the source tarball and cd to the resulting dir + +2. # autoconf + this reads configure.in and generates the ./configure script + +3. # ./configure + this probes your system and then, for each "file" named + in the AC_OUTPUT() macro near the end of configure.in, + read "file".in and generate "file". Variables named @somevariable@ + will be substituted with literal values. + +4. step (3) produces several files. These files are generated by + configure from their respective .in file in the same directory. + You should have a read of these generated files and diff them + against their respective .in files to see what was substituted + by configure. + + src/include/builddefs + common definitions for the build environment. This is included + by all Makefiles, in conjunction with src/include/buildrules. + Note that most autoconf/configure build environments generate + Makefile (from Makefile.in) in every src dir. Instead, we + generate builddefs, and then include it in every Makefile. + + src/include/platform_defs.h + header containing conditional macros defining the C run-time + environment discovered by the configure script. + +5. read some or all of the GNU tool chain documentation + gmake Table Of Contents : + http://www.delorie.com/gnu/docs/make/make_toc.html + gmake Quick Reference section : + http://www.delorie.com/gnu/docs/make/make_120.html + Autoconf : + http://www.delorie.com/gnu/docs/autoconf/autoconf_toc.html + gcc/g++ : + http://www.delorie.com/gnu/docs/gcc/gcc_toc.html + +6. Makefiles and build environment + First have a look at some Makefiles + + example using SUBDIRS : xfsprogs/Makefile + example static library: xfsprogs/libxfs/Makefile + example command : xfsprogs/bmap/Makefile + + All Makefiles must define TOPDIR as the root of the project. This + allows other stuff to be found relative to $(TOPDIR). + + All Makefiles should have the following structure, which is + much like commondefs and commonrules in the IRIX build environment, e.g. + + # ---------------------------------------------------------------------- + # TOPDIR must point to the root of the project + # The builddefs file defines lots of things. Read it. + TOPDIR = .. + include $(TOPDIR)/include/builddefs + + # first rule should always be "default" + default : sometarget + commands to build targets, if necessary + + # $(BUILDRULES) is defined in builddefs and includes rules for + # descending subdirs, building targets and installation rules + include $(BUILDRULES) + + install : default + $(INSTALL) sometargets somewhere + # ---------------------------------------------------------------------- + +7. packaging + + # ./Makepkgs + this script generates all of the packages supported - each has a + subdirectory below xfsprogs/build where knowledge specific to + each package type is maintained. + + The script produces logs of each stage of the build (this info is + also echoed to the screen when the "verbose" option is provided): + + xfsprogs/Logs/configure - `autoconf; ./configure' output + xfsprogs/Logs/default - `make default' output + xfsprogs/Logs/dist - `make build dist' output + + On successful completion, the script echoes the names of packages + successfully generated. diff --git a/fsck/Makefile b/fsck/Makefile index 965dca0b4..56b4e9236 100644 --- a/fsck/Makefile +++ b/fsck/Makefile @@ -42,5 +42,6 @@ default: $(CMDTARGET) include $(BUILDRULES) install: default - $(INSTALL) -m 755 -d $(XFS_CMDS_SBIN_DIR) - $(INSTALL) -m 755 $(CMDTARGET) $(XFS_CMDS_SBIN_DIR) + $(INSTALL) -m 755 -d $(PKG_SBIN_DIR) + $(INSTALL) -m 755 $(CMDTARGET) $(PKG_SBIN_DIR) +install-dev: diff --git a/growfs/Makefile b/growfs/Makefile index f0bf7616c..6a3ade362 100644 --- a/growfs/Makefile +++ b/growfs/Makefile @@ -34,10 +34,10 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs CMDTARGET = xfs_growfs -CMDDEPS = $(LIBXFS) CFILES = xfs_growfs.c LLDLIBS = $(LIBXFS) $(LIBUUID) +LLDFLAGS = -L$(TOPDIR)/libxfs LSRCFILES = xfs_info.sh default: $(CMDTARGET) @@ -45,6 +45,7 @@ default: $(CMDTARGET) include $(BUILDRULES) install: default - $(INSTALL) -m 755 -d $(XFS_CMDS_BIN_DIR) - $(INSTALL) -m 755 $(CMDTARGET) $(XFS_CMDS_BIN_DIR) - $(INSTALL) -m 755 xfs_info.sh $(XFS_CMDS_BIN_DIR)/xfs_info + $(INSTALL) -m 755 -d $(PKG_BIN_DIR) + $(INSTALL) -m 755 $(CMDTARGET) $(PKG_BIN_DIR) + $(INSTALL) -m 755 xfs_info.sh $(PKG_BIN_DIR)/xfs_info +install-dev: diff --git a/include/Makefile b/include/Makefile index 60d0a28bd..8a879161d 100644 --- a/include/Makefile +++ b/include/Makefile @@ -33,8 +33,7 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs -LSRCFILES = libxfs.h acl.h arch.h attributes.h handle.h jdm.h \ - platform_defs.h.in builddefs.in buildrules \ +HFILES = arch.h handle.h jdm.h libxfs.h xqm.h \ xfs_ag.h xfs_alloc.h xfs_alloc_btree.h xfs_arch.h xfs_attr_leaf.h \ xfs_attr_sf.h xfs_bit.h xfs_bmap.h xfs_bmap_btree.h xfs_btree.h \ xfs_buf_item.h xfs_cred.h xfs_da_btree.h xfs_dfrag.h xfs_dinode.h \ @@ -44,9 +43,13 @@ LSRCFILES = libxfs.h acl.h arch.h attributes.h handle.h jdm.h \ xfs_ialloc_btree.h xfs_imap.h xfs_inode.h xfs_inode_item.h xfs_inum.h \ xfs_log.h xfs_log_priv.h xfs_log_recover.h xfs_mount.h xfs_quota.h \ xfs_rtalloc.h xfs_sb.h xfs_trans.h xfs_trans_space.h xfs_types.h +LSRCFILES = platform_defs.h.in builddefs.in buildrules lvm.h lvm_user.h liblvm.h -default : +default install : include $(BUILDRULES) -install : default +install-dev: default + $(INSTALL) -m 755 -d $(PKG_INC_DIR) + $(INSTALL) -m 644 $(HFILES) $(PKG_INC_DIR) + $(INSTALL) -m 644 platform_defs.h $(PKG_INC_DIR) diff --git a/include/builddefs.in b/include/builddefs.in index 0f10b8aaf..c84c38301 100644 --- a/include/builddefs.in +++ b/include/builddefs.in @@ -39,29 +39,28 @@ DEBUG = @debug_build@ OPTIMIZER = @opt_build@ MALLOCLIB = @malloc_lib@ -LIBXFS = $(TOPDIR)/libxfs/libxfs.a -LIBATTR = $(TOPDIR)/libattr/libattr.a -LIBHANDLE = $(TOPDIR)/handle/libhandle.a LIBUUID = /usr/lib/libuuid.a +LIBXFS = -lxfs +LIBHANDLE = -lhandle + LIBLVM = @liblvm@ +USELVM = -DHAVE_LIBLVM=@have_liblvm@ BUILDRULES = $(TOPDIR)/include/buildrules # General package information -TARGET_OS = @host_platform@ -PACKAGE_NAME = @package_name@ -PACKAGE_RELEASE = @package_release@ -PACKAGE_VERSION = @package_version@ -PACKAGE_DISTRIBUTION = @package_distribution@ -PACKAGE_BUILDER = @package_builder@ -XFS_CMDS_SBIN_DIR = @xfs_cmds_sbin_dir@ -XFS_CMDS_BIN_DIR = @xfs_cmds_bin_dir@ -XFS_CMDS_LIB_DIR = @xfs_cmds_lib_dir@ -XFS_CMDS_SHARE_DIR = @xfs_cmds_share_dir@ -XFS_CMDS_INC_DIR = @xfs_cmds_inc_dir@ -XFS_CMDS_MAN_DIR = @xfs_cmds_man_dir@ -XFS_CMDS_TMP_DIR = @xfs_cmds_tmp_dir@ -XFS_CMDS_DOC_DIR = @xfs_cmds_doc_dir@ +PKG_NAME = @pkg_name@ +PKG_RELEASE = @pkg_release@ +PKG_VERSION = @pkg_version@ +PKG_DISTRIBUTION = @pkg_distribution@ +PKG_BUILDER = @pkg_builder@ +PKG_BIN_DIR = @pkg_bin_dir@ +PKG_LIB_DIR = @pkg_lib_dir@ +PKG_SBIN_DIR = @pkg_sbin_dir@ +PKG_SLIB_DIR = @pkg_slib_dir@ +PKG_INC_DIR = @pkg_inc_dir@ +PKG_MAN_DIR = @pkg_man_dir@ +PKG_DOC_DIR = @pkg_doc_dir@ # LCFLAGS, LLDFLAGS, LLDLIBS, LSRCFILES and LDIRT may be specified in # user Makefiles. Note: LSRCFILES is anything other than Makefile, $(CFILES) @@ -69,9 +68,9 @@ XFS_CMDS_DOC_DIR = @xfs_cmds_doc_dir@ # during the "dist" phase (packaging). CFLAGS += $(OPTIMIZER) $(DEBUG) -funsigned-char -Wall -Wno-parentheses \ - $(LCFLAGS) -I$(TOPDIR)/include '-DVERSION="$(PACKAGE_VERSION)"' \ + $(LCFLAGS) -I$(TOPDIR)/include '-DVERSION="$(PKG_VERSION)"' \ -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE \ - -DXFS_BIG_FILES=1 -DXFS_BIG_FILESYSTEMS=1 -DHAVE_LIBLVM=@have_liblvm@ + -DXFS_BIG_FILES=1 -DXFS_BIG_FILESYSTEMS=1 LDFLAGS = $(LLDFLAGS) LDLIBS = $(LLDLIBS) $(MALLOCLIB) diff --git a/include/buildrules b/include/buildrules index af2a7caca..dab3faeda 100644 --- a/include/buildrules +++ b/include/buildrules @@ -30,14 +30,15 @@ include $(TOPDIR)/include/builddefs # Standard targets # ifdef CMDTARGET -$(CMDTARGET) : $(SUBDIRS) $(OBJECTS) $(CMDDEPS) +$(CMDTARGET) : $(SUBDIRS) $(OBJECTS) $(CCF) -o $(CMDTARGET) $(LDFLAGS) $(OBJECTS) $(LDLIBS) +$(CMDTARGET).static : $(SUBDIRS) $(OBJECTS) + $(CCF) -static -o $(CMDTARGET).static $(LDFLAGS) $(OBJECTS) $(LDLIBS) endif ifdef LIBTARGET $(LIBTARGET) : $(SUBDIRS) $(OBJECTS) - $(CC) $(LDFLAGS) -shared -Wl,-soname,$(LIBTARGET) -o $(LIBTARGET) \ - $(OBJECTS) $(LDLIBS) $(LIB_FOR_DLOPEN) $(LIB_FOR_BASENAME) + $(CC) $(LDFLAGS) -fPIC -shared -Wl,-soname,$(LIBTARGET) -o $(LIBTARGET) $(OBJECTS) $(LDLIBS) endif ifdef STATICLIBTARGET diff --git a/install-sh b/install-sh new file mode 100755 index 000000000..395497ad6 --- /dev/null +++ b/install-sh @@ -0,0 +1,273 @@ +#! /bin/sh +# +# Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Further, this software is distributed without any warranty that it is +# free of the rightful claim of any third person regarding infringement +# or the like. Any license provided herein, whether implied or +# otherwise, applies only to this software file. Patent licenses, if +# any, provided herein do not apply to combinations of this program with +# other software, or any other product whatsoever. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write the Free Software Foundation, Inc., 59 +# Temple Place - Suite 330, Boston MA 02111-1307, USA. +# +# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, +# Mountain View, CA 94043, or: +# +# http://www.sgi.com +# +# For further information regarding this notice, see: +# +# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ +# + +# +# This script emulates bsd install and also recognises +# two environment variables, with the following semantics :- +# +# $DIST_MANIFEST - if set, the name of the file to append manifest +# information in the following format: +# File : f mode owner group src target +# Directory: d mode owner group target +# Symlink : l linkval target +# +# $DIST_ROOT - if set, prepend to target +# +# The sematics of all combinations of these two variables +# are as follows: +# +# $DIST_MANIFEST? $DIST_ROOT? | Copy? Append Manifest? +# -----------------------------+-------------------------- +# not set not set | yes no +# not set set | yes no +# set not set | no yes +# set set | yes yes +# +_usage() { + echo "Usage: $prog [-o owner] [-g group] [-m mode] -d directory" + echo "or $prog [-D] [-o owner] [-g group] [-m mode] file directory/file" + echo "or $prog [-o owner] [-g group] [-m mode] file [file ...] directory" + echo "or $prog -S file target (creates \"target\" symlink)" + echo "" + echo "The \$DIST_MANIFEST and \$DIST_ROOT environment variables affect the" + echo "behaviour of this command - see comments in the script." + echo "The -D flag is only available for the second usage, and causes" + echo "the target directory to be created before installing the file." + echo "" + exit 1 +} + +_chown () +{ + _st=255 + if [ $# -eq 3 ] ; then + chown $1:$2 $3 + _st=$? + if [ $_st -ne 0 ] ; then + if [ $REAL_UID != '0' ] ; then + if [ ! -f $DIST_ROOT/.chown.quite ] ; then + echo '===============================================' + echo Ownership of files under ${DIST_ROOT:-/} + echo cannot be changed + echo '===============================================' + if [ -n "$DIST_ROOT" ] ; then + touch $DIST_ROOT/.chown.quite + fi + fi + _st=0 + fi + fi + fi + + return $_st +} + + +_manifest () +{ + echo $* | sed -e 's/\/\//\//g' >>${DIST_MANIFEST:-/dev/null} +} + +prog=`basename $0` +HERE=`pwd` +dflag=false +Dflag=false +Sflag=false +DIRMODE=755 +FILEMODE=644 +OWNER=`id -u` +GROUP=`id -g` +REAL_UID=$OWNER + +# default is to install and don't append manifest +INSTALL=true +MANIFEST=: + +[ -n "$DIST_MANIFEST" -a -z "$DIST_ROOT" ] && INSTALL=false +[ -n "$DIST_MANIFEST" ] && MANIFEST="_manifest" + +[ $# -eq 0 ] && _usage + +if $INSTALL +then + CP=cp; LN=ln; MKDIR=mkdir; CHMOD=chmod; CHOWN=_chown +else + CP=true; LN=true; MKDIR=true; CHMOD=true; CHOWN=true +fi + +[ -n "$DIST_ROOT" -a $REAL_UID -ne 0 ] && CHOWN=true + +while getopts "Dcm:d:S:o:g:" c $* +do + case $c in + c) + ;; + g) + GROUP=$OPTARG + ;; + o) + OWNER=$OPTARG + ;; + m) + DIRMODE=`expr $OPTARG` + FILEMODE=$DIRMODE + ;; + D) + Dflag=true + ;; + S) + symlink=$OPTARG + Sflag=true + ;; + d) + dir=$DIST_ROOT/$OPTARG + dflag=true + ;; + *) + _usage + ;; + esac +done + +shift `expr $OPTIND - 1` + +status=0 +if $dflag +then + # + # first usage + # + $MKDIR -p $dir + status=$? + if [ $status -eq 0 ] + then + $CHMOD $DIRMODE $dir + status=$? + fi + if [ $status -eq 0 ] + then + $CHOWN $OWNER $GROUP $dir + status=$? + fi + $MANIFEST d $DIRMODE $OWNER $GROUP ${dir#$DIST_ROOT} +elif $Sflag +then + # + # fourth usage (symlink) + # + if [ $# -ne 1 ] + then + _usage + else + target=$DIST_ROOT/$1 + fi + $LN -s -f $symlink $target + status=$? + $MANIFEST l $symlink ${target#$DIST_ROOT} +else + list="" + dir="" + if [ $# -eq 2 ] + then + # + # second usage + # + f=$1 + dir=$DIST_ROOT/$2 + if $Dflag + then + mkdir -p `dirname $dir` + fi + $CP $f $dir + status=$? + if [ $status -eq 0 ] + then + if [ -f $dir/$f ] + then + $CHMOD $FILEMODE $dir/$f + status=$? + if [ $status -eq 0 ] + then + $CHOWN $OWNER $GROUP $dir/$f + status=$? + fi + $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$f ${dir#$DIST_ROOT}/$f + else + $CHMOD $FILEMODE $dir + status=$? + if [ $status -eq 0 ] + then + $CHOWN $OWNER $GROUP $dir + status=$? + fi + $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$dir ${dir#$DIST_ROOT} + fi + fi + else + # + # third usage + # + n=1 + while [ $# -gt 0 ] + do + if [ $# -gt 1 ] + then + list="$list $1" + else + dir=$DIST_ROOT/$1 + fi + shift + done + + # echo DIR=$dir list=\"$list\" + for f in $list + do + $CP $f $dir + status=$? + if [ $status -eq 0 ] + then + $CHMOD $FILEMODE $dir/$f + status=$? + if [ $status -eq 0 ] + then + $CHOWN $OWNER $GROUP $dir/$f + status=$? + fi + $MANIFEST f $FILEMODE $OWNER $GROUP $HERE/$f ${dir#$DIST_ROOT}/$f + fi + [ $status -ne 0 ] && break + done + fi +fi + +exit $status diff --git a/libhandle/Makefile b/libhandle/Makefile index 1a69d335b..1566af629 100644 --- a/libhandle/Makefile +++ b/libhandle/Makefile @@ -33,13 +33,29 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs -STATICLIBTARGET = libhandle.a +LIB = libhandle +STATICLIBTARGET = $(LIB).a +#MAJOR = 1 +#MINOR = 0 +#LIBTARGET = $(LIB).so.$(MAJOR) + CFILES = handle.c jdm.c +LCFLAGS = -D_REENTRANT -default: $(STATICLIBTARGET) +default: $(STATICLIBTARGET) include $(BUILDRULES) install: default - #$(INSTALL) -m 755 -d $(XFS_CMDS_LIB_DIR) - #$(INSTALL) -m 755 $(STATICLIBTARGET) $(XFS_CMDS_LIB_DIR) + +#MODE = $(shell test -f /etc/debian_version && echo 644 || echo 755) +#install: default +# $(INSTALL) -m 755 -d $(PKG_SLIB_DIR) +# $(INSTALL) -m $(MODE) $(LIBTARGET) $(PKG_SLIB_DIR)/$(LIBTARGET).$(MINOR) +# $(INSTALL) -S $(LIBTARGET).$(MINOR) $(PKG_SLIB_DIR)/$(LIBTARGET) +#install-dev: default +# $(INSTALL) -S $(PKG_SLIB_DIR)/$(LIBTARGET) $(PKG_LIB_DIR)/$(LIB).so + +install-dev: default + $(INSTALL) -m 755 -d $(PKG_LIB_DIR) + $(INSTALL) -m 644 $(STATICLIBTARGET) $(PKG_LIB_DIR) diff --git a/libxfs/Makefile b/libxfs/Makefile index ce45344de..2f833d925 100644 --- a/libxfs/Makefile +++ b/libxfs/Makefile @@ -33,7 +33,9 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs -STATICLIBTARGET = libxfs.a +LIB = libxfs +STATICLIBTARGET = $(LIB).a + HFILES = xfs.h CFILES = arch.c init.c logitem.c rdwr.c trans.c util.c \ xfs_bit.c xfs_rtbit.c xfs_alloc.c xfs_ialloc.c xfs_rtalloc.c \ @@ -43,9 +45,6 @@ CFILES = arch.c init.c logitem.c rdwr.c trans.c util.c \ xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \ xfs_mount.c xfs_trans.c -# xfs_repair is braindead, don't try linking it with a debug libxfs yet. -DEBUG = -DNDEBUG - # # Tracing flags: # -DIO_DEBUG reads and writes of buffers @@ -55,8 +54,29 @@ DEBUG = -DNDEBUG # LCFLAGS += -Wno-unknown-pragmas -Wno-unused -Wno-uninitialized -I. -default: $(STATICLIBTARGET) +# don't try linking xfs_repair with a debug libxfs. +DEBUG = -DNDEBUG + +default: $(STATICLIBTARGET) include $(BUILDRULES) install: default + +install-dev: default + $(INSTALL) -m 755 -d $(PKG_LIB_DIR) + $(INSTALL) -m 644 $(STATICLIBTARGET) $(PKG_LIB_DIR) + +#MODE = $(shell test -f /etc/debian_version && echo 644 || echo 755) +#MAJOR = 1 +#MINOR = 0 +#LIBTARGET = $(LIB).so.$(MAJOR) +#LDIRT = $(LIB).so +#default: +# [ -L $(LIB).so ] || $(LN_S) $(LIBTARGET) $(LIB).so +#install: default +# $(INSTALL) -m 755 -d $(PKG_SLIB_DIR) +# $(INSTALL) -m $(MODE) $(LIBTARGET) $(PKG_SLIB_DIR)/$(LIBTARGET).$(MINOR) +# #$(INSTALL) -S $(LIBTARGET).$(MINOR) $(PKG_SLIB_DIR)/$(LIBTARGET) +#install-dev: default +# $(INSTALL) -S $(PKG_SLIB_DIR)/$(LIBTARGET) $(PKG_LIB_DIR)/$(LIB).so diff --git a/libxfs/xfs.h b/libxfs/xfs.h index d702a385e..45f61d55b 100644 --- a/libxfs/xfs.h +++ b/libxfs/xfs.h @@ -60,7 +60,6 @@ #include #include #include -#include /* * Map XFS kernel routine names to libxfs.h names @@ -231,6 +230,7 @@ typedef __uint32_t inst_t; /* an instruction */ typedef enum { B_FALSE, B_TRUE } boolean_t; typedef struct { dev_t dev; } buftarg_t; #define STATIC +#define ATTR_ROOT 1 /* use attrs in root namespace */ #define ENOATTR 1009 /* Attribute not found */ #define EFSCORRUPTED 1010 /* Filesystem is corrupted */ #define ktrace_t void diff --git a/logprint/Makefile b/logprint/Makefile index 4b878e297..ff7bc5e92 100644 --- a/logprint/Makefile +++ b/logprint/Makefile @@ -34,17 +34,18 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs CMDTARGET = xfs_logprint -CMDDEPS = $(LIBXFS) CFILES = log_print_trans.c log_print_all.c log_misc.c logprint.c \ xfs_log_recover.c HFILES = logprint.h LLDLIBS = $(LIBXFS) $(LIBUUID) +LLDFLAGS = -L$(TOPDIR)/libxfs default: $(CMDTARGET) include $(BUILDRULES) install: default - $(INSTALL) -m 755 -d $(XFS_CMDS_BIN_DIR) - $(INSTALL) -m 755 $(CMDTARGET) $(XFS_CMDS_BIN_DIR) + $(INSTALL) -m 755 -d $(PKG_BIN_DIR) + $(INSTALL) -m 755 $(CMDTARGET) $(PKG_BIN_DIR) +install-dev: diff --git a/man/Makefile b/man/Makefile index 139d5ae85..0793e5c1a 100644 --- a/man/Makefile +++ b/man/Makefile @@ -33,9 +33,9 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs -SUBDIRS = man1 man2 man3 man5 man8 +SUBDIRS = man3 man5 man8 -default install : $(SUBDIRS) +default install install-dev : $(SUBDIRS) $(SUBDIRS_MAKERULE) include $(BUILDRULES) diff --git a/man/man3/Makefile b/man/man3/Makefile new file mode 100644 index 000000000..a395fff6f --- /dev/null +++ b/man/man3/Makefile @@ -0,0 +1,50 @@ +# +# Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Further, this software is distributed without any warranty that it is +# free of the rightful claim of any third person regarding infringement +# or the like. Any license provided herein, whether implied or +# otherwise, applies only to this software file. Patent licenses, if +# any, provided herein do not apply to combinations of this program with +# other software, or any other product whatsoever. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write the Free Software Foundation, Inc., 59 +# Temple Place - Suite 330, Boston MA 02111-1307, USA. +# +# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, +# Mountain View, CA 94043, or: +# +# http://www.sgi.com +# +# For further information regarding this notice, see: +# +# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ +# + +TOPDIR = ../.. +include $(TOPDIR)/include/builddefs + +MAN_SECTION = 3 + +MAN_PAGES = $(shell echo *.$(MAN_SECTION)) +MAN_DEST = $(PKG_MAN_DIR)/man$(MAN_SECTION) +LSRCFILES = $(MAN_PAGES) + +default : $(MAN_PAGES) + +include $(BUILDRULES) + +install : + +install-dev : default + $(INSTALL) -m 755 -d $(MAN_DEST) + $(INSTALL_MAN) diff --git a/man/man3/handle.3 b/man/man3/handle.3 new file mode 100644 index 000000000..acf136f49 --- /dev/null +++ b/man/man3/handle.3 @@ -0,0 +1,196 @@ +.TH HANDLE 3 +.SH NAME +path_to_handle, path_to_fshandle, fd_to_handle, handle_to_fshandle, open_by_handle, readlink_by_handle, attr_multi_by_handle, attr_list_by_handle, fssetdm_by_handle, free_handle \- file handle operations +.SH C SYNOPSIS +.nf +.B #include +.B #include +.PP +.B "int path_to_handle (char *path, void **hanp," +.B " size_t *hlen);" +.PP +.B "int path_to_fshandle (char *path, void **hanp," +.B " size_t *hlen);" +.PP +.B "int fd_to_handle (int fd, void **hanp, size_t *hlen); +.PP +.B "int handle_to_fshandle (void *hanp, size_t hlen," +.B " void **fshanp, size_t *fshlen); +.PP +.B "int open_by_handle (void *hanp, size_t hlen," +.B " int oflag);" +.PP +.B "int readlink_by_handle (void *hanp, size_t hlen," +.B " void *buf, size_t bs); +.PP +.B "int attr_multi_by_handle (void *hanp, size_t hlen," +.B " void *buf, int rtrvcnt," +.B " int flags);" +.PP +.B "int attr_list_by_handle (void *hanp, size_t hlen," +.B " char *buf, size_t bufsiz," +.B " int flags," +.B " struct attrlist_cursor *cursor);" +.PP +.B "int fssetdm_by_handle (void *hanp, size_t hlen," +.B " struct fsdmidata *fssetdm);" +.PP +.B "void free_handle (void *hanp, size_t hlen); +.Op +.SH DESCRIPTION +.PP +These functions provide a way to perform certain +filesystem operations without using a file descriptor +to access filesystem objects. +They are intended for use by a limited set of system utilities +such as backup programs. +They are supported only by the XFS filesystem. +Link with the +.I libhandle +library to access these functions. +.sp +A +.I handle +uniquely identifies a filesystem object +or an entire filesystem. +There is one and only one +handle per filesystem or filesystem object. +Handles consist of some number of bytes. +The size of a handle +(i.e. the number of bytes comprising it) +varies by the type of handle +and may vary for different objects +of the same type. +The content of a handle is opaque to applications. +Since handle sizes vary +and their contents are opaque, +handles are described by two quantities, +a pointer and a size. +The size indicates the number of bytes +in the handle which are pointed to by the pointer. +.P +The \f2path_to_handle\f1() function +returns the handle for the object given by the +.I path +argument. +If the final component of the path name is a symbolic link, +the handle returned is that of the link itself. +.P +The \f2path_to_fshandle\f1() function +returns the handle for the filesystem +in which the object given by the +.I path +argument resides. +.P +The \f2fd_to_handle\f1() function +returns the handle for the object referenced by the +.I fd +argument, +which must be a valid file descriptor. +.P +The \f2handle_to_fshandle\f1() function +returns the handle for the filesystem +in which the object referenced by the +handle given by the +.I hanp +and +.I hlen +arguments resides. +.P +The \f2open_by_handle\f1() function +opens a file descriptor for the object referenced +by a handle. +It is analogous and identical to +.I open(2) +with the exception of accepting handles instead of path names. +.P +The \f2readlink_by_handle\f1() function +returns the contents of a symbolic link +referenced by a handle. +.P +The \f2attr_multi_by_handle\f1() function +manipulates multiple user attributes on a +filesystem object. +It is analogous and identical to +.I attr_multif(2) +except that a handle is specified instead of a file descriptor. +.P +The \f2attr_list_by_handle\f1() function returns +the names of the user attributes of a filesystem object. +It is analogous and identical to +.I attr_listf(2) +except that a handle is specified instead of a file descriptor. +.P +The \f2fssetdm_by_handle\f1() function sets the +di_dmevmask and di_dmstate fields in an XFS on-disk inode. +It is analogous to the \f2F_FSSETDM\f1 subfunction of +.I fcntl(2) +except that a handle is specified instead of a file descriptor. +.P +The \f2free_handle\f1() function +frees the storage allocated for handles +returned by the following functions: +\f2path_to_handle\f1(), +\f2path_to_fshandle\f1(), +\f2fd_to_handle\f1(), +and +\f2handle_to_fshandle\f1(). +.SH "SEE ALSO" +open(2), +readlink(2), +attr_multi(2), +attr_list(2), +fcntl(2). +.SH "DIAGNOSTICS" +.PP +The function +\f2free_handle\f1() +has no failure indication. +The other functions +return the value 0 to the calling process +if they succeed; +otherwise, they return the value -1 and set +.I errno +to indicate the error: +.sp +.TP 15 +.SM +\%[EACCES] +Search permission was denied for a component of +.IR path . +.TP 15 +.SM +\%[EBADF] +.I fd +is not a valid and open file descriptor. +.TP 15 +.SM +\%[EFAULT] +An argument pointed to an invalid address. +.TP 15 +.SM +\%[EINVAL] +.I path +is in a filesystem that does not support these functions. +.TP 15 +.SM +\%[ELOOP] +Too many symbolic links were encountered in translating the path name. +.TP 15 +.SM +\%[ENAMETOOLONG] +A component of +.I path +or the entire length of +.I path +exceeds filesystem limits. +.TP 15 +.SM +\%[ENOENT] +A component of +.I path +does not exist. +.TP 15 +.SM +\%[EPERM] +The caller does not have sufficient privileges. diff --git a/man/man5/Makefile b/man/man5/Makefile index 8602606f0..e603a9359 100644 --- a/man/man5/Makefile +++ b/man/man5/Makefile @@ -36,10 +36,9 @@ include $(TOPDIR)/include/builddefs MAN_SECTION = 5 MAN_PAGES = $(shell echo *.$(MAN_SECTION)) -MAN_DEST = $(XFS_CMDS_MAN_DIR)/man$(MAN_SECTION) +MAN_DEST = $(PKG_MAN_DIR)/man$(MAN_SECTION) LSRCFILES = $(MAN_PAGES) - default : $(MAN_PAGES) include $(BUILDRULES) @@ -47,3 +46,4 @@ include $(BUILDRULES) install : default $(INSTALL) -m 755 -d $(MAN_DEST) $(INSTALL_MAN) +install-dev : diff --git a/man/man8/Makefile b/man/man8/Makefile index 9ccd9c446..90008706e 100644 --- a/man/man8/Makefile +++ b/man/man8/Makefile @@ -37,7 +37,7 @@ include $(TOPDIR)/include/builddefs MAN_SECTION = 8 MAN_PAGES = $(shell echo *.$(MAN_SECTION)) -MAN_DEST = $(XFS_CMDS_MAN_DIR)/man$(MAN_SECTION) +MAN_DEST = $(PKG_MAN_DIR)/man$(MAN_SECTION) LSRCFILES = $(MAN_PAGES) default : $(MAN_PAGES) @@ -47,3 +47,4 @@ include $(BUILDRULES) install : default $(INSTALL) -m 755 -d $(MAN_DEST) $(INSTALL_MAN) +install-dev : diff --git a/mkfile/Makefile b/mkfile/Makefile index fc274e821..c28d71b69 100644 --- a/mkfile/Makefile +++ b/mkfile/Makefile @@ -41,5 +41,6 @@ default: $(CMDTARGET) include $(BUILDRULES) install: default - $(INSTALL) -m 755 -d $(XFS_CMDS_BIN_DIR) - $(INSTALL) -m 755 $(CMDTARGET) $(XFS_CMDS_BIN_DIR) + $(INSTALL) -m 755 -d $(PKG_BIN_DIR) + $(INSTALL) -m 755 $(CMDTARGET) $(PKG_BIN_DIR) +install-dev: diff --git a/mkfs/Makefile b/mkfs/Makefile index d6f813d13..97b102603 100644 --- a/mkfs/Makefile +++ b/mkfs/Makefile @@ -34,12 +34,14 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs CMDTARGET = mkfs.xfs -CMDDEPS = $(LIBXFS) MAXTRRES = maxtrres CFILES = xfs_mkfs.c mountinfo.c proto.c HFILES = xfs_mkfs.h mountinfo.h proto.h volume.h +LCFLAGS = $(USELVM) LLDLIBS = $(LIBXFS) $(LIBUUID) $(LIBLVM) +LLDFLAGS = -L$(TOPDIR)/libxfs + MAXTRLIBS = $(LIBXFS) $(LIBUUID) LSRCFILES = $(MAXTRRES).c LDIRT = $(MAXTRRES) $(MAXTRRES).h @@ -48,12 +50,14 @@ default: $(MAXTRRES).h $(CMDTARGET) include $(BUILDRULES) -install: default - $(INSTALL) -m 755 -d $(XFS_CMDS_SBIN_DIR) - $(INSTALL) -m 755 $(CMDTARGET) $(XFS_CMDS_SBIN_DIR) - $(MAXTRRES): $(CCF) $@.c -o $@ $(LDFLAGS) $(MAXTRLIBS) $(MAXTRRES).h: $(MAXTRRES) + LD_LIBRARY_PATH=../libxfs; export LD_LIBRARY_PATH; \ ./$(MAXTRRES) > $@ || ( rm -f $@ && exit 1 ) + +install: default + $(INSTALL) -m 755 -d $(PKG_SBIN_DIR) + $(INSTALL) -m 755 $(CMDTARGET) $(PKG_SBIN_DIR) +install-dev: diff --git a/repair/Makefile b/repair/Makefile index 96f81d7c4..876f796c2 100644 --- a/repair/Makefile +++ b/repair/Makefile @@ -34,7 +34,6 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs CMDTARGET = xfs_repair -CMDDEPS = $(LIBXFS) HFILES = agheader.h attr_repair.h avl.h avl64.h bmap.h dinode.h dir.h \ dir2.h dir_stack.h err_protos.h globals.h incore.h protos.h rt.h \ @@ -47,6 +46,7 @@ CFILES = agheader.c attr_repair.c avl.c avl64.c bmap.c dino_chunks.c \ scan.c versions.c xfs_repair.c LLDLIBS = $(LIBXFS) $(LIBUUID) +LLDFLAGS = -L$(TOPDIR)/libxfs default: $(CMDTARGET) @@ -68,5 +68,6 @@ include $(BUILDRULES) CFLAGS += -DAVL_USER_MODE -DAVL_FUTURE_ENHANCEMENTS install: default - $(INSTALL) -m 755 -d $(XFS_CMDS_SBIN_DIR) - $(INSTALL) -m 755 $(CMDTARGET) $(XFS_CMDS_SBIN_DIR) + $(INSTALL) -m 755 -d $(PKG_SBIN_DIR) + $(INSTALL) -m 755 $(CMDTARGET) $(PKG_SBIN_DIR) +install-dev: diff --git a/repair/attr_repair.c b/repair/attr_repair.c index d64230b09..3fd25286e 100644 --- a/repair/attr_repair.c +++ b/repair/attr_repair.c @@ -32,10 +32,10 @@ #include #include -#include #include "globals.h" #include "err_protos.h" +#include "attr_repair.h" #include "dir.h" #include "dinode.h" #include "bmap.h" diff --git a/repair/attr_repair.h b/repair/attr_repair.h index 61d3f212a..0bce68513 100644 --- a/repair/attr_repair.h +++ b/repair/attr_repair.h @@ -35,6 +35,39 @@ struct blkmap; +#define SGI_ACL_FILE "SGI_ACL_FILE" +#define SGI_ACL_DEFAULT "SGI_ACL_DEFAULT" +#define SGI_ACL_FILE_SIZE 12 +#define SGI_ACL_DEFAULT_SIZE 15 + +#define ACL_MAX_ENTRIES 25 +#define ACL_USER_OBJ 0x01 /* owner */ +#define ACL_USER 0x02 /* additional users */ +#define ACL_GROUP_OBJ 0x04 /* group */ +#define ACL_GROUP 0x08 /* additional groups */ +#define ACL_MASK 0x10 /* mask entry */ +#define ACL_OTHER_OBJ 0x20 /* other entry */ + +typedef ushort acl_perm_t; +typedef int acl_type_t; +typedef int acl_tag_t; + +/* + * On-disk representation of an ACL. + */ +struct acl_entry { + acl_tag_t ae_tag; + uid_t ae_id; + acl_perm_t ae_perm; +}; + +typedef struct acl_entry * acl_entry_t; + +struct acl { + int acl_cnt; /* Number of entries */ + struct acl_entry acl_entry[ACL_MAX_ENTRIES]; +}; + int process_attributes( xfs_mount_t *mp, @@ -43,5 +76,4 @@ process_attributes( struct blkmap *blkmap, int *repair); - #endif /* _XR_ATTRREPAIR_H */ -- 2.47.2