summaryrefslogtreecommitdiffstats
path: root/liblvm/lvm_base.c
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2009-03-06 16:19:52 +0000
committerDave Wysochanski <dwysocha@redhat.com>2009-03-06 16:19:52 +0000
commite0c64c6c35e7d673a627a3487e3d30f2f7c79c53 (patch)
tree32dd100a0c2b4d4725b351f3a60b8ebe1a598fc0 /liblvm/lvm_base.c
parent0bf8455b64bf73e4536c60b6c7b6239dce6db904 (diff)
downloadlvm2-e0c64c6c35e7d673a627a3487e3d30f2f7c79c53.tar.gz
lvm2-e0c64c6c35e7d673a627a3487e3d30f2f7c79c53.tar.xz
lvm2-e0c64c6c35e7d673a627a3487e3d30f2f7c79c53.zip
Add new liblvm build directory and move lvm_base.c.
The original liblvm.a has been moved to liblvm-internal.a. We now use liblvm.a for the new application library and build it inside liblvm directory. Change dependencies so tools depend on liblvm application library, and application library depends on liblvm internal.
Diffstat (limited to 'liblvm/lvm_base.c')
-rw-r--r--liblvm/lvm_base.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/liblvm/lvm_base.c b/liblvm/lvm_base.c
new file mode 100644
index 00000000..f9175338
--- /dev/null
+++ b/liblvm/lvm_base.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2008,2009 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
+ */
+
+#include "lib.h"
+#include "lvm.h"
+#include "toolcontext.h"
+#include "locking.h"
+#include "metadata-exported.h"
+#include "report.h"
+
+lvm_t lvm_create(const char *system_dir)
+{
+ struct cmd_context *cmd;
+
+ /* FIXME: logging bound to handle
+ */
+
+ /* create context */
+ /* FIXME: split create_toolcontext */
+ cmd = create_toolcontext(1, system_dir);
+ if (!cmd)
+ return NULL;
+ /*
+ * FIXME: if an non memory error occured, return the cmd (maybe some
+ * cleanup needed).
+ */
+
+ /* initialization from lvm_run_command */
+ init_error_message_produced(0);
+
+ /* FIXME: locking_type config option needed? */
+ /* initialize locking */
+ if (!init_locking(-1, cmd)) {
+ /* FIXME: use EAGAIN as error code here */
+ log_error("Locking initialisation failed.");
+ lvm_destroy((lvm_t) cmd);
+ return NULL;
+ }
+
+ return (lvm_t) cmd;
+}
+
+void lvm_destroy(lvm_t libh)
+{
+ /* FIXME: error handling */
+ destroy_toolcontext((struct cmd_context *)libh);
+}
+
+int lvm_reload_config(lvm_t libh)
+{
+ /* FIXME: re-init locking needed here? */
+ return refresh_toolcontext((struct cmd_context *)libh);
+}