]> sourceware.org Git - lvm2.git/commitdiff
Tidy various pre-processing incl. making libdl optional.
authorAlasdair Kergon <agk@redhat.com>
Mon, 24 Mar 2003 18:08:53 +0000 (18:08 +0000)
committerAlasdair Kergon <agk@redhat.com>
Mon, 24 Mar 2003 18:08:53 +0000 (18:08 +0000)
51 files changed:
configure
configure.in
lib/Makefile.in
lib/activate/activate.c
lib/activate/dev_manager.c
lib/activate/dev_manager.h
lib/cache/cache.c
lib/cache/cache.h
lib/commands/toolcontext.c
lib/config/config.c
lib/config/config.h
lib/config/defaults.h
lib/datastruct/bitset.h
lib/datastruct/btree.h
lib/datastruct/hash.h
lib/datastruct/list.h
lib/datastruct/lvm-types.h
lib/device/dev-cache.c
lib/device/dev-cache.h
lib/device/device.c
lib/device/device.h
lib/display/display.c
lib/filters/filter.c
lib/filters/filter.h
lib/format1/disk-rep.c
lib/format1/import-export.c
lib/format_text/format-text.c
lib/label/label.c
lib/label/label.h
lib/locking/external_locking.c
lib/locking/locking.c
lib/log/log.h
lib/metadata/metadata.c
lib/metadata/metadata.h
lib/misc/crc.h
lib/misc/lib.h
lib/misc/sharedlib.h
lib/mm/dbg_malloc.h
lib/report/report.c
lib/uuid/uuid.h
libdm/datastruct/list.h
make.tmpl.in
tools/Makefile.in
tools/archive.c
tools/lvcreate.c
tools/lvm.c
tools/lvmdiskscan.c
tools/pvcreate.c
tools/vgconvert.c
tools/vgreduce.c
tools/vgremove.c

index 3c94eb3b578f618218bd79dad7338ae061e155bc..844bac9fa4b3e626bd725edb4ad1bf6995a501f8 100755 (executable)
--- a/configure
+++ b/configure
@@ -2005,9 +2005,55 @@ Note: (n)curses also seems to work as a substitute for termcap.  This was
 fi
 fi
 
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:2010: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2018 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:2029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  HAVE_LIBDL=yes
+else
+  echo "$ac_t""no" 1>&6
+HAVE_LIBDL=no
+fi
+
+
+if test x$HAVE_LIBDL = xyes; then
+       LIBS="-ldl $LIBS"
+fi
+
 if test x$READLINE = xyes; then
        echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
-echo "configure:2011: checking for readline in -lreadline" >&5
+echo "configure:2057: checking for readline in -lreadline" >&5
 ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2015,7 +2061,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lreadline  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2019 "configure"
+#line 2065 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2026,7 +2072,7 @@ int main() {
 readline()
 ; return 0; }
 EOF
-if { (eval echo configure:2030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2063,12 +2109,12 @@ package as well (which may be called readline-devel or something similar).
 fi
 
        echo $ac_n "checking for rl_completion_matches""... $ac_c" 1>&6
-echo "configure:2067: checking for rl_completion_matches" >&5
+echo "configure:2113: checking for rl_completion_matches" >&5
 if eval "test \"`echo '$''{'ac_cv_func_rl_completion_matches'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2072 "configure"
+#line 2118 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char rl_completion_matches(); below.  */
@@ -2091,7 +2137,7 @@ rl_completion_matches();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_rl_completion_matches=yes"
 else
@@ -2130,6 +2176,7 @@ fi
 
 
 
+
 trap '' 1 2 15
 cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
@@ -2308,6 +2355,7 @@ s%@GROUP@%$GROUP%g
 s%@LVM_VERSION@%$LVM_VERSION%g
 s%@DEBUG@%$DEBUG%g
 s%@DEVMAPPER@%$DEVMAPPER%g
+s%@HAVE_LIBDL@%$HAVE_LIBDL%g
 
 CEOF
 EOF
index f570f516e6fae052821430548231930661981ba6..b993b6a8ae7e0192cd986f9836e6920bb3f87851 100644 (file)
@@ -121,6 +121,13 @@ Note: (n)curses also seems to work as a substitute for termcap.  This was
        )
 fi
 
+dnl Check for dlopen
+AC_CHECK_LIB(dl, dlopen, HAVE_LIBDL=yes, HAVE_LIBDL=no)
+
+if test x$HAVE_LIBDL = xyes; then
+       LIBS="-ldl $LIBS"
+fi
+
 dnl Check for readline (Shamelessly copied from parted 1.4.17)
 if test x$READLINE = xyes; then
        AC_CHECK_LIB(readline, readline, ,
@@ -155,6 +162,7 @@ AC_SUBST(LIBS)
 AC_SUBST(LVM_VERSION)
 AC_SUBST(DEBUG)
 AC_SUBST(DEVMAPPER)
+AC_SUBST(HAVE_LIBDL)
 dnl First and last lines should not contain files to generate in order to 
 dnl keep utility scripts running properly
 AC_OUTPUT(                                                             \
index 433dccc9c9dc88f514d290ead03b6d0792f2b211..880ecc6fd2d702380256299de5afc9ec3047903a 100644 (file)
@@ -36,7 +36,6 @@ SOURCES=\
        format_text/import_vsn1.c \
        format_text/text_label.c \
        label/label.c \
-       locking/external_locking.c \
        locking/file_locking.c \
        locking/locking.c \
        locking/no_locking.c \
@@ -79,6 +78,11 @@ ifeq ("@DEVMAPPER@", "yes")
        activate/fs.c
 endif
 
+ifeq ("@HAVE_LIBDL@", "yes")
+  SOURCES+=\
+       locking/external_locking.c
+endif
+
 TARGETS=liblvm.a
 
 include ../make.tmpl
index 53675bb6c5c287ea28f560cc27409c20239767a1..ec623f3fc5cc09269e208d93424a7815c77c67f0 100644 (file)
@@ -15,7 +15,6 @@
 #include "dev_manager.h"
 
 #include <limits.h>
-#include <linux/kdev_t.h>
 #include <fcntl.h>
 
 #define _skip(fmt, args...) log_very_verbose("Skipping: " fmt , ## args)
index adcf12635699ded6601c996390afa5b5c88c0147..6e8e851d84df41b3f6f33afca594f21cd33cd105 100644 (file)
@@ -671,7 +671,7 @@ static int _populate_origin(struct dev_manager *dm,
 
        log_debug("Adding target: 0 %" PRIu64 " snapshot-origin %s",
                  dl->lv->size, params);
-       if (!dm_task_add_target(dmt, __UINT64_C(0), dl->lv->size,
+       if (!dm_task_add_target(dmt, UINT64_C(0), dl->lv->size,
                                "snapshot-origin", params)) {
                stack;
                return 0;
@@ -712,7 +712,7 @@ static int _populate_snapshot(struct dev_manager *dm,
        log_debug("Adding target: 0 %" PRIu64 " snapshot %s",
                  s->origin->size, params);
        if (!dm_task_add_target
-           (dmt, __UINT64_C(0), s->origin->size, "snapshot", params)) {
+           (dmt, UINT64_C(0), s->origin->size, "snapshot", params)) {
                stack;
                return 0;
        }
index cbbd758fd2836984a78662071a6fefc22b8d605b..ccf956001ead26ab4a9bc6f282341674b1c026bf 100644 (file)
@@ -9,9 +9,8 @@
 
 #include "metadata.h"
 
-#include <libdevmapper.h>
-
 struct dev_manager;
+struct dm_info;
 
 /*
  * Constructor and destructor.
index 63cabe284ac521c5f2dfcd8d1b66e7e0187729bf..a3b5eccc1f78edc83034ae0d00284feecfaba45d 100644 (file)
@@ -13,8 +13,6 @@
 #include "metadata.h"
 #include "filter.h"
 
-#include <linux/kdev_t.h>
-
 static struct hash_table *_pvid_hash = NULL;
 static struct hash_table *_vgid_hash = NULL;
 static struct hash_table *_vgname_hash = NULL;
index 446e8ebbcc00288321f1cc6e711feb22de096787..e790d302ded7beba1ca07194a9f165eb6d6e9cda 100644 (file)
@@ -9,13 +9,10 @@
 #define _LVM_CACHE_H
 
 #include "dev-cache.h"
-#include "list.h"
 #include "uuid.h"
 #include "label.h"
 #include "metadata.h"
 
-#include <sys/types.h>
-
 #define ORPHAN ""
 
 #define CACHE_INVALID 0x00000001
index 3427888c37a6da978c11fa4284cc6bf9320d0ddc..889815f57a291b33a3cc3f73a5da7a0ea304ff61 100644 (file)
 #include "label.h"
 #include "lvm-file.h"
 #include "format-text.h"
-#include "sharedlib.h"
 #include "display.h"
 
+#ifdef HAVE_LIBDL
+#include "sharedlib.h"
+#endif
+
 #ifdef LVM1_INTERNAL
 #include "format1.h"
 #endif
@@ -29,7 +32,6 @@
 #include <locale.h>
 #include <sys/stat.h>
 #include <syslog.h>
-#include <dlfcn.h>
 #include <time.h>
 
 static FILE *_log;
@@ -332,12 +334,10 @@ static int _init_formats(struct cmd_context *cmd)
 
        struct format_type *fmt;
        struct list *fmth;
-       struct config_node *cn;
-       struct config_value *cv;
-
-       struct format_type *(*init_format_fn) (struct cmd_context *);
 
-       void *lib;
+#ifdef HAVE_LIBDL
+       struct config_node *cn;
+#endif
 
        label_init();
 
@@ -348,9 +348,15 @@ static int _init_formats(struct cmd_context *cmd)
        list_add(&cmd->formats, &fmt->list);
 #endif
 
+#ifdef HAVE_LIBDL
        /* Load any formats in shared libs */
        if ((cn = find_config_node(cmd->cf->root, "global/format_libraries",
                                   '/'))) {
+
+               struct config_value *cv;
+               struct format_type *(*init_format_fn) (struct cmd_context *);
+               void *lib;
+
                for (cv = cn->v; cv; cv = cv->next) {
                        if (cv->type != CFG_STRING) {
                                log_error("Invalid string in config file: "
@@ -376,6 +382,7 @@ static int _init_formats(struct cmd_context *cmd)
                        list_add(&cmd->formats, &fmt->list);
                }
        }
+#endif
 
        if (!(fmt = create_text_format(cmd)))
                return 0;
@@ -469,8 +476,10 @@ static void _destroy_formats(struct list *formats)
                list_del(&fmt->list);
                lib = fmt->library;
                fmt->ops->destroy(fmt);
+#ifdef HAVE_LIBDL
                if (lib)
                        dlclose(lib);
+#endif
        }
 }
 
index a40877a9880d1b8727040801a486df194b2ca4a6..034b9b284345e8efc55e4c3cffcb3c4986edbf4f 100644 (file)
@@ -15,7 +15,6 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <ctype.h>
-#include <asm/page.h>
 
 enum {
        TOK_INT,
@@ -128,7 +127,7 @@ int read_config_fd(struct config_tree *cf, int fd, const char *file,
 
        if (size2) {
                /* FIXME Attempt adjacent mmaps MAP_FIXED into malloced space 
-                * one PAGE_SIZE larger than required...
+                * one page size larger than required...
                 */
                if (!(p->fb = dbg_malloc(size + size2))) {
                        stack;
@@ -151,7 +150,7 @@ int read_config_fd(struct config_tree *cf, int fd, const char *file,
                        goto out;
                }
        } else {
-               mmap_offset = offset % PAGE_SIZE;
+               mmap_offset = offset % getpagesize();
                /* memory map the file */
                p->fb = mmap((caddr_t) 0, size + mmap_offset, PROT_READ,
                             MAP_PRIVATE, fd, offset - mmap_offset);
index 3e9c095f217b5a2b90f722434423fc9d764fcf6a..872d07e1a5f2d3d1d42eb3a5a984562ddb40fb14 100644 (file)
@@ -7,9 +7,6 @@
 #ifndef _LVM_CONFIG_H
 #define _LVM_CONFIG_H
 
-#include <inttypes.h>
-#include <sys/types.h>
-
 enum {
        CFG_STRING,
        CFG_FLOAT,
index 8369507d54aa16cf7f7629d093fb2c6e3de48808..7961645e23b865b0d735eff051edc83abd4cab3d 100644 (file)
@@ -34,7 +34,7 @@
 #define DEFAULT_STRIPESIZE 64  /* KB */
 #define DEFAULT_PVMETADATASIZE 255
 #define DEFAULT_PVMETADATACOPIES 1
-#define DEFAULT_LABELSECTOR __UINT64_C(1)
+#define DEFAULT_LABELSECTOR UINT64_C(1)
 
 #define DEFAULT_MSG_PREFIX "  "
 #define DEFAULT_CMD_NAME 0
index 9943809cbb1312a989e17e4ccbaed115df4d283b..54693bbbae01b3c33e8dc0fa7cd859fcd48ce5ad 100644 (file)
@@ -7,7 +7,6 @@
 #ifndef _LVM_BITSET_H
 #define _LVM_BITSET_H
 
-#include "lvm-types.h"
 #include "pool.h"
 
 #include <limits.h>
index 4ae8770cd0a4253d2b372cc45b3e5d12b9bed484..79e2b396789412cb6333cdfe77ac53313323afc5 100644 (file)
@@ -7,7 +7,6 @@
 #ifndef _LVM_BTREE_H
 #define _LVM_BTREE_H
 
-#include "lvm-types.h"
 #include "pool.h"
 
 struct btree;
index 787c9806dcf2c02fbca26f3f80ba5414650d4b8f..bbf0697a95fd2eac3bb7a0fe783b57ac18ff63d2 100644 (file)
@@ -7,8 +7,6 @@
 #ifndef _LVM_HASH_H
 #define _LVM_HASH_H
 
-#include "lvm-types.h"
-
 struct hash_table;
 struct hash_node;
 
index 48ec81bf8a7c13876102bcd4d39e4f73e2776c09..0c6ca405b53c311ade07086aa5994bcc52411a3e 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef _LVM_LIST_H
 #define _LVM_LIST_H
 
+#include <assert.h>
+
 struct list {
        struct list *n, *p;
 };
index bba936c480350dd133964635a5a8a245f3a31afe..006916f8c009ddd7c9056220faa6d4d2ac1a53c7 100644 (file)
 #include <inttypes.h>
 
 /* Define some portable printing types */
-#if __WORDSIZE == 64
-#define PRIsize_t "lu"
-#else
-#define PRIsize_t "u"
+#if (SIZE_MAX == UINT64_MAX)
+#define PRIsize_t PRIu64
+#elif (SIZE_MAX == UINT32_MAX)
+#define PRIsize_t PRIu32
 #endif
 
 struct str_list {
index b1652859944d45406669bf12e8949dc570b3b431..37644ef4647fbed98d1a21883b637bd7c6d4304c 100644 (file)
 #include "list.h"
 #include "lvm-types.h"
 #include "btree.h"
+#include "filter.h"
 
-#include <sys/stat.h>
 #include <unistd.h>
 #include <sys/param.h>
 #include <dirent.h>
-#include <linux/kdev_t.h>
 
 struct dev_iter {
        struct btree_iter *current;
index 257c5ca9dea5f306a2d539eb6b48d1da2b3b3d3d..e867ce92116eb38120a6afd550b910af4d480aee 100644 (file)
@@ -7,7 +7,6 @@
 #ifndef _LVM_DEV_CACHE_H
 #define _LVM_DEV_CACHE_H
 
-#include <sys/types.h>
 #include "lvm-types.h"
 #include "device.h"
 
index 938974c8be2b140703d8081e6e55ca2b1b671497..8c28a6a4ad1d1f27a62ac4a492fd63f30e4af13c 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #if 0
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
 #include <stdio.h>
index 1e1d555de9a4c27da5665f30d261cedcec4e464b..9576cef7f252e54d691a229abe30b2ed6bfa301b 100644 (file)
@@ -7,8 +7,6 @@
 #ifndef _LVM_DEVICE_H
 #define _LVM_DEVICE_H
 
-#include "lvm-types.h"
-#include "list.h"
 #include "uuid.h"
 
 #define DEV_ACCESSED_W         0x00000001      /* Device written to? */
index 10bc66965cceef0645e054ce3be270f4e6b43d2a..7c78fc0d6fa2f60cd98afde835489289882d53a5 100644 (file)
@@ -70,16 +70,16 @@ uint64_t units_to_bytes(const char *units, char *unit_type)
        switch (*units) {
        case 'h':
        case 'H':
-               v = __UINT64_C(1);
+               v = UINT64_C(1);
                *unit_type = *units;
                break;
        case 's':
                v *= SECTOR_SIZE;
        case 'b':
        case 'B':
-               v *= __UINT64_C(1);
+               v *= UINT64_C(1);
                break;
-#define KILO __UINT64_C(1024)
+#define KILO UINT64_C(1024)
        case 'k':
                v *= KILO;
        case 'm':
@@ -92,7 +92,7 @@ uint64_t units_to_bytes(const char *units, char *unit_type)
                v *= KILO * KILO * KILO * KILO;
                break;
 #undef KILO
-#define KILO __UINT64_C(1000)
+#define KILO UINT64_C(1000)
        case 'K':
                v *= KILO;
                break;
@@ -167,7 +167,7 @@ const char *display_size(struct cmd_context *cmd, uint64_t size, size_len_t sl)
        int s;
        int suffix = 1;
        uint64_t byte;
-       uint64_t units = __UINT64_C(1024);
+       uint64_t units = UINT64_C(1024);
        char *size_buf = NULL;
        const char *size_str[][3] = {
                {" Terabyte", " TB", "T"},
@@ -193,20 +193,20 @@ const char *display_size(struct cmd_context *cmd, uint64_t size, size_len_t sl)
                    *size_str[s][2])
                        break;
 
-       if (size == __UINT64_C(0)) {
+       if (size == UINT64_C(0)) {
                sprintf(size_buf, "0%s", suffix ? size_str[s][sl] : "");
                return size_buf;
        }
 
        if (s < 8) {
                byte = cmd->current_settings.unit_factor;
-               size *= __UINT64_C(1024);
+               size *= UINT64_C(1024);
        } else {
                suffix = 1;
                if (cmd->current_settings.unit_type == 'H')
-                       units = __UINT64_C(1000);
+                       units = UINT64_C(1000);
                else
-                       units = __UINT64_C(1024);
+                       units = UINT64_C(1024);
                byte = units * units * units;
                s = 0;
                while (size_str[s] && size < byte)
index baf245b2e2f6d427ba2fb4f37db69e0a43d4ecf5..01cf80de6778c2b2607a0014e38ff2012fd93539 100644 (file)
 #include "config.h"
 
 #include <dirent.h>
-#include <sys/stat.h>
 #include <unistd.h>
 #include <ctype.h>
 #include <fcntl.h>
-#include <linux/kdev_t.h>
 
 #define NUMBER_OF_MAJORS 256
 
index f262d0964b247941bc9282408b049876871e166b..8c6bd9838bf78fe8671d012aa0bf9338ccf172ab 100644 (file)
@@ -23,6 +23,9 @@
 
 #include "config.h"
 
+#include <sys/stat.h>
+#include <linux/kdev_t.h>
+
 struct dev_filter *lvm_type_filter_create(const char *proc,
                                          struct config_node *cn);
 
index afc55493f8fd3fb49452b00cb5727cf51ca7af7a..a7aef0bddba0cced14a68abc84298caacc930ff1 100644 (file)
@@ -11,9 +11,7 @@
 #include "filter.h"
 #include "cache.h"
 
-#include <sys/stat.h>
 #include <fcntl.h>
-#include <linux/kdev_t.h>
 
 #define fail do {stack; return 0;} while(0)
 #define xx16(v) disk->v = xlate16(disk->v)
@@ -132,7 +130,7 @@ static int _munge_formats(struct pv_disk *pvd)
 
 static int _read_pvd(struct device *dev, struct pv_disk *pvd)
 {
-       if (dev_read(dev, __UINT64_C(0), sizeof(*pvd), pvd) != sizeof(*pvd)) {
+       if (dev_read(dev, UINT64_C(0), sizeof(*pvd), pvd) != sizeof(*pvd)) {
                log_very_verbose("Failed to read PV data from %s",
                                 dev_name(dev));
                return 0;
index eeafbe2e8ecdad6af957d5f0b605a77d0b081df5..0fb5f3d7977def034a04737cd64985a030670b8c 100644 (file)
 #include "hash.h"
 #include "list.h"
 #include "lvm-string.h"
+#include "filter.h"
 
 #include <time.h>
 #include <sys/utsname.h>
-#include <linux/kdev_t.h>
 
 static int _check_vg_name(const char *name)
 {
index 4956b9b961884dec20eebecc7191db271ec6704e..7ca9264eea954eeec86d211a0092f566a8c05f76 100644 (file)
@@ -1027,7 +1027,7 @@ static int _pv_write(const struct format_type *fmt, struct physical_volume *pv,
        }
        if (!add_da
            (fmt, NULL, &info->das, pv->pe_start << SECTOR_SHIFT,
-            __UINT64_C(0))) {
+            UINT64_C(0))) {
                stack;
                return 0;
        }
index 437828d8e8e6ef220583fb62f50c0eaec97f09af..1af5443da43879998c6d8d1c9eda2c7a74d1996c 100644 (file)
@@ -117,7 +117,7 @@ static struct labeller *_find_labeller(struct device *dev, char *buf,
                return NULL;
        }
 
-       if (dev_read(dev, __UINT64_C(0), LABEL_SCAN_SIZE, readbuf) !=
+       if (dev_read(dev, UINT64_C(0), LABEL_SCAN_SIZE, readbuf) !=
            LABEL_SCAN_SIZE) {
                log_debug("%s: Failed to read label area", dev_name(dev));
                goto out;
@@ -205,7 +205,7 @@ int label_remove(struct device *dev)
                return 0;
        }
 
-       if (dev_read(dev, __UINT64_C(0), LABEL_SCAN_SIZE, readbuf) !=
+       if (dev_read(dev, UINT64_C(0), LABEL_SCAN_SIZE, readbuf) !=
            LABEL_SCAN_SIZE) {
                log_debug("%s: Failed to read label area", dev_name(dev));
                goto out;
index 20d825c088c6eba3b87d5f8be3a18960c69e4c4f..b2dbc825f3576b24b18d1e059be1dfae4dbb525d 100644 (file)
@@ -8,7 +8,6 @@
 #define _LVM_LABEL_H
 
 #include "cache.h"
-#include "lvm-types.h"
 #include "uuid.h"
 #include "device.h"
 
index 0dcc8406953995c8029ed0a21bd9a1e44c009e40..718e179f1741fa1b016016cd8078990d24450e9f 100644 (file)
@@ -10,8 +10,6 @@
 #include "defaults.h"
 #include "sharedlib.h"
 
-#include <dlfcn.h>
-
 static void *_locking_lib = NULL;
 static void (*_end_fn) (void) = NULL;
 static int (*_lock_fn) (struct cmd_context * cmd, const char *resource,
index 6fecec61d90a99ff3de2aa1d58bc99ff908832aa..363ec843a55becc7b2026a633b036186ec72a82b 100644 (file)
@@ -107,11 +107,13 @@ int init_locking(int type, struct config_tree *cf)
                log_very_verbose("File-based locking enabled.");
                return 1;
 
+#ifdef HAVE_LIBDL
        case 2:
                if (!init_external_locking(&_locking, cf))
                        break;
                log_very_verbose("External locking enabled.");
                return 1;
+#endif
 
        default:
                log_error("Unknown locking type requested.");
index d46a2a861eb4bc2ab82d65a782d3843c3407bcaa..f2d87c8495d83a263b238fdf4ac7e6ee22909a6e 100644 (file)
@@ -78,10 +78,10 @@ void print_log(int level, const char *file, int line, const char *format, ...)
 
 #define stack log_debug("<backtrace>") /* Backtrace on error */
 
-#define log_error(fmt, args...) log_err(fmt , ## args)
-#define log_print(fmt, args...) log_warn(fmt , ## args)
-#define log_verbose(fmt, args...) log_notice(fmt , ## args)
-#define log_very_verbose(fmt, args...) log_info(fmt , ## args)
+#define log_error(args...) log_err(args)
+#define log_print(args...) log_warn(args)
+#define log_verbose(args...) log_notice(args)
+#define log_very_verbose(args...) log_info(args)
 
 /* Two System call equivalents */
 #define log_sys_error(x, y) \
index a2c7835ed05ac3e9ae6251387d220c32923d5478..b0545ee5daabd07d8de235557601691f5f422611 100644 (file)
@@ -68,8 +68,8 @@ static int _add_pv_to_vg(struct format_instance *fid, struct volume_group *vg,
 
        pv->pe_alloc_count = 0;
 
-       if (!fid->fmt->ops->pv_setup(fid->fmt, __UINT64_C(0), 0,
-                                    vg->extent_size, 0, __UINT64_C(0),
+       if (!fid->fmt->ops->pv_setup(fid->fmt, UINT64_C(0), 0,
+                                    vg->extent_size, 0, UINT64_C(0),
                                     &fid->metadata_areas, pv, vg)) {
                log_error("Format-specific setup of physical volume '%s' "
                          "failed.", pv_name);
index 5973d989c1e545dd3430cae1f728a27196c860be..a99c7c37e3576281518fafaac2b5a96a67ac7afd 100644 (file)
 
 #include "ctype.h"
 #include "dev-cache.h"
-#include "list.h"
 #include "uuid.h"
 
-#include <sys/types.h>
-#include <asm/page.h>
-
 #define NAME_LEN 128
 #define MAX_STRIPES 128
 #define SECTOR_SHIFT 9L
 #define SECTOR_SIZE ( 1L << SECTOR_SHIFT )
-#define STRIPE_SIZE_MIN ( PAGE_SIZE >> SECTOR_SHIFT)   /* PAGESIZE in sectors */
+#define STRIPE_SIZE_MIN ( getpagesize() >> SECTOR_SHIFT)       /* PAGESIZE in sectors */
 #define STRIPE_SIZE_MAX ( 512L * 1024L >> SECTOR_SHIFT)        /* 512 KB in sectors */
 #define PV_MIN_SIZE ( 512L * 1024L >> SECTOR_SHIFT)    /* 512 KB in sectors */
 #define PE_ALIGN (65536UL >> SECTOR_SHIFT)     /* PE alignment */
index fcef90824a7583768a95da9502d85e179dd90091..752187b7bb87b6a9a10074cfb7b0e06532b5741a 100644 (file)
@@ -7,8 +7,6 @@
 #ifndef _LVM_CRC_H
 #define _LVM_CRC_H
 
-#include "lvm-types.h"
-
 #define INITIAL_CRC 0xf597a6cf
 
 uint32_t calc_crc(uint32_t initial, void *buf, uint32_t size);
index 9f6c9238101d252ec121be3d225d16fac1aa28ab..2462e15a9f7296fa9015578a395d04a2854eebb1 100644 (file)
@@ -15,6 +15,4 @@
 #include "log.h"
 #include "dbg_malloc.h"
 
-#include <assert.h>
-
 #endif
index 407527564c3a9a241400704b96438cab8a733427..da50174b1735962c42871123b62f8c13bfeaa39d 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include "config.h"
+#include <dlfcn.h>
 
 void *load_shared_library(struct config_tree *cf, const char *libname,
                          const char *what);
index 35c22a43732c3c5df4a2407eefbf2c991c048fd8..be27f5017791c8e3d0cdc26666f302169aa34550 100644 (file)
@@ -7,9 +7,9 @@
 #ifndef _LVM_DBG_MALLOC_H
 #define _LVM_DBG_MALLOC_H
 
+#include "lvm-types.h"
 #include <stdlib.h>
 #include <string.h>
-#include <sys/types.h>
 
 #ifdef DEBUG_MEM
 void *malloc_aux(size_t s, const char *file, int line);
index 74beea21c402fcb35a45e79ed2a7c0543fffabfa..65ea8e13a5fe2be5ddceac29361bd623677126ad 100644 (file)
@@ -27,8 +27,6 @@
 #include "display.h"
 #include "activate.h"
 
-#include <sys/types.h>
-
 /* 
  * For macro use
  */
@@ -566,14 +564,14 @@ static int _snpercent_disp(struct report_handle *rh, struct field *field,
 
        if (!(snap = find_cow(lv))) {
                field->report_string = "";
-               *sortval = __UINT64_C(0);
+               *sortval = UINT64_C(0);
                field->sort_value = sortval;
                return 1;
        }
 
        if (!lv_snapshot_percent(snap->cow, &snap_percent) || snap_percent < 0) {
                field->report_string = "100.00";
-               *sortval = __UINT64_C(100);
+               *sortval = UINT64_C(100);
                field->sort_value = sortval;
                return 1;
        }
@@ -591,7 +589,7 @@ static int _snpercent_disp(struct report_handle *rh, struct field *field,
                return 0;
        }
 
-       *sortval = snap_percent * __UINT64_C(1000);
+       *sortval = snap_percent * UINT64_C(1000);
        field->sort_value = sortval;
        field->report_string = repstr;
 
index d06157fdb7c7d5865a8b83b27d31e2ecd63c90da..aa25773d7021bd732c79d228d39fb9e538bb0f20 100644 (file)
@@ -7,8 +7,6 @@
 #ifndef _LVM_UUID_H
 #define _LVM_UUID_H
 
-#include "lvm-types.h"
-
 #define ID_LEN 32
 #define ID_LEN_S "32"
 
index 48ec81bf8a7c13876102bcd4d39e4f73e2776c09..0c6ca405b53c311ade07086aa5994bcc52411a3e 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef _LVM_LIST_H
 #define _LVM_LIST_H
 
+#include <assert.h>
+
 struct list {
        struct list *n, *p;
 };
index 01debe4ef9002a2afa8812ff02aca7436dc2693e..9d3a905b3507718980f52bb8e8f7f5593caddd68 100644 (file)
@@ -93,6 +93,10 @@ ifeq ("@HAVE_RL_COMPLETION_MATCHES@", "yes")
   CFLAGS += -DHAVE_RL_COMPLETION_MATCHES
 endif
 
+ifeq ("@HAVE_LIBDL@", "yes")
+  CFLAGS += -DHAVE_LIBDL
+endif
+
 ifeq ("@LVM1@", "internal")
   CFLAGS += -DLVM1_INTERNAL
 endif
index d3df40750b248cde45970a8beef5af34449afdd7..8886d7107f568837e31f8f97ab7f11d9c5f834af 100644 (file)
@@ -72,7 +72,7 @@ include ../make.tmpl
 
 lvm: $(OBJECTS) $(top_srcdir)/lib/liblvm.a
        $(CC) -o lvm $(OBJECTS) $(LD_FLAGS) -L$(top_srcdir)/lib \
-             -L$(DESTDIR)/lib $(LVMLIBS) $(LIBS) -ldl -rdynamic
+             -L$(DESTDIR)/lib $(LVMLIBS) $(LIBS) -rdynamic
 
 .commands: commands.h cmdnames.h Makefile
        $(CC) -E -P cmdnames.h | egrep -v '(help|version)' > .commands
index bd8ef4c89fa04f58adc5796f10f01d94438a9a8f..9e37ee5d4bd19a6607f490f9468307514ce21f4d 100644 (file)
@@ -262,8 +262,8 @@ int backup_restore_vg(struct cmd_context *cmd, struct volume_group *vg)
                        return 0;
                }
                if (!vg->fid->fmt->ops->
-                   pv_setup(vg->fid->fmt, __UINT64_C(0), 0, 0, 0,
-                            __UINT64_C(0), &vg->fid->metadata_areas, pv, vg)) {
+                   pv_setup(vg->fid->fmt, UINT64_C(0), 0, 0, 0,
+                            UINT64_C(0), &vg->fid->metadata_areas, pv, vg)) {
                        log_error("Format-specific setup for %s failed",
                                  dev_name(pv->dev));
                        return 0;
index 74d21caad9b266e6e28903260b0d28297ac56f8f..1b92fc7f4022b53d486a3d7a02bf5a29239cbd5e 100644 (file)
@@ -150,7 +150,7 @@ static int _read_size_params(struct lvcreate_params *lp,
 
        /* Size returned in kilobyte units; held in sectors */
        if (arg_count(cmd, size_ARG))
-               lp->size = arg_uint64_value(cmd, size_ARG, __UINT64_C(0)) * 2;
+               lp->size = arg_uint64_value(cmd, size_ARG, UINT64_C(0)) * 2;
 
        return 1;
 }
@@ -317,7 +317,7 @@ static int _zero_lv(struct cmd_context *cmd, struct logical_volume *lv)
        if (!(dev_open(dev, O_WRONLY)))
                return 0;
 
-       dev_zero(dev, __UINT64_C(0), (size_t) 4096);
+       dev_zero(dev, UINT64_C(0), (size_t) 4096);
        dev_close(dev);
 
        return 1;
index cd0ea98998ae8033ce0081db7a7a42e91f3a3f25..b94e98a0df9eaf67482664921db51b273d42459c 100644 (file)
@@ -30,7 +30,7 @@
  */
 struct arg the_args[ARG_COUNT + 1] = {
 
-#define arg(a, b, c, d) {b, "--" c, d, 0, NULL, 0, 0, __INT64_C(0), __UINT64_C(0), 0, NULL},
+#define arg(a, b, c, d) {b, "--" c, d, 0, NULL, 0, 0, INT64_C(0), UINT64_C(0), 0, NULL},
 #include "args.h"
 #undef arg
 
index e83a82de1db783f2e38988acadcba902ed1abb4c..80efb63ba60dff89e724c8d187407f0215941ecb 100644 (file)
@@ -67,7 +67,7 @@ static int _check_device(struct cmd_context *cmd, struct device *dev)
        if (!dev_open(dev, 0)) {
                return 0;
        }
-       if (dev_read(dev, __UINT64_C(0), (size_t) 1, &buffer) != 1) {
+       if (dev_read(dev, UINT64_C(0), (size_t) 1, &buffer) != 1) {
                dev_close(dev);
                return 0;
        }
index c0b98d34702a554d155d5b36b4d3e81750fb2f56..5211b2da46eb2369ef7610b4a1e22515867525d5 100644 (file)
@@ -129,9 +129,9 @@ static void pvcreate_single(struct cmd_context *cmd, const char *pv_name,
        if (!pvcreate_check(cmd, pv_name))
                goto error;
 
-       size = arg_uint64_value(cmd, physicalvolumesize_ARG, __UINT64_C(0)) * 2;
+       size = arg_uint64_value(cmd, physicalvolumesize_ARG, UINT64_C(0)) * 2;
 
-       pvmetadatasize = arg_uint64_value(cmd, metadatasize_ARG, __UINT64_C(0))
+       pvmetadatasize = arg_uint64_value(cmd, metadatasize_ARG, UINT64_C(0))
            * 2;
        if (!pvmetadatasize)
                pvmetadatasize = find_config_int(cmd->cf->root,
index 16c5e575ea92bc2c704d12073984d5c4dc2db664..b67ba1a33a28eb3cc9a992b4957591c94ebf7f10 100644 (file)
@@ -63,7 +63,7 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
 
        if (cmd->fmt->features & FMT_MDAS) {
                pvmetadatasize = arg_uint64_value(cmd, metadatasize_ARG,
-                                                 __UINT64_C(0)) * 2;
+                                                 UINT64_C(0)) * 2;
                if (!pvmetadatasize)
                        pvmetadatasize =
                            find_config_int(cmd->cf->root,
index 24f12b03ed1f9f019c559b18b2131d74613f60b0..d9ad696fc1a108314308f21e89c453fab5fba8ae 100644 (file)
@@ -205,7 +205,7 @@ static int _vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
                return ECMD_FAILED;
        }
 
-       if (!pv_write(cmd, pv, NULL, __INT64_C(-1))) {
+       if (!pv_write(cmd, pv, NULL, INT64_C(-1))) {
                log_error("Failed to clear metadata from physical "
                          "volume \"%s\" "
                          "after removal from \"%s\"", name, vg->name);
index 2e9744742e936bf2cb31af2835927bee5af3c444..1d2d2a9f60032c54d97975141a5ab40db2381fcf 100644 (file)
@@ -65,7 +65,7 @@ static int vgremove_single(struct cmd_context *cmd, const char *vg_name,
                            "volume group \"%s\"", dev_name(pv->dev), vg_name);
                pv->vg_name = ORPHAN;
                /* FIXME Write to same sector label was read from */
-               if (!pv_write(cmd, pv, NULL, __INT64_C(-1))) {
+               if (!pv_write(cmd, pv, NULL, INT64_C(-1))) {
                        log_error("Failed to remove physical volume \"%s\""
                                  " from volume group \"%s\"",
                                  dev_name(pv->dev), vg_name);
This page took 0.083891 seconds and 5 git commands to generate.