* [PATCH] xfsprogs: blkid is now mandatory @ 2015-07-01 16:01 Jan Tulak 2015-07-01 22:55 ` Dave Chinner 0 siblings, 1 reply; 17+ messages in thread From: Jan Tulak @ 2015-07-01 16:01 UTC (permalink / raw) To: xfs; +Cc: hch, sandeen Because blkid is here for a long time, I hereby propose a patch for removing support for NOT having blkid. The current support through set of #ifdef is prone to errors like making a patch just in one of the branches, and according to a recent talk between Christoph and Eric, it is not necessary to keep it supported. Remove code for checking ENABLE_BLKID, and the code when ENABLE_BLKID is not defined. It makes blkid required for compilation. Signed-off-by: Jan Tulak <jtulak@redhat.com> --- Makefile | 5 ---- configure.ac | 6 +---- doc/INSTALL | 44 ------------------------------------ include/builddefs.in | 1 - libdisk/Makefile | 4 ---- m4/package_blkid.m4 | 7 +++--- mkfs/Makefile | 21 ++++------------- mkfs/xfs_mkfs.c | 64 ---------------------------------------------------- 8 files changed, 10 insertions(+), 142 deletions(-) diff --git a/Makefile b/Makefile index d04f853..973bd42 100644 --- a/Makefile +++ b/Makefile @@ -66,11 +66,6 @@ io: libxcmd libhandle quota: libxcmd repair: libxlog - -ifneq ($(ENABLE_BLKID), yes) -mkfs: libdisk -endif - ifeq ($(HAVE_BUILDDEFS), yes) include $(BUILDRULES) else diff --git a/configure.ac b/configure.ac index ae17c68..108556b 100644 --- a/configure.ac +++ b/configure.ac @@ -37,10 +37,6 @@ AC_ARG_ENABLE(termcap, test $enable_termcap = yes && libtermcap="-ltermcap",) AC_SUBST(libtermcap) -# AC_HAVE_BLKID_TOPO below wil find the library & check for topo support -AC_ARG_ENABLE(blkid, -[ --enable-blkid=[yes/no] Enable block device id library [default=yes]],, - enable_blkid=yes) AC_ARG_ENABLE(lib64, [ --enable-lib64=[yes/no] Enable lib64 support [default=yes]],, @@ -111,7 +107,7 @@ AC_HAVE_FALLOCATE AC_HAVE_FIEMAP AC_HAVE_PREADV AC_HAVE_SYNC_FILE_RANGE -AC_HAVE_BLKID_TOPO($enable_blkid) +AC_HAVE_BLKID_TOPO(yes) AC_HAVE_READDIR AC_CHECK_SIZEOF([long]) diff --git a/doc/INSTALL b/doc/INSTALL index ba3472b..ae8b64e 100644 --- a/doc/INSTALL +++ b/doc/INSTALL @@ -48,50 +48,6 @@ Linux Instructions before running make or Makepkgs. -Mac OS X Instructions -===================== - -0. Note: since there is no XFS implementation on Mac OS X, you are - severely limited in what you can do. mkfs.xfs(8), xfs_db(8) and - xfs_repair(8) are the only functional tools on this platform, as - they do not interact with the XFS kernel code at all. Still, it - can be useful to have access to these utilities from Mac OS X in - a dual boot configuration, for example. - -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, make, - and glibtool). - - You will also need to have built and installed the UUID library which - is provided by the e2fsprogs source package. - - Building libuuid: - - [download; unzip/untar e2fsprogs; cd e2fsprogs] - $ ./configure --prefix=/usr --mandir=/usr/share/man - $ make lib/ext2fs/ext2_types.h - $ cd lib/uuid - $ make - $ su root - # make install - [verify that you now have a /usr/lib/libuuid.a] - - Building xfsprogs: - - [firstly set these environment variables to these values] - TAR=/usr/bin/gnutar - LIBTOOL=/usr/bin/glibtool - INSTALL_GROUP=wheel - LOCAL_CONFIGURE_OPTIONS="--enable-gettext=no" - - $ make - $ su root - # make install - [and optionally, for the development libraries and headers] - # make install-dev - IRIX Instructions ================= diff --git a/include/builddefs.in b/include/builddefs.in index 7e9f53d..e3a546f 100644 --- a/include/builddefs.in +++ b/include/builddefs.in @@ -89,7 +89,6 @@ ENABLE_SHARED = @enable_shared@ ENABLE_GETTEXT = @enable_gettext@ ENABLE_EDITLINE = @enable_editline@ ENABLE_READLINE = @enable_readline@ -ENABLE_BLKID = @enable_blkid@ HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@ diff --git a/libdisk/Makefile b/libdisk/Makefile index b058a9f..bbb3c8c 100644 --- a/libdisk/Makefile +++ b/libdisk/Makefile @@ -20,11 +20,7 @@ else LSRCFILES = $(LINUX_DRIVERS) endif -ifneq ($(ENABLE_BLKID), yes) -default: ltdepend $(LTLIBRARY) -else default: -endif include $(BUILDRULES) diff --git a/m4/package_blkid.m4 b/m4/package_blkid.m4 index 44ca2cc..363142c 100644 --- a/m4/package_blkid.m4 +++ b/m4/package_blkid.m4 @@ -11,9 +11,10 @@ AC_DEFUN([AC_HAVE_BLKID_TOPO], if test $ac_cv_func_blkid_probe_get_topology = yes; then libblkid="-lblkid" else - libblkd="" - enable_blkid="no" - AC_SUBST(enable_blkid) + echo + echo 'FATAL ERROR: could not find a valid BLKID header.' + echo 'Install the Block device ID development package.' + exit 1 fi fi AC_SUBST(libblkid) diff --git a/mkfs/Makefile b/mkfs/Makefile index fd1f615..6de2da4 100644 --- a/mkfs/Makefile +++ b/mkfs/Makefile @@ -11,15 +11,7 @@ FSTYP = fstyp HFILES = xfs_mkfs.h CFILES = maxtrres.c proto.c xfs_mkfs.c -ifeq ($(ENABLE_BLKID),yes) -LLDLIBS += $(LIBBLKID) -CFLAGS += -DENABLE_BLKID -else -LLDLIBS += $(LIBDISK) -LTDEPENDENCIES += $(LIBDISK) -endif - -LLDLIBS += $(LIBXFS) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) +LLDLIBS += $(LIBBLKID) $(LIBXFS) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) LTDEPENDENCIES += $(LIBXFS) LLDFLAGS = -static-libtool-libs @@ -28,15 +20,12 @@ LDIRT = $(FSTYP) default: depend $(LTCOMMAND) -ifneq ($(ENABLE_BLKID),yes) -default: $(FSTYP) -endif - include $(BUILDRULES) -$(FSTYP): - @echo " [CC] $@" - $(Q)$(LTLINK) $@.c -o $@ $(CFLAGS) $(LDFLAGS) $(LIBDISK) $(PLDLIBS) +# remove too with !enable_blkid? +#$(FSTYP): +# @echo " [CC] $@" +# $(Q)$(LTLINK) $@.c -o $@ $(CFLAGS) $(LDFLAGS) $(LIBDISK) $(PLDLIBS) install: default $(INSTALL) -m 755 -d $(PKG_ROOT_SBIN_DIR) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 83f7749..ddbb509 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -18,12 +18,7 @@ #include <xfs/libxfs.h> #include <ctype.h> -#ifdef ENABLE_BLKID #include <blkid/blkid.h> -#else -#include <disk/fstyp.h> -#include <disk/volume.h> -#endif #include "xfs_mkfs.h" /* @@ -297,7 +292,6 @@ calc_stripe_factors( } } -#ifdef ENABLE_BLKID /* * Check for existing filesystem or partition table on device. * Returns: @@ -498,64 +492,6 @@ static void get_topology( &lsectorsize, &psectorsize, force_overwrite); } } -#else /* ENABLE_BLKID */ -static int -check_overwrite( - char *device) -{ - char *type; - - if (device && *device) { - if ((type = fstype(device)) != NULL) { - fprintf(stderr, - _("%s: %s appears to contain an existing " - "filesystem (%s).\n"), progname, device, type); - return 1; - } - if ((type = pttype(device)) != NULL) { - fprintf(stderr, - _("%s: %s appears to contain a partition " - "table (%s).\n"), progname, device, type); - return 1; - } - } - return 0; -} - -static void get_topology( - libxfs_init_t *xi, - struct fs_topology *ft, - int force_overwrite) -{ - - char *dfile = xi->volname ? xi->volname : xi->dname; - int bsz = BBSIZE; - - if (!xi->disfile) { - int fd; - long long dummy; - - get_subvol_stripe_wrapper(dfile, SVTYPE_DATA, - &ft->dsunit, &ft->dswidth, &ft->sectoralign); - fd = open(dfile, O_RDONLY); - /* If this fails we just fall back to BBSIZE */ - if (fd >= 0) { - platform_findsizes(dfile, fd, &dummy, &bsz); - close(fd); - } - } - - ft->lsectorsize = bsz; - ft->psectorsize = bsz; - - if (xi->rtname && !xi->risfile) { - int dummy1; - - get_subvol_stripe_wrapper(dfile, SVTYPE_RT, &dummy1, - &ft->rtswidth, &dummy1); - } -} -#endif /* ENABLE_BLKID */ static void fixup_log_stripe_unit( -- 2.4.3 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH] xfsprogs: blkid is now mandatory 2015-07-01 16:01 [PATCH] xfsprogs: blkid is now mandatory Jan Tulak @ 2015-07-01 22:55 ` Dave Chinner 2015-07-02 10:27 ` Jan Tulak 0 siblings, 1 reply; 17+ messages in thread From: Dave Chinner @ 2015-07-01 22:55 UTC (permalink / raw) To: Jan Tulak; +Cc: hch, sandeen, xfs On Wed, Jul 01, 2015 at 06:01:01PM +0200, Jan Tulak wrote: > Because blkid is here for a long time, I hereby propose a patch for removing support > for NOT having blkid. The current support through set of #ifdef is prone to errors like > making a patch just in one of the branches, and according to a recent talk between > Christoph and Eric, it is not necessary to keep it supported. > > Remove code for checking ENABLE_BLKID, and the code when ENABLE_BLKID is not defined. > It makes blkid required for compilation. > > Signed-off-by: Jan Tulak <jtulak@redhat.com> > --- > Makefile | 5 ---- > configure.ac | 6 +---- > doc/INSTALL | 44 ------------------------------------ > include/builddefs.in | 1 - > libdisk/Makefile | 4 ---- > m4/package_blkid.m4 | 7 +++--- > mkfs/Makefile | 21 ++++------------- > mkfs/xfs_mkfs.c | 64 ---------------------------------------------------- > 8 files changed, 10 insertions(+), 142 deletions(-) Given that only mkfs.xfs uses libdisk, which is now not linked to any binary, shouldn't libdisk/ be removed completely? Cheers, Dave. -- Dave Chinner david@fromorbit.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] xfsprogs: blkid is now mandatory 2015-07-01 22:55 ` Dave Chinner @ 2015-07-02 10:27 ` Jan Tulak 2015-07-02 10:43 ` [PATCH v2] " Jan Tulak 0 siblings, 1 reply; 17+ messages in thread From: Jan Tulak @ 2015-07-02 10:27 UTC (permalink / raw) To: Dave Chinner; +Cc: hch, sandeen, xfs ----- Original Message ----- > From: "Dave Chinner" <david@fromorbit.com> > To: "Jan Tulak" <jtulak@redhat.com> > Cc: hch@infradead.org, sandeen@redhat.com, xfs@oss.sgi.com > Sent: Thursday, July 2, 2015 12:55:36 AM > Subject: Re: [PATCH] xfsprogs: blkid is now mandatory > > On Wed, Jul 01, 2015 at 06:01:01PM +0200, Jan Tulak wrote: > > Because blkid is here for a long time, I hereby propose a patch for > > removing support > > for NOT having blkid. The current support through set of #ifdef is prone to > > errors like > > making a patch just in one of the branches, and according to a recent talk > > between > > Christoph and Eric, it is not necessary to keep it supported. > > > > Remove code for checking ENABLE_BLKID, and the code when ENABLE_BLKID is > > not defined. > > It makes blkid required for compilation. > > > > Signed-off-by: Jan Tulak <jtulak@redhat.com> > > --- > > Makefile | 5 ---- > > configure.ac | 6 +---- > > doc/INSTALL | 44 ------------------------------------ > > include/builddefs.in | 1 - > > libdisk/Makefile | 4 ---- > > m4/package_blkid.m4 | 7 +++--- > > mkfs/Makefile | 21 ++++------------- > > mkfs/xfs_mkfs.c | 64 > > ---------------------------------------------------- > > 8 files changed, 10 insertions(+), 142 deletions(-) > > Given that only mkfs.xfs uses libdisk, which is now not linked to > any binary, shouldn't libdisk/ be removed completely? > > Cheers, > > Dave. True, I prepared a fixed patch with libdisk removed. Also, it looks to me like ft.sectoralign in xfs_mkfs.c is not used anymore: if (ft.sectoralign) { /* * Older Linux software RAID versions want the sector size * to match the block size to avoid switching I/O sizes. * For the legacy libdisk case we thus set the sector size to * match the block size. For systems using libblkid we assume * that the kernel is recent enough to not require this and * ft.sectoralign will never be set. */ sectorsize = blocksize; } So I removed it too. Jan -- Jan Tulak jtulak@redhat.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2] xfsprogs: blkid is now mandatory 2015-07-02 10:27 ` Jan Tulak @ 2015-07-02 10:43 ` Jan Tulak 2015-07-03 15:19 ` Christoph Hellwig 0 siblings, 1 reply; 17+ messages in thread From: Jan Tulak @ 2015-07-02 10:43 UTC (permalink / raw) To: xfs; +Cc: hch, sandeen Because blkid is here for a long time, I hereby propose a patch for removing support for NOT having blkid. The current support through set of #ifdef is prone to errors like making a patch just in one of the branches, and according to a recent talk between Christoph and Eric, it is not necessary to keep it supported. Remove code for checking ENABLE_BLKID, and the code when ENABLE_BLKID is not defined. The only use of libdisk was in the removed code, so remove libdisk too. It makes blkid required for compilation. Signed-off-by: Jan Tulak <jtulak@redhat.com> --- Makefile | 7 +- configure.ac | 6 +- debian/rules | 2 +- doc/INSTALL | 44 ----- include/builddefs.in | 2 - libdisk/Makefile | 37 ----- libdisk/dm.c | 112 ------------- libdisk/drivers.c | 82 ---------- libdisk/drivers.h | 45 ------ libdisk/evms.c | 68 -------- libdisk/evms.h | 32 ---- libdisk/fstype.c | 442 --------------------------------------------------- libdisk/fstype.h | 334 -------------------------------------- libdisk/lvm.c | 117 -------------- libdisk/md.c | 119 -------------- libdisk/md.h | 67 -------- libdisk/pttype.c | 118 -------------- libdisk/pttype.h | 50 ------ libdisk/xvm.c | 93 ----------- libdisk/xvm.h | 53 ------ m4/package_blkid.m4 | 7 +- mkfs/Makefile | 18 +-- mkfs/xfs_mkfs.c | 79 +-------- po/de.po | 51 ------ po/pl.po | 49 ------ 25 files changed, 10 insertions(+), 2024 deletions(-) delete mode 100644 libdisk/Makefile delete mode 100644 libdisk/dm.c delete mode 100644 libdisk/drivers.c delete mode 100644 libdisk/drivers.h delete mode 100644 libdisk/evms.c delete mode 100644 libdisk/evms.h delete mode 100644 libdisk/fstype.c delete mode 100644 libdisk/fstype.h delete mode 100644 libdisk/lvm.c delete mode 100644 libdisk/md.c delete mode 100644 libdisk/md.h delete mode 100644 libdisk/pttype.c delete mode 100644 libdisk/pttype.h delete mode 100644 libdisk/xvm.c delete mode 100644 libdisk/xvm.h diff --git a/Makefile b/Makefile index d04f853..dee58a9 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ LDIRT += $(SRCTAR) endif -DLIB_SUBDIRS = libxlog libxcmd libhandle libdisk +DLIB_SUBDIRS = libxlog libxcmd libhandle LIB_SUBDIRS = libxfs $(DLIB_SUBDIRS) TOOL_SUBDIRS = copy db estimate fsck fsr growfs io logprint mkfs quota \ mdrestore repair rtcp m4 man doc po debian @@ -66,11 +66,6 @@ io: libxcmd libhandle quota: libxcmd repair: libxlog - -ifneq ($(ENABLE_BLKID), yes) -mkfs: libdisk -endif - ifeq ($(HAVE_BUILDDEFS), yes) include $(BUILDRULES) else diff --git a/configure.ac b/configure.ac index ae17c68..108556b 100644 --- a/configure.ac +++ b/configure.ac @@ -37,10 +37,6 @@ AC_ARG_ENABLE(termcap, test $enable_termcap = yes && libtermcap="-ltermcap",) AC_SUBST(libtermcap) -# AC_HAVE_BLKID_TOPO below wil find the library & check for topo support -AC_ARG_ENABLE(blkid, -[ --enable-blkid=[yes/no] Enable block device id library [default=yes]],, - enable_blkid=yes) AC_ARG_ENABLE(lib64, [ --enable-lib64=[yes/no] Enable lib64 support [default=yes]],, @@ -111,7 +107,7 @@ AC_HAVE_FALLOCATE AC_HAVE_FIEMAP AC_HAVE_PREADV AC_HAVE_SYNC_FILE_RANGE -AC_HAVE_BLKID_TOPO($enable_blkid) +AC_HAVE_BLKID_TOPO(yes) AC_HAVE_READDIR AC_CHECK_SIZEOF([long]) diff --git a/debian/rules b/debian/rules index 2be2773..ee3f310 100755 --- a/debian/rules +++ b/debian/rules @@ -44,7 +44,7 @@ dibuild: @echo "== dpkg-buildpackage: installer" 1>&2 if [ ! -f mkfs/mkfs.xfs-$(bootpkg) ]; then \ $(diopts) $(MAKE) include/platform_defs.h; \ - for dir in include libxfs libdisk mkfs; do \ + for dir in include libxfs mkfs; do \ $(MAKE) -C $$dir; \ done; \ mv mkfs/mkfs.xfs mkfs/mkfs.xfs-$(bootpkg); \ diff --git a/doc/INSTALL b/doc/INSTALL index ba3472b..ae8b64e 100644 --- a/doc/INSTALL +++ b/doc/INSTALL @@ -48,50 +48,6 @@ Linux Instructions before running make or Makepkgs. -Mac OS X Instructions -===================== - -0. Note: since there is no XFS implementation on Mac OS X, you are - severely limited in what you can do. mkfs.xfs(8), xfs_db(8) and - xfs_repair(8) are the only functional tools on this platform, as - they do not interact with the XFS kernel code at all. Still, it - can be useful to have access to these utilities from Mac OS X in - a dual boot configuration, for example. - -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, make, - and glibtool). - - You will also need to have built and installed the UUID library which - is provided by the e2fsprogs source package. - - Building libuuid: - - [download; unzip/untar e2fsprogs; cd e2fsprogs] - $ ./configure --prefix=/usr --mandir=/usr/share/man - $ make lib/ext2fs/ext2_types.h - $ cd lib/uuid - $ make - $ su root - # make install - [verify that you now have a /usr/lib/libuuid.a] - - Building xfsprogs: - - [firstly set these environment variables to these values] - TAR=/usr/bin/gnutar - LIBTOOL=/usr/bin/glibtool - INSTALL_GROUP=wheel - LOCAL_CONFIGURE_OPTIONS="--enable-gettext=no" - - $ make - $ su root - # make install - [and optionally, for the development libraries and headers] - # make install-dev - IRIX Instructions ================= diff --git a/include/builddefs.in b/include/builddefs.in index 7e9f53d..925761d 100644 --- a/include/builddefs.in +++ b/include/builddefs.in @@ -37,7 +37,6 @@ LIBBLKID = @libblkid@ LIBXFS = $(TOPDIR)/libxfs/libxfs.la LIBXCMD = $(TOPDIR)/libxcmd/libxcmd.la LIBXLOG = $(TOPDIR)/libxlog/libxlog.la -LIBDISK = $(TOPDIR)/libdisk/libdisk.la LIBHANDLE = $(TOPDIR)/libhandle/libhandle.la PKG_NAME = @pkg_name@ @@ -89,7 +88,6 @@ ENABLE_SHARED = @enable_shared@ ENABLE_GETTEXT = @enable_gettext@ ENABLE_EDITLINE = @enable_editline@ ENABLE_READLINE = @enable_readline@ -ENABLE_BLKID = @enable_blkid@ HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@ diff --git a/libdisk/Makefile b/libdisk/Makefile deleted file mode 100644 index b058a9f..0000000 --- a/libdisk/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright (c) 2000-2001,2004 Silicon Graphics, Inc. All Rights Reserved. -# - -TOPDIR = .. -include $(TOPDIR)/include/builddefs - -LTLIBRARY = libdisk.la -LT_CURRENT = 0 -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 += $(LINUX_DRIVERS) -else -LSRCFILES = $(LINUX_DRIVERS) -endif - -ifneq ($(ENABLE_BLKID), yes) -default: ltdepend $(LTLIBRARY) -else -default: -endif - -include $(BUILDRULES) - -install: default - -install-dev: default - -install-qa: install-dev - --include .ltdep diff --git a/libdisk/dm.c b/libdisk/dm.c deleted file mode 100644 index dfc1f37..0000000 --- a/libdisk/dm.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2004-2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "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, - int *sectalign, - struct stat64 *sb) -{ - int count, stripes = 0, stripesize = 0; - int dmpipe[2]; - char *largv[7]; - FILE *stream; - long long offset, size; - static char *command = "table"; /* dmsetup table /dev/xxx */ - char major_str[4], minor_str[4]; - - 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("/usr/sbin/dmsetup", R_OK|X_OK)) - largv[0] = "/usr/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; - } - - snprintf(major_str, 4, "%d", major(sb->st_rdev)); - snprintf(minor_str, 4, "%d", minor(sb->st_rdev)); - - largv[1] = command; - largv[2] = "-j"; - largv[3] = major_str; - largv[4] = "-m"; - largv[5] = minor_str; - largv[6] = 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); - *sectalign = 0; - return 1; -} diff --git a/libdisk/drivers.c b/libdisk/drivers.c deleted file mode 100644 index 26c6ec1..0000000 --- a/libdisk/drivers.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2000-2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "drivers.h" - -void -get_subvol_stripe_wrapper( - char *dev, - sv_type_t type, - int *sunit, - int *swidth, - int *sectalign) -{ - struct stat64 sb; - - if (dev == NULL) - return; - - if (stat64(dev, &sb)) { - fprintf(stderr, _("Cannot stat %s: %s\n"), - dev, strerror(errno)); - exit(1); - } - - if ( dm_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb)) - return; - if ( md_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb)) - return; - if ( lvm_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb)) - return; - if ( xvm_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb)) - return; - if (evms_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb)) - return; - - /* ... 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, - int major) -{ - FILE *f; - char buf[64], puf[64]; - int dmajor, match = 0; - - 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", &dmajor, puf) == 2) && - (strncmp(puf, driver, sizeof(puf)) == 0) && - (dmajor == major)) - match = 1; - fclose(f); - return match; -} diff --git a/libdisk/drivers.h b/libdisk/drivers.h deleted file mode 100644 index 4ede58b..0000000 --- a/libdisk/drivers.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2000-2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <xfs/libxfs.h> -#include <sys/stat.h> -#include <volume.h> - -/* - * This stuff is all very platform specific. - */ - -#ifdef __linux__ -extern int dm_get_subvol_stripe(char*, sv_type_t, int*, int*, int*, - struct stat64*); -extern int md_get_subvol_stripe(char*, sv_type_t, int*, int*, int*, - struct stat64*); -extern int lvm_get_subvol_stripe(char*, sv_type_t, int*, int*, int*, - struct stat64*); -extern int xvm_get_subvol_stripe(char*, sv_type_t, int*, int*, int*, - struct stat64*); -extern int evms_get_subvol_stripe(char*, sv_type_t, int*, int*, int*, - struct stat64*); -#else -#define stat64 stat -#define dm_get_subvol_stripe(dev, type, a, b, c, stat) (-1) -#define md_get_subvol_stripe(dev, type, a, b, c, stat) (-1) -#define lvm_get_subvol_stripe(dev, type, a, b, c, stat) (-1) -#define xvm_get_subvol_stripe(dev, type, a, b, c, stat) (-1) -#define evms_get_subvol_stripe(dev, type, a, b, c, stat) (-1) -#endif diff --git a/libdisk/evms.c b/libdisk/evms.c deleted file mode 100644 index 4c22ee1..0000000 --- a/libdisk/evms.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) International Business Machines Corp., 2002 - * - * 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 - */ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/ioctl.h> -#include <sys/sysmacros.h> -#include <disk/volume.h> -#include "evms.h" - -int -mnt_is_evms_subvol( - dev_t dev) -{ - if (major(dev) == EVMS_MAJOR) - return 1; - return get_driver_block_major("evms", major(dev)); -} - -int -evms_get_subvol_stripe( - char *device, - sv_type_t type, - int *sunit, - int *swidth, - int *sectalign, - struct stat64 *sb) -{ - if (mnt_is_evms_subvol(sb->st_rdev)) { - evms_vol_stripe_info_t info; - int fd; - - fd = open(device, O_RDONLY); - if (fd == -1) - return 0; - - if (ioctl(fd, EVMS_GET_VOL_STRIPE_INFO, &info)) { - close(fd); - return 0; - } - - /* Update sizes */ - *sunit = info.size; - *swidth = *sunit * info.width; - *sectalign = 0; - - close(fd); - return 1; - } - return 0; -} diff --git a/libdisk/evms.h b/libdisk/evms.h deleted file mode 100644 index aab797b..0000000 --- a/libdisk/evms.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) International Business Machines Corp., 2002 - * - * 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 - */ - -#define EVMS_MAJOR 117 -#define EVMS_GET_VOL_STRIPE_INFO \ - _IOR(EVMS_MAJOR, 0xF0, struct evms_vol_stripe_info_s) - -/* - * struct evms_vol_stripe_info_s - contains stripe information for a volume - * - * unit: the stripe unit specified in 512 byte block units - * width: the number of stripe members or RAID data disks - */ -typedef struct evms_vol_stripe_info_s { - u_int32_t size; - u_int32_t width; -} evms_vol_stripe_info_t; diff --git a/libdisk/fstype.c b/libdisk/fstype.c deleted file mode 100644 index 548f297..0000000 --- a/libdisk/fstype.c +++ /dev/null @@ -1,442 +0,0 @@ -/* - * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <stdio.h> -#include <fcntl.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> -#include "fstype.h" - -/* - * From mount(8) source by Andries Brouwer. Hacked for XFS by mkp. - * Recent sync's to mount source: - * - util-linux-2.10o ... 06 Sep 00 - * - util-linux-2.10r ... 06 Dec 00 - * - util-linux-2.11g ... 02 Jul 01 - * - util-linux-2.11u ... 24 Aug 02 - * - util-linux-2.11z ... 13 May 03 - */ - -#define SIZE(a) (sizeof(a)/sizeof(a[0])) - -/* Most file system types can be recognized by a `magic' number - in the superblock. Note that the order of the tests is - significant: by coincidence a filesystem can have the - magic numbers for several file system types simultaneously. - For example, the romfs magic lives in the 1st sector; - xiafs does not touch the 1st sector and has its magic in - the 2nd sector; ext2 does not touch the first two sectors. */ - -static inline unsigned short -swapped(unsigned short a) { - return (a>>8) | (a<<8); -} - -/* - Probes the device and attempts to determine the type of filesystem - contained within. - - Original routine by <jmorriso@bogomips.ww.ubc.ca>; made into a function - for mount(8) by Mike Grupenhoff <kashmir@umiacs.umd.edu>. - Corrected the test for xiafs - aeb - Read the superblock only once - aeb - Added a very weak heuristic for vfat - aeb - Added iso9660, minix-v2, romfs, qnx4, udf, vxfs, swap - aeb - Added a test for high sierra (iso9660) - quinlan@bucknell.edu - Added ufs from a patch by jj. But maybe there are several types of ufs? - Added ntfs from a patch by Richard Russon. - Added xfs - 2000-03-21 Martin K. Petersen <mkp@linuxcare.com> - Added cramfs, hfs, hpfs, adfs - Sepp Wijnands <mrrazz@garbage-coderz.net> - Added ext3 - Andrew Morton - Added jfs - Christoph Hellwig - Added sysv - Tim Launchbury - Added udf - Bryce Nesbitt - Added gfs/gfs2, btrfs - Eric Sandeen -*/ - -/* - * udf magic - I find that trying to mount garbage as an udf fs - * causes a very large kernel delay, almost killing the machine. - * So, we do not try udf unless there is positive evidence that it - * might work. Strings below taken from ECMA 167. - */ -/* - * It seems that before udf 2.00 the volume descriptor was not well - * defined. For 2.00 you're supposed to keep scanning records until - * you find one NOT in this list. (See ECMA 2/8.3.1). - */ -static char -*udf_magic[] = { "BEA01", "BOOT2", "CD001", "CDW02", "NSR02", - "NSR03", "TEA01" }; - - -static int -may_be_udf(const char *id) { - char **m; - - for (m = udf_magic; m - udf_magic < SIZE(udf_magic); m++) - if (!strncmp(*m, id, 5)) - return 1; - return 0; -} - -/* we saw "CD001" - may be iso9660 or udf - Bryce Nesbitt */ -static int -is_really_udf(int fd) { - int j, bs; - struct iso_volume_descriptor isosb; - - /* determine the block size by scanning in 2K increments - (block sizes larger than 2K will be null padded) */ - for (bs = 1; bs < 16; bs++) { - lseek(fd, bs*2048+32768, SEEK_SET); - if (read(fd, (char *)&isosb, sizeof(isosb)) != sizeof(isosb)) - return 0; - if (isosb.id[0]) - break; - } - - /* Scan up to another 64 blocks looking for additional VSD's */ - for (j = 1; j < 64; j++) { - if (j > 1) { - lseek(fd, j*bs*2048+32768, SEEK_SET); - if (read(fd, (char *)&isosb, sizeof(isosb)) - != sizeof(isosb)) - return 0; - } - /* If we find NSR0x then call it udf: - NSR01 for UDF 1.00 - NSR02 for UDF 1.50 - NSR03 for UDF 2.00 */ - if (!strncmp(isosb.id, "NSR0", 4)) - return 1; - if (!may_be_udf(isosb.id)) - return 0; - } - - return 0; -} - -static int -may_be_swap(const char *s) { - return (strncmp(s-10, "SWAP-SPACE", 10) == 0 || - strncmp(s-10, "SWAPSPACE2", 10) == 0); -} - -/* rather weak necessary condition */ -static int -may_be_adfs(const struct adfs_super_block *sb) { - char *p; - int sum; - - p = (char *)sb->s_checksum; - sum = 0; - while(--p != (char *)sb) - sum = (sum >> 8) + (sum & 0xff) + *p; - - return (sum & 0xff) == sb->s_checksum[0]; -} - -static int is_reiserfs_magic_string (struct reiserfs_super_block * rs) -{ - return (!strncmp (rs->s_magic, REISERFS_SUPER_MAGIC_STRING, - strlen ( REISERFS_SUPER_MAGIC_STRING)) || - !strncmp (rs->s_magic, REISER2FS_SUPER_MAGIC_STRING, - strlen ( REISER2FS_SUPER_MAGIC_STRING))); -} - -char * -fstype(const char *device) { - int fd; - char *type = NULL; - union { - struct minix_super_block ms; - struct ext_super_block es; - struct ext2_super_block e2s; - struct vxfs_super_block vs; - struct hfs_super_block hs; - } sb; /* stuff at 1024 */ - union { - struct xiafs_super_block xiasb; - char romfs_magic[8]; - char qnx4fs_magic[10]; /* ignore first 4 bytes */ - unsigned int bfs_magic; - struct ntfs_super_block ntfssb; - struct fat_super_block fatsb; - struct xfs_super_block xfsb; - struct cramfs_super_block cramfssb; - } xsb; - struct ufs_super_block ufssb; - union { - struct iso_volume_descriptor iso; - struct hs_volume_descriptor hs; - } isosb; - struct reiserfs_super_block reiserfssb; /* block 64 or 8 */ - struct jfs_super_block jfssb; /* block 32 */ - struct hpfs_super_block hpfssb; - struct adfs_super_block adfssb; - struct sysv_super_block svsb; - struct gfs2_sb gfs2sb; - struct btrfs_super_block btrfssb; - struct stat statbuf; - - /* opening and reading an arbitrary unknown path can have - undesired side effects - first check that `device' refers - to a block device or ordinary file */ - if (stat (device, &statbuf) || - !(S_ISBLK(statbuf.st_mode) || S_ISREG(statbuf.st_mode))) - return NULL; - - fd = open(device, O_RDONLY); - if (fd < 0) - return NULL; - - /* do seeks and reads in disk order, otherwise a very short - partition may cause a failure because of read error */ - - if (!type) { - /* block 0 */ - if (lseek(fd, 0, SEEK_SET) != 0 - || read(fd, (char *) &xsb, sizeof(xsb)) != sizeof(xsb)) - goto try_iso9660; - /* Gyorgy Kovesdi: none of my photocds has a readable block 0 */ - - if (xiafsmagic(xsb.xiasb) == _XIAFS_SUPER_MAGIC) - type = "xiafs"; - else if(!strncmp(xsb.romfs_magic, "-rom1fs-", 8)) - type = "romfs"; - else if(!strncmp(xsb.xfsb.s_magic, XFS_SUPER_MAGIC, 4)) - type = "xfs"; - else if(!strncmp(xsb.qnx4fs_magic+4, "QNX4FS", 6)) - type = "qnx4"; - else if(xsb.bfs_magic == 0x1badface) - type = "bfs"; - else if(!strncmp(xsb.ntfssb.s_magic, NTFS_SUPER_MAGIC, - sizeof(xsb.ntfssb.s_magic))) - type = "ntfs"; - else if(cramfsmagic(xsb.cramfssb) == CRAMFS_SUPER_MAGIC || - cramfsmagic(xsb.cramfssb) == CRAMFS_SUPER_MAGIC_BE) - type = "cramfs"; - else if ((!strncmp(xsb.fatsb.s_os, "MSDOS", 5) || - !strncmp(xsb.fatsb.s_os, "MSWIN", 5) || - !strncmp(xsb.fatsb.s_os, "MTOOL", 5) || - !strncmp(xsb.fatsb.s_os, "mkdosfs", 7) || - !strncmp(xsb.fatsb.s_os, "kmkdosfs", 8) || - /* Michal Svec: created by fdformat, old msdos utility for - formatting large (1.7) floppy disks. */ - !strncmp(xsb.fatsb.s_os, "CH-FOR18", 8)) - && (!strncmp(xsb.fatsb.s_fs, "FAT12 ", 8) || - !strncmp(xsb.fatsb.s_fs, "FAT16 ", 8) || - !strncmp(xsb.fatsb.s_fs2, "FAT32 ", 8))) - type = "vfat"; /* only guessing - might as well be fat or umsdos */ - } - - if (!type) { - /* sector 1 */ - if (lseek(fd, 512 , SEEK_SET) != 512 - || read(fd, (char *) &svsb, sizeof(svsb)) != sizeof(svsb)) - goto io_error; - if (sysvmagic(svsb) == SYSV_SUPER_MAGIC ) - type = "sysv"; - } - - if (!type) { - /* block 1 */ - if (lseek(fd, 1024, SEEK_SET) != 1024 || - read(fd, (char *) &sb, sizeof(sb)) != sizeof(sb)) - goto io_error; - - /* ext2 has magic in little-endian on disk, so "swapped" is - superfluous; however, there have existed strange byteswapped - PPC ext2 systems */ - if (ext2magic(sb.e2s) == EXT2_SUPER_MAGIC || - ext2magic(sb.e2s) == EXT2_PRE_02B_MAGIC || - ext2magic(sb.e2s) == swapped(EXT2_SUPER_MAGIC)) { - type = "ext2"; - - /* maybe even ext3? */ - if ((assemble4le(sb.e2s.s_feature_compat) - & EXT3_FEATURE_COMPAT_HAS_JOURNAL) && - assemble4le(sb.e2s.s_journal_inum) != 0) - type = "ext3"; /* "ext3,ext2" */ - } - - else if (minixmagic(sb.ms) == MINIX_SUPER_MAGIC || - minixmagic(sb.ms) == MINIX_SUPER_MAGIC2 || - minixmagic(sb.ms) == swapped(MINIX_SUPER_MAGIC2) || - minixmagic(sb.ms) == MINIX2_SUPER_MAGIC || - minixmagic(sb.ms) == MINIX2_SUPER_MAGIC2) - type = "minix"; - - else if (extmagic(sb.es) == EXT_SUPER_MAGIC) - type = "ext"; - - else if (vxfsmagic(sb.vs) == VXFS_SUPER_MAGIC) - type = "vxfs"; - - else if (hfsmagic(sb.hs) == swapped(HFS_SUPER_MAGIC) || - (hfsmagic(sb.hs) == swapped(HFSPLUS_SUPER_MAGIC) && - hfsversion(sb.hs) == swapped(HFSPLUS_SUPER_VERSION))) - type = "hfs"; - } - - if (!type) { - /* block 3 */ - if (lseek(fd, 0xc00, SEEK_SET) != 0xc00 - || read(fd, (char *) &adfssb, sizeof(adfssb)) != sizeof(adfssb)) - goto io_error; - - /* only a weak test */ - if (may_be_adfs(&adfssb) - && (adfsblksize(adfssb) >= 8 && - adfsblksize(adfssb) <= 10)) - type = "adfs"; - } - - if (!type) { - int mag; - - /* block 8 */ - if (lseek(fd, 8192, SEEK_SET) != 8192 - || read(fd, (char *) &ufssb, sizeof(ufssb)) != sizeof(ufssb)) - goto io_error; - - mag = ufsmagic(ufssb); - if (mag == UFS_SUPER_MAGIC_LE || mag == UFS_SUPER_MAGIC_BE) - type = "ufs"; - } - - if (!type) { - /* block 8 */ - if (lseek(fd, REISERFS_OLD_DISK_OFFSET_IN_BYTES, SEEK_SET) != - REISERFS_OLD_DISK_OFFSET_IN_BYTES - || read(fd, (char *) &reiserfssb, sizeof(reiserfssb)) != - sizeof(reiserfssb)) - goto io_error; - if (is_reiserfs_magic_string(&reiserfssb)) - type = "reiserfs"; - } - - if (!type) { - /* block 8 */ - if (lseek(fd, 0x2000, SEEK_SET) != 0x2000 - || read(fd, (char *) &hpfssb, sizeof(hpfssb)) != sizeof(hpfssb)) - goto io_error; - - if (hpfsmagic(hpfssb) == HPFS_SUPER_MAGIC) - type = "hpfs"; - } - - if (!type) { - /* block 32 */ - if (lseek(fd, JFS_SUPER1_OFF, SEEK_SET) != JFS_SUPER1_OFF - || read(fd, (char *) &jfssb, sizeof(jfssb)) != sizeof(jfssb)) - goto io_error; - if (!strncmp(jfssb.s_magic, JFS_MAGIC, 4)) - type = "jfs"; - } - - if (!type) { - /* block 32 */ - try_iso9660: - if (lseek(fd, 0x8000, SEEK_SET) != 0x8000 - || read(fd, (char *) &isosb, sizeof(isosb)) != sizeof(isosb)) - goto io_error; - - if (strncmp(isosb.hs.id, HS_STANDARD_ID, sizeof(isosb.hs.id)) == 0) { - /* "CDROM" */ - type = "iso9660"; - } else if (strncmp(isosb.iso.id, ISO_STANDARD_ID, - sizeof(isosb.iso.id)) == 0) { - /* CD001 */ - type = "iso9660"; - if (is_really_udf(fd)) - type = "udf"; - } else if (may_be_udf(isosb.iso.id)) - type = "udf"; - } - - if (!type) { - /* block 64 */ - if (lseek(fd, REISERFS_DISK_OFFSET_IN_BYTES, SEEK_SET) != - REISERFS_DISK_OFFSET_IN_BYTES - || read(fd, (char *) &reiserfssb, sizeof(reiserfssb)) != - sizeof(reiserfssb)) - goto io_error; - if (is_reiserfs_magic_string(&reiserfssb)) - type = "reiserfs"; - } - - if (!type) { - /* block 64 */ - if (lseek(fd, GFS_SUPERBLOCK_OFFSET, SEEK_SET) != GFS_SUPERBLOCK_OFFSET - || read(fd, (char *) &gfs2sb, sizeof(gfs2sb)) != sizeof(gfs2sb)) - goto io_error; - if (gfsmagic(gfs2sb)) { - if (gfsformat(gfs2sb) == GFS_FORMAT_FS && - gfsmultiformat(gfs2sb) == GFS_FORMAT_MULTI) - type = "gfs"; - else if (gfsformat(gfs2sb) == GFS2_FORMAT_FS && - gfsmultiformat(gfs2sb) == GFS2_FORMAT_MULTI) - type = "gfs2"; - } - } - - if (!type) { - /* block 64 */ - if (lseek(fd, BTRFS_SUPER_INFO_OFFSET, SEEK_SET) != BTRFS_SUPER_INFO_OFFSET - || read(fd, (char *) &btrfssb, sizeof(btrfssb)) != sizeof(btrfssb)) - goto io_error; - if (!strncmp((char *)(btrfssb.magic), BTRFS_MAGIC, - sizeof(btrfssb.magic))) { - type = "btrfs"; - } - } - - if (!type) { - /* perhaps the user tries to mount the swap space - on a new disk; warn her before she does mkfs on it */ - int pagesize = getpagesize(); - int rd; - char buf[128 * 1024]; /* 64k is current max pagesize */ - - if (pagesize > sizeof(buf)) - abort(); - - rd = pagesize; - if (rd < 8192) - rd = 8192; - if (rd > sizeof(buf)) - rd = sizeof(buf); - if (lseek(fd, 0, SEEK_SET) != 0 - || read(fd, buf, rd) != rd) - goto io_error; - if (may_be_swap(buf+pagesize) || - may_be_swap(buf+4096) || may_be_swap(buf+8192)) - type = "swap"; - } - - close (fd); - return(type); - -io_error: - close(fd); - return NULL; -} diff --git a/libdisk/fstype.h b/libdisk/fstype.h deleted file mode 100644 index c0abbab..0000000 --- a/libdisk/fstype.h +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#undef XFS_SUPER_MAGIC - -/* - * From mount(8) source by Andries Brouwer. Hacked for XFS by mkp. - * Recent sync's to mount source: - * - util-linux-2.10o ... 06 Sep 00 - * - util-linux-2.10r ... 06 Dec 00 - * - util-linux-2.11g ... 02 Jul 01 - * - util-linux-2.11u ... 24 Aug 02 - * - util-linux-2.11z ... 13 May 03 - */ - -/* Including <linux/fs.h> became more and more painful. - Below a very abbreviated version of some declarations, - only designed to be able to check a magic number - in case no filesystem type was given. */ - -#define MINIX_SUPER_MAGIC 0x137F /* minix v1, 14 char names */ -#define MINIX_SUPER_MAGIC2 0x138F /* minix v1, 30 char names */ -#define MINIX2_SUPER_MAGIC 0x2468 /* minix v2, 14 char names */ -#define MINIX2_SUPER_MAGIC2 0x2478 /* minix v2, 30 char names */ -struct minix_super_block { - char s_dummy[16]; - char s_magic[2]; -}; -#define minixmagic(s) assemble2le(s.s_magic) - -#define ISODCL(from, to) (to - from + 1) -#define ISO_STANDARD_ID "CD001" -struct iso_volume_descriptor { - char type[ISODCL(1,1)]; /* 711 */ - char id[ISODCL(2,6)]; - char version[ISODCL(7,7)]; - char data[ISODCL(8,2048)]; -}; - -#define HS_STANDARD_ID "CDROM" -struct hs_volume_descriptor { - char foo[ISODCL ( 1, 8)]; /* 733 */ - char type[ISODCL ( 9, 9)]; /* 711 */ - char id[ISODCL ( 10, 14)]; - char version[ISODCL ( 15, 15)]; /* 711 */ - char data[ISODCL(16,2048)]; -}; - -#define EXT_SUPER_MAGIC 0x137D -struct ext_super_block { - char s_dummy[56]; - char s_magic[2]; -}; -#define extmagic(s) assemble2le(s.s_magic) - -#define EXT2_PRE_02B_MAGIC 0xEF51 -#define EXT2_SUPER_MAGIC 0xEF53 -#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 -struct ext2_super_block { - char s_dummy1[56]; - char s_magic[2]; - char s_dummy2[34]; - char s_feature_compat[4]; - char s_feature_incompat[4]; - char s_feature_ro_compat[4]; - char s_uuid[16]; - char s_volume_name[16]; - char s_dummy3[88]; - char s_journal_inum[4]; /* ext3 only */ -}; -#define ext2magic(s) assemble2le(s.s_magic) - -struct reiserfs_super_block -{ - char s_block_count[4]; - char s_free_blocks[4]; - char s_root_block[4]; - char s_journal_block[4]; - char s_journal_dev[4]; - char s_orig_journal_size[4]; - char s_journal_trans_max[4]; - char s_journal_block_count[4]; - char s_journal_max_batch[4]; - char s_journal_max_commit_age[4]; - char s_journal_max_trans_age[4]; - char s_blocksize[2]; - char s_oid_maxsize[2]; - char s_oid_cursize[2]; - char s_state[2]; - char s_magic[12]; -}; -#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" -#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" -#define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024) -/* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */ -#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024) - -#define _XIAFS_SUPER_MAGIC 0x012FD16D -struct xiafs_super_block { - char s_boot_segment[512]; /* 1st sector reserved for boot */ - char s_dummy[60]; - char s_magic[4]; -}; -#define xiafsmagic(s) assemble4le(s.s_magic) - -/* From jj@sunsite.ms.mff.cuni.cz Mon Mar 23 15:19:05 1998 */ -#define UFS_SUPER_MAGIC_LE 0x00011954 -#define UFS_SUPER_MAGIC_BE 0x54190100 -struct ufs_super_block { - char s_dummy[0x55c]; - char s_magic[4]; -}; -#define ufsmagic(s) assemble4le(s.s_magic) - -/* From Richard.Russon@ait.co.uk Wed Feb 24 08:05:27 1999 */ -#define NTFS_SUPER_MAGIC "NTFS" -struct ntfs_super_block { - char s_dummy[3]; - char s_magic[4]; -}; - -/* From inspection of a few FAT filesystems - aeb */ -/* Unfortunately I find almost the same thing on an extended partition; - it looks like a primary has some directory entries where the extended - has a partition table: IO.SYS, MSDOS.SYS, WINBOOT.SYS */ -struct fat_super_block { - char s_dummy[3]; - char s_os[8]; /* "MSDOS5.0" or "MSWIN4.0" or "MSWIN4.1" */ - /* mtools-3.9.4 writes "MTOOL394" */ - char s_dummy2[32]; - char s_label[11]; /* for DOS? */ - char s_fs[8]; /* "FAT12 " or "FAT16 " or all zero */ - /* OS/2 BM has "FAT " here. */ - char s_dummy3[9]; - char s_label2[11]; /* for Windows? */ - char s_fs2[8]; /* garbage or "FAT32 " */ -}; - -#define XFS_SUPER_MAGIC "XFSB" -struct xfs_super_block { - char s_magic[4]; - char s_dummy[28]; - char s_uuid[16]; - char s_dummy2[60]; - char s_fname[12]; -}; - -#define CRAMFS_SUPER_MAGIC 0x28cd3d45 -#define CRAMFS_SUPER_MAGIC_BE 0x453dcd28 -struct cramfs_super_block { - char s_magic[4]; - char s_dummy[12]; - char s_id[16]; -}; -#define cramfsmagic(s) assemble4le(s.s_magic) - -#define HFS_SUPER_MAGIC 0x4244 -#define HFSPLUS_SUPER_MAGIC 0x482B -#define HFSPLUS_SUPER_VERSION 0x004 -struct hfs_super_block { - char s_magic[2]; - char s_version[2]; -}; -#define hfsmagic(s) assemble2le(s.s_magic) -#define hfsversion(s) assemble2le(s.s_version) - -#define HPFS_SUPER_MAGIC 0xf995e849 -struct hpfs_super_block { - char s_magic[4]; - char s_magic2[4]; -}; -#define hpfsmagic(s) assemble4le(s.s_magic) - -struct adfs_super_block { - char s_dummy[448]; - char s_blksize[1]; - char s_dummy2[62]; - char s_checksum[1]; -}; -#define adfsblksize(s) ((uint) s.s_blksize[0]) - -/* found in first 4 bytes of block 1 */ -struct vxfs_super_block { - char s_magic[4]; -}; -#define vxfsmagic(s) assemble4le(s.s_magic) -#define VXFS_SUPER_MAGIC 0xa501FCF5 - -struct jfs_super_block { - char s_magic[4]; - char s_version[4]; - char s_dummy1[93]; - char s_fpack[11]; - char s_dummy2[24]; - char s_uuid[16]; - char s_label[16]; -}; -#define JFS_SUPER1_OFF 0x8000 -#define JFS_MAGIC "JFS1" - -struct sysv_super_block { - char s_dummy1[504]; - char s_magic[4]; - char type[4]; -}; -#define sysvmagic(s) assemble4le(s.s_magic) -#define SYSV_SUPER_MAGIC 0xfd187e20 - -struct mdp_super_block { - char md_magic[4]; -}; -#define MD_SB_MAGIC 0xa92b4efc -#define mdsbmagic(s) assemble4le(s.md_magic) - -struct ocfs_volume_header { - char minor_version[4]; - char major_version[4]; - char signature[128]; -}; - -struct ocfs_volume_label { - char disk_lock[48]; - char label[64]; - char label_len[2]; -}; - -#define ocfslabellen(o) assemble2le(o.label_len) -#define OCFS_MAGIC "OracleCFS" - -/* Common gfs/gfs2 constants: */ -#define GFS_MAGIC 0x01161970 -#define GFS_DEFAULT_BSIZE 4096 -#define GFS_SUPERBLOCK_OFFSET (0x10 * GFS_DEFAULT_BSIZE) -#define GFS_LOCKNAME_LEN 64 - -/* gfs1 constants: */ -#define GFS_FORMAT_FS 1309 -#define GFS_FORMAT_MULTI 1401 -/* gfs2 constants: */ -#define GFS2_FORMAT_FS 1801 -#define GFS2_FORMAT_MULTI 1900 - -struct gfs2_meta_header { - char mh_magic[4]; - char mh_type[4]; - char __pad0[8]; /* Was generation number in gfs1 */ - char mh_format[4]; - char __pad1[4]; /* Was incarnation number in gfs1 */ -}; - -struct gfs2_inum { - char no_formal_ino[8]; - char no_addr[8]; -}; - -struct gfs2_sb { - struct gfs2_meta_header sb_header; - - char sb_fs_format[4]; - char sb_multihost_format[4]; - char __pad0[4]; /* Was superblock flags in gfs1 */ - - char sb_bsize[4]; - char sb_bsize_shift[4]; - char __pad1[4]; /* Was journal segment size in gfs1 */ - - struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */ - struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */ - struct gfs2_inum sb_root_dir; - - char sb_lockproto[GFS_LOCKNAME_LEN]; - char sb_locktable[GFS_LOCKNAME_LEN]; - /* In gfs1, quota and license dinodes followed */ -}; - -#define gfsmagic(s) assemble4be(s.sb_header.mh_magic) -#define gfsformat(s) assemble4be(s.sb_fs_format) -#define gfsmultiformat(s) assemble4be(s.sb_multihost_format) - -/* btrfs constants */ -#define BTRFS_SUPER_INFO_OFFSET (64 * 1024) - -/* 32 bytes in various csum fields */ -#define BTRFS_CSUM_SIZE 32 - -#define BTRFS_FSID_SIZE 16 - -#define BTRFS_MAGIC "_BHRfS_M" - -/* - * the super block basically lists the main trees of the FS - * it currently lacks any block count etc etc - */ -struct btrfs_super_block { - char csum[BTRFS_CSUM_SIZE]; - /* the first 3 fields must match struct btrfs_header */ - char fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */ - char bytenr[8]; /* this block number */ - char flags[8]; - - /* allowed to be different from the btrfs_header from here own down */ - char magic[8]; - /* more follows but this is all our libdisk cares about*/ -} __attribute__ ((__packed__)); - -static inline int -assemble2le(char *p) { - return (p[0] | (p[1] << 8)); -} - -static inline int -assemble4le(char *p) { - return (p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24)); -} - -static inline int -assemble4be(char *p) { - return (p[3] | (p[2] << 8) | (p[1] << 16) | (p[0] << 24)); -} diff --git a/libdisk/lvm.c b/libdisk/lvm.c deleted file mode 100644 index d8d7536..0000000 --- a/libdisk/lvm.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2000-2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "drivers.h" - -#ifndef LVM_BLK_MAJOR -#define LVM_BLK_MAJOR 58 -#endif - -int -mnt_is_lvm_subvol( - dev_t dev) -{ - if (major(dev) == LVM_BLK_MAJOR) - return 1; - return get_driver_block_major("lvm", major(dev)); -} - -int -lvm_get_subvol_stripe( - char *dfile, - sv_type_t type, - int *sunit, - int *swidth, - int *sectalign, - struct stat64 *sb) -{ - int lvpipe[2], stripes = 0, stripesize = 0; - char *largv[3], buf[1024]; - FILE *stream; - char tmppath[MAXPATHLEN]; - - 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; - } - - /* realpath gives an absolute pathname */ - largv[1] = realpath(dfile, tmppath); - 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, _("Failed 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; - *sectalign = 0; - - fclose(stream); - - return 1; -} diff --git a/libdisk/md.c b/libdisk/md.c deleted file mode 100644 index 82b1cf1..0000000 --- a/libdisk/md.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2000-2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "drivers.h" -#include "md.h" - -int -mnt_is_md_subvol( - dev_t dev, - enum md_type *type) -{ - *type = MD_TYPE_MD; - if (major(dev) == MD_MAJOR) - return 1; - if (get_driver_block_major("md", major(dev))) - return 1; - *type = MD_TYPE_MDP; - if (get_driver_block_major("mdp", major(dev))) - return 1; - return 0; -} - -int -md_get_subvol_stripe( - char *dfile, - sv_type_t type, - int *sunit, - int *swidth, - int *sectalign, - struct stat64 *sb) -{ - char *pc; - char *dfile2 = NULL; - enum md_type md_type; - - if (mnt_is_md_subvol(sb->st_rdev, &md_type)) { - struct md_array_info md; - int fd; - - if (md_type == MD_TYPE_MDP) { - pc = strrchr(dfile, 'd'); - if (pc) - pc = strchr(pc, 'p'); - if (!pc) { - fprintf(stderr, - _("Error getting MD array device from %s\n"), - dfile); - exit(1); - } - dfile2 = malloc(pc - dfile + 1); - if (dfile2 == NULL) { - fprintf(stderr, - _("Couldn't malloc device string\n")); - exit(1); - } - strncpy(dfile2, dfile, pc - dfile); - dfile2[pc - dfile + 1] = '\0'; - } - /* Open device */ - fd = open(dfile2 ? dfile2 : dfile, O_RDONLY); - if (fd == -1) { - free(dfile2); - return 0; - } - - /* Is this thing on... */ - if (ioctl(fd, GET_ARRAY_INFO, &md)) { - fprintf(stderr, - _("Error getting MD array info from %s\n"), - dfile2 ? dfile2 : dfile); - exit(1); - } - close(fd); - free(dfile2); - - /* - * Ignore levels we don't want aligned (e.g. linear) - * and deduct disk(s) from stripe width on RAID4/5/6 - */ - switch (md.level) { - case 6: - md.raid_disks--; - /* fallthrough */ - case 5: - case 4: - md.raid_disks--; - /* fallthrough */ - case 1: - case 0: - case 10: - break; - default: - return 0; - } - - /* Update sizes */ - *sunit = md.chunk_size >> 9; - *swidth = *sunit * md.raid_disks; - *sectalign = (md.level == 4 || md.level == 5 || md.level == 6); - - return 1; - } - return 0; -} diff --git a/libdisk/md.h b/libdisk/md.h deleted file mode 100644 index c3284e5..0000000 --- a/libdisk/md.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2002-2003,2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MD_MAJOR -#define MD_MAJOR 9 /* we also check at runtime */ -#endif - -#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, struct md_array_info) - -#define MD_SB_CLEAN 0 -#define MD_SB_ERRORS 1 - -struct md_array_info { - /* - * Generic constant information - */ - __uint32_t major_version; - __uint32_t minor_version; - __uint32_t patch_version; - __uint32_t ctime; - __uint32_t level; - __uint32_t size; - __uint32_t nr_disks; - __uint32_t raid_disks; - __uint32_t md_minor; - __uint32_t not_persistent; - - /* - * Generic state information - */ - __uint32_t utime; /* 0 Superblock update time */ - __uint32_t state; /* 1 State bits (clean, ...) */ - __uint32_t active_disks; /* 2 Number of currently active disks */ - __uint32_t working_disks; /* 3 Number of working disks */ - __uint32_t failed_disks; /* 4 Number of failed disks */ - __uint32_t spare_disks; /* 5 Number of spare disks */ - - /* - * Personality information - */ - __uint32_t layout; /* 0 the array's physical layout */ - __uint32_t chunk_size; /* 1 chunk size in bytes */ - -}; - -/* - * MDP = partitionable RAID arrays - */ -enum md_type { - MD_TYPE_MD, - MD_TYPE_MDP -}; diff --git a/libdisk/pttype.c b/libdisk/pttype.c deleted file mode 100644 index 172073a..0000000 --- a/libdisk/pttype.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2000-2001 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <stdio.h> -#include <fcntl.h> -#include <unistd.h> -#include <sys/types.h> -#include <netinet/in.h> -#include <disk/dvh.h> -#include "pttype.h" - -#define blksize 512 - -static u_int32_t -twos_complement_32bit_sum(u_int32_t *base, int size) -{ - int i; - u_int32_t sum = 0; - - size = size / sizeof(u_int32_t); - for (i = 0; i < size; i++) - sum = sum - ntohl(base[i]); - return sum; -} - -static int -sgi_parttable(char *base) -{ - u_int32_t csum; - struct volume_header *vh = (struct volume_header *)base; - - if (ntohl(vh->vh_magic) != VHMAGIC) - return 0; - csum = twos_complement_32bit_sum((u_int32_t *)vh, - sizeof(struct volume_header)); - return !csum; -} - -static int -dos_parttable(char *base) -{ - return (base[510] == 0x55 && base[511] == 0xaa); -} - -static int -aix_parttable(char *base) -{ - return (aixlabel(base)->magic == AIX_LABEL_MAGIC || - aixlabel(base)->magic == AIX_LABEL_MAGIC_SWAPPED); -} - -static int -sun_parttable(char *base) -{ - unsigned short *ush; - int csum = 0; - - if (sunlabel(base)->magic != SUN_LABEL_MAGIC && - sunlabel(base)->magic != SUN_LABEL_MAGIC_SWAPPED) - return csum; - ush = ((unsigned short *) (sunlabel(base) + 1)) - 1; - while (ush >= (unsigned short *)sunlabel(base)) - csum ^= *ush--; - return !csum; -} - -static int -mac_parttable(char *base) -{ - return (ntohs(maclabel(base)->magic) == MAC_LABEL_MAGIC || - ntohs(maclabel(base)->magic) == MAC_PARTITION_MAGIC || - ntohs(maclabel(base)->magic) == MAC_OLD_PARTITION_MAGIC); -} - - -char * -pttype(char *device) -{ - int fd; - char *type = NULL; - char buf[blksize]; - - if ((fd = open(device, O_RDONLY)) < 0) - ; - else if (read(fd, buf, blksize) != blksize) - ; - else { - if (sgi_parttable(buf)) - type = "SGI"; - else if (sun_parttable(buf)) - type = "Sun"; - else if (aix_parttable(buf)) - type = "AIX"; - else if (dos_parttable(buf)) - type = "DOS"; - else if (mac_parttable(buf)) - type = "Mac"; - } - - if (fd >= 0) - close(fd); - return type; -} diff --git a/libdisk/pttype.h b/libdisk/pttype.h deleted file mode 100644 index 4f35c47..0000000 --- a/libdisk/pttype.h +++ /dev/null @@ -1,50 +0,0 @@ -typedef struct { - unsigned char info[128]; /* Informative text string */ - unsigned char spare0[14]; - struct sun_info { - unsigned char spare1; - unsigned char id; - unsigned char spare2; - unsigned char flags; - } infos[8]; - unsigned char spare1[246]; /* Boot information etc. */ - unsigned short rspeed; /* Disk rotational speed */ - unsigned short pcylcount; /* Physical cylinder count */ - unsigned short sparecyl; /* extra sects per cylinder */ - unsigned char spare2[4]; /* More magic... */ - unsigned short ilfact; /* Interleave factor */ - unsigned short ncyl; /* Data cylinder count */ - unsigned short nacyl; /* Alt. cylinder count */ - unsigned short ntrks; /* Tracks per cylinder */ - unsigned short nsect; /* Sectors per track */ - unsigned char spare3[4]; /* Even more magic... */ - struct sun_partition { - u_int32_t start_cylinder; - u_int32_t num_sectors; - } partitions[8]; - unsigned short magic; /* Magic number */ - unsigned short csum; /* Label xor'd checksum */ -} sun_partition; - -#define SUN_LABEL_MAGIC 0xDABE -#define SUN_LABEL_MAGIC_SWAPPED 0xBEDA -#define sunlabel(x) ((sun_partition *)x) - -typedef struct { - unsigned int magic; /* expect AIX_LABEL_MAGIC */ - /* ... */ -} aix_partition; - -#define AIX_LABEL_MAGIC 0xc9c2d4c1 -#define AIX_LABEL_MAGIC_SWAPPED 0xc1d4c2c9 -#define aixlabel(x) ((aix_partition *)x) - -typedef struct { - unsigned short magic; - /* ... */ -} mac_partition; - -#define MAC_LABEL_MAGIC 0x4552 -#define MAC_PARTITION_MAGIC 0x504d -#define MAC_OLD_PARTITION_MAGIC 0x5453 -#define maclabel(x) ((mac_partition *)x) diff --git a/libdisk/xvm.c b/libdisk/xvm.c deleted file mode 100644 index 79dff21..0000000 --- a/libdisk/xvm.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2000-2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <stdio.h> -#include <fcntl.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <disk/volume.h> -#include "xvm.h" - -int -mnt_is_xvm_subvol( - dev_t dev) -{ - return get_driver_block_major("xvm", major(dev)); -} - -/* - * If the logical device is a xvm striped volume, then it returns the - * stripe unit and stripe width information. - * Input parameters: the logical volume - * the subvolume type - (SVTYPE_RT or - * SVTYPE_DATA) - * Output parameters: the stripe unit and width in 512 byte blocks - * true/false - was this device an XVM volume? - */ -int -xvm_get_subvol_stripe( - char *dev, - sv_type_t type, - int *sunit, - int *swidth, - int *sectalign, - struct stat64 *sb) -{ - int fd; - xvm_getdev_t getdev; - xvm_subvol_stripe_t subvol_stripe; - - if (!mnt_is_xvm_subvol(sb->st_rdev)) - return 0; - - /* - * This will actually open the data subvolume. - */ - if ((fd = open(dev, O_RDONLY)) < 0) - return 0; - - /* - * Go and get the the information for the correct - * subvolume. - */ - if (ioctl(fd, DIOCGETVOLDEV, &getdev) < 0) { - close(fd); - return 0; - } - if ( (type == SVTYPE_RT) && (getdev.rt_subvol_dev) ) - subvol_stripe.dev = getdev.rt_subvol_dev; - else if ( (type == SVTYPE_DATA) && (getdev.data_subvol_dev) ) - subvol_stripe.dev = getdev.data_subvol_dev; - else { - close(fd); - return 0; - } - - if (ioctl(fd, DIOCGETVOLSTRIPE, &subvol_stripe) < 0) { - close(fd); - return 0; - } - - *sunit = subvol_stripe.unit_size; - *swidth = *sunit * subvol_stripe.width_size; - *sectalign = 0; - close(fd); - return 1; -} diff --git a/libdisk/xvm.h b/libdisk/xvm.h deleted file mode 100644 index 307e77b..0000000 --- a/libdisk/xvm.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#define _DIOC_(x) (('d'<<8) | x) -#define DIOCGETVOLDEV _DIOC_(36) /* subvolume devices */ -#define DIOCGETVOLSTRIPE _DIOC_(47) /* subvolume stripe info */ - -/* - * Structure returned by the DIOCGETVOLDEV ioctl to list the - * subvolume device nodes in a volume. These are external device - * numbers. - */ -#define XVM_GETDEV_VERS 1 - -typedef __uint32_t xvm_dev_t; - -typedef struct { - __uint32_t version; - xvm_dev_t data_subvol_dev; - - xvm_dev_t log_subvol_dev; - xvm_dev_t rt_subvol_dev; - - xvm_dev_t sp_subvol_dev; -} xvm_getdev_t; - -/* - * Structure returned by the DIOCGETVOLSTRIPE ioctl to describe - * the subvolume stripe units and width. - */ -#define XVM_SUBVOL_GEOMETRY_VERS 1 -typedef struct xvm_subvol_stripe_s { - __uint32_t version; - __uint32_t unit_size; /* in blocks */ - __uint32_t width_size; /* in blocks */ - __uint32_t pad1; /* padding */ - xvm_dev_t dev; -} xvm_subvol_stripe_t; diff --git a/m4/package_blkid.m4 b/m4/package_blkid.m4 index 44ca2cc..363142c 100644 --- a/m4/package_blkid.m4 +++ b/m4/package_blkid.m4 @@ -11,9 +11,10 @@ AC_DEFUN([AC_HAVE_BLKID_TOPO], if test $ac_cv_func_blkid_probe_get_topology = yes; then libblkid="-lblkid" else - libblkd="" - enable_blkid="no" - AC_SUBST(enable_blkid) + echo + echo 'FATAL ERROR: could not find a valid BLKID header.' + echo 'Install the Block device ID development package.' + exit 1 fi fi AC_SUBST(libblkid) diff --git a/mkfs/Makefile b/mkfs/Makefile index fd1f615..de56184 100644 --- a/mkfs/Makefile +++ b/mkfs/Makefile @@ -11,15 +11,7 @@ FSTYP = fstyp HFILES = xfs_mkfs.h CFILES = maxtrres.c proto.c xfs_mkfs.c -ifeq ($(ENABLE_BLKID),yes) -LLDLIBS += $(LIBBLKID) -CFLAGS += -DENABLE_BLKID -else -LLDLIBS += $(LIBDISK) -LTDEPENDENCIES += $(LIBDISK) -endif - -LLDLIBS += $(LIBXFS) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) +LLDLIBS += $(LIBBLKID) $(LIBXFS) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) LTDEPENDENCIES += $(LIBXFS) LLDFLAGS = -static-libtool-libs @@ -28,16 +20,8 @@ LDIRT = $(FSTYP) default: depend $(LTCOMMAND) -ifneq ($(ENABLE_BLKID),yes) -default: $(FSTYP) -endif - include $(BUILDRULES) -$(FSTYP): - @echo " [CC] $@" - $(Q)$(LTLINK) $@.c -o $@ $(CFLAGS) $(LDFLAGS) $(LIBDISK) $(PLDLIBS) - install: default $(INSTALL) -m 755 -d $(PKG_ROOT_SBIN_DIR) $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_ROOT_SBIN_DIR) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 83f7749..0d125d3 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -18,12 +18,7 @@ #include <xfs/libxfs.h> #include <ctype.h> -#ifdef ENABLE_BLKID #include <blkid/blkid.h> -#else -#include <disk/fstyp.h> -#include <disk/volume.h> -#endif #include "xfs_mkfs.h" /* @@ -35,7 +30,6 @@ struct fs_topology { int rtswidth; /* stripe width - rt subvolume */ int lsectorsize; /* logical sector size &*/ int psectorsize; /* physical sector size */ - int sectoralign; }; /* @@ -297,7 +291,6 @@ calc_stripe_factors( } } -#ifdef ENABLE_BLKID /* * Check for existing filesystem or partition table on device. * Returns: @@ -498,64 +491,6 @@ static void get_topology( &lsectorsize, &psectorsize, force_overwrite); } } -#else /* ENABLE_BLKID */ -static int -check_overwrite( - char *device) -{ - char *type; - - if (device && *device) { - if ((type = fstype(device)) != NULL) { - fprintf(stderr, - _("%s: %s appears to contain an existing " - "filesystem (%s).\n"), progname, device, type); - return 1; - } - if ((type = pttype(device)) != NULL) { - fprintf(stderr, - _("%s: %s appears to contain a partition " - "table (%s).\n"), progname, device, type); - return 1; - } - } - return 0; -} - -static void get_topology( - libxfs_init_t *xi, - struct fs_topology *ft, - int force_overwrite) -{ - - char *dfile = xi->volname ? xi->volname : xi->dname; - int bsz = BBSIZE; - - if (!xi->disfile) { - int fd; - long long dummy; - - get_subvol_stripe_wrapper(dfile, SVTYPE_DATA, - &ft->dsunit, &ft->dswidth, &ft->sectoralign); - fd = open(dfile, O_RDONLY); - /* If this fails we just fall back to BBSIZE */ - if (fd >= 0) { - platform_findsizes(dfile, fd, &dummy, &bsz); - close(fd); - } - } - - ft->lsectorsize = bsz; - ft->psectorsize = bsz; - - if (xi->rtname && !xi->risfile) { - int dummy1; - - get_subvol_stripe_wrapper(dfile, SVTYPE_RT, &dummy1, - &ft->rtswidth, &dummy1); - } -} -#endif /* ENABLE_BLKID */ static void fixup_log_stripe_unit( @@ -1779,17 +1714,7 @@ _("Minimum block size for CRC enabled filesystems is %d bytes.\n"), memset(&ft, 0, sizeof(ft)); get_topology(&xi, &ft, force_overwrite); - if (ft.sectoralign) { - /* - * Older Linux software RAID versions want the sector size - * to match the block size to avoid switching I/O sizes. - * For the legacy libdisk case we thus set the sector size to - * match the block size. For systems using libblkid we assume - * that the kernel is recent enough to not require this and - * ft.sectoralign will never be set. - */ - sectorsize = blocksize; - } else if (!ssflag) { + if (!ssflag) { /* * Unless specified manually on the command line use the * advertised sector size of the device. We use the physical @@ -1817,7 +1742,7 @@ _("switching to logical sector size %d\n"), } } - if (ft.sectoralign || !ssflag) { + if (!ssflag) { sectorlog = libxfs_highbit32(sectorsize); if (loginternal) { lsectorsize = sectorsize; diff --git a/po/de.po b/po/de.po index 7933636..fc62525 100644 --- a/po/de.po +++ b/po/de.po @@ -5706,57 +5706,6 @@ msgstr "[-cpv]" msgid "print or check parent inodes" msgstr "Eltern-Inodes ausgeben oder prüfen" -#: .././libdisk/lvm.c:60 -#, c-format -msgid "Warning - LVM device, but no lvdisplay(8) found\n" -msgstr "Warnung: LVM-Gerät, aber es wurde kein lvdisplay(8) gefunden\n" - -#: .././libdisk/lvm.c:70 .././libdisk/dm.c:73 -#, c-format -msgid "Could not open pipe\n" -msgstr "Weiterleitung kann nicht geöffnet werden\n" - -#: .././libdisk/lvm.c:85 .././libdisk/dm.c:88 -#, c-format -msgid "Failed to execute %s\n" -msgstr "Ausführen von %s fehlgeschlagen\n" - -#: .././libdisk/lvm.c:89 -#, c-format -msgid "Failed forking lvdisplay process\n" -msgstr "Erstellen des »lvdisplay«-Unterprozesses fehlgeschlagen\n" - -#: .././libdisk/drivers.c:35 -#, c-format -msgid "Cannot stat %s: %s\n" -msgstr "Kann Status für »%s« nicht abfragen:%s\n" - -#: .././libdisk/md.c:61 -#, c-format -msgid "Error getting MD array device from %s\n" -msgstr "Fehler beim Ermitteln des MD-Array-Geräts von %s\n" - -#: .././libdisk/md.c:68 -#, c-format -msgid "Couldn't malloc device string\n" -msgstr "malloc von Gerätzeichenkette konnte nicht durchgeführt werden\n" - -#: .././libdisk/md.c:84 -#, c-format -msgid "Error getting MD array info from %s\n" -msgstr "Fehler beim Ermitteln der MD-Array-Informationen von %s\n" - -#: .././libdisk/dm.c:57 -#, c-format -msgid "Warning - device mapper device, but no dmsetup(8) found\n" -msgstr "" -"Warnung: »device mapper«-Gerät, aber es wurde kein dmsetup(8) gefunden\n" - -#: .././libdisk/dm.c:92 -#, c-format -msgid "Failed forking dmsetup process\n" -msgstr "Erstellen des »dmsetup«-Unterprozesses fehlgeschlagen\n" - #: .././libxcmd/command.c:85 #, c-format msgid "bad argument count %d to %s, expected at least %d arguments\n" diff --git a/po/pl.po b/po/pl.po index 02d8c22..a950f77 100644 --- a/po/pl.po +++ b/po/pl.po @@ -5606,55 +5606,6 @@ msgstr "offset" msgid "truncates the current file at the given offset" msgstr "ucięcie bieżącego pliku na podanym offsecie" -#: .././libdisk/dm.c:57 -#, c-format -msgid "Warning - device mapper device, but no dmsetup(8) found\n" -msgstr "Uwaga - urządzenie device mappera, ale nie znaleziono dmsetup(8)\n" - -#: .././libdisk/dm.c:73 .././libdisk/lvm.c:70 -#, c-format -msgid "Could not open pipe\n" -msgstr "Nie udało się otworzyć potoku\n" - -#: .././libdisk/dm.c:88 .././libdisk/lvm.c:85 -#, c-format -msgid "Failed to execute %s\n" -msgstr "Nie udało się wywołać %s\n" - -#: .././libdisk/dm.c:92 -#, c-format -msgid "Failed forking dmsetup process\n" -msgstr "Nie udało się odgałęzić procesu dmsetup\n" - -#: .././libdisk/drivers.c:35 -#, c-format -msgid "Cannot stat %s: %s\n" -msgstr "Nie można wykonać stat na %s: %s\n" - -#: .././libdisk/lvm.c:60 -#, c-format -msgid "Warning - LVM device, but no lvdisplay(8) found\n" -msgstr "Uwaga - urządzenie LVM, ale nie znaleziono lvdisplay(8)\n" - -#: .././libdisk/lvm.c:89 -#, c-format -msgid "Failed forking lvdisplay process\n" -msgstr "Nie udało się odgałęzić procesu lvdisplay\n" - -#: .././libdisk/md.c:61 -#, c-format -msgid "Error getting MD array device from %s\n" -msgstr "Błąd podczas pobierania urządzenia macierzy MD z %s\n" - -#: .././libdisk/md.c:68 -#, c-format -msgid "Couldn't malloc device string\n" -msgstr "Nie można przydzielić łańcucha nazwy urządzenia\n" - -#: .././libdisk/md.c:84 -#, c-format -msgid "Error getting MD array info from %s\n" -msgstr "Błąd podczas pobierania informacji o macierzy MD z %s\n" #: .././libxcmd/command.c:85 #, c-format -- 2.4.3 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v2] xfsprogs: blkid is now mandatory 2015-07-02 10:43 ` [PATCH v2] " Jan Tulak @ 2015-07-03 15:19 ` Christoph Hellwig 2015-07-03 23:45 ` Dave Chinner 2015-07-07 15:10 ` Jan Tulak 0 siblings, 2 replies; 17+ messages in thread From: Christoph Hellwig @ 2015-07-03 15:19 UTC (permalink / raw) To: Jan Tulak; +Cc: hch, sandeen, xfs Thanks Jan! On Thu, Jul 02, 2015 at 12:43:16PM +0200, Jan Tulak wrote: > Because blkid is here for a long time, I hereby propose a patch for removing support > for NOT having blkid. The current support through set of #ifdef is prone to errors like > making a patch just in one of the branches, and according to a recent talk between > Christoph and Eric, it is not necessary to keep it supported. > > Remove code for checking ENABLE_BLKID, and the code when ENABLE_BLKID is not defined. > The only use of libdisk was in the removed code, so remove libdisk too. > It makes blkid required for compilation. Can you wrap your commit description lines after ~ 75 characters, please? > +AC_HAVE_BLKID_TOPO(yes) I don't think we'll need an unused argument for AC_HAVE_BLKID_TOPO. > -Mac OS X Instructions > -===================== Why do you remove this section? > > default: depend $(LTCOMMAND) > > -ifneq ($(ENABLE_BLKID),yes) > -default: $(FSTYP) > -endif > - > include $(BUILDRULES) > > -$(FSTYP): > - @echo " [CC] $@" > - $(Q)$(LTLINK) $@.c -o $@ $(CFLAGS) $(LDFLAGS) $(LIBDISK) $(PLDLIBS) > - Please remove fstyp.c and the definition of FSTYP in the Makefile as well. _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2] xfsprogs: blkid is now mandatory 2015-07-03 15:19 ` Christoph Hellwig @ 2015-07-03 23:45 ` Dave Chinner 2015-07-07 15:10 ` Jan Tulak 1 sibling, 0 replies; 17+ messages in thread From: Dave Chinner @ 2015-07-03 23:45 UTC (permalink / raw) To: Christoph Hellwig; +Cc: sandeen, xfs, Jan Tulak On Fri, Jul 03, 2015 at 08:19:04AM -0700, Christoph Hellwig wrote: > Thanks Jan! > > On Thu, Jul 02, 2015 at 12:43:16PM +0200, Jan Tulak wrote: > > Because blkid is here for a long time, I hereby propose a patch for removing support > > for NOT having blkid. The current support through set of #ifdef is prone to errors like > > making a patch just in one of the branches, and according to a recent talk between > > Christoph and Eric, it is not necessary to keep it supported. > > > > Remove code for checking ENABLE_BLKID, and the code when ENABLE_BLKID is not defined. > > The only use of libdisk was in the removed code, so remove libdisk too. > > It makes blkid required for compilation. > > Can you wrap your commit description lines after ~ 75 characters, > please? ObBikeShed: I find 68 characters for commit messages is more friendly, especially with the way git show pads the commit messages and people cut/paste it into email... Cheers, Dave. -- Dave Chinner david@fromorbit.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2] xfsprogs: blkid is now mandatory 2015-07-03 15:19 ` Christoph Hellwig 2015-07-03 23:45 ` Dave Chinner @ 2015-07-07 15:10 ` Jan Tulak 2015-07-08 9:14 ` [PATCH v3] " Jan Tulak 1 sibling, 1 reply; 17+ messages in thread From: Jan Tulak @ 2015-07-07 15:10 UTC (permalink / raw) To: Christoph Hellwig; +Cc: sandeen, xfs ----- Original Message ----- > From: "Christoph Hellwig" <hch@infradead.org> > > Can you wrap your commit description lines after ~ 75 characters, > please? > Sure. I changed it to ~ 68 by Dave's suggestion. > > > +AC_HAVE_BLKID_TOPO(yes) > > I don't think we'll need an unused argument for AC_HAVE_BLKID_TOPO. Fixed. > > > -Mac OS X Instructions > > -===================== > > Why do you remove this section? > I shouldn't put it into this patch but a standalone one: I tried to build the current version of XFS on OS X (10.10 Yosemite), but so far without a success. (I got to some errors in #defines where I thought I have better things to do.) Neither Macports, nor Homebrew [*] seems to ships XFS... Essentially, even if our docs contain a howto for OS X, it is not working and it looks like no one is using it. So I found this section ready for discarding. :-) Regarding OS X and blkid... Macports contains util-linux with libblkid, so the new dependency shouldn't be breaking the possibility to port it, if anyone wants to try it... [*] Macports and Hombrew - two biggest (AFAIK the only ones who are widely used) software repositories for OS X in Linux/BSD style. Macports are basically a port of BSD's Port. > > > > default: depend $(LTCOMMAND) > > > > -ifneq ($(ENABLE_BLKID),yes) > > -default: $(FSTYP) > > -endif > > - > > include $(BUILDRULES) > > > > -$(FSTYP): > > - @echo " [CC] $@" > > - $(Q)$(LTLINK) $@.c -o $@ $(CFLAGS) $(LDFLAGS) $(LIBDISK) $(PLDLIBS) > > - > > > Please remove fstyp.c and the definition of FSTYP in the Makefile as well. > I assume fstyp.h should go too... Jan -- Jan Tulak jtulak@redhat.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v3] xfsprogs: blkid is now mandatory 2015-07-07 15:10 ` Jan Tulak @ 2015-07-08 9:14 ` Jan Tulak 2015-07-21 12:39 ` Jan Tulak 2015-07-26 16:28 ` Christoph Hellwig 0 siblings, 2 replies; 17+ messages in thread From: Jan Tulak @ 2015-07-08 9:14 UTC (permalink / raw) To: xfs; +Cc: hch, sandeen Because blkid is here for a long time, I hereby propose a patch for removing support for NOT having blkid. The current support through set of #ifdef is prone to errors like making a patch just in one of the branches, and according to a recent talk between Christoph and Eric, it is not necessary to keep it supported. Remove code for checking ENABLE_BLKID, and the code when ENABLE_BLKID is not defined. The only use of libdisk was in the removed code, so remove libdisk too. It makes blkid required for compilation. Signed-off-by: Jan Tulak <jtulak@redhat.com> --- Makefile | 6 +- configure.ac | 6 +- debian/rules | 2 +- include/Makefile | 2 +- include/builddefs.in | 2 - include/fstyp.h | 43 ----- libdisk/Makefile | 37 ----- libdisk/dm.c | 112 ------------- libdisk/drivers.c | 82 ---------- libdisk/drivers.h | 45 ------ libdisk/evms.c | 68 -------- libdisk/evms.h | 32 ---- libdisk/fstype.c | 442 --------------------------------------------------- libdisk/fstype.h | 334 -------------------------------------- libdisk/lvm.c | 117 -------------- libdisk/md.c | 119 -------------- libdisk/md.h | 67 -------- libdisk/pttype.c | 118 -------------- libdisk/pttype.h | 50 ------ libdisk/xvm.c | 93 ----------- libdisk/xvm.h | 53 ------ m4/package_blkid.m4 | 20 ++- mkfs/Makefile | 22 +-- mkfs/fstyp.c | 59 ------- mkfs/xfs_mkfs.c | 100 +----------- po/de.po | 51 ------ po/pl.po | 49 ------ 27 files changed, 16 insertions(+), 2115 deletions(-) delete mode 100644 include/fstyp.h delete mode 100644 libdisk/Makefile delete mode 100644 libdisk/dm.c delete mode 100644 libdisk/drivers.c delete mode 100644 libdisk/drivers.h delete mode 100644 libdisk/evms.c delete mode 100644 libdisk/evms.h delete mode 100644 libdisk/fstype.c delete mode 100644 libdisk/fstype.h delete mode 100644 libdisk/lvm.c delete mode 100644 libdisk/md.c delete mode 100644 libdisk/md.h delete mode 100644 libdisk/pttype.c delete mode 100644 libdisk/pttype.h delete mode 100644 libdisk/xvm.c delete mode 100644 libdisk/xvm.h delete mode 100644 mkfs/fstyp.c diff --git a/Makefile b/Makefile index 6d6803b..798f02a 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ endif # header install rules to populate include/xfs correctly HDR_SUBDIRS = include libxfs -DLIB_SUBDIRS = libxlog libxcmd libhandle libdisk +DLIB_SUBDIRS = libxlog libxcmd libhandle LIB_SUBDIRS = libxfs $(DLIB_SUBDIRS) TOOL_SUBDIRS = copy db estimate fsck fsr growfs io logprint mkfs quota \ mdrestore repair rtcp m4 man doc po debian @@ -71,10 +71,6 @@ quota: libxcmd repair: libxlog -ifneq ($(ENABLE_BLKID), yes) -mkfs: libdisk -endif - ifeq ($(HAVE_BUILDDEFS), yes) include $(BUILDRULES) else diff --git a/configure.ac b/configure.ac index fe991cc..fac3ea7 100644 --- a/configure.ac +++ b/configure.ac @@ -37,10 +37,6 @@ AC_ARG_ENABLE(termcap, test $enable_termcap = yes && libtermcap="-ltermcap",) AC_SUBST(libtermcap) -# AC_HAVE_BLKID_TOPO below wil find the library & check for topo support -AC_ARG_ENABLE(blkid, -[ --enable-blkid=[yes/no] Enable block device id library [default=yes]],, - enable_blkid=yes) AC_ARG_ENABLE(lib64, [ --enable-lib64=[yes/no] Enable lib64 support [default=yes]],, @@ -111,7 +107,7 @@ AC_HAVE_FALLOCATE AC_HAVE_FIEMAP AC_HAVE_PREADV AC_HAVE_SYNC_FILE_RANGE -AC_HAVE_BLKID_TOPO($enable_blkid) +AC_HAVE_BLKID_TOPO AC_HAVE_READDIR AC_CHECK_SIZEOF([long]) diff --git a/debian/rules b/debian/rules index 27b043f..10d04f8 100755 --- a/debian/rules +++ b/debian/rules @@ -47,7 +47,7 @@ dibuild: for dir in include libxfs; do \ $(MAKE) -C $$dir NODEP=1 install-headers; \ done; \ - for dir in include libxfs libdisk mkfs; do \ + for dir in include libxfs mkfs; do \ $(MAKE) -C $$dir; \ done; \ mv mkfs/mkfs.xfs mkfs/mkfs.xfs-$(bootpkg); \ diff --git a/include/Makefile b/include/Makefile index 91b33b0..63a7748 100644 --- a/include/Makefile +++ b/include/Makefile @@ -46,7 +46,7 @@ HFILES = handle.h \ xqm.h PHFILES = darwin.h freebsd.h irix.h linux.h gnukfreebsd.h -DKHFILES = volume.h fstyp.h dvh.h +DKHFILES = volume.h dvh.h LIBHFILES = command.h input.h path.h project.h LSRCFILES = $(shell echo $(PHFILES) | sed -e "s/$(PKG_PLATFORM).h//g") LSRCFILES += platform_defs.h.in builddefs.in buildmacros buildrules install-sh diff --git a/include/builddefs.in b/include/builddefs.in index 7e9f53d..925761d 100644 --- a/include/builddefs.in +++ b/include/builddefs.in @@ -37,7 +37,6 @@ LIBBLKID = @libblkid@ LIBXFS = $(TOPDIR)/libxfs/libxfs.la LIBXCMD = $(TOPDIR)/libxcmd/libxcmd.la LIBXLOG = $(TOPDIR)/libxlog/libxlog.la -LIBDISK = $(TOPDIR)/libdisk/libdisk.la LIBHANDLE = $(TOPDIR)/libhandle/libhandle.la PKG_NAME = @pkg_name@ @@ -89,7 +88,6 @@ ENABLE_SHARED = @enable_shared@ ENABLE_GETTEXT = @enable_gettext@ ENABLE_EDITLINE = @enable_editline@ ENABLE_READLINE = @enable_readline@ -ENABLE_BLKID = @enable_blkid@ HAVE_ZIPPED_MANPAGES = @have_zipped_manpages@ diff --git a/include/fstyp.h b/include/fstyp.h deleted file mode 100644 index 04c1608..0000000 --- a/include/fstyp.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2000-2001, 2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef __FSTYP_H__ -#define __FSTYP_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * fstype allows the user to determine the filesystem identifier of - * mounted or unmounted filesystems, using heuristics. - * The filesystem type is required by mount(2) and sometimes by mount(8) - * to mount filesystems of different types. - */ -extern char *fstype (const char * __device); - -/* - * ptabtype allows one to determine the type of partition table in - * use on a given volume, using heuristics. - */ -extern char *pttype (const char *__device); - -#ifdef __cplusplus -} -#endif - -#endif /* __FSTYP_H__ */ diff --git a/libdisk/Makefile b/libdisk/Makefile deleted file mode 100644 index b058a9f..0000000 --- a/libdisk/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright (c) 2000-2001,2004 Silicon Graphics, Inc. All Rights Reserved. -# - -TOPDIR = .. -include $(TOPDIR)/include/builddefs - -LTLIBRARY = libdisk.la -LT_CURRENT = 0 -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 += $(LINUX_DRIVERS) -else -LSRCFILES = $(LINUX_DRIVERS) -endif - -ifneq ($(ENABLE_BLKID), yes) -default: ltdepend $(LTLIBRARY) -else -default: -endif - -include $(BUILDRULES) - -install: default - -install-dev: default - -install-qa: install-dev - --include .ltdep diff --git a/libdisk/dm.c b/libdisk/dm.c deleted file mode 100644 index dfc1f37..0000000 --- a/libdisk/dm.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2004-2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "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, - int *sectalign, - struct stat64 *sb) -{ - int count, stripes = 0, stripesize = 0; - int dmpipe[2]; - char *largv[7]; - FILE *stream; - long long offset, size; - static char *command = "table"; /* dmsetup table /dev/xxx */ - char major_str[4], minor_str[4]; - - 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("/usr/sbin/dmsetup", R_OK|X_OK)) - largv[0] = "/usr/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; - } - - snprintf(major_str, 4, "%d", major(sb->st_rdev)); - snprintf(minor_str, 4, "%d", minor(sb->st_rdev)); - - largv[1] = command; - largv[2] = "-j"; - largv[3] = major_str; - largv[4] = "-m"; - largv[5] = minor_str; - largv[6] = 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); - *sectalign = 0; - return 1; -} diff --git a/libdisk/drivers.c b/libdisk/drivers.c deleted file mode 100644 index 26c6ec1..0000000 --- a/libdisk/drivers.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2000-2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "drivers.h" - -void -get_subvol_stripe_wrapper( - char *dev, - sv_type_t type, - int *sunit, - int *swidth, - int *sectalign) -{ - struct stat64 sb; - - if (dev == NULL) - return; - - if (stat64(dev, &sb)) { - fprintf(stderr, _("Cannot stat %s: %s\n"), - dev, strerror(errno)); - exit(1); - } - - if ( dm_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb)) - return; - if ( md_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb)) - return; - if ( lvm_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb)) - return; - if ( xvm_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb)) - return; - if (evms_get_subvol_stripe(dev, type, sunit, swidth, sectalign, &sb)) - return; - - /* ... 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, - int major) -{ - FILE *f; - char buf[64], puf[64]; - int dmajor, match = 0; - - 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", &dmajor, puf) == 2) && - (strncmp(puf, driver, sizeof(puf)) == 0) && - (dmajor == major)) - match = 1; - fclose(f); - return match; -} diff --git a/libdisk/drivers.h b/libdisk/drivers.h deleted file mode 100644 index 22ac1ea..0000000 --- a/libdisk/drivers.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2000-2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "xfs/libxfs.h" -#include <sys/stat.h> -#include <volume.h> - -/* - * This stuff is all very platform specific. - */ - -#ifdef __linux__ -extern int dm_get_subvol_stripe(char*, sv_type_t, int*, int*, int*, - struct stat64*); -extern int md_get_subvol_stripe(char*, sv_type_t, int*, int*, int*, - struct stat64*); -extern int lvm_get_subvol_stripe(char*, sv_type_t, int*, int*, int*, - struct stat64*); -extern int xvm_get_subvol_stripe(char*, sv_type_t, int*, int*, int*, - struct stat64*); -extern int evms_get_subvol_stripe(char*, sv_type_t, int*, int*, int*, - struct stat64*); -#else -#define stat64 stat -#define dm_get_subvol_stripe(dev, type, a, b, c, stat) (-1) -#define md_get_subvol_stripe(dev, type, a, b, c, stat) (-1) -#define lvm_get_subvol_stripe(dev, type, a, b, c, stat) (-1) -#define xvm_get_subvol_stripe(dev, type, a, b, c, stat) (-1) -#define evms_get_subvol_stripe(dev, type, a, b, c, stat) (-1) -#endif diff --git a/libdisk/evms.c b/libdisk/evms.c deleted file mode 100644 index 4c22ee1..0000000 --- a/libdisk/evms.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) International Business Machines Corp., 2002 - * - * 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 - */ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/ioctl.h> -#include <sys/sysmacros.h> -#include <disk/volume.h> -#include "evms.h" - -int -mnt_is_evms_subvol( - dev_t dev) -{ - if (major(dev) == EVMS_MAJOR) - return 1; - return get_driver_block_major("evms", major(dev)); -} - -int -evms_get_subvol_stripe( - char *device, - sv_type_t type, - int *sunit, - int *swidth, - int *sectalign, - struct stat64 *sb) -{ - if (mnt_is_evms_subvol(sb->st_rdev)) { - evms_vol_stripe_info_t info; - int fd; - - fd = open(device, O_RDONLY); - if (fd == -1) - return 0; - - if (ioctl(fd, EVMS_GET_VOL_STRIPE_INFO, &info)) { - close(fd); - return 0; - } - - /* Update sizes */ - *sunit = info.size; - *swidth = *sunit * info.width; - *sectalign = 0; - - close(fd); - return 1; - } - return 0; -} diff --git a/libdisk/evms.h b/libdisk/evms.h deleted file mode 100644 index aab797b..0000000 --- a/libdisk/evms.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) International Business Machines Corp., 2002 - * - * 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 - */ - -#define EVMS_MAJOR 117 -#define EVMS_GET_VOL_STRIPE_INFO \ - _IOR(EVMS_MAJOR, 0xF0, struct evms_vol_stripe_info_s) - -/* - * struct evms_vol_stripe_info_s - contains stripe information for a volume - * - * unit: the stripe unit specified in 512 byte block units - * width: the number of stripe members or RAID data disks - */ -typedef struct evms_vol_stripe_info_s { - u_int32_t size; - u_int32_t width; -} evms_vol_stripe_info_t; diff --git a/libdisk/fstype.c b/libdisk/fstype.c deleted file mode 100644 index 548f297..0000000 --- a/libdisk/fstype.c +++ /dev/null @@ -1,442 +0,0 @@ -/* - * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <stdio.h> -#include <fcntl.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> -#include "fstype.h" - -/* - * From mount(8) source by Andries Brouwer. Hacked for XFS by mkp. - * Recent sync's to mount source: - * - util-linux-2.10o ... 06 Sep 00 - * - util-linux-2.10r ... 06 Dec 00 - * - util-linux-2.11g ... 02 Jul 01 - * - util-linux-2.11u ... 24 Aug 02 - * - util-linux-2.11z ... 13 May 03 - */ - -#define SIZE(a) (sizeof(a)/sizeof(a[0])) - -/* Most file system types can be recognized by a `magic' number - in the superblock. Note that the order of the tests is - significant: by coincidence a filesystem can have the - magic numbers for several file system types simultaneously. - For example, the romfs magic lives in the 1st sector; - xiafs does not touch the 1st sector and has its magic in - the 2nd sector; ext2 does not touch the first two sectors. */ - -static inline unsigned short -swapped(unsigned short a) { - return (a>>8) | (a<<8); -} - -/* - Probes the device and attempts to determine the type of filesystem - contained within. - - Original routine by <jmorriso@bogomips.ww.ubc.ca>; made into a function - for mount(8) by Mike Grupenhoff <kashmir@umiacs.umd.edu>. - Corrected the test for xiafs - aeb - Read the superblock only once - aeb - Added a very weak heuristic for vfat - aeb - Added iso9660, minix-v2, romfs, qnx4, udf, vxfs, swap - aeb - Added a test for high sierra (iso9660) - quinlan@bucknell.edu - Added ufs from a patch by jj. But maybe there are several types of ufs? - Added ntfs from a patch by Richard Russon. - Added xfs - 2000-03-21 Martin K. Petersen <mkp@linuxcare.com> - Added cramfs, hfs, hpfs, adfs - Sepp Wijnands <mrrazz@garbage-coderz.net> - Added ext3 - Andrew Morton - Added jfs - Christoph Hellwig - Added sysv - Tim Launchbury - Added udf - Bryce Nesbitt - Added gfs/gfs2, btrfs - Eric Sandeen -*/ - -/* - * udf magic - I find that trying to mount garbage as an udf fs - * causes a very large kernel delay, almost killing the machine. - * So, we do not try udf unless there is positive evidence that it - * might work. Strings below taken from ECMA 167. - */ -/* - * It seems that before udf 2.00 the volume descriptor was not well - * defined. For 2.00 you're supposed to keep scanning records until - * you find one NOT in this list. (See ECMA 2/8.3.1). - */ -static char -*udf_magic[] = { "BEA01", "BOOT2", "CD001", "CDW02", "NSR02", - "NSR03", "TEA01" }; - - -static int -may_be_udf(const char *id) { - char **m; - - for (m = udf_magic; m - udf_magic < SIZE(udf_magic); m++) - if (!strncmp(*m, id, 5)) - return 1; - return 0; -} - -/* we saw "CD001" - may be iso9660 or udf - Bryce Nesbitt */ -static int -is_really_udf(int fd) { - int j, bs; - struct iso_volume_descriptor isosb; - - /* determine the block size by scanning in 2K increments - (block sizes larger than 2K will be null padded) */ - for (bs = 1; bs < 16; bs++) { - lseek(fd, bs*2048+32768, SEEK_SET); - if (read(fd, (char *)&isosb, sizeof(isosb)) != sizeof(isosb)) - return 0; - if (isosb.id[0]) - break; - } - - /* Scan up to another 64 blocks looking for additional VSD's */ - for (j = 1; j < 64; j++) { - if (j > 1) { - lseek(fd, j*bs*2048+32768, SEEK_SET); - if (read(fd, (char *)&isosb, sizeof(isosb)) - != sizeof(isosb)) - return 0; - } - /* If we find NSR0x then call it udf: - NSR01 for UDF 1.00 - NSR02 for UDF 1.50 - NSR03 for UDF 2.00 */ - if (!strncmp(isosb.id, "NSR0", 4)) - return 1; - if (!may_be_udf(isosb.id)) - return 0; - } - - return 0; -} - -static int -may_be_swap(const char *s) { - return (strncmp(s-10, "SWAP-SPACE", 10) == 0 || - strncmp(s-10, "SWAPSPACE2", 10) == 0); -} - -/* rather weak necessary condition */ -static int -may_be_adfs(const struct adfs_super_block *sb) { - char *p; - int sum; - - p = (char *)sb->s_checksum; - sum = 0; - while(--p != (char *)sb) - sum = (sum >> 8) + (sum & 0xff) + *p; - - return (sum & 0xff) == sb->s_checksum[0]; -} - -static int is_reiserfs_magic_string (struct reiserfs_super_block * rs) -{ - return (!strncmp (rs->s_magic, REISERFS_SUPER_MAGIC_STRING, - strlen ( REISERFS_SUPER_MAGIC_STRING)) || - !strncmp (rs->s_magic, REISER2FS_SUPER_MAGIC_STRING, - strlen ( REISER2FS_SUPER_MAGIC_STRING))); -} - -char * -fstype(const char *device) { - int fd; - char *type = NULL; - union { - struct minix_super_block ms; - struct ext_super_block es; - struct ext2_super_block e2s; - struct vxfs_super_block vs; - struct hfs_super_block hs; - } sb; /* stuff at 1024 */ - union { - struct xiafs_super_block xiasb; - char romfs_magic[8]; - char qnx4fs_magic[10]; /* ignore first 4 bytes */ - unsigned int bfs_magic; - struct ntfs_super_block ntfssb; - struct fat_super_block fatsb; - struct xfs_super_block xfsb; - struct cramfs_super_block cramfssb; - } xsb; - struct ufs_super_block ufssb; - union { - struct iso_volume_descriptor iso; - struct hs_volume_descriptor hs; - } isosb; - struct reiserfs_super_block reiserfssb; /* block 64 or 8 */ - struct jfs_super_block jfssb; /* block 32 */ - struct hpfs_super_block hpfssb; - struct adfs_super_block adfssb; - struct sysv_super_block svsb; - struct gfs2_sb gfs2sb; - struct btrfs_super_block btrfssb; - struct stat statbuf; - - /* opening and reading an arbitrary unknown path can have - undesired side effects - first check that `device' refers - to a block device or ordinary file */ - if (stat (device, &statbuf) || - !(S_ISBLK(statbuf.st_mode) || S_ISREG(statbuf.st_mode))) - return NULL; - - fd = open(device, O_RDONLY); - if (fd < 0) - return NULL; - - /* do seeks and reads in disk order, otherwise a very short - partition may cause a failure because of read error */ - - if (!type) { - /* block 0 */ - if (lseek(fd, 0, SEEK_SET) != 0 - || read(fd, (char *) &xsb, sizeof(xsb)) != sizeof(xsb)) - goto try_iso9660; - /* Gyorgy Kovesdi: none of my photocds has a readable block 0 */ - - if (xiafsmagic(xsb.xiasb) == _XIAFS_SUPER_MAGIC) - type = "xiafs"; - else if(!strncmp(xsb.romfs_magic, "-rom1fs-", 8)) - type = "romfs"; - else if(!strncmp(xsb.xfsb.s_magic, XFS_SUPER_MAGIC, 4)) - type = "xfs"; - else if(!strncmp(xsb.qnx4fs_magic+4, "QNX4FS", 6)) - type = "qnx4"; - else if(xsb.bfs_magic == 0x1badface) - type = "bfs"; - else if(!strncmp(xsb.ntfssb.s_magic, NTFS_SUPER_MAGIC, - sizeof(xsb.ntfssb.s_magic))) - type = "ntfs"; - else if(cramfsmagic(xsb.cramfssb) == CRAMFS_SUPER_MAGIC || - cramfsmagic(xsb.cramfssb) == CRAMFS_SUPER_MAGIC_BE) - type = "cramfs"; - else if ((!strncmp(xsb.fatsb.s_os, "MSDOS", 5) || - !strncmp(xsb.fatsb.s_os, "MSWIN", 5) || - !strncmp(xsb.fatsb.s_os, "MTOOL", 5) || - !strncmp(xsb.fatsb.s_os, "mkdosfs", 7) || - !strncmp(xsb.fatsb.s_os, "kmkdosfs", 8) || - /* Michal Svec: created by fdformat, old msdos utility for - formatting large (1.7) floppy disks. */ - !strncmp(xsb.fatsb.s_os, "CH-FOR18", 8)) - && (!strncmp(xsb.fatsb.s_fs, "FAT12 ", 8) || - !strncmp(xsb.fatsb.s_fs, "FAT16 ", 8) || - !strncmp(xsb.fatsb.s_fs2, "FAT32 ", 8))) - type = "vfat"; /* only guessing - might as well be fat or umsdos */ - } - - if (!type) { - /* sector 1 */ - if (lseek(fd, 512 , SEEK_SET) != 512 - || read(fd, (char *) &svsb, sizeof(svsb)) != sizeof(svsb)) - goto io_error; - if (sysvmagic(svsb) == SYSV_SUPER_MAGIC ) - type = "sysv"; - } - - if (!type) { - /* block 1 */ - if (lseek(fd, 1024, SEEK_SET) != 1024 || - read(fd, (char *) &sb, sizeof(sb)) != sizeof(sb)) - goto io_error; - - /* ext2 has magic in little-endian on disk, so "swapped" is - superfluous; however, there have existed strange byteswapped - PPC ext2 systems */ - if (ext2magic(sb.e2s) == EXT2_SUPER_MAGIC || - ext2magic(sb.e2s) == EXT2_PRE_02B_MAGIC || - ext2magic(sb.e2s) == swapped(EXT2_SUPER_MAGIC)) { - type = "ext2"; - - /* maybe even ext3? */ - if ((assemble4le(sb.e2s.s_feature_compat) - & EXT3_FEATURE_COMPAT_HAS_JOURNAL) && - assemble4le(sb.e2s.s_journal_inum) != 0) - type = "ext3"; /* "ext3,ext2" */ - } - - else if (minixmagic(sb.ms) == MINIX_SUPER_MAGIC || - minixmagic(sb.ms) == MINIX_SUPER_MAGIC2 || - minixmagic(sb.ms) == swapped(MINIX_SUPER_MAGIC2) || - minixmagic(sb.ms) == MINIX2_SUPER_MAGIC || - minixmagic(sb.ms) == MINIX2_SUPER_MAGIC2) - type = "minix"; - - else if (extmagic(sb.es) == EXT_SUPER_MAGIC) - type = "ext"; - - else if (vxfsmagic(sb.vs) == VXFS_SUPER_MAGIC) - type = "vxfs"; - - else if (hfsmagic(sb.hs) == swapped(HFS_SUPER_MAGIC) || - (hfsmagic(sb.hs) == swapped(HFSPLUS_SUPER_MAGIC) && - hfsversion(sb.hs) == swapped(HFSPLUS_SUPER_VERSION))) - type = "hfs"; - } - - if (!type) { - /* block 3 */ - if (lseek(fd, 0xc00, SEEK_SET) != 0xc00 - || read(fd, (char *) &adfssb, sizeof(adfssb)) != sizeof(adfssb)) - goto io_error; - - /* only a weak test */ - if (may_be_adfs(&adfssb) - && (adfsblksize(adfssb) >= 8 && - adfsblksize(adfssb) <= 10)) - type = "adfs"; - } - - if (!type) { - int mag; - - /* block 8 */ - if (lseek(fd, 8192, SEEK_SET) != 8192 - || read(fd, (char *) &ufssb, sizeof(ufssb)) != sizeof(ufssb)) - goto io_error; - - mag = ufsmagic(ufssb); - if (mag == UFS_SUPER_MAGIC_LE || mag == UFS_SUPER_MAGIC_BE) - type = "ufs"; - } - - if (!type) { - /* block 8 */ - if (lseek(fd, REISERFS_OLD_DISK_OFFSET_IN_BYTES, SEEK_SET) != - REISERFS_OLD_DISK_OFFSET_IN_BYTES - || read(fd, (char *) &reiserfssb, sizeof(reiserfssb)) != - sizeof(reiserfssb)) - goto io_error; - if (is_reiserfs_magic_string(&reiserfssb)) - type = "reiserfs"; - } - - if (!type) { - /* block 8 */ - if (lseek(fd, 0x2000, SEEK_SET) != 0x2000 - || read(fd, (char *) &hpfssb, sizeof(hpfssb)) != sizeof(hpfssb)) - goto io_error; - - if (hpfsmagic(hpfssb) == HPFS_SUPER_MAGIC) - type = "hpfs"; - } - - if (!type) { - /* block 32 */ - if (lseek(fd, JFS_SUPER1_OFF, SEEK_SET) != JFS_SUPER1_OFF - || read(fd, (char *) &jfssb, sizeof(jfssb)) != sizeof(jfssb)) - goto io_error; - if (!strncmp(jfssb.s_magic, JFS_MAGIC, 4)) - type = "jfs"; - } - - if (!type) { - /* block 32 */ - try_iso9660: - if (lseek(fd, 0x8000, SEEK_SET) != 0x8000 - || read(fd, (char *) &isosb, sizeof(isosb)) != sizeof(isosb)) - goto io_error; - - if (strncmp(isosb.hs.id, HS_STANDARD_ID, sizeof(isosb.hs.id)) == 0) { - /* "CDROM" */ - type = "iso9660"; - } else if (strncmp(isosb.iso.id, ISO_STANDARD_ID, - sizeof(isosb.iso.id)) == 0) { - /* CD001 */ - type = "iso9660"; - if (is_really_udf(fd)) - type = "udf"; - } else if (may_be_udf(isosb.iso.id)) - type = "udf"; - } - - if (!type) { - /* block 64 */ - if (lseek(fd, REISERFS_DISK_OFFSET_IN_BYTES, SEEK_SET) != - REISERFS_DISK_OFFSET_IN_BYTES - || read(fd, (char *) &reiserfssb, sizeof(reiserfssb)) != - sizeof(reiserfssb)) - goto io_error; - if (is_reiserfs_magic_string(&reiserfssb)) - type = "reiserfs"; - } - - if (!type) { - /* block 64 */ - if (lseek(fd, GFS_SUPERBLOCK_OFFSET, SEEK_SET) != GFS_SUPERBLOCK_OFFSET - || read(fd, (char *) &gfs2sb, sizeof(gfs2sb)) != sizeof(gfs2sb)) - goto io_error; - if (gfsmagic(gfs2sb)) { - if (gfsformat(gfs2sb) == GFS_FORMAT_FS && - gfsmultiformat(gfs2sb) == GFS_FORMAT_MULTI) - type = "gfs"; - else if (gfsformat(gfs2sb) == GFS2_FORMAT_FS && - gfsmultiformat(gfs2sb) == GFS2_FORMAT_MULTI) - type = "gfs2"; - } - } - - if (!type) { - /* block 64 */ - if (lseek(fd, BTRFS_SUPER_INFO_OFFSET, SEEK_SET) != BTRFS_SUPER_INFO_OFFSET - || read(fd, (char *) &btrfssb, sizeof(btrfssb)) != sizeof(btrfssb)) - goto io_error; - if (!strncmp((char *)(btrfssb.magic), BTRFS_MAGIC, - sizeof(btrfssb.magic))) { - type = "btrfs"; - } - } - - if (!type) { - /* perhaps the user tries to mount the swap space - on a new disk; warn her before she does mkfs on it */ - int pagesize = getpagesize(); - int rd; - char buf[128 * 1024]; /* 64k is current max pagesize */ - - if (pagesize > sizeof(buf)) - abort(); - - rd = pagesize; - if (rd < 8192) - rd = 8192; - if (rd > sizeof(buf)) - rd = sizeof(buf); - if (lseek(fd, 0, SEEK_SET) != 0 - || read(fd, buf, rd) != rd) - goto io_error; - if (may_be_swap(buf+pagesize) || - may_be_swap(buf+4096) || may_be_swap(buf+8192)) - type = "swap"; - } - - close (fd); - return(type); - -io_error: - close(fd); - return NULL; -} diff --git a/libdisk/fstype.h b/libdisk/fstype.h deleted file mode 100644 index c0abbab..0000000 --- a/libdisk/fstype.h +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#undef XFS_SUPER_MAGIC - -/* - * From mount(8) source by Andries Brouwer. Hacked for XFS by mkp. - * Recent sync's to mount source: - * - util-linux-2.10o ... 06 Sep 00 - * - util-linux-2.10r ... 06 Dec 00 - * - util-linux-2.11g ... 02 Jul 01 - * - util-linux-2.11u ... 24 Aug 02 - * - util-linux-2.11z ... 13 May 03 - */ - -/* Including <linux/fs.h> became more and more painful. - Below a very abbreviated version of some declarations, - only designed to be able to check a magic number - in case no filesystem type was given. */ - -#define MINIX_SUPER_MAGIC 0x137F /* minix v1, 14 char names */ -#define MINIX_SUPER_MAGIC2 0x138F /* minix v1, 30 char names */ -#define MINIX2_SUPER_MAGIC 0x2468 /* minix v2, 14 char names */ -#define MINIX2_SUPER_MAGIC2 0x2478 /* minix v2, 30 char names */ -struct minix_super_block { - char s_dummy[16]; - char s_magic[2]; -}; -#define minixmagic(s) assemble2le(s.s_magic) - -#define ISODCL(from, to) (to - from + 1) -#define ISO_STANDARD_ID "CD001" -struct iso_volume_descriptor { - char type[ISODCL(1,1)]; /* 711 */ - char id[ISODCL(2,6)]; - char version[ISODCL(7,7)]; - char data[ISODCL(8,2048)]; -}; - -#define HS_STANDARD_ID "CDROM" -struct hs_volume_descriptor { - char foo[ISODCL ( 1, 8)]; /* 733 */ - char type[ISODCL ( 9, 9)]; /* 711 */ - char id[ISODCL ( 10, 14)]; - char version[ISODCL ( 15, 15)]; /* 711 */ - char data[ISODCL(16,2048)]; -}; - -#define EXT_SUPER_MAGIC 0x137D -struct ext_super_block { - char s_dummy[56]; - char s_magic[2]; -}; -#define extmagic(s) assemble2le(s.s_magic) - -#define EXT2_PRE_02B_MAGIC 0xEF51 -#define EXT2_SUPER_MAGIC 0xEF53 -#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 -struct ext2_super_block { - char s_dummy1[56]; - char s_magic[2]; - char s_dummy2[34]; - char s_feature_compat[4]; - char s_feature_incompat[4]; - char s_feature_ro_compat[4]; - char s_uuid[16]; - char s_volume_name[16]; - char s_dummy3[88]; - char s_journal_inum[4]; /* ext3 only */ -}; -#define ext2magic(s) assemble2le(s.s_magic) - -struct reiserfs_super_block -{ - char s_block_count[4]; - char s_free_blocks[4]; - char s_root_block[4]; - char s_journal_block[4]; - char s_journal_dev[4]; - char s_orig_journal_size[4]; - char s_journal_trans_max[4]; - char s_journal_block_count[4]; - char s_journal_max_batch[4]; - char s_journal_max_commit_age[4]; - char s_journal_max_trans_age[4]; - char s_blocksize[2]; - char s_oid_maxsize[2]; - char s_oid_cursize[2]; - char s_state[2]; - char s_magic[12]; -}; -#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" -#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" -#define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024) -/* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */ -#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024) - -#define _XIAFS_SUPER_MAGIC 0x012FD16D -struct xiafs_super_block { - char s_boot_segment[512]; /* 1st sector reserved for boot */ - char s_dummy[60]; - char s_magic[4]; -}; -#define xiafsmagic(s) assemble4le(s.s_magic) - -/* From jj@sunsite.ms.mff.cuni.cz Mon Mar 23 15:19:05 1998 */ -#define UFS_SUPER_MAGIC_LE 0x00011954 -#define UFS_SUPER_MAGIC_BE 0x54190100 -struct ufs_super_block { - char s_dummy[0x55c]; - char s_magic[4]; -}; -#define ufsmagic(s) assemble4le(s.s_magic) - -/* From Richard.Russon@ait.co.uk Wed Feb 24 08:05:27 1999 */ -#define NTFS_SUPER_MAGIC "NTFS" -struct ntfs_super_block { - char s_dummy[3]; - char s_magic[4]; -}; - -/* From inspection of a few FAT filesystems - aeb */ -/* Unfortunately I find almost the same thing on an extended partition; - it looks like a primary has some directory entries where the extended - has a partition table: IO.SYS, MSDOS.SYS, WINBOOT.SYS */ -struct fat_super_block { - char s_dummy[3]; - char s_os[8]; /* "MSDOS5.0" or "MSWIN4.0" or "MSWIN4.1" */ - /* mtools-3.9.4 writes "MTOOL394" */ - char s_dummy2[32]; - char s_label[11]; /* for DOS? */ - char s_fs[8]; /* "FAT12 " or "FAT16 " or all zero */ - /* OS/2 BM has "FAT " here. */ - char s_dummy3[9]; - char s_label2[11]; /* for Windows? */ - char s_fs2[8]; /* garbage or "FAT32 " */ -}; - -#define XFS_SUPER_MAGIC "XFSB" -struct xfs_super_block { - char s_magic[4]; - char s_dummy[28]; - char s_uuid[16]; - char s_dummy2[60]; - char s_fname[12]; -}; - -#define CRAMFS_SUPER_MAGIC 0x28cd3d45 -#define CRAMFS_SUPER_MAGIC_BE 0x453dcd28 -struct cramfs_super_block { - char s_magic[4]; - char s_dummy[12]; - char s_id[16]; -}; -#define cramfsmagic(s) assemble4le(s.s_magic) - -#define HFS_SUPER_MAGIC 0x4244 -#define HFSPLUS_SUPER_MAGIC 0x482B -#define HFSPLUS_SUPER_VERSION 0x004 -struct hfs_super_block { - char s_magic[2]; - char s_version[2]; -}; -#define hfsmagic(s) assemble2le(s.s_magic) -#define hfsversion(s) assemble2le(s.s_version) - -#define HPFS_SUPER_MAGIC 0xf995e849 -struct hpfs_super_block { - char s_magic[4]; - char s_magic2[4]; -}; -#define hpfsmagic(s) assemble4le(s.s_magic) - -struct adfs_super_block { - char s_dummy[448]; - char s_blksize[1]; - char s_dummy2[62]; - char s_checksum[1]; -}; -#define adfsblksize(s) ((uint) s.s_blksize[0]) - -/* found in first 4 bytes of block 1 */ -struct vxfs_super_block { - char s_magic[4]; -}; -#define vxfsmagic(s) assemble4le(s.s_magic) -#define VXFS_SUPER_MAGIC 0xa501FCF5 - -struct jfs_super_block { - char s_magic[4]; - char s_version[4]; - char s_dummy1[93]; - char s_fpack[11]; - char s_dummy2[24]; - char s_uuid[16]; - char s_label[16]; -}; -#define JFS_SUPER1_OFF 0x8000 -#define JFS_MAGIC "JFS1" - -struct sysv_super_block { - char s_dummy1[504]; - char s_magic[4]; - char type[4]; -}; -#define sysvmagic(s) assemble4le(s.s_magic) -#define SYSV_SUPER_MAGIC 0xfd187e20 - -struct mdp_super_block { - char md_magic[4]; -}; -#define MD_SB_MAGIC 0xa92b4efc -#define mdsbmagic(s) assemble4le(s.md_magic) - -struct ocfs_volume_header { - char minor_version[4]; - char major_version[4]; - char signature[128]; -}; - -struct ocfs_volume_label { - char disk_lock[48]; - char label[64]; - char label_len[2]; -}; - -#define ocfslabellen(o) assemble2le(o.label_len) -#define OCFS_MAGIC "OracleCFS" - -/* Common gfs/gfs2 constants: */ -#define GFS_MAGIC 0x01161970 -#define GFS_DEFAULT_BSIZE 4096 -#define GFS_SUPERBLOCK_OFFSET (0x10 * GFS_DEFAULT_BSIZE) -#define GFS_LOCKNAME_LEN 64 - -/* gfs1 constants: */ -#define GFS_FORMAT_FS 1309 -#define GFS_FORMAT_MULTI 1401 -/* gfs2 constants: */ -#define GFS2_FORMAT_FS 1801 -#define GFS2_FORMAT_MULTI 1900 - -struct gfs2_meta_header { - char mh_magic[4]; - char mh_type[4]; - char __pad0[8]; /* Was generation number in gfs1 */ - char mh_format[4]; - char __pad1[4]; /* Was incarnation number in gfs1 */ -}; - -struct gfs2_inum { - char no_formal_ino[8]; - char no_addr[8]; -}; - -struct gfs2_sb { - struct gfs2_meta_header sb_header; - - char sb_fs_format[4]; - char sb_multihost_format[4]; - char __pad0[4]; /* Was superblock flags in gfs1 */ - - char sb_bsize[4]; - char sb_bsize_shift[4]; - char __pad1[4]; /* Was journal segment size in gfs1 */ - - struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */ - struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */ - struct gfs2_inum sb_root_dir; - - char sb_lockproto[GFS_LOCKNAME_LEN]; - char sb_locktable[GFS_LOCKNAME_LEN]; - /* In gfs1, quota and license dinodes followed */ -}; - -#define gfsmagic(s) assemble4be(s.sb_header.mh_magic) -#define gfsformat(s) assemble4be(s.sb_fs_format) -#define gfsmultiformat(s) assemble4be(s.sb_multihost_format) - -/* btrfs constants */ -#define BTRFS_SUPER_INFO_OFFSET (64 * 1024) - -/* 32 bytes in various csum fields */ -#define BTRFS_CSUM_SIZE 32 - -#define BTRFS_FSID_SIZE 16 - -#define BTRFS_MAGIC "_BHRfS_M" - -/* - * the super block basically lists the main trees of the FS - * it currently lacks any block count etc etc - */ -struct btrfs_super_block { - char csum[BTRFS_CSUM_SIZE]; - /* the first 3 fields must match struct btrfs_header */ - char fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */ - char bytenr[8]; /* this block number */ - char flags[8]; - - /* allowed to be different from the btrfs_header from here own down */ - char magic[8]; - /* more follows but this is all our libdisk cares about*/ -} __attribute__ ((__packed__)); - -static inline int -assemble2le(char *p) { - return (p[0] | (p[1] << 8)); -} - -static inline int -assemble4le(char *p) { - return (p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24)); -} - -static inline int -assemble4be(char *p) { - return (p[3] | (p[2] << 8) | (p[1] << 16) | (p[0] << 24)); -} diff --git a/libdisk/lvm.c b/libdisk/lvm.c deleted file mode 100644 index d8d7536..0000000 --- a/libdisk/lvm.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2000-2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "drivers.h" - -#ifndef LVM_BLK_MAJOR -#define LVM_BLK_MAJOR 58 -#endif - -int -mnt_is_lvm_subvol( - dev_t dev) -{ - if (major(dev) == LVM_BLK_MAJOR) - return 1; - return get_driver_block_major("lvm", major(dev)); -} - -int -lvm_get_subvol_stripe( - char *dfile, - sv_type_t type, - int *sunit, - int *swidth, - int *sectalign, - struct stat64 *sb) -{ - int lvpipe[2], stripes = 0, stripesize = 0; - char *largv[3], buf[1024]; - FILE *stream; - char tmppath[MAXPATHLEN]; - - 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; - } - - /* realpath gives an absolute pathname */ - largv[1] = realpath(dfile, tmppath); - 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, _("Failed 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; - *sectalign = 0; - - fclose(stream); - - return 1; -} diff --git a/libdisk/md.c b/libdisk/md.c deleted file mode 100644 index 82b1cf1..0000000 --- a/libdisk/md.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2000-2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "drivers.h" -#include "md.h" - -int -mnt_is_md_subvol( - dev_t dev, - enum md_type *type) -{ - *type = MD_TYPE_MD; - if (major(dev) == MD_MAJOR) - return 1; - if (get_driver_block_major("md", major(dev))) - return 1; - *type = MD_TYPE_MDP; - if (get_driver_block_major("mdp", major(dev))) - return 1; - return 0; -} - -int -md_get_subvol_stripe( - char *dfile, - sv_type_t type, - int *sunit, - int *swidth, - int *sectalign, - struct stat64 *sb) -{ - char *pc; - char *dfile2 = NULL; - enum md_type md_type; - - if (mnt_is_md_subvol(sb->st_rdev, &md_type)) { - struct md_array_info md; - int fd; - - if (md_type == MD_TYPE_MDP) { - pc = strrchr(dfile, 'd'); - if (pc) - pc = strchr(pc, 'p'); - if (!pc) { - fprintf(stderr, - _("Error getting MD array device from %s\n"), - dfile); - exit(1); - } - dfile2 = malloc(pc - dfile + 1); - if (dfile2 == NULL) { - fprintf(stderr, - _("Couldn't malloc device string\n")); - exit(1); - } - strncpy(dfile2, dfile, pc - dfile); - dfile2[pc - dfile + 1] = '\0'; - } - /* Open device */ - fd = open(dfile2 ? dfile2 : dfile, O_RDONLY); - if (fd == -1) { - free(dfile2); - return 0; - } - - /* Is this thing on... */ - if (ioctl(fd, GET_ARRAY_INFO, &md)) { - fprintf(stderr, - _("Error getting MD array info from %s\n"), - dfile2 ? dfile2 : dfile); - exit(1); - } - close(fd); - free(dfile2); - - /* - * Ignore levels we don't want aligned (e.g. linear) - * and deduct disk(s) from stripe width on RAID4/5/6 - */ - switch (md.level) { - case 6: - md.raid_disks--; - /* fallthrough */ - case 5: - case 4: - md.raid_disks--; - /* fallthrough */ - case 1: - case 0: - case 10: - break; - default: - return 0; - } - - /* Update sizes */ - *sunit = md.chunk_size >> 9; - *swidth = *sunit * md.raid_disks; - *sectalign = (md.level == 4 || md.level == 5 || md.level == 6); - - return 1; - } - return 0; -} diff --git a/libdisk/md.h b/libdisk/md.h deleted file mode 100644 index c3284e5..0000000 --- a/libdisk/md.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2002-2003,2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MD_MAJOR -#define MD_MAJOR 9 /* we also check at runtime */ -#endif - -#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, struct md_array_info) - -#define MD_SB_CLEAN 0 -#define MD_SB_ERRORS 1 - -struct md_array_info { - /* - * Generic constant information - */ - __uint32_t major_version; - __uint32_t minor_version; - __uint32_t patch_version; - __uint32_t ctime; - __uint32_t level; - __uint32_t size; - __uint32_t nr_disks; - __uint32_t raid_disks; - __uint32_t md_minor; - __uint32_t not_persistent; - - /* - * Generic state information - */ - __uint32_t utime; /* 0 Superblock update time */ - __uint32_t state; /* 1 State bits (clean, ...) */ - __uint32_t active_disks; /* 2 Number of currently active disks */ - __uint32_t working_disks; /* 3 Number of working disks */ - __uint32_t failed_disks; /* 4 Number of failed disks */ - __uint32_t spare_disks; /* 5 Number of spare disks */ - - /* - * Personality information - */ - __uint32_t layout; /* 0 the array's physical layout */ - __uint32_t chunk_size; /* 1 chunk size in bytes */ - -}; - -/* - * MDP = partitionable RAID arrays - */ -enum md_type { - MD_TYPE_MD, - MD_TYPE_MDP -}; diff --git a/libdisk/pttype.c b/libdisk/pttype.c deleted file mode 100644 index 172073a..0000000 --- a/libdisk/pttype.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2000-2001 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <stdio.h> -#include <fcntl.h> -#include <unistd.h> -#include <sys/types.h> -#include <netinet/in.h> -#include <disk/dvh.h> -#include "pttype.h" - -#define blksize 512 - -static u_int32_t -twos_complement_32bit_sum(u_int32_t *base, int size) -{ - int i; - u_int32_t sum = 0; - - size = size / sizeof(u_int32_t); - for (i = 0; i < size; i++) - sum = sum - ntohl(base[i]); - return sum; -} - -static int -sgi_parttable(char *base) -{ - u_int32_t csum; - struct volume_header *vh = (struct volume_header *)base; - - if (ntohl(vh->vh_magic) != VHMAGIC) - return 0; - csum = twos_complement_32bit_sum((u_int32_t *)vh, - sizeof(struct volume_header)); - return !csum; -} - -static int -dos_parttable(char *base) -{ - return (base[510] == 0x55 && base[511] == 0xaa); -} - -static int -aix_parttable(char *base) -{ - return (aixlabel(base)->magic == AIX_LABEL_MAGIC || - aixlabel(base)->magic == AIX_LABEL_MAGIC_SWAPPED); -} - -static int -sun_parttable(char *base) -{ - unsigned short *ush; - int csum = 0; - - if (sunlabel(base)->magic != SUN_LABEL_MAGIC && - sunlabel(base)->magic != SUN_LABEL_MAGIC_SWAPPED) - return csum; - ush = ((unsigned short *) (sunlabel(base) + 1)) - 1; - while (ush >= (unsigned short *)sunlabel(base)) - csum ^= *ush--; - return !csum; -} - -static int -mac_parttable(char *base) -{ - return (ntohs(maclabel(base)->magic) == MAC_LABEL_MAGIC || - ntohs(maclabel(base)->magic) == MAC_PARTITION_MAGIC || - ntohs(maclabel(base)->magic) == MAC_OLD_PARTITION_MAGIC); -} - - -char * -pttype(char *device) -{ - int fd; - char *type = NULL; - char buf[blksize]; - - if ((fd = open(device, O_RDONLY)) < 0) - ; - else if (read(fd, buf, blksize) != blksize) - ; - else { - if (sgi_parttable(buf)) - type = "SGI"; - else if (sun_parttable(buf)) - type = "Sun"; - else if (aix_parttable(buf)) - type = "AIX"; - else if (dos_parttable(buf)) - type = "DOS"; - else if (mac_parttable(buf)) - type = "Mac"; - } - - if (fd >= 0) - close(fd); - return type; -} diff --git a/libdisk/pttype.h b/libdisk/pttype.h deleted file mode 100644 index 4f35c47..0000000 --- a/libdisk/pttype.h +++ /dev/null @@ -1,50 +0,0 @@ -typedef struct { - unsigned char info[128]; /* Informative text string */ - unsigned char spare0[14]; - struct sun_info { - unsigned char spare1; - unsigned char id; - unsigned char spare2; - unsigned char flags; - } infos[8]; - unsigned char spare1[246]; /* Boot information etc. */ - unsigned short rspeed; /* Disk rotational speed */ - unsigned short pcylcount; /* Physical cylinder count */ - unsigned short sparecyl; /* extra sects per cylinder */ - unsigned char spare2[4]; /* More magic... */ - unsigned short ilfact; /* Interleave factor */ - unsigned short ncyl; /* Data cylinder count */ - unsigned short nacyl; /* Alt. cylinder count */ - unsigned short ntrks; /* Tracks per cylinder */ - unsigned short nsect; /* Sectors per track */ - unsigned char spare3[4]; /* Even more magic... */ - struct sun_partition { - u_int32_t start_cylinder; - u_int32_t num_sectors; - } partitions[8]; - unsigned short magic; /* Magic number */ - unsigned short csum; /* Label xor'd checksum */ -} sun_partition; - -#define SUN_LABEL_MAGIC 0xDABE -#define SUN_LABEL_MAGIC_SWAPPED 0xBEDA -#define sunlabel(x) ((sun_partition *)x) - -typedef struct { - unsigned int magic; /* expect AIX_LABEL_MAGIC */ - /* ... */ -} aix_partition; - -#define AIX_LABEL_MAGIC 0xc9c2d4c1 -#define AIX_LABEL_MAGIC_SWAPPED 0xc1d4c2c9 -#define aixlabel(x) ((aix_partition *)x) - -typedef struct { - unsigned short magic; - /* ... */ -} mac_partition; - -#define MAC_LABEL_MAGIC 0x4552 -#define MAC_PARTITION_MAGIC 0x504d -#define MAC_OLD_PARTITION_MAGIC 0x5453 -#define maclabel(x) ((mac_partition *)x) diff --git a/libdisk/xvm.c b/libdisk/xvm.c deleted file mode 100644 index 79dff21..0000000 --- a/libdisk/xvm.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2000-2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <stdio.h> -#include <fcntl.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <disk/volume.h> -#include "xvm.h" - -int -mnt_is_xvm_subvol( - dev_t dev) -{ - return get_driver_block_major("xvm", major(dev)); -} - -/* - * If the logical device is a xvm striped volume, then it returns the - * stripe unit and stripe width information. - * Input parameters: the logical volume - * the subvolume type - (SVTYPE_RT or - * SVTYPE_DATA) - * Output parameters: the stripe unit and width in 512 byte blocks - * true/false - was this device an XVM volume? - */ -int -xvm_get_subvol_stripe( - char *dev, - sv_type_t type, - int *sunit, - int *swidth, - int *sectalign, - struct stat64 *sb) -{ - int fd; - xvm_getdev_t getdev; - xvm_subvol_stripe_t subvol_stripe; - - if (!mnt_is_xvm_subvol(sb->st_rdev)) - return 0; - - /* - * This will actually open the data subvolume. - */ - if ((fd = open(dev, O_RDONLY)) < 0) - return 0; - - /* - * Go and get the the information for the correct - * subvolume. - */ - if (ioctl(fd, DIOCGETVOLDEV, &getdev) < 0) { - close(fd); - return 0; - } - if ( (type == SVTYPE_RT) && (getdev.rt_subvol_dev) ) - subvol_stripe.dev = getdev.rt_subvol_dev; - else if ( (type == SVTYPE_DATA) && (getdev.data_subvol_dev) ) - subvol_stripe.dev = getdev.data_subvol_dev; - else { - close(fd); - return 0; - } - - if (ioctl(fd, DIOCGETVOLSTRIPE, &subvol_stripe) < 0) { - close(fd); - return 0; - } - - *sunit = subvol_stripe.unit_size; - *swidth = *sunit * subvol_stripe.width_size; - *sectalign = 0; - close(fd); - return 1; -} diff --git a/libdisk/xvm.h b/libdisk/xvm.h deleted file mode 100644 index 307e77b..0000000 --- a/libdisk/xvm.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#define _DIOC_(x) (('d'<<8) | x) -#define DIOCGETVOLDEV _DIOC_(36) /* subvolume devices */ -#define DIOCGETVOLSTRIPE _DIOC_(47) /* subvolume stripe info */ - -/* - * Structure returned by the DIOCGETVOLDEV ioctl to list the - * subvolume device nodes in a volume. These are external device - * numbers. - */ -#define XVM_GETDEV_VERS 1 - -typedef __uint32_t xvm_dev_t; - -typedef struct { - __uint32_t version; - xvm_dev_t data_subvol_dev; - - xvm_dev_t log_subvol_dev; - xvm_dev_t rt_subvol_dev; - - xvm_dev_t sp_subvol_dev; -} xvm_getdev_t; - -/* - * Structure returned by the DIOCGETVOLSTRIPE ioctl to describe - * the subvolume stripe units and width. - */ -#define XVM_SUBVOL_GEOMETRY_VERS 1 -typedef struct xvm_subvol_stripe_s { - __uint32_t version; - __uint32_t unit_size; /* in blocks */ - __uint32_t width_size; /* in blocks */ - __uint32_t pad1; /* padding */ - xvm_dev_t dev; -} xvm_subvol_stripe_t; diff --git a/m4/package_blkid.m4 b/m4/package_blkid.m4 index 44ca2cc..9510dce 100644 --- a/m4/package_blkid.m4 +++ b/m4/package_blkid.m4 @@ -4,17 +4,15 @@ AC_DEFUN([AC_HAVE_BLKID_TOPO], [ - enable_blkid="$1" - if test "$enable_blkid" = "yes"; then - AC_SEARCH_LIBS([blkid_probe_all], [blkid]) - AC_CHECK_FUNCS(blkid_probe_get_topology) - if test $ac_cv_func_blkid_probe_get_topology = yes; then - libblkid="-lblkid" - else - libblkd="" - enable_blkid="no" - AC_SUBST(enable_blkid) - fi + AC_SEARCH_LIBS([blkid_probe_all], [blkid]) + AC_CHECK_FUNCS(blkid_probe_get_topology) + if test $ac_cv_func_blkid_probe_get_topology = yes; then + libblkid="-lblkid" + else + echo + echo 'FATAL ERROR: could not find a valid BLKID header.' + echo 'Install the Block device ID development package.' + exit 1 fi AC_SUBST(libblkid) ]) diff --git a/mkfs/Makefile b/mkfs/Makefile index fd1f615..570ab07 100644 --- a/mkfs/Makefile +++ b/mkfs/Makefile @@ -6,38 +6,18 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs LTCOMMAND = mkfs.xfs -FSTYP = fstyp HFILES = xfs_mkfs.h CFILES = maxtrres.c proto.c xfs_mkfs.c -ifeq ($(ENABLE_BLKID),yes) -LLDLIBS += $(LIBBLKID) -CFLAGS += -DENABLE_BLKID -else -LLDLIBS += $(LIBDISK) -LTDEPENDENCIES += $(LIBDISK) -endif - -LLDLIBS += $(LIBXFS) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) +LLDLIBS += $(LIBBLKID) $(LIBXFS) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) LTDEPENDENCIES += $(LIBXFS) LLDFLAGS = -static-libtool-libs -LSRCFILES = $(FSTYP).c -LDIRT = $(FSTYP) - default: depend $(LTCOMMAND) -ifneq ($(ENABLE_BLKID),yes) -default: $(FSTYP) -endif - include $(BUILDRULES) -$(FSTYP): - @echo " [CC] $@" - $(Q)$(LTLINK) $@.c -o $@ $(CFLAGS) $(LDFLAGS) $(LIBDISK) $(PLDLIBS) - install: default $(INSTALL) -m 755 -d $(PKG_ROOT_SBIN_DIR) $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_ROOT_SBIN_DIR) diff --git a/mkfs/fstyp.c b/mkfs/fstyp.c deleted file mode 100644 index 7410516..0000000 --- a/mkfs/fstyp.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "xfs/libxfs.h" -#include <disk/fstyp.h> - -/* - * fstyp allows the user to determine the filesystem identifier of - * mounted or unmounted filesystems using heuristics. - * - * The filesystem type is required by mount(2) and sometimes by mount(8) - * to mount filesystems of different types. fstyp uses exactly the same - * heuristics that mount does to determine whether the supplied device - * special file is of a known filesystem type. If it is, fstyp prints - * on standard output the usual filesystem identifier for that type and - * exits with a zero return code. If no filesystem is identified, fstyp - * prints "Unknown" to indicate failure and exits with a non-zero status. - * - * WARNING: The use of heuristics implies that the result of fstyp is not - * guaranteed to be accurate. - */ - -int -main(int argc, char *argv[]) -{ - char *type; - - if (argc != 2) { - fprintf(stderr, "Usage: %s <device>\n", basename(argv[0])); - exit(1); - } - - if (access(argv[1], R_OK) < 0) { - perror(argv[1]); - exit(1); - } - - if ((type = fstype(argv[1])) == NULL) { - printf("Unknown\n"); - exit(1); - } - printf("%s\n", type); - exit(0); -} diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 11e9f4b..cf75a02 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -18,12 +18,7 @@ #include "xfs/libxfs.h" #include <ctype.h> -#ifdef ENABLE_BLKID #include <blkid/blkid.h> -#else -#include <disk/fstyp.h> -#include <disk/volume.h> -#endif #include "xfs_mkfs.h" /* @@ -35,7 +30,6 @@ struct fs_topology { int rtswidth; /* stripe width - rt subvolume */ int lsectorsize; /* logical sector size &*/ int psectorsize; /* physical sector size */ - int sectoralign; }; /* @@ -297,7 +291,6 @@ calc_stripe_factors( } } -#ifdef ENABLE_BLKID /* * Check for existing filesystem or partition table on device. * Returns: @@ -502,85 +495,6 @@ static void get_topology( &lsectorsize, &psectorsize, force_overwrite); } } -#else /* ENABLE_BLKID */ -static int -check_overwrite( - char *device) -{ - char *type; - - if (device && *device) { - if ((type = fstype(device)) != NULL) { - fprintf(stderr, - _("%s: %s appears to contain an existing " - "filesystem (%s).\n"), progname, device, type); - return 1; - } - if ((type = pttype(device)) != NULL) { - fprintf(stderr, - _("%s: %s appears to contain a partition " - "table (%s).\n"), progname, device, type); - return 1; - } - } - return 0; -} - -static void get_topology( - libxfs_init_t *xi, - struct fs_topology *ft, - int force_overwrite) -{ - struct stat statbuf; - char *dfile = xi->volname ? xi->volname : xi->dname; - int bsz = BBSIZE; - - /* - * If our target is a regular file, use platform_findsizes - * to try to obtain the underlying filesystem's requirements - * for direct IO; we'll set our sector size to that if possible. - */ - if (xi->disfile || - (!stat(dfile, &statbuf) && S_ISREG(statbuf.st_mode))) { - int fd; - int flags = O_RDONLY; - long long dummy; - - /* with xi->disfile we may not have the file yet! */ - if (xi->disfile) - flags |= O_CREAT; - - fd = open(dfile, flags, 0666); - /* If this fails we just fall back to BBSIZE */ - if (fd >= 0) { - platform_findsizes(dfile, fd, &dummy, &bsz); - close(fd); - } - } else { - int fd; - long long dummy; - - get_subvol_stripe_wrapper(dfile, SVTYPE_DATA, - &ft->dsunit, &ft->dswidth, &ft->sectoralign); - fd = open(dfile, O_RDONLY); - /* If this fails we just fall back to BBSIZE */ - if (fd >= 0) { - platform_findsizes(dfile, fd, &dummy, &bsz); - close(fd); - } - } - - ft->lsectorsize = bsz; - ft->psectorsize = bsz; - - if (xi->rtname && !xi->risfile) { - int dummy1; - - get_subvol_stripe_wrapper(dfile, SVTYPE_RT, &dummy1, - &ft->rtswidth, &dummy1); - } -} -#endif /* ENABLE_BLKID */ static void fixup_log_stripe_unit( @@ -1804,17 +1718,7 @@ _("Minimum block size for CRC enabled filesystems is %d bytes.\n"), memset(&ft, 0, sizeof(ft)); get_topology(&xi, &ft, force_overwrite); - if (ft.sectoralign) { - /* - * Older Linux software RAID versions want the sector size - * to match the block size to avoid switching I/O sizes. - * For the legacy libdisk case we thus set the sector size to - * match the block size. For systems using libblkid we assume - * that the kernel is recent enough to not require this and - * ft.sectoralign will never be set. - */ - sectorsize = blocksize; - } else if (!ssflag) { + if (!ssflag) { /* * Unless specified manually on the command line use the * advertised sector size of the device. We use the physical @@ -1842,7 +1746,7 @@ _("switching to logical sector size %d\n"), } } - if (ft.sectoralign || !ssflag) { + if (!ssflag) { sectorlog = libxfs_highbit32(sectorsize); if (loginternal) { lsectorsize = sectorsize; diff --git a/po/de.po b/po/de.po index 7933636..fc62525 100644 --- a/po/de.po +++ b/po/de.po @@ -5706,57 +5706,6 @@ msgstr "[-cpv]" msgid "print or check parent inodes" msgstr "Eltern-Inodes ausgeben oder prüfen" -#: .././libdisk/lvm.c:60 -#, c-format -msgid "Warning - LVM device, but no lvdisplay(8) found\n" -msgstr "Warnung: LVM-Gerät, aber es wurde kein lvdisplay(8) gefunden\n" - -#: .././libdisk/lvm.c:70 .././libdisk/dm.c:73 -#, c-format -msgid "Could not open pipe\n" -msgstr "Weiterleitung kann nicht geöffnet werden\n" - -#: .././libdisk/lvm.c:85 .././libdisk/dm.c:88 -#, c-format -msgid "Failed to execute %s\n" -msgstr "Ausführen von %s fehlgeschlagen\n" - -#: .././libdisk/lvm.c:89 -#, c-format -msgid "Failed forking lvdisplay process\n" -msgstr "Erstellen des »lvdisplay«-Unterprozesses fehlgeschlagen\n" - -#: .././libdisk/drivers.c:35 -#, c-format -msgid "Cannot stat %s: %s\n" -msgstr "Kann Status für »%s« nicht abfragen:%s\n" - -#: .././libdisk/md.c:61 -#, c-format -msgid "Error getting MD array device from %s\n" -msgstr "Fehler beim Ermitteln des MD-Array-Geräts von %s\n" - -#: .././libdisk/md.c:68 -#, c-format -msgid "Couldn't malloc device string\n" -msgstr "malloc von Gerätzeichenkette konnte nicht durchgeführt werden\n" - -#: .././libdisk/md.c:84 -#, c-format -msgid "Error getting MD array info from %s\n" -msgstr "Fehler beim Ermitteln der MD-Array-Informationen von %s\n" - -#: .././libdisk/dm.c:57 -#, c-format -msgid "Warning - device mapper device, but no dmsetup(8) found\n" -msgstr "" -"Warnung: »device mapper«-Gerät, aber es wurde kein dmsetup(8) gefunden\n" - -#: .././libdisk/dm.c:92 -#, c-format -msgid "Failed forking dmsetup process\n" -msgstr "Erstellen des »dmsetup«-Unterprozesses fehlgeschlagen\n" - #: .././libxcmd/command.c:85 #, c-format msgid "bad argument count %d to %s, expected at least %d arguments\n" diff --git a/po/pl.po b/po/pl.po index 02d8c22..a950f77 100644 --- a/po/pl.po +++ b/po/pl.po @@ -5606,55 +5606,6 @@ msgstr "offset" msgid "truncates the current file at the given offset" msgstr "ucięcie bieżącego pliku na podanym offsecie" -#: .././libdisk/dm.c:57 -#, c-format -msgid "Warning - device mapper device, but no dmsetup(8) found\n" -msgstr "Uwaga - urządzenie device mappera, ale nie znaleziono dmsetup(8)\n" - -#: .././libdisk/dm.c:73 .././libdisk/lvm.c:70 -#, c-format -msgid "Could not open pipe\n" -msgstr "Nie udało się otworzyć potoku\n" - -#: .././libdisk/dm.c:88 .././libdisk/lvm.c:85 -#, c-format -msgid "Failed to execute %s\n" -msgstr "Nie udało się wywołać %s\n" - -#: .././libdisk/dm.c:92 -#, c-format -msgid "Failed forking dmsetup process\n" -msgstr "Nie udało się odgałęzić procesu dmsetup\n" - -#: .././libdisk/drivers.c:35 -#, c-format -msgid "Cannot stat %s: %s\n" -msgstr "Nie można wykonać stat na %s: %s\n" - -#: .././libdisk/lvm.c:60 -#, c-format -msgid "Warning - LVM device, but no lvdisplay(8) found\n" -msgstr "Uwaga - urządzenie LVM, ale nie znaleziono lvdisplay(8)\n" - -#: .././libdisk/lvm.c:89 -#, c-format -msgid "Failed forking lvdisplay process\n" -msgstr "Nie udało się odgałęzić procesu lvdisplay\n" - -#: .././libdisk/md.c:61 -#, c-format -msgid "Error getting MD array device from %s\n" -msgstr "Błąd podczas pobierania urządzenia macierzy MD z %s\n" - -#: .././libdisk/md.c:68 -#, c-format -msgid "Couldn't malloc device string\n" -msgstr "Nie można przydzielić łańcucha nazwy urządzenia\n" - -#: .././libdisk/md.c:84 -#, c-format -msgid "Error getting MD array info from %s\n" -msgstr "Błąd podczas pobierania informacji o macierzy MD z %s\n" #: .././libxcmd/command.c:85 #, c-format -- 2.4.5 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v3] xfsprogs: blkid is now mandatory 2015-07-08 9:14 ` [PATCH v3] " Jan Tulak @ 2015-07-21 12:39 ` Jan Tulak 2015-07-26 16:25 ` Christoph Hellwig 2015-07-26 16:28 ` Christoph Hellwig 1 sibling, 1 reply; 17+ messages in thread From: Jan Tulak @ 2015-07-21 12:39 UTC (permalink / raw) To: xfs; +Cc: hch, sandeen ----- Original Message ----- > From: "Jan Tulak" <jtulak@redhat.com> > Subject: [PATCH v3] xfsprogs: blkid is now mandatory > > Because blkid is here for a long time, I hereby propose a patch for > removing support for NOT having blkid. The current support through > set of #ifdef is prone to errors like > making a patch just in one of the branches, and according to a > recent talk between Christoph and Eric, it is not necessary to keep > it supported. > > Remove code for checking ENABLE_BLKID, and the code when > ENABLE_BLKID is not defined. The only use of libdisk was in the > removed code, so remove libdisk too. It makes blkid required for > compilation. > I just found that while it is possible to get blkid on OS X, it is in 1.0.0 version which doesn't have blkid_probe_get function. I'm examining whether it is possible to get an updated version there, but right now, this patch breaks OS X support. Unfortunately I didn't noticed of this before, as the OS X port was terribly out of date. So this patch shouldn't be included until I find how to get around. Cheers, Jan -- Jan Tulak jtulak@redhat.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3] xfsprogs: blkid is now mandatory 2015-07-21 12:39 ` Jan Tulak @ 2015-07-26 16:25 ` Christoph Hellwig 2015-08-03 10:40 ` Jan Tulak 0 siblings, 1 reply; 17+ messages in thread From: Christoph Hellwig @ 2015-07-26 16:25 UTC (permalink / raw) To: Jan Tulak; +Cc: hch, sandeen, xfs On Tue, Jul 21, 2015 at 08:39:36AM -0400, Jan Tulak wrote: > I just found that while it is possible to get blkid on OS X, it is > in 1.0.0 version which doesn't have blkid_probe_get function. > I'm examining whether it is possible to get an updated version there, > but right now, this patch breaks OS X support. Unfortunately I didn't > noticed of this before, as the OS X port was terribly out of date. > > So this patch shouldn't be included until I find how to get around. I don't think this is a lbocker given that OSX support doesn't even work. To the contrary I'd really prefer to go in ASAP to avoid anyone relying on it longer than nessecary. _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3] xfsprogs: blkid is now mandatory 2015-07-26 16:25 ` Christoph Hellwig @ 2015-08-03 10:40 ` Jan Tulak 2015-08-03 17:20 ` Eric Sandeen 0 siblings, 1 reply; 17+ messages in thread From: Jan Tulak @ 2015-08-03 10:40 UTC (permalink / raw) To: Christoph Hellwig; +Cc: sandeen, xfs ----- Original Message ----- > From: "Christoph Hellwig" <hch@infradead.org> > > On Tue, Jul 21, 2015 at 08:39:36AM -0400, Jan Tulak wrote: > > I just found that while it is possible to get blkid on OS X, it is > > in 1.0.0 version which doesn't have blkid_probe_get function. > > I'm examining whether it is possible to get an updated version there, > > but right now, this patch breaks OS X support. Unfortunately I didn't > > noticed of this before, as the OS X port was terribly out of date. > > > > So this patch shouldn't be included until I find how to get around. > > I don't think this is a lbocker given that OSX support doesn't > even work. > > To the contrary I'd really prefer to go in ASAP to avoid anyone > relying on it longer than nessecary. I tried to get newer blkid on OSX, but so far without a big success (well, it looks like a kind of a small dependency hell that would have to be ported, with bigger or smaller effort...). With regards on the priorities, I think if we can make the OS X support in "manual patching required" way, then? So lets include this patch, and just note it OS X doc "you have to revert commit XXX and re-apply any changes to the relevant code"? Jan -- Jan Tulak jtulak@redhat.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3] xfsprogs: blkid is now mandatory 2015-08-03 10:40 ` Jan Tulak @ 2015-08-03 17:20 ` Eric Sandeen 2015-08-04 15:30 ` Jan Tulak 0 siblings, 1 reply; 17+ messages in thread From: Eric Sandeen @ 2015-08-03 17:20 UTC (permalink / raw) To: Jan Tulak, Christoph Hellwig; +Cc: xfs On 8/3/15 3:40 AM, Jan Tulak wrote: > > > ----- Original Message ----- >> From: "Christoph Hellwig" <hch@infradead.org> >> >> On Tue, Jul 21, 2015 at 08:39:36AM -0400, Jan Tulak wrote: >>> I just found that while it is possible to get blkid on OS X, it is >>> in 1.0.0 version which doesn't have blkid_probe_get function. >>> I'm examining whether it is possible to get an updated version there, >>> but right now, this patch breaks OS X support. Unfortunately I didn't >>> noticed of this before, as the OS X port was terribly out of date. >>> >>> So this patch shouldn't be included until I find how to get around. >> >> I don't think this is a lbocker given that OSX support doesn't >> even work. >> >> To the contrary I'd really prefer to go in ASAP to avoid anyone >> relying on it longer than nessecary. > > I tried to get newer blkid on OSX, but so far without a big success > (well, it looks like a kind of a small dependency hell that would > have to be ported, with bigger or smaller effort...). With regards > on the priorities, I think if we can make the OS X support in > "manual patching required" way, then? > > So lets include this patch, and just note it OS X doc "you have to revert > commit XXX and re-apply any changes to the relevant code"? IIRC block device signature detection isn't really required, it's just a nice-to-have; perhaps if blkid isn't present, that functionality can simply be disabled? -Eric _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3] xfsprogs: blkid is now mandatory 2015-08-03 17:20 ` Eric Sandeen @ 2015-08-04 15:30 ` Jan Tulak 2015-08-04 16:24 ` Eric Sandeen 0 siblings, 1 reply; 17+ messages in thread From: Jan Tulak @ 2015-08-04 15:30 UTC (permalink / raw) To: Eric Sandeen; +Cc: Christoph Hellwig, xfs ----- Original Message ----- > From: "Eric Sandeen" <sandeen@redhat.com> > To: "Jan Tulak" <jtulak@redhat.com>, "Christoph Hellwig" <hch@infradead.org> > Cc: xfs@oss.sgi.com > Sent: Monday, August 3, 2015 7:20:05 PM > Subject: Re: [PATCH v3] xfsprogs: blkid is now mandatory > > On 8/3/15 3:40 AM, Jan Tulak wrote: > > > > > > ----- Original Message ----- > >> From: "Christoph Hellwig" <hch@infradead.org> > >> > >> On Tue, Jul 21, 2015 at 08:39:36AM -0400, Jan Tulak wrote: > >>> I just found that while it is possible to get blkid on OS X, it is > >>> in 1.0.0 version which doesn't have blkid_probe_get function. > >>> I'm examining whether it is possible to get an updated version there, > >>> but right now, this patch breaks OS X support. Unfortunately I didn't > >>> noticed of this before, as the OS X port was terribly out of date. > >>> > >>> So this patch shouldn't be included until I find how to get around. > >> > >> I don't think this is a lbocker given that OSX support doesn't > >> even work. > >> > >> To the contrary I'd really prefer to go in ASAP to avoid anyone > >> relying on it longer than nessecary. > > > > I tried to get newer blkid on OSX, but so far without a big success > > (well, it looks like a kind of a small dependency hell that would > > have to be ported, with bigger or smaller effort...). With regards > > on the priorities, I think if we can make the OS X support in > > "manual patching required" way, then? > > > > So lets include this patch, and just note it OS X doc "you have to revert > > commit XXX and re-apply any changes to the relevant code"? > > IIRC block device signature detection isn't really required, it's just > a nice-to-have; perhaps if blkid isn't present, that functionality can > simply be disabled? Signature detection (if I understand you correctly 'signature of existing FS') could be really disabled, I think. That would take care of check_overwrite(). However, blkid is also used in get_topology. That one calls blkid_get_topology, which uses blkid's functions for finding out sector and io sizes. What I really can do is to say "on osx, you can mkfs only files," and cut out the blkid parts. But it limits the usage on OS X even further. Although, the removed code for non-blkid systems used platform_findsizes as fallback. Are there some ugly, terrible monsters who would jump from under the bed when doing that? However, this patch affects only mkfs. It still should be possible to use xfs_db and xfs_repair even on block devices. Cheers, Jan -- Jan Tulak jtulak@redhat.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3] xfsprogs: blkid is now mandatory 2015-08-04 15:30 ` Jan Tulak @ 2015-08-04 16:24 ` Eric Sandeen 2015-08-06 13:13 ` Jan Tulak 0 siblings, 1 reply; 17+ messages in thread From: Eric Sandeen @ 2015-08-04 16:24 UTC (permalink / raw) To: Jan Tulak, Eric Sandeen; +Cc: Christoph Hellwig, xfs On 8/4/15 8:30 AM, Jan Tulak wrote: > > > ----- Original Message ----- >> From: "Eric Sandeen" <sandeen@redhat.com> >> To: "Jan Tulak" <jtulak@redhat.com>, "Christoph Hellwig" <hch@infradead.org> >> Cc: xfs@oss.sgi.com >> Sent: Monday, August 3, 2015 7:20:05 PM >> Subject: Re: [PATCH v3] xfsprogs: blkid is now mandatory >> >> On 8/3/15 3:40 AM, Jan Tulak wrote: >>> >>> >>> ----- Original Message ----- >>>> From: "Christoph Hellwig" <hch@infradead.org> >>>> >>>> On Tue, Jul 21, 2015 at 08:39:36AM -0400, Jan Tulak wrote: >>>>> I just found that while it is possible to get blkid on OS X, it is >>>>> in 1.0.0 version which doesn't have blkid_probe_get function. >>>>> I'm examining whether it is possible to get an updated version there, >>>>> but right now, this patch breaks OS X support. Unfortunately I didn't >>>>> noticed of this before, as the OS X port was terribly out of date. >>>>> >>>>> So this patch shouldn't be included until I find how to get around. >>>> >>>> I don't think this is a lbocker given that OSX support doesn't >>>> even work. >>>> >>>> To the contrary I'd really prefer to go in ASAP to avoid anyone >>>> relying on it longer than nessecary. >>> >>> I tried to get newer blkid on OSX, but so far without a big success >>> (well, it looks like a kind of a small dependency hell that would >>> have to be ported, with bigger or smaller effort...). With regards >>> on the priorities, I think if we can make the OS X support in >>> "manual patching required" way, then? >>> >>> So lets include this patch, and just note it OS X doc "you have to revert >>> commit XXX and re-apply any changes to the relevant code"? >> >> IIRC block device signature detection isn't really required, it's just >> a nice-to-have; perhaps if blkid isn't present, that functionality can >> simply be disabled? > > Signature detection (if I understand you correctly 'signature of existing > FS') could be really disabled, I think. That would take care of > check_overwrite(). However, blkid is also used in get_topology. That one > calls blkid_get_topology, which uses blkid's functions for finding out > sector and io sizes. Well, it would be sane to default to 512 sectors; if that fails it'll be obvious fairly quickly, and the user can always use the command line to specify 4k sectors (or stripe alignment, etc) manually. > What I really can do is to say "on osx, you can mkfs only files," and cut bleah! ;) > out the blkid parts. But it limits the usage on OS X even further. > Although, the removed code for non-blkid systems used platform_findsizes > as fallback. Are there some ugly, terrible monsters who would jump from > under the bed when doing that? Well, the old findsizes was there for this reason, but now it's gone ;) > However, this patch affects only mkfs. It still should be possible to use > xfs_db and xfs_repair even on block devices. I don't know how invasive it'd be, but I think in the absence of blkid, we should still work, but lose signature detection, and fall back to geometry defaults. -Eric _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3] xfsprogs: blkid is now mandatory 2015-08-04 16:24 ` Eric Sandeen @ 2015-08-06 13:13 ` Jan Tulak 2015-08-11 16:40 ` Jan Tulak 0 siblings, 1 reply; 17+ messages in thread From: Jan Tulak @ 2015-08-06 13:13 UTC (permalink / raw) To: Eric Sandeen; +Cc: Christoph Hellwig, Eric Sandeen, xfs ----- Original Message ----- > From: "Eric Sandeen" <sandeen@sandeen.net> > > Signature detection (if I understand you correctly 'signature of existing > > FS') could be really disabled, I think. That would take care of > > check_overwrite(). However, blkid is also used in get_topology. That one > > calls blkid_get_topology, which uses blkid's functions for finding out > > sector and io sizes. > > Well, it would be sane to default to 512 sectors; if that fails it'll > be obvious fairly quickly, and the user can always use the command line > to specify 4k sectors (or stripe alignment, etc) manually. > > > What I really can do is to say "on osx, you can mkfs only files," and cut > > bleah! ;) > > > out the blkid parts. But it limits the usage on OS X even further. > > Although, the removed code for non-blkid systems used platform_findsizes > > as fallback. Are there some ugly, terrible monsters who would jump from > > under the bed when doing that? > > Well, the old findsizes was there for this reason, but now it's gone ;) platform_findsizes is still there, in the "is file" branch. Small ifdef can put it instead of blkid... > > > However, this patch affects only mkfs. It still should be possible to use > > xfs_db and xfs_repair even on block devices. > > I don't know how invasive it'd be, but I think in the absence of blkid, > we should still work, but lose signature detection, and fall back to geometry > defaults. It looks like it works. Though I need to do some testing before I send the patch. Unfortunately, making FS tests without the ability to mount it on the machine requires USB drive shuffling and it is hard to automate it... :-) What I think about is whether to write some warning in autoconf. Because it is easy to forget to install libblkid-dev package on linux and with this patch, it chancan change the behaviour unexpectedly when using autoconf for blkid detection. Or maybe I could require blkid by default, and disable it with an argument like LOCAL_CONFIGURE_OPTIONS="--enable-blkid=no". I think the config option is a better way - it can't happen you disable it just because you forget to install a package. Cheers, Jan -- Jan Tulak jtulak@redhat.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3] xfsprogs: blkid is now mandatory 2015-08-06 13:13 ` Jan Tulak @ 2015-08-11 16:40 ` Jan Tulak 0 siblings, 0 replies; 17+ messages in thread From: Jan Tulak @ 2015-08-11 16:40 UTC (permalink / raw) To: Eric Sandeen; +Cc: Christoph Hellwig, xfs [-- Attachment #1.1: Type: text/plain, Size: 847 bytes --] On Thu, Aug 6, 2015 at 3:13 PM, Jan Tulak <jtulak@redhat.com> wrote: > > It looks like it works. Though I need to do some testing before I send the patch. > Unfortunately, making FS tests without the ability to mount it on the machine > requires USB drive shuffling and it is hard to automate it... :-) > (Sorry for spam, Eric, resubmitting it with mailing list in cc) My hope was premature. After long searching for "why there is not created any FS," I found that using mkfs on OS X on block devices probably wasn't ever enabled. Some platform_ functions in libxfs/darwin.h used for block device work are empty (so it just silently fails). I edited the doc/INSTALL respectively and once I check and clean the patches, I submit the updates in the compatibility patchset with block devices disabled. Cheers, Jan -- Jan Tulak jtulak@redhat.com [-- Attachment #1.2: Type: text/html, Size: 1332 bytes --] [-- Attachment #2: Type: text/plain, Size: 121 bytes --] _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3] xfsprogs: blkid is now mandatory 2015-07-08 9:14 ` [PATCH v3] " Jan Tulak 2015-07-21 12:39 ` Jan Tulak @ 2015-07-26 16:28 ` Christoph Hellwig 1 sibling, 0 replies; 17+ messages in thread From: Christoph Hellwig @ 2015-07-26 16:28 UTC (permalink / raw) To: Jan Tulak; +Cc: hch, sandeen, xfs On Wed, Jul 08, 2015 at 11:14:53AM +0200, Jan Tulak wrote: > Because blkid is here for a long time, I hereby propose a patch for > removing support for NOT having blkid. The current support through > set of #ifdef is prone to errors like > making a patch just in one of the branches, and according to a > recent talk between Christoph and Eric, it is not necessary to keep > it supported. > > Remove code for checking ENABLE_BLKID, and the code when > ENABLE_BLKID is not defined. The only use of libdisk was in the > removed code, so remove libdisk too. It makes blkid required for > compilation. > > Signed-off-by: Jan Tulak <jtulak@redhat.com> > --- > Makefile | 6 +- > configure.ac | 6 +- > debian/rules | 2 +- > include/Makefile | 2 +- > include/builddefs.in | 2 - > include/fstyp.h | 43 ----- > libdisk/Makefile | 37 ----- > libdisk/dm.c | 112 ------------- > libdisk/drivers.c | 82 ---------- > libdisk/drivers.h | 45 ------ > libdisk/evms.c | 68 -------- > libdisk/evms.h | 32 ---- > libdisk/fstype.c | 442 --------------------------------------------------- > libdisk/fstype.h | 334 -------------------------------------- > libdisk/lvm.c | 117 -------------- > libdisk/md.c | 119 -------------- > libdisk/md.h | 67 -------- > libdisk/pttype.c | 118 -------------- > libdisk/pttype.h | 50 ------ > libdisk/xvm.c | 93 ----------- > libdisk/xvm.h | 53 ------ > m4/package_blkid.m4 | 20 ++- > mkfs/Makefile | 22 +-- > mkfs/fstyp.c | 59 ------- > mkfs/xfs_mkfs.c | 100 +----------- > po/de.po | 51 ------ > po/pl.po | 49 ------ > 27 files changed, 16 insertions(+), 2115 deletions(-) > delete mode 100644 include/fstyp.h > delete mode 100644 libdisk/Makefile > delete mode 100644 libdisk/dm.c > delete mode 100644 libdisk/drivers.c > delete mode 100644 libdisk/drivers.h > delete mode 100644 libdisk/evms.c > delete mode 100644 libdisk/evms.h > delete mode 100644 libdisk/fstype.c > delete mode 100644 libdisk/fstype.h > delete mode 100644 libdisk/lvm.c > delete mode 100644 libdisk/md.c > delete mode 100644 libdisk/md.h > delete mode 100644 libdisk/pttype.c > delete mode 100644 libdisk/pttype.h > delete mode 100644 libdisk/xvm.c > delete mode 100644 libdisk/xvm.h > delete mode 100644 mkfs/fstyp.c > > diff --git a/Makefile b/Makefile > index 6d6803b..798f02a 100644 > --- a/Makefile > +++ b/Makefile > @@ -43,7 +43,7 @@ endif > # header install rules to populate include/xfs correctly > HDR_SUBDIRS = include libxfs > > -DLIB_SUBDIRS = libxlog libxcmd libhandle libdisk > +DLIB_SUBDIRS = libxlog libxcmd libhandle > LIB_SUBDIRS = libxfs $(DLIB_SUBDIRS) > TOOL_SUBDIRS = copy db estimate fsck fsr growfs io logprint mkfs quota \ > mdrestore repair rtcp m4 man doc po debian > @@ -71,10 +71,6 @@ quota: libxcmd > repair: libxlog > > > -ifneq ($(ENABLE_BLKID), yes) > -mkfs: libdisk > -endif > - > ifeq ($(HAVE_BUILDDEFS), yes) > include $(BUILDRULES) > else > diff --git a/configure.ac b/configure.ac > index fe991cc..fac3ea7 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -37,10 +37,6 @@ AC_ARG_ENABLE(termcap, > test $enable_termcap = yes && libtermcap="-ltermcap",) > AC_SUBST(libtermcap) > > -# AC_HAVE_BLKID_TOPO below wil find the library & check for topo support > -AC_ARG_ENABLE(blkid, > -[ --enable-blkid=[yes/no] Enable block device id library [default=yes]],, > - enable_blkid=yes) > > AC_ARG_ENABLE(lib64, > [ --enable-lib64=[yes/no] Enable lib64 support [default=yes]],, > @@ -111,7 +107,7 @@ AC_HAVE_FALLOCATE > AC_HAVE_FIEMAP > AC_HAVE_PREADV > AC_HAVE_SYNC_FILE_RANGE > -AC_HAVE_BLKID_TOPO($enable_blkid) > +AC_HAVE_BLKID_TOPO > AC_HAVE_READDIR > > AC_CHECK_SIZEOF([long]) > diff --git a/debian/rules b/debian/rules > index 27b043f..10d04f8 100755 > --- a/debian/rules > +++ b/debian/rules > @@ -47,7 +47,7 @@ dibuild: > for dir in include libxfs; do \ > $(MAKE) -C $$dir NODEP=1 install-headers; \ > done; \ > - for dir in include libxfs libdisk mkfs; do \ > + for dir in include libxfs mkfs; do \ > $(MAKE) -C $$dir; \ > done; \ > mv mkfs/mkfs.xfs mkfs/mkfs.xfs-$(bootpkg); \ > diff --git a/include/Makefile b/include/Makefile > index 91b33b0..63a7748 100644 > --- a/include/Makefile > +++ b/include/Makefile > @@ -46,7 +46,7 @@ HFILES = handle.h \ > xqm.h > > PHFILES = darwin.h freebsd.h irix.h linux.h gnukfreebsd.h > -DKHFILES = volume.h fstyp.h dvh.h > +DKHFILES = volume.h dvh.h These two aren't useful without libdisk, so they should be removed from the repository an the Makefile as well. Otherwise looks good, Reviewed-by: Christoph Hellwig <hch@lst.de> _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2015-08-11 16:41 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-07-01 16:01 [PATCH] xfsprogs: blkid is now mandatory Jan Tulak 2015-07-01 22:55 ` Dave Chinner 2015-07-02 10:27 ` Jan Tulak 2015-07-02 10:43 ` [PATCH v2] " Jan Tulak 2015-07-03 15:19 ` Christoph Hellwig 2015-07-03 23:45 ` Dave Chinner 2015-07-07 15:10 ` Jan Tulak 2015-07-08 9:14 ` [PATCH v3] " Jan Tulak 2015-07-21 12:39 ` Jan Tulak 2015-07-26 16:25 ` Christoph Hellwig 2015-08-03 10:40 ` Jan Tulak 2015-08-03 17:20 ` Eric Sandeen 2015-08-04 15:30 ` Jan Tulak 2015-08-04 16:24 ` Eric Sandeen 2015-08-06 13:13 ` Jan Tulak 2015-08-11 16:40 ` Jan Tulak 2015-07-26 16:28 ` Christoph Hellwig
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox