]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Update libdisk to extract stripe info from device mapper, for mkfs.
authorNathan Scott <nathans@sgi.com>
Fri, 30 Apr 2004 03:50:20 +0000 (03:50 +0000)
committerNathan Scott <nathans@sgi.com>
Fri, 30 Apr 2004 03:50:20 +0000 (03:50 +0000)
VERSION
debian/changelog
doc/CHANGES
libdisk/Makefile
libdisk/dm.c [new file with mode: 0644]
libdisk/drivers.c
libdisk/drivers.h
libdisk/lvm.c

diff --git a/VERSION b/VERSION
index bff762b5eea8f51842216eb40ff5a29020bc517c..80f3574507800920087da9043ba5b5480db24aef 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -3,5 +3,5 @@
 #
 PKG_MAJOR=2
 PKG_MINOR=6
-PKG_REVISION=11
+PKG_REVISION=12
 PKG_BUILD=1
index 32fe622501d97b604f0394b99b746e3ccc0e019f..ede67c8b5d5acf2ad90d97110dab5be78adc6e51 100644 (file)
@@ -1,3 +1,9 @@
+xfsprogs (2.6.12-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Nathan Scott <nathans@debian.org>  Fri, 30 Apr 2004 05:13:20 +1000
+
 xfsprogs (2.6.11-1) unstable; urgency=low
 
   * New upstream release.
index 0bb7a36c70484d22602067a348d5709848b57442..ca91e93dbc64d35fc2acbd7a6c55b9e0c0b5823c 100644 (file)
@@ -1,3 +1,11 @@
+xfsprogs-2.6.12 (30 April 2004)
+       - Extract stripe unit/width from device mapper devices
+         (added libdisk infrastructure, used by mkfs.xfs).
+       - Fix rounding in xfs_io(8) bytes read/written output.
+       - Sync up user/kernel source in libxfs and headers.
+       - Fix compiler warnings on 64 bit platforms.
+       - Update i18n message catalog.
+
 xfsprogs-2.6.11 (15 April 2004)
        - Fix file descriptor leak in path_to_fshandle. A file
          was being opened but never closed, regardless of
index 9be1de3a89e76db080fd37748b61922a98885a49..6f3d705ee135dc0c5ba7828a96eb58c75b558579 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
+# Copyright (c) 2000-2001,2004 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
@@ -39,12 +39,14 @@ LT_REVISION = 0
 LT_AGE = 0
 
 CFILES = drivers.c fstype.c pttype.c
+HFILES = drivers.h fstype.h pttype.h md.h xvm.h evms.h
+LINUX_DRIVERS = dm.c md.c xvm.c evms.c lvm.c
+
 ifeq ($(PKG_PLATFORM),linux)
-CFILES += md.c xvm.c evms.c lvm.c
+CFILES += $(LINUX_DRIVERS)
 else
-LSRCFILES = md.c xvm.c evms.c lvm.c
+LSRCFILES = $(LINUX_DRIVERS)
 endif
-HFILES = drivers.h fstype.h pttype.h md.h xvm.h evms.h
 
 default: $(LTLIBRARY)
 
diff --git a/libdisk/dm.c b/libdisk/dm.c
new file mode 100644 (file)
index 0000000..220bb36
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2004 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include "drivers.h"
+
+int
+mnt_is_dm_subvol(
+       dev_t           dev)
+{
+       return get_driver_block_major("device-mapper", major(dev));
+}
+
+int
+dm_get_subvol_stripe(
+       char            *dfile,
+       sv_type_t       type,
+       int             *sunit,
+       int             *swidth,
+       struct stat64   *sb)
+{
+       int             count, stripes = 0, stripesize = 0;
+       int             dmpipe[2];
+       char            *dpath, *largv[4], tmppath[PATH_MAX];
+       FILE            *stream;
+       long long       offset, size;
+       static char     *command = "table";     /* dmsetup table /dev/xxx */
+
+       if (!mnt_is_dm_subvol(sb->st_rdev))
+               return 0;
+
+       /* Quest for dmsetup */
+       if (!access("/usr/local/sbin/dmsetup", R_OK|X_OK))
+               largv[0] = "/usr/local/sbin/dmsetup";
+       else if (!access("/sbin/dmsetup", R_OK|X_OK))
+               largv[0] = "/sbin/dmsetup";
+       else {
+               fprintf(stderr,
+       _("Warning - device mapper device, but no dmsetup(8) found\n"));
+               return 0;
+       }
+
+       if (!(dpath = realpath(dfile, tmppath))) {
+               fprintf(stderr,
+       _("Warning - device mapper device, but cannot resolve path %s: %s\n"),
+                       dfile, strerror(errno));
+               return 0;
+       }
+
+       largv[1] = command;
+       largv[2] = dpath;
+       largv[3] = NULL;
+
+       /* Open pipe */
+       if (pipe(dmpipe) < 0) {
+               fprintf(stderr, _("Could not open pipe\n"));
+               exit(1);
+       }
+
+       /* Spawn dmsetup */
+       switch (fork()) {
+       case 0:
+               /* Plumbing */
+               close(dmpipe[0]);
+
+               if (dmpipe[1] != STDOUT_FILENO)
+                       dup2(dmpipe[1], STDOUT_FILENO);
+
+               execv(largv[0], largv);
+
+               fprintf(stderr, _("Failed to execute %s\n"), largv[0]);
+               exit(1);
+
+       case -1:
+               fprintf(stderr, _("Failed forking dmsetup process\n"));
+               exit(1);
+
+       default:
+               break;
+       }
+
+       close(dmpipe[1]);
+       stream = fdopen(dmpipe[0], "r");
+       count = fscanf(stream, "%lld %lld striped %d %d ",
+                       &offset, &size, &stripes, &stripesize);
+       fclose(stream);
+       if (count != 4)
+               return 0;
+
+       /* Update sizes */
+       *sunit = stripesize;
+       *swidth = (stripes * stripesize);
+       return 1;
+}
index 9bfb75174f1f52d8a61c486bc7f5157aa22e55a0..4cbb9344d773013822eae8b9ab9899ee805b38a5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2004 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
@@ -46,6 +46,8 @@ get_subvol_stripe_wrapper(char *dev, sv_type_t type, int *sunit, int *swidth)
                exit(1);
        }
 
+       if (  dm_get_subvol_stripe(dev, type, sunit, swidth, &sb))
+               return;
        if (  md_get_subvol_stripe(dev, type, sunit, swidth, &sb))
                return;
        if ( lvm_get_subvol_stripe(dev, type, sunit, swidth, &sb))
index cd729cb2e2774e44ecfa3a087b9c9cd916940fe9..c712064bcf4984de0f19444a4b09216f5219a256 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2004 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
  */
 
 #ifdef __linux__
+extern int   dm_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
 extern int   md_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
 extern int  lvm_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
 extern int  xvm_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
 extern int evms_get_subvol_stripe(char*, sv_type_t, int*, int*, struct stat64*);
 #else
 #define stat64 stat
+#define   dm_get_subvol_stripe(dev, type, a, b, stat)  (-1)
 #define   md_get_subvol_stripe(dev, type, a, b, stat)  (-1)
 #define  lvm_get_subvol_stripe(dev, type, a, b, stat)  (-1)
 #define  xvm_get_subvol_stripe(dev, type, a, b, stat)  (-1)
index ad5e6c1045e6d48ee230f820fd019ac932f9232e..327808fff92ab7b3f1baa01803f3f96ed44f759a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2004 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
@@ -70,19 +70,11 @@ lvm_get_subvol_stripe(
                largv[0] = "/sbin/lvdisplay";
        else {
                fprintf(stderr,
-                       "Warning - LVM device, but no lvdisplay(8) found\n");
+                       _("Warning - LVM device, but no lvdisplay(8) found\n"));
                return 0;
        }
 
-       /* lvm tools want the full, real path to a logical volume.
-        * (lvm doesn't really open the file, it just wants a
-        * string that happens to look like a path :/ )
-        */
-       if (dfile[0] != '/') {
-               getcwd(tmppath, MAXPATHLEN);
-               strcat(tmppath, "/");
-               dfile = strcat(tmppath, dfile);
-       }
+       /* realpath gives an absolute pathname */
        largv[1] = realpath(dfile, tmppath);
        largv[2] = NULL;