OpenVZ Forum


Home » Mailing lists » Devel » Q: libvzctl-simfs
Q: libvzctl-simfs [message #3850] Wed, 21 June 2006 17:20 Go to next message
ldv is currently offline  ldv
Messages: 24
Registered: June 2006
Junior Member
Hi,

I wonder what was rationale for introducing libvzctl-simfs library.
Since this library references to symbols defined in libvzctl, it cannot be
loaded without loading libvzctl.


--
ldv
Re: Q: libvzctl-simfs [message #3868 is a reply to message #3850] Thu, 22 June 2006 07:41 Go to previous messageGo to next message
Igor Sukhih is currently offline  Igor Sukhih
Messages: 21
Registered: May 2006
Junior Member
Dmitry V. Levin wrote:
> Hi,
>
> I wonder what was rationale for introducing libvzctl-simfs library.
> Since this library references to symbols defined in libvzctl, it cannot be
> loaded without loading libvzctl.
It can't supposed to work standalone.
libvzctl-simfs introduced for VE file system type selection.
Then vzctl will support more file systems appropriate library will used.
Re: Q: libvzctl-simfs [message #3869 is a reply to message #3850] Thu, 22 June 2006 07:44 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

It was a try to split vzctl and make it plugin based.
however, due to lack of time and low prio it was stopped
on the early stages... :/ Rudiments...

Kirill

> Hi,
>
> I wonder what was rationale for introducing libvzctl-simfs library.
> Since this library references to symbols defined in libvzctl, it cannot be
> loaded without loading libvzctl.
>
>
>
>
> ------------------------------------------------------------ ------------
>
Re: Q: libvzctl-simfs [message #3870 is a reply to message #3869] Thu, 22 June 2006 07:55 Go to previous messageGo to next message
ldv is currently offline  ldv
Messages: 24
Registered: June 2006
Junior Member
On Thu, Jun 22, 2006 at 11:44:15AM +0400, Kirill Korotaev wrote:
> It was a try to split vzctl and make it plugin based.
> however, due to lack of time and low prio it was stopped
> on the early stages... :/ Rudiments...

I see. Anyway, if shared library references to symbols defined in another
shared library, then it should link with that library. That is, I suggest
to merge libvzctl-simfs back to libvzctl. Also, I suggest to move "g_log"
symbol from vzcfgvalidate binary to libvzctl. After that, libvzctl will
be self-contained, thus enabling both --as-needed and prelink support.

At least, I had to apply these changes to package vzctl for Sisyphus.


--
ldv
Re: Q: libvzctl-simfs [message #4838 is a reply to message #3870] Thu, 27 July 2006 15:37 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

Dmitry V. Levin wrote:
> On Thu, Jun 22, 2006 at 11:44:15AM +0400, Kirill Korotaev wrote:
>
>> It was a try to split vzctl and make it plugin based.
>> however, due to lack of time and low prio it was stopped
>> on the early stages... :/ Rudiments...
>>
>
> I see. Anyway, if shared library references to symbols defined in another
> shared library, then it should link with that library. That is, I suggest
> to merge libvzctl-simfs back to libvzctl. Also, I suggest to move "g_log"
> symbol from vzcfgvalidate binary to libvzctl. After that, libvzctl will
> be self-contained, thus enabling both --as-needed and prelink support.
>
> At least, I had to apply these changes to package vzctl for Sisyphus.
Dmitry,

Can you please send your patches (if you have those) -- we'll take a
look and possibly commit them.
Re: Q: libvzctl-simfs [message #4991 is a reply to message #4838] Mon, 07 August 2006 19:32 Go to previous message
ldv is currently offline  ldv
Messages: 24
Registered: June 2006
Junior Member
On Thu, Jul 27, 2006 at 07:37:54PM +0400, Kir Kolyshkin wrote:
> Dmitry V. Levin wrote:
> >On Thu, Jun 22, 2006 at 11:44:15AM +0400, Kirill Korotaev wrote:
> >
> >>It was a try to split vzctl and make it plugin based.
> >>however, due to lack of time and low prio it was stopped
> >>on the early stages... :/ Rudiments...
> >>
> >
> >I see. Anyway, if shared library references to symbols defined in another
> >shared library, then it should link with that library. That is, I suggest
> >to merge libvzctl-simfs back to libvzctl. Also, I suggest to move "g_log"
> >symbol from vzcfgvalidate binary to libvzctl. After that, libvzctl will
> >be self-contained, thus enabling both --as-needed and prelink support.
> >
> >At least, I had to apply these changes to package vzctl for Sisyphus.
> Dmitry,
>
> Can you please send your patches (if you have those) -- we'll take a
> look and possibly commit them.

The patch I made to package vzctl for Sisyphus just merges libvzctl-simfs
back to libvzctl. Since you want to implement plugin support some day,
I reworked the change, this patch may be more appropriate.

---
Rework libraries to support ld --as-needed.

Makefile:
Relocate libraries from /usr/lib/vzctl/lib to /usr/lib.
Drop rpath.
Move logger to separate libvzlogger library.
Add sonames to all shared libraries.
Link libvzctl-simfs with libvzlogger.
Link libvzctl with libvzctl-simfs and libvzlogger.
Link vzctl, vzlist, vzmemcheck and vzcfgvalidate with libvzlogger.
Raise LIB_VER.

logger.c:
Define export g_log variable.

vzcalc.c, vzcfgvalidate.c, vzctl.c, vzlist.c, vzmemcheck.c:
Use g_log variable from libvzlogger.

vzctl.spec:
Relocate libraries from /usr/lib/vzctl/lib to /usr/lib.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---

src/Makefile | 41 +++++++++++++++++++++++------------------
src/lib/logger.c | 2 +-
src/vzcalc.c | 2 --
src/vzcfgvalidate.c | 2 --
src/vzctl.c | 2 --
src/vzlist.c | 1 -
src/vzmemcheck.c | 2 --
vzctl.spec | 29 +++++++++++++++++------------
8 files changed, 41 insertions(+), 40 deletions(-)

2d2c39b960e0a61ff7122210dc75c70ef189a25a
diff --git a/src/Makefile b/src/Makefile
index 3008f1c..97e17a1 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -17,7 +17,7 @@ #
INSTALL = install
PREFIX = /usr
SBINDIR = $(PREFIX)/sbin
- LIBDIR = $(PREFIX)/lib/vzctl/lib
+ LIBDIR = $(PREFIX)/lib
CONFDIR = /etc/vz
GLBCONFIG = $(CONFDIR)/vz.conf
VPSCONFDIR = $(CONFDIR)/conf
@@ -33,7 +33,7 @@ NETSCRIPTDIR = /etc/sysconfig/network-sc
VZDUMPDIR = $(VZDIR)/dump
VEIPDUMPDIR = /var/lib/vzctl/veip
LOGRDIR = /etc/logrotate.d
- LIB_VER = 0.0.2
+ LIB_VER = 0.0.3

export LD_LIBRARY_PATH=.
CC = gcc
@@ -43,13 +43,14 @@ #VZKERNEL_HEADERS ?= /lib/modules/$(shel
INC = -I ../include
ARCH ?= $(shell uname -m)

-OBJ_libvzctl = lib/env.lo lib/ub.lo lib/net.lo lib/logger.lo lib/exec.lo \
+OBJ_libvzctl = lib/env.lo lib/ub.lo lib/net.lo lib/exec.lo \
lib/cap.lo lib/cpu.lo lib/res.lo lib/util.lo lib/dist.lo lib/list.lo \
lib/script.lo lib/dev.lo lib/config.lo lib/lock.lo lib/quota.lo \
lib/modules.lo lib/iptables.lo lib/fs.lo lib/create.lo lib/readelf.lo \
lib/cpt.lo lib/destroy.lo lib/vps_configure.lo lib/meminfo.lo \
lib/veth.lo
OBJ_simfs=lib/fs_simfs.lo
+OBJ_logger = lib/logger.lo
OBJ_vzctl = vzctl.o vzctl-actions.o modules.o enter.o
OBJ_vzlist = vzlist.o
OBJ_arp = arpsend.o
@@ -59,17 +60,17 @@ OBJ_cfgvalidate = vzcfgvalidate.o valida
OBJ_calc = vzcalc.o
OBJ = $(OBJ_vzctl) $(OBJ_vzlist) $(OBJ_arp) $(OBJ_split) $(OBJ_memcheck) \
$(OBJ_cfgvalidate) $(OBJ_calc)
-LOBJ = $(OBJ_libvzctl) $(OBJ_simfs)
+LOBJ = $(OBJ_libvzctl) $(OBJ_simfs) $(OBJ_logger)
LIB_vzctl = libvzctl.so.$(LIB_VER)
LIB_simfs = libvzctl-simfs.so.$(LIB_VER)
+LIB_logger = libvzlogger.so.$(LIB_VER)
LIB_fs = $(LIB_simfs)

-LDFLAGS += -Wl,-rpath=$(LIBDIR)
LIBSCRIPTS = vps-create vps-postcreate vps-net_add vps-net_del vps-stop \
vps-functions

PROGS = vzctl vzlist arpsend vzsplit vzcfgvalidate vzmemcheck vzcalc
-LIBS = $(LIB_vzctl) $(LIB_fs)
+LIBS = $(LIB_vzctl) $(LIB_fs) $(LIB_logger)

INITSCRIPTS = vz
CRONSCRIPTS = vpsreboot vpsnetclean
@@ -102,23 +103,26 @@ check-version:
%.lo: %.c
$(CC) -c $(CFLAGS) $(SHAREDLIB_CFLAGS) $(INC) $< -o $@

-$(LIB_fs) : $(OBJ_simfs) lib/logger.lo
- $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -shared -o $@
+$(LIB_logger) : $(OBJ_logger)
+ $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -shared -Wl,-soname,$@ -o $@

-libvzctl.a: $(OBJ_libvzctl) $(LIB_fs)
+$(LIB_fs) : $(OBJ_simfs) $(LIB_logger)
+ $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -shared -Wl,-soname,$@ -o $@
+
+$(LIB_vzctl) : $(OBJ_libvzctl) $(LIB_fs) $(LIB_logger)
+ $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ $(LD_FLAGS) -shared -Wl,-soname,$@ -o $@
+
+libvzctl.a: $(OBJ_libvzctl) $(OBJ_simfs) $(OBJ_logger)
ar scq $@ $+
ranlib $@

-$(LIB_vzctl) : $(LIB_fs) $(OBJ_libvzctl)
- $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ $(LD_FLAGS) -shared -o $@
-
vzctl-static: $(OBJ_vzctl) libvzctl.a
$(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -rdynamic -ldl -lutil -o $@

-vzctl: check-version $(OBJ_vzctl) $(LIB_vzctl) $(LIB_fs)
- $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $(OBJ_vzctl) $(LIB_vzctl) $(LIB_fs) -ldl -lutil -o $@
+vzctl: check-version $(OBJ_vzctl) $(LIB_vzctl) $(LIB_fs) $(LIB_logger)
+ $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $(OBJ_vzctl) $(LIB_vzctl) $(LIB_fs) $(LIB_logger) -ldl -lutil -o $@

-vzlist: $(OBJ_vzlist) $(LIB_vzctl) $(LIB_fs)
+vzlist: $(OBJ_vzlist) $(LIB_vzctl) $(LIB_logger)
$(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -o $@

arpsend: $(OBJ_arp)
@@ -127,10 +131,10 @@ arpsend: $(OBJ_arp)
vzsplit: $(OBJ_split)
$(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -o $@

-vzmemcheck: $(OBJ_memcheck) $(LIB_vzctl)
+vzmemcheck: $(OBJ_memcheck) $(LIB_vzctl) $(LIB_logger)
$(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -o $@

-vzcfgvalidate: $(OBJ_cfgvalidate) $(LIB_vzctl)
+vzcfgvalidate: $(OBJ_cfgvalidate) $(LIB_vzctl) $(LIB_logger)
$(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -o $@

vzcalc: $(OBJ_calc) $(LIB_vzctl)
@@ -145,6 +149,7 @@ install-lib: $(LIB_vzctl) $(LIB_fs)
$(INSTALL) -d $(DESTDIR)$(LIBSCRIPTSDIR)
$(INSTALL) $(LIB_vzctl) $(DESTDIR)$(LIBDIR)/$(LIB_vzctl)
$(INSTALL) $(LIB_fs) $(DESTDIR)$(LIBDIR)/$(LIB_fs)
+ $(INSTALL) $(LIB_logger) $(DESTDIR)$(LIBDIR)/$(LIB_logger)
for file in $(LIBSCRIPTS); do \
$(INSTALL) -m 755 ../etc/$$file $(DESTDIR)$(LIBSCRIPTSDIR)/$$file; \
done
@@ -208,7 +213,7 @@ inst-dirs:
install: $(PROGS) inst-dirs install-lib inst-sbin inst-scripts \
inst-netscripts inst-configs inst-initd inst-cron
clean:
- rm -f *.o lib/*.lo $(PROGS) $(LIB_vzctl) $(LIB_fs) $(LIB_fs) .depend
+ rm -f *.o lib/*.lo $(PROGS) $(LIB_vzctl) $(LIB_fs) $(LIB_logger) .depend

.depend:: $(OBJ:.o=.c) $(LOBJ:.lo=.c)
$(CC) -M $(FLAGS) $(DEPFLAGS) $(INC) $^ >.depend
diff --git a/src/lib/logger.c b/src/lib/logger.c
index 1b18e8e..8432069 100644
--- a/src/lib/logger.c
+++ b/src/lib/logger.c
@@ -30,7 +30,7 @@ #include <sys/file.h>
#include "types.h"
#include "logger.h"

-extern log_param g_log;
+LOG_DATA

static inline void get_date(char *buf, int len)
{
diff --git a/src/vzcalc.c b/src/vzcalc.c
index 71ff02b..5e09809 100644
--- a/src/vzcalc.c
+++ b/src/vzcalc.c
@@ -27,8 +27,6 @@ #include "ub.h"
#include "config.h"
#include "util.h"

-LOG_DATA
-
void usage()
{
printf("Usage: vzcalc [-v] <veid>\n");
diff --git a/src/vzcfgvalidate.c b/src/vzcfgvalidate.c
index 57f3d92..764b0f0 100644
--- a/src/vzcfgvalidate.c
+++ b/src/vzcfgvalidate.c
@@ -26,8 +26,6 @@ #include "config.h"
#include "validate.h"
#include "logger.h"

-log_param g_log;
-
void usage()
{
printf("Usage: vzcfgvalidate [-r|-i] <configfile>\n");
diff --git a/src/vzctl.c b/src/vzctl.c
index 255f20e..62b36cb 100644
--- a/src/vzctl.c
+++ b/src/vzctl.c
@@ -32,8 +32,6 @@ #include "types.h"
#include "util.h"
#include "modules.h"

-LOG_DATA
-
struct mod_action g_action;
char *_proc_title;
int _proc_title_len;
diff --git a/src/vzlist.c b/src/vzlist.c
index 3e631ea..53bfc5c 100644
--- a/src/vzlist.c
+++ b/src/vzlist.c
@@ -42,7 +42,6 @@ #include "logger.h"
#include "util.h"
#include "types.h"

-LOG_DATA
static struct Cveinfo *veinfo = NULL;
static int n_veinfo = 0;

diff --git a/src/vzmemcheck.c b/src/vzmemcheck.c
index cadeab7..bfe1632 100644
--- a/src/vzmemcheck.c
+++ b/src/vzmemcheck.c
@@ -29,8 +29,6 @@ #include "ub.h"
#include "util.h"
#include "logger.h"

-LOG_DATA
-
void usage()
{
printf("Usage: vzmemcheck [-v] [-A]\n");
diff --git a/vzctl.spec b/vzctl.spec
index 0e3f166..793bd20 100644
--- a/vzctl.spec
+++ b/vzctl.spec
@@ -5,9 +5,10 @@
%define _dumpdir %{_vzdir}/dump
%define _cachedir %{_vzdir}/template/cache
%define _veipdir /var/lib/vzctl/veip
-%define _libdir /usr/lib/vzctl
+%define _libvzdir /usr/lib/vzctl
+%define _libscriptdir %{_libvzdir}/scripts
%define _configdir /etc/vz
-%define _scriptdir /usr/share/vzctl//scripts
+%define _scriptdir /usr/share/vzctl/scripts
%define _vpsconfdir /etc/sysconfig/vz-scripts
%define _netdir /etc/sysconfig/network-scripts
%define _logrdir /etc/logrotate.d
@@ -156,13 +157,17 @@ Virtual Private Servers control API libr

%files lib
%defattr(-,root,root)
-%dir %{_libdir}/lib
-%attr(755,root,root) %{_libdir}/lib/libvzctl.so.*
-%attr(755,root,root) %{_libdir}/lib/libvzctl-simfs.so.*
-%attr(755,root,root) %{_libdir}/scripts/vps-stop
-%attr(755,root,root) %{_libdir}/scripts/vps-functions
-%attr(755,root,root) %{_libdir}/scripts/vps-net_add
-%attr(755,root,root) %{_libdir}/scripts/vps-net_del
-%attr(755,root,root) %{_libdir}/scripts/vps-create
-%attr(755,root,root) %{_
...

Previous Topic: Fwd: [PATCH] pidspace is_init()
Next Topic: [Lxc-devel] [PATCH] pidspace: is_init()
Goto Forum:
  


Current Time: Sun Jul 14 20:18:39 GMT 2024

Total time taken to generate the page: 0.02362 seconds