master - cleanup: uint64_t casts
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bd67a3151aa3a3...
Commit: bd67a3151aa3a3202d52fcc9ffac781b96dca04a
Parent: ff86c6ed00859a93b984ffd5944c6ba3e450c747
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Aug 16 20:07:30 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Aug 23 14:37:21 2012 +0200
cleanup: uint64_t casts
---
lib/format1/disk-rep.c | 2 +-
lib/format1/layout.c | 2 +-
lib/format1/lvm1-label.c | 2 +-
lib/format_pool/disk_rep.c | 2 +-
lib/metadata/lv_manip.c | 2 +-
tools/pvdisplay.c | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/format1/disk-rep.c b/lib/format1/disk-rep.c
index d7c3f7d..0143ea0 100644
--- a/lib/format1/disk-rep.c
+++ b/lib/format1/disk-rep.c
@@ -335,7 +335,7 @@ static void __update_lvmcache(const struct format_type *fmt,
return;
}
- lvmcache_set_device_size(info, xlate32(dl->pvd.pv_size) << SECTOR_SHIFT);
+ lvmcache_set_device_size(info, ((uint64_t)xlate32(dl->pvd.pv_size)) << SECTOR_SHIFT);
lvmcache_del_mdas(info);
lvmcache_make_valid(info);
}
diff --git a/lib/format1/layout.c b/lib/format1/layout.c
index de9b206..14a7eaf 100644
--- a/lib/format1/layout.c
+++ b/lib/format1/layout.c
@@ -153,7 +153,7 @@ int calculate_extent_count(struct physical_volume *pv, uint32_t extent_size,
pvd->pe_start = _round_up(end, LVM1_PE_ALIGN);
- } while ((pvd->pe_start + (pvd->pe_total * extent_size))
+ } while ((pvd->pe_start + ((uint64_t)pvd->pe_total * extent_size))
> pv->size);
if (pvd->pe_total > MAX_PE_TOTAL) {
diff --git a/lib/format1/lvm1-label.c b/lib/format1/lvm1-label.c
index 4c157ac..6138a05 100644
--- a/lib/format1/lvm1-label.c
+++ b/lib/format1/lvm1-label.c
@@ -79,7 +79,7 @@ static int _lvm1_read(struct labeller *l, struct device *dev, void *buf,
return_0;
*label = lvmcache_get_label(info);
- lvmcache_set_device_size(info, xlate32(pvd->pv_size) << SECTOR_SHIFT);
+ lvmcache_set_device_size(info, ((uint64_t)xlate32(pvd->pv_size)) << SECTOR_SHIFT);
lvmcache_del_mdas(info);
lvmcache_make_valid(info);
diff --git a/lib/format_pool/disk_rep.c b/lib/format_pool/disk_rep.c
index 2201ab9..a140384 100644
--- a/lib/format_pool/disk_rep.c
+++ b/lib/format_pool/disk_rep.c
@@ -103,7 +103,7 @@ int read_pool_label(struct pool_list *pl, struct labeller *l,
if (label)
*label = lvmcache_get_label(info);
- lvmcache_set_device_size(info, xlate32_be(pd->pl_blocks) << SECTOR_SHIFT);
+ lvmcache_set_device_size(info, ((uint64_t)xlate32_be(pd->pl_blocks)) << SECTOR_SHIFT);
lvmcache_del_mdas(info);
lvmcache_make_valid(info);
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 70b984e..51abae0 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -726,7 +726,7 @@ static uint32_t mirror_log_extents(uint32_t region_size, uint32_t pe_size, uint3
{
size_t area_size, bitset_size, log_size, region_count;
- area_size = area_len * pe_size;
+ area_size = (size_t)area_len * pe_size;
region_count = dm_div_up(area_size, region_size);
/* Work out how many "unsigned long"s we need to hold the bitset. */
diff --git a/tools/pvdisplay.c b/tools/pvdisplay.c
index 2136721..c6cd412 100644
--- a/tools/pvdisplay.c
+++ b/tools/pvdisplay.c
@@ -54,7 +54,7 @@ static int _pvdisplay_single(struct cmd_context *cmd,
if (is_orphan(pv))
size = pv_size(pv);
else
- size = (pv_pe_count(pv) - pv_pe_alloc_count(pv)) *
+ size = (uint64_t)(pv_pe_count(pv) - pv_pe_alloc_count(pv)) *
pv_pe_size(pv);
if (arg_count(cmd, short_ARG)) {
10 years, 5 months
master - cleanup: keep MKNOD type cast clean
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ff86c6ed00859a...
Commit: ff86c6ed00859a93b984ffd5944c6ba3e450c747
Parent: ba309e0da5bd22f844dbfc284c1606ca413f79f7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Aug 16 20:06:07 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Aug 23 14:37:21 2012 +0200
cleanup: keep MKNOD type cast clean
Setup major already a dev_t type before it gets shifted.
---
lib/device/device.c | 2 +-
libdm/ioctl/libdm-iface.c | 6 +++---
libdm/libdm-common.c | 2 +-
libdm/libdm-deptree.c | 4 ++--
tools/pvscan.c | 2 +-
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/device/device.c b/lib/device/device.c
index 37bed63..3e5e2a4 100644
--- a/lib/device/device.c
+++ b/lib/device/device.c
@@ -347,7 +347,7 @@ int get_primary_dev(const char *sysfs_dir,
path, buffer);
goto out;
}
- *result = MKDEV(pri_maj, pri_min);
+ *result = MKDEV((dev_t)pri_maj, pri_min);
ret = 1;
out:
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index 5276c11..9932aa9 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -239,7 +239,7 @@ static int _control_exists(const char *control, uint32_t major, uint32_t minor)
return -1;
}
- if (major && buf.st_rdev != MKDEV(major, minor)) {
+ if (major && buf.st_rdev != MKDEV((dev_t)major, minor)) {
log_verbose("%s: Wrong device number: (%u, %u) instead of "
"(%u, %u)", control,
MAJOR(buf.st_mode), MINOR(buf.st_mode),
@@ -282,7 +282,7 @@ static int _create_control(const char *control, uint32_t major, uint32_t minor)
(void) dm_prepare_selinux_context(control, S_IFCHR);
old_umask = umask(DM_CONTROL_NODE_UMASK);
if (mknod(control, S_IFCHR | S_IRUSR | S_IWUSR,
- MKDEV(major, minor)) < 0) {
+ MKDEV((dev_t)major, minor)) < 0) {
log_sys_error("mknod", control);
(void) dm_prepare_selinux_context(NULL, 0);
return 0;
@@ -1062,7 +1062,7 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
}
dmi->flags |= DM_PERSISTENT_DEV_FLAG;
- dmi->dev = MKDEV(dmt->major, dmt->minor);
+ dmi->dev = MKDEV((dev_t)dmt->major, dmt->minor);
}
/* Does driver support device number referencing? */
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index fd775ca..7929889 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -841,7 +841,7 @@ static int _add_dev_node(const char *dev_name, uint32_t major, uint32_t minor,
{
char path[PATH_MAX];
struct stat info;
- dev_t dev = MKDEV(major, minor);
+ dev_t dev = MKDEV((dev_t)major, minor);
mode_t old_mask;
_build_dev_path(path, sizeof(path), dev_name);
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 503b240..28d1153 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -484,7 +484,7 @@ static struct dm_tree_node *_create_dm_tree_node(struct dm_tree *dtree,
dm_list_init(&node->used_by);
dm_list_init(&node->props.segs);
- dev = MKDEV(info->major, info->minor);
+ dev = MKDEV((dev_t)info->major, info->minor);
if (!dm_hash_insert_binary(dtree->devs, (const char *) &dev,
sizeof(dev), node)) {
@@ -508,7 +508,7 @@ static struct dm_tree_node *_create_dm_tree_node(struct dm_tree *dtree,
static struct dm_tree_node *_find_dm_tree_node(struct dm_tree *dtree,
uint32_t major, uint32_t minor)
{
- dev_t dev = MKDEV(major, minor);
+ dev_t dev = MKDEV((dev_t)major, minor);
return dm_hash_lookup_binary(dtree->devs, (const char *) &dev,
sizeof(dev));
diff --git a/tools/pvscan.c b/tools/pvscan.c
index a040899..a846322 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -209,7 +209,7 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)
if (major < 0 || minor < 0)
continue;
- devno = MKDEV(major, minor);
+ devno = MKDEV((dev_t)major, minor);
if (!(dev = dev_cache_get_by_devt(devno, NULL))) {
if (!dm_asprintf(&buf, "%" PRIi32 ":%" PRIi32, major, minor))
10 years, 5 months
master - cleanup: add standard GPL file header
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ba309e0da5bd22...
Commit: ba309e0da5bd22f844dbfc284c1606ca413f79f7
Parent: b0b507b197588a25698cd876673f722b97bd18d8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Aug 17 01:15:45 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Aug 23 14:37:20 2012 +0200
cleanup: add standard GPL file header
Add FIXME about DEBUG define colission.
---
libdaemon/server/daemon-log.h | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/libdaemon/server/daemon-log.h b/libdaemon/server/daemon-log.h
index 17d8007..f09fc2a 100644
--- a/libdaemon/server/daemon-log.h
+++ b/libdaemon/server/daemon-log.h
@@ -1,14 +1,38 @@
+/*
+ * Copyright (C) 2012 Red Hat, Inc.
+ *
+ * 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
+ */
+
+#ifndef _LVM_DAEMON_LOG_H
+#define _LVM_DAEMON_LOG_H
+
enum { DAEMON_LOG_FATAL = 0 /* usually preceding daemon death */
, DAEMON_LOG_ERROR = 1 /* something serious has happened */
, DAEMON_LOG_WARN = 2 /* something unusual has happened */
, DAEMON_LOG_INFO = 3 /* thought you might be interested */
, DAEMON_LOG_WIRE = 4 /* dump traffic on client sockets */
, DAEMON_LOG_DEBUG = 5 /* unsorted debug stuff */
- };
+};
+/*
+ * FIXME: We are currently compiling with -DDEBUG
+ * so this define DEBUG collision needs fixing
+ */
+#undef DEBUG
#define DEBUG(s, x...) daemon_logf((s)->log, DAEMON_LOG_DEBUG, x)
#define DEBUG_cft(s, i, n) daemon_log_cft((s)->log, DAEMON_LOG_DEBUG, i, n)
#define WARN(s, x...) daemon_logf((s)->log, DAEMON_LOG_WARN, x)
#define INFO(s, x...) daemon_logf((s)->log, DAEMON_LOG_INFO, x)
#define ERROR(s, x...) daemon_logf((s)->log, DAEMON_LOG_ERROR, x)
#define FATAL(s, x...) daemon_logf((s)->log, DAEMON_LOG_FATAL, x)
+
+#endif
10 years, 5 months
master - cleanup: use <> for system header file
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b0b507b197588a...
Commit: b0b507b197588a25698cd876673f722b97bd18d8
Parent: 286cd2006bd6426f19d2dd312441755624ed260e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Aug 17 01:12:10 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Aug 23 14:37:20 2012 +0200
cleanup: use <> for system header file
---
libdaemon/server/daemon-log.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libdaemon/server/daemon-log.c b/libdaemon/server/daemon-log.c
index 21068bc..8eab917 100644
--- a/libdaemon/server/daemon-log.c
+++ b/libdaemon/server/daemon-log.c
@@ -1,7 +1,7 @@
#include "daemon-server.h"
#include "daemon-log.h"
#include <syslog.h>
-#include "assert.h"
+#include <assert.h>
struct backend {
int id;
10 years, 5 months
master - cleanup: drop unneeded included header files
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=286cd2006bd642...
Commit: 286cd2006bd6426f19d2dd312441755624ed260e
Parent: 6d0abc6b484f1441c6a0a65fd3c82bc09e9d2104
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Aug 16 19:24:09 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Aug 23 14:37:20 2012 +0200
cleanup: drop unneeded included header files
This headers were not resolving anything used for compiled .c files.
Remove unused util.c file.
---
daemons/clvmd/clvmd-command.c | 3 --
daemons/dmeventd/dmeventd.c | 2 -
daemons/dmeventd/plugins/lvm2/dmeventd_lvm.c | 2 -
.../dmeventd/plugins/snapshot/dmeventd_snapshot.c | 2 -
daemons/dmeventd/plugins/thin/dmeventd_thin.c | 2 -
daemons/lvmetad/lvmetad-core.c | 1 -
lib/Makefile.in | 1 -
lib/activate/dev_manager.c | 1 -
lib/cache/lvmetad.c | 1 -
lib/config/config.c | 2 -
lib/device/dev-swap.c | 2 -
lib/error/errseg.c | 5 ----
lib/filters/filter-md.c | 1 -
lib/filters/filter-sysfs.c | 1 -
lib/format1/import-export.c | 1 -
lib/format_pool/import_export.c | 1 -
lib/format_pool/pool_label.c | 1 -
lib/format_text/archive.c | 1 -
lib/format_text/archiver.c | 1 -
lib/format_text/format-text.c | 2 -
lib/format_text/import.c | 3 --
lib/format_text/text_label.c | 1 -
lib/freeseg/freeseg.c | 10 ---------
lib/log/log.c | 3 --
lib/metadata/merge.c | 1 -
lib/metadata/metadata.c | 1 -
lib/metadata/mirror.c | 1 -
lib/metadata/pv_manip.c | 2 -
lib/metadata/pv_map.c | 1 -
lib/metadata/raid_manip.c | 3 --
lib/mirror/mirrored.c | 1 -
lib/misc/lvm-file.c | 1 -
lib/misc/lvm-globals.c | 1 -
lib/misc/sharedlib.c | 2 -
lib/misc/util.c | 22 --------------------
lib/replicator/replicator.c | 3 --
lib/report/report.c | 1 -
lib/thin/thin.c | 2 -
lib/unknown/unknown.c | 6 -----
lib/zero/zero.c | 5 ----
libdm/libdm-deptree.c | 1 -
tools/dmsetup.c | 1 -
tools/lvcreate.c | 1 -
tools/lvmcmdlib.c | 3 --
tools/lvmcmdline.c | 3 --
tools/toollib.c | 4 ---
tools/vgreduce.c | 1 -
47 files changed, 0 insertions(+), 117 deletions(-)
diff --git a/daemons/clvmd/clvmd-command.c b/daemons/clvmd/clvmd-command.c
index 0494ee4..c5cd461 100644
--- a/daemons/clvmd/clvmd-command.c
+++ b/daemons/clvmd/clvmd-command.c
@@ -51,9 +51,6 @@
*/
#include "clvmd-common.h"
-
-#include <pthread.h>
-
#include "clvmd-comms.h"
#include "clvm.h"
#include "clvmd.h"
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 2ffe7f4..13148c3 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -39,8 +39,6 @@
#include <arpa/inet.h> /* for htonl, ntohl */
#ifdef linux
-# include <malloc.h>
-
/*
* Kernel version 2.6.36 and higher has
* new OOM killer adjustment interface.
diff --git a/daemons/dmeventd/plugins/lvm2/dmeventd_lvm.c b/daemons/dmeventd/plugins/lvm2/dmeventd_lvm.c
index 1bde50e..5d5a46b 100644
--- a/daemons/dmeventd/plugins/lvm2/dmeventd_lvm.c
+++ b/daemons/dmeventd/plugins/lvm2/dmeventd_lvm.c
@@ -16,8 +16,6 @@
#include "log.h"
#include "lvm2cmd.h"
-#include "errors.h"
-#include "libdevmapper-event.h"
#include "dmeventd_lvm.h"
#include <pthread.h>
diff --git a/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c b/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
index 0c59e34..205218a 100644
--- a/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
+++ b/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
@@ -19,8 +19,6 @@
#include "libdevmapper-event.h"
#include "dmeventd_lvm.h"
-#include "lvm-string.h"
-
#include <sys/wait.h>
#include <syslog.h> /* FIXME Replace syslog with multilog */
/* FIXME Missing openlog? */
diff --git a/daemons/dmeventd/plugins/thin/dmeventd_thin.c b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
index 4bdad23..5a408a8 100644
--- a/daemons/dmeventd/plugins/thin/dmeventd_thin.c
+++ b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
@@ -19,8 +19,6 @@
#include "libdevmapper-event.h"
#include "dmeventd_lvm.h"
-#include "lvm-string.h"
-
#include <sys/wait.h>
#include <syslog.h> /* FIXME Replace syslog with multilog */
/* FIXME Missing openlog? */
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index d06ff46..3ca3fd5 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -21,7 +21,6 @@
#include <assert.h>
#include <pthread.h>
-#include <malloc.h>
#include <stdint.h>
#include <unistd.h>
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 5252658..82f700b 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -103,7 +103,6 @@ SOURCES =\
misc/lvm-string.c \
misc/lvm-wrappers.c \
misc/lvm-percent.c \
- misc/util.c \
mm/memlock.c \
report/properties.c \
report/report.c \
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 40b0edc..122741c 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -14,7 +14,6 @@
*/
#include "lib.h"
-#include "str_list.h"
#include "dev_manager.h"
#include "lvm-string.h"
#include "fs.h"
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 3384ec4..bb949b5 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -20,7 +20,6 @@
#include "lvmcache.h"
#include "lvmetad-client.h"
#include "format-text.h" // TODO for disk_locn, used as a DA representation
-#include "filter.h"
static int _using_lvmetad = 0;
static daemon_handle _lvmetad;
diff --git a/lib/config/config.c b/lib/config/config.c
index 60ae6c8..a7bda97 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -21,14 +21,12 @@
#include "device.h"
#include "str_list.h"
#include "toolcontext.h"
-#include "lvm-string.h"
#include "lvm-file.h"
#include <sys/stat.h>
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
-#include <ctype.h>
#include <assert.h>
struct config_file {
diff --git a/lib/device/dev-swap.c b/lib/device/dev-swap.c
index f742bfe..346b60a 100644
--- a/lib/device/dev-swap.c
+++ b/lib/device/dev-swap.c
@@ -14,8 +14,6 @@
#include "lib.h"
#include "metadata.h"
-#include "xlate.h"
-#include "filter.h"
#ifdef linux
diff --git a/lib/error/errseg.c b/lib/error/errseg.c
index a2fbc4d..179f1a6 100644
--- a/lib/error/errseg.c
+++ b/lib/error/errseg.c
@@ -16,15 +16,10 @@
#include "toolcontext.h"
#include "segtype.h"
#include "display.h"
-#include "text_export.h"
-#include "text_import.h"
#include "config.h"
#include "str_list.h"
-#include "targets.h"
-#include "lvm-string.h"
#include "activate.h"
#include "str_list.h"
-#include "metadata.h"
static const char *_errseg_name(const struct lv_segment *seg)
{
diff --git a/lib/filters/filter-md.c b/lib/filters/filter-md.c
index 5cd8fb2..e3e88f1 100644
--- a/lib/filters/filter-md.c
+++ b/lib/filters/filter-md.c
@@ -15,7 +15,6 @@
#include "lib.h"
#include "filter-md.h"
-#include "metadata.h"
#ifdef linux
diff --git a/lib/filters/filter-sysfs.c b/lib/filters/filter-sysfs.c
index 112e77c..ebd16a2 100644
--- a/lib/filters/filter-sysfs.c
+++ b/lib/filters/filter-sysfs.c
@@ -14,7 +14,6 @@
#include "lib.h"
#include "filter-sysfs.h"
-#include "lvm-string.h"
#ifdef linux
diff --git a/lib/format1/import-export.c b/lib/format1/import-export.c
index 1370d12..5c5d890 100644
--- a/lib/format1/import-export.c
+++ b/lib/format1/import-export.c
@@ -25,7 +25,6 @@
#include "segtype.h"
#include "pv_alloc.h"
#include "display.h"
-#include "lvmcache.h"
#include "metadata.h"
#include <time.h>
diff --git a/lib/format_pool/import_export.c b/lib/format_pool/import_export.c
index f7f619e..480fa1c 100644
--- a/lib/format_pool/import_export.c
+++ b/lib/format_pool/import_export.c
@@ -16,7 +16,6 @@
#include "lib.h"
#include "label.h"
#include "metadata.h"
-#include "lvmcache.h"
#include "disk_rep.h"
#include "sptype_names.h"
#include "lv_alloc.h"
diff --git a/lib/format_pool/pool_label.c b/lib/format_pool/pool_label.c
index 2d34e60..7059b98 100644
--- a/lib/format_pool/pool_label.c
+++ b/lib/format_pool/pool_label.c
@@ -16,7 +16,6 @@
#include "lib.h"
#include "label.h"
#include "metadata.h"
-#include "xlate.h"
#include "disk_rep.h"
#include "pool_label.h"
diff --git a/lib/format_text/archive.c b/lib/format_text/archive.c
index c961150..18fe577 100644
--- a/lib/format_text/archive.c
+++ b/lib/format_text/archive.c
@@ -25,7 +25,6 @@
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
-#include <sys/file.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/format_text/archiver.c b/lib/format_text/archiver.c
index 13d242a..ccefb4c 100644
--- a/lib/format_text/archiver.c
+++ b/lib/format_text/archiver.c
@@ -16,7 +16,6 @@
#include "lib.h"
#include "archiver.h"
#include "format-text.h"
-#include "lvm-file.h"
#include "lvm-string.h"
#include "lvmcache.h"
#include "toolcontext.h"
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index aea03c9..d706c2b 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -27,12 +27,10 @@
#include "crc.h"
#include "xlate.h"
#include "label.h"
-#include "memlock.h"
#include "lvmcache.h"
#include "lvmetad.h"
#include <unistd.h>
-#include <sys/file.h>
#include <sys/param.h>
#include <limits.h>
#include <dirent.h>
diff --git a/lib/format_text/import.c b/lib/format_text/import.c
index 3d2f496..8a05ca9 100644
--- a/lib/format_text/import.c
+++ b/lib/format_text/import.c
@@ -16,9 +16,6 @@
#include "lib.h"
#include "metadata.h"
#include "import-export.h"
-#include "display.h"
-#include "toolcontext.h"
-#include "lvmcache.h"
/* FIXME Use tidier inclusion method */
static struct text_vg_version_ops *(_text_vsn_list[2]);
diff --git a/lib/format_text/text_label.c b/lib/format_text/text_label.c
index 7b2659c..f53aa0d 100644
--- a/lib/format_text/text_label.c
+++ b/lib/format_text/text_label.c
@@ -19,7 +19,6 @@
#include "label.h"
#include "xlate.h"
#include "lvmcache.h"
-#include "lvmetad.h"
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/freeseg/freeseg.c b/lib/freeseg/freeseg.c
index 6fbad7e..1dce243 100644
--- a/lib/freeseg/freeseg.c
+++ b/lib/freeseg/freeseg.c
@@ -15,16 +15,6 @@
#include "lib.h"
#include "toolcontext.h"
#include "segtype.h"
-#include "display.h"
-#include "text_export.h"
-#include "text_import.h"
-#include "config.h"
-#include "str_list.h"
-#include "targets.h"
-#include "lvm-string.h"
-#include "activate.h"
-#include "str_list.h"
-#include "metadata.h"
static const char *_freeseg_name(const struct lv_segment *seg)
{
diff --git a/lib/log/log.c b/lib/log/log.c
index c36f1e7..d50cb4a 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -16,10 +16,7 @@
#include "lib.h"
#include "device.h"
#include "memlock.h"
-#include "lvm-string.h"
-#include "lvm-file.h"
#include "defaults.h"
-#include "config.h"
#include <stdarg.h>
#include <syslog.h>
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index 4183046..cc906d1 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -15,7 +15,6 @@
#include "lib.h"
#include "metadata.h"
-#include "toolcontext.h"
#include "lv_alloc.h"
#include "pv_alloc.h"
#include "str_list.h"
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index c14125a..dd029ac 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -30,7 +30,6 @@
#include "locking.h"
#include "archiver.h"
#include "defaults.h"
-#include "filter-persistent.h"
#include <math.h>
#include <sys/param.h>
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 0997c58..ac885d6 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -24,7 +24,6 @@
#include "lvm-string.h"
#include "str_list.h"
#include "locking.h" /* FIXME Should not be used in this file */
-#include "memlock.h"
#include "defaults.h" /* FIXME: should this be defaults.h? */
diff --git a/lib/metadata/pv_manip.c b/lib/metadata/pv_manip.c
index e3fe272..e85a2bc 100644
--- a/lib/metadata/pv_manip.c
+++ b/lib/metadata/pv_manip.c
@@ -17,9 +17,7 @@
#include "metadata.h"
#include "pv_alloc.h"
#include "toolcontext.h"
-#include "archiver.h"
#include "locking.h"
-#include "lvmcache.h"
#include "defaults.h"
static struct pv_segment *_alloc_pv_segment(struct dm_pool *mem,
diff --git a/lib/metadata/pv_map.c b/lib/metadata/pv_map.c
index 29d235f..48a601e 100644
--- a/lib/metadata/pv_map.c
+++ b/lib/metadata/pv_map.c
@@ -15,7 +15,6 @@
#include "lib.h"
#include "pv_map.h"
-#include "pv_alloc.h"
#include <assert.h>
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index a3d6709..c86bb9a 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -17,12 +17,9 @@
#include "toolcontext.h"
#include "segtype.h"
#include "display.h"
-#include "archiver.h"
#include "activate.h"
#include "lv_alloc.h"
#include "lvm-string.h"
-#include "str_list.h"
-#include "memlock.h"
#define RAID_REGION_SIZE 1024
diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
index 28e4a1d..7ce8475 100644
--- a/lib/mirror/mirrored.c
+++ b/lib/mirror/mirrored.c
@@ -25,7 +25,6 @@
#include "lvm-string.h"
#include "targets.h"
#include "activate.h"
-#include "sharedlib.h"
#include "str_list.h"
#include <sys/utsname.h>
diff --git a/lib/misc/lvm-file.c b/lib/misc/lvm-file.c
index d71737b..b8e49cb 100644
--- a/lib/misc/lvm-file.c
+++ b/lib/misc/lvm-file.c
@@ -15,7 +15,6 @@
#include "lib.h"
#include "lvm-file.h"
-#include "lvm-string.h"
#include <unistd.h>
#include <sys/stat.h>
diff --git a/lib/misc/lvm-globals.c b/lib/misc/lvm-globals.c
index e1512f9..1c72f85 100644
--- a/lib/misc/lvm-globals.c
+++ b/lib/misc/lvm-globals.c
@@ -17,7 +17,6 @@
#include "device.h"
#include "memlock.h"
#include "lvm-string.h"
-#include "lvm-file.h"
#include "defaults.h"
#include "metadata-exported.h"
diff --git a/lib/misc/sharedlib.c b/lib/misc/sharedlib.c
index 48fa522..4c2d178 100644
--- a/lib/misc/sharedlib.c
+++ b/lib/misc/sharedlib.c
@@ -15,9 +15,7 @@
#include "lib.h"
#include "config.h"
-#include "lvm-string.h"
#include "sharedlib.h"
-#include "toolcontext.h"
#include <limits.h>
#include <sys/stat.h>
diff --git a/lib/misc/util.c b/lib/misc/util.c
deleted file mode 100644
index 75c7afa..0000000
--- a/lib/misc/util.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 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
- */
-
-/*
- * Return the address of the last file name component of NAME.
- * If NAME ends in a slash, return the empty string.
- */
-
-#include "lib.h"
-
-/* empty for now. */
diff --git a/lib/replicator/replicator.c b/lib/replicator/replicator.c
index 2571e81..76bdbca 100644
--- a/lib/replicator/replicator.c
+++ b/lib/replicator/replicator.c
@@ -17,12 +17,9 @@
#include "metadata.h"
#include "segtype.h"
#include "text_export.h"
-#include "text_import.h"
-#include "config.h"
#include "activate.h"
#include "str_list.h"
#ifdef DMEVENTD
-# include "sharedlib.h"
# include "libdevmapper-event.h"
#endif
diff --git a/lib/report/report.c b/lib/report/report.c
index a8553d2..eeca282 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -21,7 +21,6 @@
#include "display.h"
#include "activate.h"
#include "segtype.h"
-#include "str_list.h"
#include "lvmcache.h"
#include <stddef.h> /* offsetof() */
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index d95b68e..8aa8121 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -17,14 +17,12 @@
#include "metadata.h"
#include "segtype.h"
#include "text_export.h"
-#include "text_import.h"
#include "config.h"
#include "activate.h"
#include "str_list.h"
#include "defaults.h"
#ifdef DMEVENTD
-# include "sharedlib.h"
# include "libdevmapper-event.h"
#endif
diff --git a/lib/unknown/unknown.c b/lib/unknown/unknown.c
index 8f5c809..f2a65eb 100644
--- a/lib/unknown/unknown.c
+++ b/lib/unknown/unknown.c
@@ -17,14 +17,8 @@
#include "segtype.h"
#include "display.h"
#include "text_export.h"
-#include "text_import.h"
#include "config.h"
-#include "str_list.h"
-#include "targets.h"
-#include "lvm-string.h"
#include "activate.h"
-#include "str_list.h"
-#include "metadata.h"
static const char *_unknown_name(const struct lv_segment *seg)
{
diff --git a/lib/zero/zero.c b/lib/zero/zero.c
index 9611e9b..473daa0 100644
--- a/lib/zero/zero.c
+++ b/lib/zero/zero.c
@@ -16,14 +16,9 @@
#include "toolcontext.h"
#include "segtype.h"
#include "display.h"
-#include "text_export.h"
-#include "text_import.h"
#include "config.h"
#include "str_list.h"
-#include "targets.h"
-#include "lvm-string.h"
#include "activate.h"
-#include "metadata.h"
static const char *_zero_name(const struct lv_segment *seg)
{
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 031ce5e..503b240 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -16,7 +16,6 @@
#include "libdm-targets.h"
#include "libdm-common.h"
#include "kdev_t.h"
-#include "dm-ioctl.h"
#include <stdarg.h>
#include <sys/param.h>
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 7d1f2a1..0734ded 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -30,7 +30,6 @@
#include <dirent.h>
#include <errno.h>
#include <unistd.h>
-#include <libgen.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/param.h>
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 6aecf1d..769ac8c 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -14,7 +14,6 @@
*/
#include "tools.h"
-#include "lv_alloc.h"
#include <fcntl.h>
diff --git a/tools/lvmcmdlib.c b/tools/lvmcmdlib.c
index 47bf1c8..6b641c2 100644
--- a/tools/lvmcmdlib.c
+++ b/tools/lvmcmdlib.c
@@ -17,13 +17,10 @@
#include "lvm2cmdline.h"
#include "label.h"
#include "memlock.h"
-#include "lvm-version.h"
#include "lvm2cmd.h"
#include <signal.h>
-#include <syslog.h>
-#include <libgen.h>
#include <sys/stat.h>
#include <time.h>
#include <sys/resource.h>
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 9964817..eea874e 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -19,12 +19,9 @@
#include "lvm-version.h"
#include "stub.h"
-#include "lvm2cmd.h"
#include "last-path-component.h"
#include <signal.h>
-#include <syslog.h>
-#include <libgen.h>
#include <sys/stat.h>
#include <time.h>
#include <sys/resource.h>
diff --git a/tools/toollib.c b/tools/toollib.c
index 0f6810b..d6fc951 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -14,11 +14,7 @@
*/
#include "tools.h"
-#include "lv_alloc.h"
-#include "xlate.h"
-
#include <sys/stat.h>
-#include <sys/wait.h>
const char *command_name(struct cmd_context *cmd)
{
diff --git a/tools/vgreduce.c b/tools/vgreduce.c
index ab448e0..9696651 100644
--- a/tools/vgreduce.c
+++ b/tools/vgreduce.c
@@ -14,7 +14,6 @@
*/
#include "tools.h"
-#include "lv_alloc.h"
static int _remove_pv(struct volume_group *vg, struct pv_list *pvl, int silent)
{
10 years, 5 months
master - cmirrord: check for result of chdir
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6d0abc6b484f14...
Commit: 6d0abc6b484f1441c6a0a65fd3c82bc09e9d2104
Parent: b1640df5e6375926df0cc0e8dab217b21b23ce57
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 20 00:10:40 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Aug 23 14:37:20 2012 +0200
cmirrord: check for result of chdir
Error exit if chdir fails.
---
daemons/cmirrord/clogd.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/daemons/cmirrord/clogd.c b/daemons/cmirrord/clogd.c
index 32b01a6..adf7a92 100644
--- a/daemons/cmirrord/clogd.c
+++ b/daemons/cmirrord/clogd.c
@@ -185,7 +185,11 @@ static void daemonize(void)
}
setsid();
- chdir("/");
+ if (chdir("/")) {
+ LOG_ERROR("Failed to chdir /: %s", strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
umask(0);
if (close(0) || close(1) || close(2)) {
10 years, 5 months
master - dmsetup: check if new_name is non NULL
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b1640df5e63759...
Commit: b1640df5e6375926df0cc0e8dab217b21b23ce57
Parent: b9ae22d758e6b5eed62774f5b2a71b87d818087e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Feb 27 01:19:23 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Aug 23 14:37:18 2012 +0200
dmsetup: check if new_name is non NULL
---
WHATS_NEW_DM | 1 +
tools/dmsetup.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 186a2e1..d0e8f7d 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.77 -
=================================
+ Check for existing new_name for dmsetup rename.
Fix memory leak in dmsetup _get_split_name() error path.
Version 1.02.76 - 7th August 2012
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index ca1087d..7d1f2a1 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -719,7 +719,7 @@ static int _do_rename(const char *name, const char *new_name, const char *new_uu
if (new_uuid) {
if (!dm_task_set_newuuid(dmt, new_uuid))
goto out;
- } else if (!dm_task_set_newname(dmt, new_name))
+ } else if (!new_name || !dm_task_set_newname(dmt, new_name))
goto out;
if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
10 years, 5 months
master - dmsetup: fix udev warning message
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b9ae22d758e6b5...
Commit: b9ae22d758e6b5eed62774f5b2a71b87d818087e
Parent: 7e318dad427c7d2e6787f9412cf7c4ee761faf9f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jun 28 21:32:24 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Aug 23 14:36:12 2012 +0200
dmsetup: fix udev warning message
Configure option is --enable-udev_sync.
---
tools/dmsetup.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 7a632c7..ca1087d 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -977,7 +977,7 @@ static int _udevcomplete(CMD_ARGS)
}
#ifndef UDEV_SYNC_SUPPORT
-static const char _cmd_not_supported[] = "Command not supported. Recompile with \"--enable-udev-sync\" to enable.";
+static const char _cmd_not_supported[] = "Command not supported. Recompile with \"--enable-udev_sync\" to enable.";
static int _udevcreatecookie(CMD_ARGS)
{
10 years, 5 months
master - dmsetup: fix memleak in _get_split_name
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7e318dad427c7d...
Commit: 7e318dad427c7d2e6787f9412cf7c4ee761faf9f
Parent: 59ca324c35f3898070a5ad4cb0ec267a1eb4a292
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Aug 16 20:12:38 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Aug 23 14:36:10 2012 +0200
dmsetup: fix memleak in _get_split_name
Free allocated buffer in _get_split_name error path.
---
WHATS_NEW_DM | 4 ++++
tools/dmsetup.c | 4 +++-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 3890ea4..186a2e1 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,3 +1,7 @@
+Version 1.02.77 -
+=================================
+ Fix memory leak in dmsetup _get_split_name() error path.
+
Version 1.02.76 - 7th August 2012
=================================
Add dm_vasprintf to libdevmapper.
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 5422f0b..7a632c7 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -380,8 +380,10 @@ static struct dm_split_name *_get_split_name(const char *uuid, const char *name,
return NULL;
}
- if (!(split_name->subsystem = _extract_uuid_prefix(uuid, separator)))
+ if (!(split_name->subsystem = _extract_uuid_prefix(uuid, separator))) {
+ dm_free(split_name);
return_NULL;
+ }
split_name->vg_name = split_name->lv_name =
split_name->lv_layer = (char *) "";
10 years, 5 months
master - clvmd: release excl_uuid hash
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=59ca324c35f389...
Commit: 59ca324c35f3898070a5ad4cb0ec267a1eb4a292
Parent: ed53b4b6740973411acee52a31fca9c48c585dab
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Aug 16 20:26:46 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Aug 23 14:34:56 2012 +0200
clvmd: release excl_uuid hash
Release allocated hash before exit.
---
daemons/clvmd/clvmd.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c
index 4efa237..f74490a 100644
--- a/daemons/clvmd/clvmd.c
+++ b/daemons/clvmd/clvmd.c
@@ -371,7 +371,8 @@ int main(int argc, char *argv[])
case 'R':
check_permissions();
- return refresh_clvmd(1)==1?0:1;
+ ret = (refresh_clvmd(1) == 1) ? 0 : 1;
+ goto out;
case 'S':
check_permissions();
10 years, 5 months