]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Update libdisk driver detection code to work for devices with multiple majors
authorNathan Scott <nathans@sgi.com>
Mon, 23 Jun 2003 01:22:03 +0000 (01:22 +0000)
committerNathan Scott <nathans@sgi.com>
Mon, 23 Jun 2003 01:22:03 +0000 (01:22 +0000)
VERSION
debian/changelog
doc/CHANGES
include/volume.h
libdisk/drivers.c
libdisk/evms.c
libdisk/lvm.c
libdisk/md.c
libdisk/xvm.c

diff --git a/VERSION b/VERSION
index 8dff1c94b0a7d32b2b86c19e55138451c0f4293a..370cc02c4efd211c190a7d8cfed9d7b4c17dba09 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -3,5 +3,5 @@
 #
 PKG_MAJOR=2
 PKG_MINOR=5
-PKG_REVISION=0
+PKG_REVISION=1
 PKG_BUILD=0
index 9c1bc8479084fd874c329f0cdc1b8d705082dddb..92e56124deab27dd7465c77f2607a884ef4f1173 100644 (file)
@@ -1,11 +1,11 @@
-xfsprogs (2.5.0-1) unstable; urgency=low
+xfsprogs (2.5.1-1) unstable; urgency=low
 
   * New upstream release
   * Changed mkfs.xfs default log size scaling algorithm slightly, to
     create larger logs at smaller filesystem sizes by default
   * Enable support for sector sizes larger than 512 bytes
 
- -- Nathan Scott <nathans@debian.org>  Wed, 18 Jun 2003 12:56:16 +1000
+ -- Nathan Scott <nathans@debian.org>  Mon, 23 Jun 2003 11:15:06 +1000
 
 xfsprogs (2.4.12-1) unstable; urgency=low
 
index e93d5fded87fd6b2209896793fb73c965270f605..8f9894187f43577e5795d902b49895a73598eed6 100644 (file)
@@ -1,3 +1,8 @@
+xfsprogs-2.5.1 (23 June 2003)
+       - Fix libdisk device driver (volume managers) detection code
+         used by mkfs, so that drivers with multiple majors are not
+         incorrectly processed.
+
 xfsprogs-2.5.0 (18 June 2003)
        - Fix libdisk (and hence mkfs) code which warns on MD devices
          with the clean flag not set, apparently this is not so wise.
index e93e0533e7e62ca43a8c55f9100218e8da6048d9..ff66d7e99bd3fed4280c91378e08830fe5a2ddf9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -61,6 +61,6 @@ typedef enum sv_type_e {
 } sv_type_t;
 
 extern void get_subvol_stripe_wrapper (char *, sv_type_t, int *, int *);
-extern int  get_driver_block_major (const char *);
+extern int  get_driver_block_major (const char *, int);
 
 #endif /* __VOLUME_H__ */
index bd16067ab5d38083b77b19325c0321e323cc753b..9bfb75174f1f52d8a61c486bc7f5157aa22e55a0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -58,29 +58,30 @@ get_subvol_stripe_wrapper(char *dev, sv_type_t type, int *sunit, int *swidth)
        /* ... add new device drivers here */
 }
 
+#define DEVICES        "/proc/devices"
+
 /*
  * General purpose routine which dredges through procfs trying to
  * match up device driver names with the associated major numbers
  * being used in the running kernel.
  */
 int
-get_driver_block_major(const char *driver)
+get_driver_block_major(const char *driver, int major)
 {
        FILE    *f;
        char    buf[64], puf[64];
-       int     major = -1;
+       int     dmajor, match = 0;
 
-       if ((f = fopen("/proc/devices", "r")) == NULL)
-               return major;
+       if ((f = fopen(DEVICES, "r")) == NULL)
+               return match;
        while (fgets(buf, sizeof(buf), f))      /* skip to block dev section */
                if (strncmp("Block devices:\n", buf, sizeof(buf)) == 0)
                        break;
        while (fgets(buf, sizeof(buf), f))
-               if ((sscanf(buf, "%u %s\n", &major, puf) == 2) &&
-                   (strncmp(puf, driver, sizeof(puf)) == 0))
-                       goto found;
-       major = -1;
-found:
+               if ((sscanf(buf, "%u %s\n", &dmajor, puf) == 2) &&
+                   (strncmp(puf, driver, sizeof(puf)) == 0) &&
+                   (dmajor == major))
+                       match = 1;
        fclose(f);
-       return major;
+       return match;
 }
index 62f937379b5a474a98e56f71d117d123677b6944..a41e62a83e3843b1f15221c7a125d8ab93f3a08d 100644 (file)
 #include "evms.h"
 
 int
-mnt_is_evms_subvol(dev_t dev)
+mnt_is_evms_subvol(
+       dev_t           dev)
 {
        if (major(dev) == EVMS_MAJOR)
                return 1;
-       if (major(dev) == get_driver_block_major("evms"))
-               return 1;
-       return 0;
+       return get_driver_block_major("evms", major(dev));
 }
 
 int
index 226ca2c75bc764583ef0641b1d133a719fc28990..ad5e6c1045e6d48ee230f820fd019ac932f9232e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
 #endif
 
 int
-mnt_is_lvm_subvol(dev_t dev)
+mnt_is_lvm_subvol(
+       dev_t           dev)
 {
        if (major(dev) == LVM_BLK_MAJOR)
                return 1;
-       if (major(dev) == get_driver_block_major("lvm"))
-               return 1;
-       return 0;
+       return get_driver_block_major("lvm", major(dev));
 }
 
 int
index a6a5d004391d1605b4eb6fc50c0def16f03cf7f8..36f9d91fb1445ae4847754746000a5639236a232 100644 (file)
 #include "md.h"
 
 int
-mnt_is_md_subvol(dev_t dev)
+mnt_is_md_subvol(
+       dev_t           dev)
 {
        if (major(dev) == MD_MAJOR)
                return 1;
-       if (major(dev) == get_driver_block_major("md"))
-               return 1;
-       return 0;
+       return get_driver_block_major("md", major(dev));
 }
 
 int
index 05c44a77dc0cf4996222ecea8fd565c866597340..451cac6a75c78c8dbc64ee0e4f3835efa01a4b6a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -32,6 +32,7 @@
 
 #include <stdio.h>
 #include <fcntl.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "xvm.h"
 
 int
-mnt_is_xvm_subvol(dev_t dev)
+mnt_is_xvm_subvol(
+       dev_t           dev)
 {
-       if (major(dev) == get_driver_block_major("xvm"))
-               return 1;
-       return 0;
+       return get_driver_block_major("xvm", major(dev));
 }
 
 /*