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
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
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
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. */
; 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
+
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
s%@LVM_VERSION@%$LVM_VERSION%g
s%@DEBUG@%$DEBUG%g
s%@DEVMAPPER@%$DEVMAPPER%g
+s%@HAVE_LIBDL@%$HAVE_LIBDL%g
CEOF
EOF
)
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, ,
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( \
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 \
activate/fs.c
endif
+ifeq ("@HAVE_LIBDL@", "yes")
+ SOURCES+=\
+ locking/external_locking.c
+endif
+
TARGETS=liblvm.a
include ../make.tmpl
#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)
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;
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;
}
#include "metadata.h"
-#include <libdevmapper.h>
-
struct dev_manager;
+struct dm_info;
/*
* Constructor and destructor.
#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;
#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
#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
#include <locale.h>
#include <sys/stat.h>
#include <syslog.h>
-#include <dlfcn.h>
#include <time.h>
static FILE *_log;
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();
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: "
list_add(&cmd->formats, &fmt->list);
}
}
+#endif
if (!(fmt = create_text_format(cmd)))
return 0;
list_del(&fmt->list);
lib = fmt->library;
fmt->ops->destroy(fmt);
+#ifdef HAVE_LIBDL
if (lib)
dlclose(lib);
+#endif
}
}
#include <unistd.h>
#include <fcntl.h>
#include <ctype.h>
-#include <asm/page.h>
enum {
TOK_INT,
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;
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);
#ifndef _LVM_CONFIG_H
#define _LVM_CONFIG_H
-#include <inttypes.h>
-#include <sys/types.h>
-
enum {
CFG_STRING,
CFG_FLOAT,
#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
#ifndef _LVM_BITSET_H
#define _LVM_BITSET_H
-#include "lvm-types.h"
#include "pool.h"
#include <limits.h>
#ifndef _LVM_BTREE_H
#define _LVM_BTREE_H
-#include "lvm-types.h"
#include "pool.h"
struct btree;
#ifndef _LVM_HASH_H
#define _LVM_HASH_H
-#include "lvm-types.h"
-
struct hash_table;
struct hash_node;
#ifndef _LVM_LIST_H
#define _LVM_LIST_H
+#include <assert.h>
+
struct list {
struct list *n, *p;
};
#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 {
#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;
#ifndef _LVM_DEV_CACHE_H
#define _LVM_DEV_CACHE_H
-#include <sys/types.h>
#include "lvm-types.h"
#include "device.h"
*/
#if 0
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <stdio.h>
#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? */
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':
v *= KILO * KILO * KILO * KILO;
break;
#undef KILO
-#define KILO __UINT64_C(1000)
+#define KILO UINT64_C(1000)
case 'K':
v *= KILO;
break;
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"},
*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)
#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
#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);
#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)
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;
#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)
{
}
if (!add_da
(fmt, NULL, &info->das, pv->pe_start << SECTOR_SHIFT,
- __UINT64_C(0))) {
+ UINT64_C(0))) {
stack;
return 0;
}
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;
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;
#define _LVM_LABEL_H
#include "cache.h"
-#include "lvm-types.h"
#include "uuid.h"
#include "device.h"
#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,
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.");
#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) \
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);
#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 */
#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);
#include "log.h"
#include "dbg_malloc.h"
-#include <assert.h>
-
#endif
*/
#include "config.h"
+#include <dlfcn.h>
void *load_shared_library(struct config_tree *cf, const char *libname,
const char *what);
#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);
#include "display.h"
#include "activate.h"
-#include <sys/types.h>
-
/*
* For macro use
*/
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;
}
return 0;
}
- *sortval = snap_percent * __UINT64_C(1000);
+ *sortval = snap_percent * UINT64_C(1000);
field->sort_value = sortval;
field->report_string = repstr;
#ifndef _LVM_UUID_H
#define _LVM_UUID_H
-#include "lvm-types.h"
-
#define ID_LEN 32
#define ID_LEN_S "32"
#ifndef _LVM_LIST_H
#define _LVM_LIST_H
+#include <assert.h>
+
struct list {
struct list *n, *p;
};
CFLAGS += -DHAVE_RL_COMPLETION_MATCHES
endif
+ifeq ("@HAVE_LIBDL@", "yes")
+ CFLAGS += -DHAVE_LIBDL
+endif
+
ifeq ("@LVM1@", "internal")
CFLAGS += -DLVM1_INTERNAL
endif
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
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;
/* 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;
}
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;
*/
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
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;
}
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,
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,
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);
"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);