mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Tidy various pre-processing incl. making libdl optional.
This commit is contained in:
parent
e6aa7d323d
commit
e8c4bf56fe
60
configure
vendored
60
configure
vendored
@ -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
|
||||
|
@ -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( \
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -9,9 +9,8 @@
|
||||
|
||||
#include "metadata.h"
|
||||
|
||||
#include <libdevmapper.h>
|
||||
|
||||
struct dev_manager;
|
||||
struct dm_info;
|
||||
|
||||
/*
|
||||
* Constructor and destructor.
|
||||
|
2
lib/cache/cache.c
vendored
2
lib/cache/cache.c
vendored
@ -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;
|
||||
|
3
lib/cache/cache.h
vendored
3
lib/cache/cache.h
vendored
@ -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
|
||||
|
@ -19,9 +19,12 @@
|
||||
#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;
|
||||
|
||||
#ifdef HAVE_LIBDL
|
||||
struct config_node *cn;
|
||||
struct config_value *cv;
|
||||
|
||||
struct format_type *(*init_format_fn) (struct cmd_context *);
|
||||
|
||||
void *lib;
|
||||
#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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -7,9 +7,6 @@
|
||||
#ifndef _LVM_CONFIG_H
|
||||
#define _LVM_CONFIG_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
enum {
|
||||
CFG_STRING,
|
||||
CFG_FLOAT,
|
||||
|
@ -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
|
||||
|
@ -7,7 +7,6 @@
|
||||
#ifndef _LVM_BITSET_H
|
||||
#define _LVM_BITSET_H
|
||||
|
||||
#include "lvm-types.h"
|
||||
#include "pool.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
@ -7,7 +7,6 @@
|
||||
#ifndef _LVM_BTREE_H
|
||||
#define _LVM_BTREE_H
|
||||
|
||||
#include "lvm-types.h"
|
||||
#include "pool.h"
|
||||
|
||||
struct btree;
|
||||
|
@ -7,8 +7,6 @@
|
||||
#ifndef _LVM_HASH_H
|
||||
#define _LVM_HASH_H
|
||||
|
||||
#include "lvm-types.h"
|
||||
|
||||
struct hash_table;
|
||||
struct hash_node;
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
#ifndef _LVM_LIST_H
|
||||
#define _LVM_LIST_H
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
struct list {
|
||||
struct list *n, *p;
|
||||
};
|
||||
|
@ -13,10 +13,10 @@
|
||||
#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 {
|
||||
|
@ -11,12 +11,11 @@
|
||||
#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;
|
||||
|
@ -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"
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <stdio.h>
|
||||
|
@ -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? */
|
||||
|
@ -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)
|
||||
|
@ -25,11 +25,9 @@
|
||||
#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
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -12,10 +12,10 @@
|
||||
#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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -8,7 +8,6 @@
|
||||
#define _LVM_LABEL_H
|
||||
|
||||
#include "cache.h"
|
||||
#include "lvm-types.h"
|
||||
#include "uuid.h"
|
||||
#include "device.h"
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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.");
|
||||
|
@ -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) \
|
||||
|
@ -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);
|
||||
|
@ -12,17 +12,13 @@
|
||||
|
||||
#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 */
|
||||
|
@ -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);
|
||||
|
@ -15,6 +15,4 @@
|
||||
#include "log.h"
|
||||
#include "dbg_malloc.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#endif
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <dlfcn.h>
|
||||
|
||||
void *load_shared_library(struct config_tree *cf, const char *libname,
|
||||
const char *what);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
#ifndef _LVM_LIST_H
|
||||
#define _LVM_LIST_H
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
struct list {
|
||||
struct list *n, *p;
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user