Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=967b5eb1f3a25572…
Commit: 967b5eb1f3a25572448974f882e3bc8ba5d3fb9a
Parent: 847e2856a29c41756cc5bbaf70eb87ea030826f4
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Aug 27 15:39:08 2012 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Aug 27 15:39:08 2012 +0200
make: fix subdir order for distclean
The 'test' subdir needs to be processed before 'tools' subdir
for distclean as all the cmd names are read from 'tools/.commands'
file. Otherwise we'd end up with dangling symlinks in 'tools' subdir.
---
Makefile.in | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index d957e26..4316190 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -40,9 +40,9 @@ SUBDIRS += scripts
# FIXME Should use intermediate Makefiles here!
ifeq ($(MAKECMDGOALS),distclean)
- SUBDIRS = doc include man scripts \
+ SUBDIRS = doc include man test scripts \
libdaemon lib tools daemons libdm \
- udev po liblvm test \
+ udev po liblvm \
unit-tests/datastruct unit-tests/mm unit-tests/regex
endif
DISTCLEAN_DIRS += lcov_reports*
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=847e2856a29c4175…
Commit: 847e2856a29c41756cc5bbaf70eb87ea030826f4
Parent: 2a70e98b05603bf8fc59929fd2709fb5d2b859e6
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Aug 27 14:19:30 2012 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Aug 27 14:33:54 2012 +0200
config: require dm_config_create_value for dm_config_node's value
If we were defining a section (which is a node without a value) and
the value was created automatically on dm_config_create_node call,
we were wasting resources as the next step after creating the config
node itself was assigning NULL for the node's value.
The dm_config_node_create + dm_config_create_value sequence should be
used instead for settings and dm_config_node_create alone for sections.
The majority of the code already used the correct sequence. Though
with dm_config_node_create fn creating the value as well, the pool
memory was being trashed this way.
This patch removes the node value initialization on dm_config_create_node
fn call and keeps it for the direct dm_config_create_value fn call.
---
WHATS_NEW_DM | 1 +
daemons/lvmetad/lvmetad-core.c | 7 +++++++
libdm/libdm-config.c | 9 ++-------
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index d0e8f7d..c46db61 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.77 -
=================================
+ Don't create value for dm_config_node and require dm_config_create_value call.
Check for existing new_name for dmsetup rename.
Fix memory leak in dmsetup _get_split_name() error path.
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index 3ca3fd5..146ee69 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -520,12 +520,19 @@ static response vg_lookup(lvmetad_state *s, request r)
if (!(res.cft->root = n = dm_config_create_node(res.cft, "response")))
goto bad;
+ if (!(n->v = dm_config_create_value(cft)))
+ goto bad;
+
n->parent = res.cft->root;
n->v->type = DM_CFG_STRING;
n->v->v.str = "OK";
if (!(n = n->sib = dm_config_create_node(res.cft, "name")))
goto bad;
+
+ if (!(n->v = dm_config_create_value(res.cft)))
+ goto bad;
+
n->parent = res.cft->root;
n->v->type = DM_CFG_STRING;
n->v->v.str = name;
diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c
index f8c0954..c19f51d 100644
--- a/libdm/libdm-config.c
+++ b/libdm/libdm-config.c
@@ -1169,14 +1169,9 @@ struct dm_config_node *dm_config_create_node(struct dm_config_tree *cft, const c
log_error("Failed to create config node's key.");
return NULL;
}
- if (!(cn->v = _create_value(cft->mem))) {
- log_error("Failed to create config node's value.");
- return NULL;
- }
cn->parent = NULL;
- cn->v->type = DM_CFG_INT;
- cn->v->v.i = 0;
- cn->v->next = NULL;
+ cn->v = NULL;
+
return cn;
}
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5a3c597fd599c21a…
Commit: 5a3c597fd599c21a0bb0c551c92393518d3e70b8
Parent: e52d3167518f5ebbb0296b117a1266874978612f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jan 27 23:43:14 2011 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Aug 27 13:03:15 2012 +0200
tests: testing lvm_lv_rename
Test stacking of rename operation within one udev transaction.
---
test/api/Makefile.in | 4 +-
test/api/lvtest.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++
test/api/lvtest.sh | 21 ++++++++++++++++
3 files changed, 87 insertions(+), 2 deletions(-)
diff --git a/test/api/Makefile.in b/test/api/Makefile.in
index 324d00b..58d0a23 100644
--- a/test/api/Makefile.in
+++ b/test/api/Makefile.in
@@ -20,8 +20,8 @@ ifeq ("@APPLIB@", "yes")
TARGETS += test
SOURCES = test.c
-TARGETS += vgtest.t percent.t pe_start.t
-SOURCES2 = vgtest.c percent.c pe_start.c
+TARGETS += vgtest.t percent.t pe_start.t lvtest.t
+SOURCES2 = vgtest.c percent.c pe_start.c lvtest.c
endif
include $(top_builddir)/make.tmpl
diff --git a/test/api/lvtest.c b/test/api/lvtest.c
new file mode 100644
index 0000000..c0fee65
--- /dev/null
+++ b/test/api/lvtest.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2010 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
+ */
+
+#undef NDEBUG
+
+#include "lvm2app.h"
+#include "assert.h"
+
+#define err(args...) \
+ do { fprintf(stderr, args); goto bad; } while (0)
+
+int main(int argc, char *argv[])
+{
+ lvm_t handle;
+ vg_t vg;
+ lv_t lv;
+ int r = -1;
+
+ if (!(handle = lvm_init(NULL)))
+ return -1;
+
+ if (!(vg = lvm_vg_open(handle, argv[1], "w", 0)))
+ err("VG open %s failed.\n", argv[1]);
+
+ if (!(lv = lvm_lv_from_name(vg, "test")))
+ err("LV test not found.\n");
+
+ if (lvm_lv_deactivate(lv))
+ err("LV test deactivation failed.\n");
+
+ if (lvm_lv_activate(lv))
+ err("LV test activation failed.\n");
+
+ if (lvm_lv_activate(lv))
+ err("LV test repeated activation failed.\n");
+
+ if (lvm_lv_rename(lv, "test1"))
+ err("LV test rename to test1 failed.\n");
+
+ if (lvm_lv_rename(lv, "test2"))
+ err("LV test1 rename to test2 failed.\n");
+
+ if (lvm_lv_rename(lv, "test"))
+ err("LV test2 rename to test failed.\n");
+
+ if (lvm_vg_close(vg))
+ err("VG close failed.\n");
+
+ r = 0;
+bad:
+ lvm_quit(handle);
+ return r;
+}
diff --git a/test/api/lvtest.sh b/test/api/lvtest.sh
new file mode 100644
index 0000000..0b7684a
--- /dev/null
+++ b/test/api/lvtest.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+# Copyright (C) 2011 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 General Public License v.2.
+#
+# You should have received a copy of the GNU 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
+
+. lib/test
+
+aux prepare_vg 1
+
+lvcreate -n test -l 5 $vg
+aux apitest lvtest $vg
+
+check lv_field $vg/test lv_name test