From: Karel Zak Date: Mon, 8 Dec 2008 14:00:03 +0000 (+0100) Subject: build-sys: remove use of devmapper library X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=882b0da3305baa1689d39eca0b4822d7e112d036;p=util-linux build-sys: remove use of devmapper library Signed-off-by: Karel Zak --- diff --git a/configure.ac b/configure.ac index 25ba6748..ca1189e8 100644 --- a/configure.ac +++ b/configure.ac @@ -642,47 +642,6 @@ else esac fi -# TODO remove devmapper from blkid -# -AC_ARG_ENABLE([blkid-devmapper], - AS_HELP_STRING([--enable-blkid-devmapper], [build with device-mapper support]), - [], with_blkid-devmapper=no -) -if test x$with_devmapper = xno; then - AC_MSG_RESULT([Disabling device-mapper support]) - AM_CONDITIONAL(HAVE_DEVMAPPER, false) - DEVMAPPER_LIBS_STATIC='' - DEVMAPPER_REQ='' - DEVMAPPER_PC_LIBS='' - DEVMAPPER_LIBS='' -else - AC_MSG_RESULT([Enabling device-mapper support]) - UTIL_CHECK_LIB(devmapper, dm_tree_create) - case $with_blkid-devmapper:$have_blkid-devmapper in - yes:no) AC_MSG_ERROR([devmapper selected but libdevmapper not found]);; - esac - UTIL_PKG_STATIC([DEVMAPPER_LIBS_STATIC], [devmapper]) - DEVMAPPER_LIBS="-ldevmapper" - DEVMAPPER_REQ="devmapper" - DEVMAPPER_PC_LIBS="-ldevmapper" - - # work around stupid devmapper.pc bug in Debian - case "$DEVMAPPER_LIBS_STATIC" in - *pthread*) - ;; - *) - AC_MSG_WARN([Working around Debian bug 390243...]) - DEVMAPPER_LIBS_STATIC="-pthread $DEVMAPPER_LIBS_STATIC" - ;; - esac -fi - -AC_SUBST([DEVMAPPER_LIBS]) -AC_SUBST([DEVMAPPER_REQ]) -AC_SUBST([DEVMAPPER_PC_LIBS]) -AC_SUBST([DEVMAPPER_LIBS_STATIC]) - - AC_ARG_ENABLE([schedutils], AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, teskset]), [], enable_schedutils=yes diff --git a/libs/blkid/TODO b/libs/blkid/TODO index 2c804996..ad7c8f94 100644 --- a/libs/blkid/TODO +++ b/libs/blkid/TODO @@ -3,6 +3,10 @@ - add hex-encoding from libudev + - do we really need to depend on libuuid? Maybe the default should be + use in-tree code rather and link against libuuid -- especially when we + need it for uuid_unparse() only. + - add blkid -o | --format=full|value|udev - consolidate "getsize" stuff (see getsize.c and lib/blkdev.c) diff --git a/libs/blkid/blkid.pc.in b/libs/blkid/blkid.pc.in index db03cc13..dd58fbb1 100644 --- a/libs/blkid/blkid.pc.in +++ b/libs/blkid/blkid.pc.in @@ -6,7 +6,6 @@ includedir=@includedir@ Name: blkid Description: Block device id library Version: @BLKID_VERSION@ -Requires: uuid @DEVMAPPER_REQ@ Cflags: -I${includedir} Libs: -L${libdir} -lblkid -Libs.private: @DEVMAPPER_PC_LIBS@ +Libs.private: uuid diff --git a/libs/blkid/src/Makefile.am b/libs/blkid/src/Makefile.am index a9702b2d..cf43a734 100644 --- a/libs/blkid/src/Makefile.am +++ b/libs/blkid/src/Makefile.am @@ -23,9 +23,6 @@ blkid_SONAME = $(blkid_IMAGE).$(BLKID_VERSION_MAJOR) blkid_LINKS = $(blkid_IMAGE) $(blkid_SONAME) blkid_OTHERLDADD = -if HAVE_DEVMAPPER -blkid_OTHERLDADD += $(DEVMAPPER_LIBS) -endif if HAVE_UUID blkid_OTHERLDADD += -luuid #TODO $(UUID_LIBS) endif diff --git a/libs/blkid/src/devname.c b/libs/blkid/src/devname.c index 79c34135..5b1b64be 100644 --- a/libs/blkid/src/devname.c +++ b/libs/blkid/src/devname.c @@ -38,12 +38,6 @@ #include "blkidP.h" -#undef HAVE_DEVMAPPER - -#ifdef HAVE_DEVMAPPER -#include -#endif - /* * Find a dev struct in the cache by device name, if available. * @@ -120,10 +114,6 @@ blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags) return dev; } -#ifdef HAVE_DEVMAPPER -static int dm_device_is_leaf(const dev_t dev); -#endif - /* Directories where we will try to search for device names */ static const char *dirlist[] = { "/dev", "/devfs", "/devices", NULL }; @@ -142,10 +132,6 @@ static void probe_one(blkid_cache cache, const char *ptname, list_for_each_safe(p, pnext, &cache->bic_devs) { blkid_dev tmp = list_entry(p, struct blkid_struct_dev, bid_devs); -#ifdef HAVE_DEVMAPPER - if (!dm_device_is_leaf(devno)) - continue; -#endif if (tmp->bid_devno == devno) { if (only_if_new && !access(tmp->bid_name, F_OK)) return; @@ -202,183 +188,6 @@ set_pri: return; } -#ifdef HAVE_DEVMAPPER -static void dm_quiet_log(int level __BLKID_ATTR((unused)), - const char *file __BLKID_ATTR((unused)), - int line __BLKID_ATTR((unused)), - const char *f __BLKID_ATTR((unused)), ...) -{ - return; -} - -/* - * device-mapper support - */ -static int dm_device_has_dep(const dev_t dev, const char *name) -{ - struct dm_task *task; - struct dm_deps *deps; - struct dm_info info; - unsigned int i; - int ret = 0; - - task = dm_task_create(DM_DEVICE_DEPS); - if (!task) - goto out; - - if (!dm_task_set_name(task, name)) - goto out; - - if (!dm_task_run(task)) - goto out; - - if (!dm_task_get_info(task, &info)) - goto out; - - if (!info.exists) - goto out; - - deps = dm_task_get_deps(task); - if (!deps || deps->count == 0) - goto out; - - for (i = 0; i < deps->count; i++) { - dev_t dep_dev = deps->device[i]; - - if (dev == dep_dev) { - ret = 1; - goto out; - } - } - -out: - if (task) - dm_task_destroy(task); - - return ret; -} - -static int dm_device_is_leaf(const dev_t dev) -{ - struct dm_task *task; - struct dm_names *names; - unsigned int next = 0; - int n, ret = 1; - - dm_log_init(dm_quiet_log); - task = dm_task_create(DM_DEVICE_LIST); - if (!task) - goto out; - - dm_log_init(0); - - if (!dm_task_run(task)) - goto out; - - names = dm_task_get_names(task); - if (!names || !names->dev) - goto out; - - n = 0; - do { - names = (struct dm_names *) ((char *)names + next); - - if (dm_device_has_dep(dev, names->name)) - ret = 0; - - next = names->next; - } while (next); - -out: - if (task) - dm_task_destroy(task); - - return ret; -} - -static dev_t dm_get_devno(const char *name) -{ - struct dm_task *task; - struct dm_info info; - dev_t ret = 0; - - task = dm_task_create(DM_DEVICE_INFO); - if (!task) - goto out; - - if (!dm_task_set_name(task, name)) - goto out; - - if (!dm_task_run(task)) - goto out; - - if (!dm_task_get_info(task, &info)) - goto out; - - if (!info.exists) - goto out; - - ret = makedev(info.major, info.minor); - -out: - if (task) - dm_task_destroy(task); - - return ret; -} - -static void dm_probe_all(blkid_cache cache, int only_if_new) -{ - struct dm_task *task; - struct dm_names *names; - unsigned int next = 0; - int n; - - dm_log_init(dm_quiet_log); - task = dm_task_create(DM_DEVICE_LIST); - if (!task) - goto out; - dm_log_init(0); - - if (!dm_task_run(task)) - goto out; - - names = dm_task_get_names(task); - if (!names || !names->dev) - goto out; - - n = 0; - do { - int rc; - char *device = NULL; - dev_t dev = 0; - - names = (struct dm_names *) ((char *)names + next); - - rc = asprintf(&device, "mapper/%s", names->name); - if (rc < 0) - goto try_next; - - dev = dm_get_devno(names->name); - if (dev == 0) - goto try_next; - - if (!dm_device_is_leaf(dev)) - goto try_next; - - probe_one(cache, device, dev, BLKID_PRI_DM, only_if_new); - -try_next: - free(device); - next = names->next; - } while (next); - -out: - if (task) - dm_task_destroy(task); -} -#endif /* HAVE_DEVMAPPER */ - #define PROC_PARTITIONS "/proc/partitions" #define VG_DIR "/proc/lvm/VGs" @@ -532,9 +341,6 @@ static int probe_all(blkid_cache cache, int only_if_new) return 0; blkid_read_cache(cache); -#ifdef HAVE_DEVMAPPER - dm_probe_all(cache, only_if_new); -#endif evms_probe_all(cache, only_if_new); #ifdef VG_DIR lvm_probe_all(cache, only_if_new);