From 3e5b6ed2147e3b31a23cfe2547aa55e1e6084986 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 3 Nov 2008 18:59:59 +0000 Subject: [PATCH] more tweaking to get things to compile - dmlib.h for log fns, list.h --- WHATS_NEW | 1 + include/.symlinks | 3 ++- lib/Makefile.in | 1 - lib/display/display.c | 24 ++++++++++++------------ lib/log/lvm-logging.h | 2 -- lib/misc/lib.h | 10 ++++++++-- lib/misc/lvm-globals.h | 2 +- libdm/Makefile.in | 1 + libdm/datastruct/bitset.c | 2 +- libdm/datastruct/hash.c | 2 +- libdm/ioctl/libdm-iface.c | 2 +- libdm/libdm-common.c | 2 +- libdm/libdm-deptree.c | 2 +- libdm/libdm-file.c | 2 +- libdm/libdm-report.c | 2 +- libdm/libdm-string.c | 2 +- libdm/misc/dmlib.h | 26 ++++++++++++++++++++++++++ libdm/mm/dbg_malloc.c | 2 +- libdm/mm/pool-debug.c | 2 +- libdm/mm/pool-fast.c | 2 +- libdm/mm/pool.c | 2 ++ libdm/regex/matcher.c | 2 +- libdm/regex/parse_rx.c | 2 +- libdm/regex/ttree.c | 2 +- 24 files changed, 67 insertions(+), 33 deletions(-) create mode 100644 libdm/misc/dmlib.h diff --git a/WHATS_NEW b/WHATS_NEW index 260fd3ca8..b947aeb20 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.43 - =================================== + Move list.c into libdevmapper and rename functions. Rename a couple of variables that matched function names. Use simplified x.y.z version number in libdevmapper.pc. Merge device-mapper into the lvm2 tree. diff --git a/include/.symlinks b/include/.symlinks index c96aef668..cbdafb0c3 100644 --- a/include/.symlinks +++ b/include/.symlinks @@ -8,7 +8,6 @@ ../lib/config/config.h ../lib/config/defaults.h ../lib/datastruct/btree.h -../lib/datastruct/list.h ../lib/datastruct/lvm-types.h ../lib/datastruct/str_list.h ../lib/device/dev-cache.h @@ -52,8 +51,10 @@ ../lib/report/report.h ../lib/uuid/uuid.h ../libdm/libdevmapper.h +../libdm/datastruct/list.h ../libdm/misc/dm-ioctl.h ../libdm/misc/dm-logging.h +../libdm/misc/dmlib.h ../libdm/misc/kdev_t.h ../po/pogen.h ../tools/version.h diff --git a/lib/Makefile.in b/lib/Makefile.in index 5c86f7425..54092cd2f 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -38,7 +38,6 @@ SOURCES =\ commands/toolcontext.c \ config/config.c \ datastruct/btree.c \ - datastruct/list.c \ datastruct/str_list.c \ device/dev-cache.c \ device/dev-io.c \ diff --git a/lib/display/display.c b/lib/display/display.c index d9358fb8f..9f6bfc668 100644 --- a/lib/display/display.c +++ b/lib/display/display.c @@ -572,7 +572,7 @@ void vgdisplay_extents(const struct volume_group *vg __attribute((unused))) void vgdisplay_full(const struct volume_group *vg) { - uint32_t access; + uint32_t access_str; uint32_t active_pvs; uint32_t lv_count = 0; struct lv_list *lvl; @@ -589,12 +589,12 @@ void vgdisplay_full(const struct volume_group *vg) list_size(&vg->fid->metadata_areas)); log_print("Metadata Sequence No %d", vg->seqno); } - access = vg->status & (LVM_READ | LVM_WRITE); + access_str = vg->status & (LVM_READ | LVM_WRITE); log_print("VG Access %s%s%s%s", - access == (LVM_READ | LVM_WRITE) ? "read/write" : "", - access == LVM_READ ? "read" : "", - access == LVM_WRITE ? "write" : "", - access == 0 ? "error" : ""); + access_str == (LVM_READ | LVM_WRITE) ? "read/write" : "", + access_str == LVM_READ ? "read" : "", + access_str == LVM_WRITE ? "write" : "", + access_str == 0 ? "error" : ""); log_print("VG Status %s%sresizable", vg->status & EXPORTED_VG ? "exported/" : "", vg->status & RESIZEABLE_VG ? "" : "NOT "); @@ -658,7 +658,7 @@ void vgdisplay_colons(const struct volume_group *vg) uint32_t active_pvs; uint32_t lv_count; struct lv_list *lvl; - const char *access; + const char *access_str; char uuid[64] __attribute((aligned(8))); active_pvs = vg->pv_count - vg_missing_pv_count(vg); @@ -669,16 +669,16 @@ void vgdisplay_colons(const struct volume_group *vg) switch (vg->status & (LVM_READ | LVM_WRITE)) { case LVM_READ | LVM_WRITE: - access = "r/w"; + access_str = "r/w"; break; case LVM_READ: - access = "r"; + access_str = "r"; break; case LVM_WRITE: - access = "w"; + access_str = "w"; break; default: - access = ""; + access_str = ""; } if (!id_write_format(&vg->id, uuid, sizeof(uuid))) { @@ -689,7 +689,7 @@ void vgdisplay_colons(const struct volume_group *vg) log_print("%s:%s:%d:-1:%u:%u:%u:-1:%u:%u:%u:%" PRIu64 ":%" PRIu32 ":%u:%u:%u:%s", vg->name, - access, + access_str, vg->status, /* internal volume group number; obsolete */ vg->max_lv, diff --git a/lib/log/lvm-logging.h b/lib/log/lvm-logging.h index 448861343..70693eaf7 100644 --- a/lib/log/lvm-logging.h +++ b/lib/log/lvm-logging.h @@ -16,8 +16,6 @@ #ifndef _LVM_LOGGING_H #define _LVM_LOGGING_H -#include "lvm-globals.h" - void print_log(int level, const char *file, int line, const char *format, ...) __attribute__ ((format(printf, 4, 5))); diff --git a/lib/misc/lib.h b/lib/misc/lib.h index 969ddc8a4..100827ddb 100644 --- a/lib/misc/lib.h +++ b/lib/misc/lib.h @@ -27,11 +27,17 @@ #include "intl.h" #include "libdevmapper.h" -#include "lvm-logging.h" -#include "lvm-types.h" +#include "lvm-globals.h" #include "lvm-wrappers.h" +#include "lvm-types.h" #include "util.h" +#ifdef DM +# include "dm-logging.h" +#else +# include "lvm-logging.h" +#endif + #include #include #include diff --git a/lib/misc/lvm-globals.h b/lib/misc/lvm-globals.h index bcf0cfa28..61fba6372 100644 --- a/lib/misc/lvm-globals.h +++ b/lib/misc/lvm-globals.h @@ -35,7 +35,7 @@ void init_security_level(int level); void init_mirror_in_sync(int in_sync); void init_dmeventd_monitor(int reg); void init_ignore_suspended_devices(int ignore); -void init_error_message_produced(int error_message_produced); +void init_error_message_produced(int produced); void set_cmd_name(const char *cmd_name); diff --git a/libdm/Makefile.in b/libdm/Makefile.in index d68c183c5..ca2a4103d 100644 --- a/libdm/Makefile.in +++ b/libdm/Makefile.in @@ -20,6 +20,7 @@ interface = @interface@ SOURCES =\ datastruct/bitset.c \ datastruct/hash.c \ + datastruct/list.c \ libdm-common.c \ libdm-file.c \ libdm-deptree.c \ diff --git a/libdm/datastruct/bitset.c b/libdm/datastruct/bitset.c index aaf678787..953916259 100644 --- a/libdm/datastruct/bitset.c +++ b/libdm/datastruct/bitset.c @@ -13,7 +13,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "lib.h" +#include "dmlib.h" /* FIXME: calculate this. */ #define INT_SHIFT 5 diff --git a/libdm/datastruct/hash.c b/libdm/datastruct/hash.c index 8fd3e60c9..9f8eff645 100644 --- a/libdm/datastruct/hash.c +++ b/libdm/datastruct/hash.c @@ -13,7 +13,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "lib.h" +#include "dmlib.h" struct dm_hash_node { struct dm_hash_node *next; diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c index 270abb94e..05b689407 100644 --- a/libdm/ioctl/libdm-iface.c +++ b/libdm/ioctl/libdm-iface.c @@ -13,7 +13,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "lib.h" +#include "dmlib.h" #include "libdm-targets.h" #include "libdm-common.h" diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c index 3efd22828..2077a66c2 100644 --- a/libdm/libdm-common.c +++ b/libdm/libdm-common.c @@ -13,7 +13,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "lib.h" +#include "dmlib.h" #include "libdm-targets.h" #include "libdm-common.h" #include "list.h" diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index 1b757f525..594fa98e3 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -12,7 +12,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "lib.h" +#include "dmlib.h" #include "libdm-targets.h" #include "libdm-common.h" #include "list.h" diff --git a/libdm/libdm-file.c b/libdm/libdm-file.c index 5fce80633..749ee4f6b 100644 --- a/libdm/libdm-file.c +++ b/libdm/libdm-file.c @@ -13,7 +13,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "lib.h" +#include "dmlib.h" #include #include diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c index 1304286f3..4cc1b8320 100644 --- a/libdm/libdm-report.c +++ b/libdm/libdm-report.c @@ -13,7 +13,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "lib.h" +#include "dmlib.h" #include diff --git a/libdm/libdm-string.c b/libdm/libdm-string.c index ab68b654f..0e41f9d9d 100644 --- a/libdm/libdm-string.c +++ b/libdm/libdm-string.c @@ -12,7 +12,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "lib.h" +#include "dmlib.h" #include "libdevmapper.h" #include diff --git a/libdm/misc/dmlib.h b/libdm/misc/dmlib.h new file mode 100644 index 000000000..9293b7c2d --- /dev/null +++ b/libdm/misc/dmlib.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. + * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. + * + * This file is part of LVM2. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU Lesser General Public License v.2.1. + * + * You should have received a copy of the GNU Lesser 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 + */ + +/* + * This file must be included first by every device-mapper library source file. + */ +#ifndef _DM_LIB_H +#define _DM_LIB_H + +#define DM + +#include "lib.h" + +#endif diff --git a/libdm/mm/dbg_malloc.c b/libdm/mm/dbg_malloc.c index b5c96262c..ef53fc51b 100644 --- a/libdm/mm/dbg_malloc.c +++ b/libdm/mm/dbg_malloc.c @@ -13,7 +13,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "lib.h" +#include "dmlib.h" #include #include diff --git a/libdm/mm/pool-debug.c b/libdm/mm/pool-debug.c index 3f762efc2..b656cc27d 100644 --- a/libdm/mm/pool-debug.c +++ b/libdm/mm/pool-debug.c @@ -13,7 +13,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "lib.h" +#include "dmlib.h" struct block { struct block *next; diff --git a/libdm/mm/pool-fast.c b/libdm/mm/pool-fast.c index 0df8b01fb..9d9f80838 100644 --- a/libdm/mm/pool-fast.c +++ b/libdm/mm/pool-fast.c @@ -13,7 +13,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "lib.h" +#include "dmlib.h" struct chunk { char *begin, *end; diff --git a/libdm/mm/pool.c b/libdm/mm/pool.c index fa6c4bbc8..3528a9119 100644 --- a/libdm/mm/pool.c +++ b/libdm/mm/pool.c @@ -13,6 +13,8 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "dmlib.h" + #ifdef DEBUG_POOL #include "pool-debug.c" #else diff --git a/libdm/regex/matcher.c b/libdm/regex/matcher.c index 24c12ae42..c2dda3e87 100644 --- a/libdm/regex/matcher.c +++ b/libdm/regex/matcher.c @@ -13,7 +13,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "lib.h" +#include "dmlib.h" #include "parse_rx.h" #include "ttree.h" #include "assert.h" diff --git a/libdm/regex/parse_rx.c b/libdm/regex/parse_rx.c index 976a6b899..fdea1a33d 100644 --- a/libdm/regex/parse_rx.c +++ b/libdm/regex/parse_rx.c @@ -13,7 +13,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "lib.h" +#include "dmlib.h" #include "parse_rx.h" struct parse_sp { /* scratch pad for the parsing process */ diff --git a/libdm/regex/ttree.c b/libdm/regex/ttree.c index da9b46cda..5aa1ba617 100644 --- a/libdm/regex/ttree.c +++ b/libdm/regex/ttree.c @@ -13,7 +13,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "lib.h" +#include "dmlib.h" #include "ttree.h" struct node {