From: Nathan Scott Date: Wed, 19 Sep 2001 05:03:59 +0000 (+0000) Subject: incorporate Martin's changes to rework the LVM support in mkfs. X-Git-Tag: v2.0.0~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c12c979e8a0a2726da21af4ecb6b1de64b02edbb;p=thirdparty%2Fxfsprogs-dev.git incorporate Martin's changes to rework the LVM support in mkfs. --- diff --git a/VERSION b/VERSION index 9a8caf3c1..5730efafd 100644 --- a/VERSION +++ b/VERSION @@ -3,5 +3,5 @@ # PKG_MAJOR=1 PKG_MINOR=3 -PKG_REVISION=7 +PKG_REVISION=8 PKG_BUILD=0 diff --git a/configure.in b/configure.in index ecf1cbec7..868043049 100644 --- a/configure.in +++ b/configure.in @@ -148,25 +148,6 @@ AC_ARG_ENABLE(shared-uuid, libuuid="/usr/lib/libuuid.a") AC_SUBST(libuuid) -dnl Note - the plan is for liblvm to go away soon... -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( diff --git a/debian/Makefile b/debian/Makefile index 54b049b20..373bb980a 100644 --- a/debian/Makefile +++ b/debian/Makefile @@ -38,7 +38,7 @@ DEV_DOC_DIR = $(PKG_DOC_DIR)/../xfslibs-dev BOOT_DOC_DIR = $(PKG_DOC_DIR)/../xfsprogs-bf BOOT_MAN_DIR = $(PKG_MAN_DIR)/man8 BOOT_MKFS_BIN = $(TOPDIR)/mkfs/mkfs.xfs-xfsprogs-bf -BOOT_MKFS_MAN = $(TOPDIR)/man/man8/mkfs.xfs.8.gz +BOOT_MKFS_MAN = $(TOPDIR)/man/man8/mkfs.xfs.8 default: @@ -67,5 +67,5 @@ ifeq ($(PKG_DISTRIBUTION), debian) $(INSTALL) -m 644 copyright $(BOOT_DOC_DIR) $(INSTALL) -m 644 changelog $(BOOT_DOC_DIR)/changelog.Debian $(INSTALL) -m 755 $(BOOT_MKFS_BIN) $(PKG_SBIN_DIR)/mkfs.xfs - $(INSTALL) -m 644 $(BOOT_MKFS_MAN) $(BOOT_MAN_DIR)/mkfs.xfs.8.gz + $(INSTALL) -m 644 $(BOOT_MKFS_MAN) $(BOOT_MAN_DIR)/mkfs.xfs.8 endif diff --git a/debian/changelog b/debian/changelog index 1f4351b9c..63e73d982 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +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 diff --git a/doc/CHANGES b/doc/CHANGES index ca20b4695..64b436e54 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,3 +1,10 @@ +xfsprogs-1.3.8 (19 September 2001) + - rewrote the LVM support used by mkfs.xfs to call external + lvdisplay program to get volume geometry (mkp@mkp.net) + - fix bug in LVM driver wrapper where it would not have been + used at all, ever (since 1.3.0), due to idiot programmer + error (*blush*) -- also thanks to mkp for the bug fix + xfsprogs-1.3.7 (10 September 2001) - enable preallocation in xfs_mkfile [missed during port?] - fix xfs_db core dump when reporting freespace diff --git a/include/builddefs.in b/include/builddefs.in index 6e6f7d1f8..eac435946 100644 --- a/include/builddefs.in +++ b/include/builddefs.in @@ -44,8 +44,6 @@ LIBXFS = $(TOPDIR)/libxfs/libxfs.la LIBDISK = $(TOPDIR)/libdisk/libdisk.la LIBHANDLE = $(TOPDIR)/libhandle/libhandle.la -LIBLVM = @liblvm@ -USELVM = -DHAVE_LIBLVM=@have_liblvm@ DK_INC_DIR = @dk_inc_dir@ PKG_NAME = @pkg_name@ diff --git a/libdisk/Makefile b/libdisk/Makefile index 0a4ee8c2b..3617278e8 100644 --- a/libdisk/Makefile +++ b/libdisk/Makefile @@ -38,9 +38,8 @@ LT_CURRENT = 0 LT_REVISION = 0 LT_AGE = 0 -LCFLAGS = $(USELVM) CFILES = fstype.c pttype.c md.c xvm.c lvm.c drivers.c mountinfo.c -HFILES = fstype.h pttype.h md.h xvm.h lvm.h lvm_user.h liblvm.h +HFILES = fstype.h pttype.h md.h xvm.h default: $(LTLIBRARY) diff --git a/libdisk/drivers.c b/libdisk/drivers.c index 6e56c9c66..e14ae72c3 100644 --- a/libdisk/drivers.c +++ b/libdisk/drivers.c @@ -54,11 +54,11 @@ get_subvol_stripe_wrapper(char *dev, sv_type_t type, int *sunit, int *swidth) exit(1); } - if ( md_get_subvol_stripe(dev, type, sunit, swidth, &sb)); + if ( md_get_subvol_stripe(dev, type, sunit, swidth, &sb)) return; - if (lvm_get_subvol_stripe(dev, type, sunit, swidth, &sb)); + if (lvm_get_subvol_stripe(dev, type, sunit, swidth, &sb)) return; - if (xvm_get_subvol_stripe(dev, type, sunit, swidth, &sb)); + if (xvm_get_subvol_stripe(dev, type, sunit, swidth, &sb)) return; /* ... add new device drivers here */ } diff --git a/libdisk/lvm.c b/libdisk/lvm.c index f419000a5..590b03086 100644 --- a/libdisk/lvm.c +++ b/libdisk/lvm.c @@ -32,16 +32,14 @@ #include #include +#include +#include +#include #include +#include +#include #include -#include "lvm_user.h" - -#if HAVE_LIBLVM - char *cmd; /* Not used. liblvm is broken */ - int opt_d; /* Same thing */ -#endif - int mnt_is_lvm_subvol(dev_t dev) { @@ -58,45 +56,75 @@ lvm_get_subvol_stripe( int *swidth, struct stat64 *sb) { -#if HAVE_LIBLVM - if (mnt_is_lvm_subvol(sb->st_rdev)) { - lv_t *lv; - char *vgname; - - /* Find volume group */ - if (! (vgname = vg_name_of_lv(dfile))) { - fprintf(stderr, "Can't find volume group for %s\n", - dfile); - exit(1); - } - - /* Logical volume */ - if (! lvm_tab_lv_check_exist(dfile)) { - fprintf(stderr, "Logical volume %s doesn't exist!\n", - dfile); - exit(1); - } - - /* Get status */ - if (lv_status_byname(vgname, dfile, &lv) < 0 || lv == NULL) { - fprintf(stderr, "Could not get status info from %s\n", - dfile); - exit(1); - } - - /* Check that data is consistent */ - if (lv_check_consistency(lv) < 0) { - fprintf(stderr, "Logical volume %s is inconsistent\n", - dfile); - exit(1); - } - - /* Update sizes */ - *sunit = lv->lv_stripesize; - *swidth = lv->lv_stripes * lv->lv_stripesize; - - return 1; + int lvpipe[2], stripes = 0, stripesize = 0; + char *largv[3], buf[1024]; + FILE *stream; + + if (!mnt_is_lvm_subvol(sb->st_rdev)) + return 0; + + /* Quest for lvdisplay */ + if (!access("/usr/local/sbin/lvdisplay", R_OK|X_OK)) + largv[0] = "/usr/local/sbin/lvdisplay"; + else if (!access("/usr/sbin/lvdisplay", R_OK|X_OK)) + largv[0] = "/usr/sbin/lvdisplay"; + else if (!access("/sbin/lvdisplay", R_OK|X_OK)) + largv[0] = "/sbin/lvdisplay"; + else { + fprintf(stderr, + "Warning - LVM device, but no lvdisplay(8) found\n"); + return 0; } -#endif /* HAVE_LIBLVM */ - return 0; + + largv[1] = dfile; + largv[2] = NULL; + + /* Open pipe */ + if (pipe(lvpipe) < 0) { + fprintf(stderr, "Could not open pipe\n"); + exit(1); + } + + /* Spawn lvdisplay */ + switch (fork()) { + case 0: + /* Plumbing */ + close(lvpipe[0]); + + if (lvpipe[1] != STDOUT_FILENO) + dup2(lvpipe[1], STDOUT_FILENO); + + execv(largv[0], largv); + + fprintf(stderr, "\nFailed to execute %s\n", largv[0]); + exit(1); + + case -1: + fprintf(stderr, "Failed forking lvdisplay process\n"); + exit(1); + + default: + break; + } + + close(lvpipe[1]); + stream = fdopen(lvpipe[0], "r"); + + /* Scan stream for keywords */ + while (fgets(buf, 1023, stream) != NULL) { + + if (!strncmp(buf, "Stripes", 7)) + sscanf(buf, "Stripes %d", &stripes); + + if (!strncmp(buf, "Stripe size", 11)) + sscanf(buf, "Stripe size (KByte) %d", &stripesize); + } + + /* Update sizes */ + *sunit = stripesize << 1; + *swidth = (stripes * stripesize) << 1; + + fclose(stream); + + return 1; } diff --git a/mkfs/Makefile b/mkfs/Makefile index aecbd8374..5b50ff068 100644 --- a/mkfs/Makefile +++ b/mkfs/Makefile @@ -40,10 +40,7 @@ FSTYP = fstyp HFILES = xfs_mkfs.h proto.h CFILES = $(HFILES:.h=.c) -# Note: ordering for libdisk and liblvm is important - we must -# now present liblvm to ld twice :( -> libdisk works around the -# liblvm unresolved symbol problem, but also calls into liblvm. -LLDLIBS = $(LIBXFS) $(LIBUUID) $(LIBLVM) $(LIBDISK) $(LIBLVM) +LLDLIBS = $(LIBXFS) $(LIBUUID) $(LIBDISK) LTDEPENDENCIES = $(LIBXFS) $(LIBDISK) LLDFLAGS = -static