[Libreoffice-commits] online.git: Branch 'private/hcvcastro/bind-mount' - loolwsd/configure.ac loolwsd/LOOLMount.cpp loolwsd/Makefile.am
Henry Castro
hcastro at collabora.com
Thu Dec 10 03:31:12 PST 2015
loolwsd/LOOLMount.cpp | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++
loolwsd/Makefile.am | 9 +++++-
loolwsd/configure.ac | 3 +-
3 files changed, 80 insertions(+), 2 deletions(-)
New commits:
commit 96f13c09f9d2572371684e0df85b2ce20b98720c
Author: Henry Castro <hcastro at collabora.com>
Date: Thu Dec 10 07:30:45 2015 -0400
loolwsd: add external binary LOOLMount.cpp
diff --git a/loolwsd/LOOLMount.cpp b/loolwsd/LOOLMount.cpp
new file mode 100644
index 0000000..f495333
--- /dev/null
+++ b/loolwsd/LOOLMount.cpp
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+/*
+ * NB. this file is compiled both standalone, and as part of the LOOLMount.
+ */
+
+#include <sys/mount.h>
+
+#include <cstring>
+#include <iostream>
+
+int main(int argc, char** argv)
+{
+ std::string source;
+ std::string target;
+
+ for (int i = 0; i < argc; ++i)
+ {
+ char *cmd = argv[i];
+ char *eq = NULL;
+ if (strstr(cmd, "--source=") == cmd)
+ {
+ eq = strchrnul(cmd, '=');
+ if (*eq)
+ source = std::string(++eq);
+ }
+ else if (strstr(cmd, "--target=") == cmd)
+ {
+ eq = strchrnul(cmd, '=');
+ if (*eq)
+ target = std::string(++eq);
+ }
+ }
+
+ if (!source.empty() && !target.empty())
+ {
+ if (mount(source.c_str(), target.c_str(), NULL, MS_BIND, NULL) < 0)
+ {
+ std::cout << "Failed to mount " << source
+ << " on " << target << " :"<< strerror(errno) << std::endl;
+ exit(-1);
+ }
+ }
+ else if (source.empty() && !target.empty())
+ {
+ if (umount(target.c_str()) < 0)
+ {
+ std::cout << "Failed to umount "
+ << target << " :"
+ << strerror(errno) << std::endl;
+ exit(-1);
+ }
+ }
+ else
+ {
+ std::cout << "Wrong parameters!" << std::endl;
+ exit(-1);
+ }
+
+ exit(EXIT_SUCCESS);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/Makefile.am b/loolwsd/Makefile.am
index 7b7123f..62f24ee 100644
--- a/loolwsd/Makefile.am
+++ b/loolwsd/Makefile.am
@@ -1,19 +1,25 @@
SUBDIRS = test
-bin_PROGRAMS = loolwsd
+bin_PROGRAMS = loolwsd loolmount
dist_bin_SCRIPTS = loolwsd-systemplate-setup
+loolwsd_LDADD = @POCO_LIBS@
loolwsd_SOURCES = LOOLWSD.cpp LOOLSession.cpp MessageQueue.cpp TileCache.cpp Util.cpp LOOLProtocol.cpp
noinst_PROGRAMS = loadtest connect lokitclient
+loadtest_LDADD = @POCO_LIBS@
loadtest_SOURCES = LoadTest.cpp Util.cpp LOOLProtocol.cpp
+connect_LDADD = @POCO_LIBS@
connect_SOURCES = Connect.cpp Util.cpp LOOLProtocol.cpp
+lokitclient_LDADD = @POCO_LIBS@
lokitclient_SOURCES = LOKitClient.cpp Util.cpp
+loolmount_SOURCES = LOOLMount.cpp
+
noinst_HEADERS = LOKitHelper.hpp LOOLProtocol.hpp LOOLSession.hpp LOOLWSD.hpp LoadTest.hpp MessageQueue.hpp TileCache.hpp Util.hpp Png.hpp \
bundled/include/LibreOfficeKit/LibreOfficeKit.h bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h \
bundled/include/LibreOfficeKit/LibreOfficeKitInit.h bundled/include/LibreOfficeKit/LibreOfficeKitTypes.h
@@ -31,6 +37,7 @@ all-local: loolwsd
if test "$$BUILDING_FROM_RPMBUILD" != yes; then \
if test `uname -s` = Linux; then \
sudo @SETCAP@ cap_fowner,cap_mknod,cap_sys_admin,cap_sys_chroot=ep loolwsd; \
+ sudo @SETCAP@ cap_sys_admin=ep loolmount; \
else \
sudo chown root loolwsd && sudo chmod u+s loolwsd; \
fi; \
diff --git a/loolwsd/configure.ac b/loolwsd/configure.ac
index 46906b1..60e92ab 100644
--- a/loolwsd/configure.ac
+++ b/loolwsd/configure.ac
@@ -104,7 +104,8 @@ AS_IF([test `uname -s` = Linux],
AS_IF([test "$enable_tests" != "no"],
[PKG_CHECK_MODULES([CPPUNIT], [cppunit])])
-LIBS="$LIBS -lPocoNet${POCO_DEBUG_SUFFIX} -lPocoUtil${POCO_DEBUG_SUFFIX} -lPocoXML${POCO_DEBUG_SUFFIX} -lPocoJSON${POCO_DEBUG_SUFFIX} -lPocoFoundation${POCO_DEBUG_SUFFIX}"
+POCO_LIBS="$LIBS -lPocoNet${POCO_DEBUG_SUFFIX} -lPocoUtil${POCO_DEBUG_SUFFIX} -lPocoXML${POCO_DEBUG_SUFFIX} -lPocoJSON${POCO_DEBUG_SUFFIX} -lPocoFoundation${POCO_DEBUG_SUFFIX}"
+AC_SUBST(POCO_LIBS)
AC_CHECK_HEADERS([LibreOfficeKit/LibreOfficeKit.h],
[],
More information about the Libreoffice-commits
mailing list