Re: [PATCH 05/10] daemon: move libvirtd code into src/remote/ directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/21/2018 04:35 PM, Daniel P. Berrangé wrote:
> Having a daemon/ directory makes little sense from a code structure
> point of view, as 90% of the code that is built into libvirtd already
> lives in the src/ directory. The virtlockd and virlogd daemons also live
> entirely in src/{locking,logging} directories. This moves the source
> code for libvirtd into src/remote/, alongside the client code.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> ---
>  .gitignore                                         |   2 +
>  daemon/Makefile.am                                 | 125 +--------------------
>  src/Makefile.am                                    |  93 ++++++++++++++-
>  daemon/libvirtd.c => src/remote/remote_daemon.c    |  10 +-
>  daemon/libvirtd.h => src/remote/remote_daemon.h    |  10 +-
>  .../remote/remote_daemon_config.c                  |  10 +-
>  .../remote/remote_daemon_config.h                  |  10 +-
>  .../remote/remote_daemon_dispatch.c                |  16 +--
>  .../remote/remote_daemon_dispatch.h                |  10 +-
>  .../stream.c => src/remote/remote_daemon_stream.c  |   8 +-
>  .../stream.h => src/remote/remote_daemon_stream.h  |  12 +-
>  11 files changed, 136 insertions(+), 170 deletions(-)
>  rename daemon/libvirtd.c => src/remote/remote_daemon.c (99%)
>  rename daemon/libvirtd.h => src/remote/remote_daemon.h (93%)
>  rename daemon/libvirtd-config.c => src/remote/remote_daemon_config.c (98%)
>  rename daemon/libvirtd-config.h => src/remote/remote_daemon_config.h (92%)
>  rename daemon/remote.c => src/remote/remote_daemon_dispatch.c (99%)
>  rename daemon/remote.h => src/remote/remote_daemon_dispatch.h (85%)
>  rename daemon/stream.c => src/remote/remote_daemon_stream.c (99%)>  rename daemon/stream.h => src/remote/remote_daemon_stream.h (85%)

Not that simple. Instead of pointing out in the patch, here's the diff
you need to squash in:


diff --git i/cfg.mk w/cfg.mk
index 920b60917..3172822cf 100644
--- i/cfg.mk
+++ w/cfg.mk
@@ -32,7 +32,7 @@ gnulib_dir = $(srcdir)/.gnulib
 # List of additional files that we want to pick up in our POTFILES.in
 # This is all gnulib files, as well as generated files for RPC code.
 generated_files = \
-  $(srcdir)/daemon/{lxc,qemu,remote}_dispatch.h \
+  $(srcdir)/src/remote/remote_daemon_dispatch{_lxc,_qemu,_}_stubs.h \
   $(srcdir)/src/*/{admin_server,log_daemon,lock_daemon}_dispatch_stubs.h \
   $(srcdir)/src/lxc/{lxc_monitor,lxc_controller}_dispatch.h \
   $(srcdir)/src/remote/*_client_bodies.h \
@@ -1116,17 +1116,26 @@ test-wrap-argv:
 
 # sc_po_check can fail if generated files are not built first
 sc_po_check: \
-		$(srcdir)/daemon/remote_dispatch.h \
-		$(srcdir)/daemon/qemu_dispatch.h \
+		$(srcdir)/src/remote/lxc_client_bodies.h \
+		$(srcdir)/src/remote/qemu_client_bodies.h \
 		$(srcdir)/src/remote/remote_client_bodies.h \
+		$(srcdir)/src/remote/remote_daemon_dispatch_lxc_stubs.h \
+		$(srcdir)/src/remote/remote_daemon_dispatch_qemu_stubs.h \
+		$(srcdir)/src/remote/remote_daemon_dispatch_stubs.h \
 		$(srcdir)/src/admin/admin_server_dispatch_stubs.h \
 		$(srcdir)/src/admin/admin_client.h
-$(srcdir)/daemon/remote_dispatch.h: $(srcdir)/src/remote/remote_protocol.x
-	$(MAKE) -C daemon remote_dispatch.h
-$(srcdir)/daemon/qemu_dispatch.h: $(srcdir)/src/remote/qemu_protocol.x
-	$(MAKE) -C daemon qemu_dispatch.h
+$(srcdir)/src/remote/lxc_client_bodies.h: $(srcdir)/src/remote/lxc_protocol.x
+	$(MAKE) -C src remote/lxc_client_bodies.h
+$(srcdir)/src/remote/qemu_client_bodies.h: $(srcdir)/src/remote/qemu_protocol.x
+	$(MAKE) -C src remote/qemu_client_bodies.h
 $(srcdir)/src/remote/remote_client_bodies.h: $(srcdir)/src/remote/remote_protocol.x
 	$(MAKE) -C src remote/remote_client_bodies.h
+$(srcdir)/src/remote/remote_daemon_dispatch_lxc_stubs.h: $(srcdir)/src/remote/lxc_protocol.x
+	$(MAKE) -C src remote/remote_daemon_dispatch_lxc_stubs.h
+$(srcdir)/src/remote/remote_daemon_dispatch_qemu_stubs.h: $(srcdir)/src/remote/qemu_protocol.x
+	$(MAKE) -C src remote/remote_daemon_dispatch_qemu_stubs.h
+$(srcdir)/src/remote/remote_daemon_dispatch_stubs.h: $(srcdir)/src/remote/remote_protocol.x
+	$(MAKE) -C src remote/remote_daemon_dispatch_stubs.h
 $(srcdir)/src/admin/admin_server_dispatch_stubs.h: $(srcdir)/src/admin/admin_protocol.x
 	$(MAKE) -C src admin/admin_server_dispatch_stubs.h
 $(srcdir)/src/admin/admin_client.h: $(srcdir)/src/admin/admin_protocol.x
@@ -1138,7 +1147,7 @@ exclude_file_name_regexp--sc_avoid_strcase = ^tools/vsh\.h$$
 _src1=libvirt-stream|qemu/qemu_monitor|util/vir(command|file|fdstream)|xen/xend_internal|rpc/virnetsocket|lxc/lxc_controller|locking/lock_daemon|logging/log_daemon
 _test1=shunloadtest|virnettlscontexttest|virnettlssessiontest|vircgroupmock|commandhelper
 exclude_file_name_regexp--sc_avoid_write = \
-  ^(src/($(_src1))|daemon/libvirtd|tools/virsh-console|tests/($(_test1)))\.c$$
+  ^(src/($(_src1))|tools/virsh-console|tests/($(_test1)))\.c$$
 
 exclude_file_name_regexp--sc_bindtextdomain = .*
 
@@ -1159,7 +1168,7 @@ exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics = \
 exclude_file_name_regexp--sc_po_check = ^(docs/|src/rpc/gendispatch\.pl$$)
 
 exclude_file_name_regexp--sc_prohibit_VIR_ERR_NO_MEMORY = \
-  ^(cfg\.mk|include/libvirt/virterror\.h|daemon/dispatch\.c|src/util/virerror\.c|docs/internals/oomtesting\.html\.in)$$
+  ^(cfg\.mk|include/libvirt/virterror\.h|src/util/virerror\.c|docs/internals/oomtesting\.html\.in)$$
 
 exclude_file_name_regexp--sc_prohibit_PATH_MAX = \
 	^cfg\.mk$$
@@ -1179,9 +1188,9 @@ exclude_file_name_regexp--sc_prohibit_close = \
 exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
   (^tests/(qemuhelp|virhostcpu|virpcitest)data/|docs/js/.*\.js|docs/fonts/.*\.woff|\.diff|tests/virconfdata/no-newline\.conf$$)
 
-_src2=src/(util/vircommand|libvirt|lxc/lxc_controller|locking/lock_daemon|logging/log_daemon)
+_src2=src/(util/vircommand|libvirt|lxc/lxc_controller|locking/lock_daemon|logging/log_daemon|remote/remote_daemon)
 exclude_file_name_regexp--sc_prohibit_fork_wrappers = \
-  (^($(_src2)|tests/testutils|daemon/libvirtd)\.c$$)
+  (^($(_src2)|tests/testutils)\.c$$)
 
 exclude_file_name_regexp--sc_prohibit_gethostname = ^src/util/vir(util|log)\.c$$
 
diff --git i/po/POTFILES.in w/po/POTFILES.in
index 285955469..306535579 100644
--- i/po/POTFILES.in
+++ w/po/POTFILES.in
@@ -1,9 +1,3 @@
-daemon/libvirtd-config.c
-daemon/libvirtd.c
-daemon/qemu_dispatch.h
-daemon/remote.c
-daemon/remote_dispatch.h
-daemon/stream.c
 gnulib/lib/gai_strerror.c
 gnulib/lib/getopt.c
 gnulib/lib/regcomp.c
@@ -148,6 +142,11 @@ src/qemu/qemu_monitor_text.c
 src/qemu/qemu_parse_command.c
 src/qemu/qemu_process.c
 src/remote/remote_client_bodies.h
+src/remote/remote_daemon.c
+src/remote/remote_daemon_config.c
+src/remote/remote_daemon_dispatch.c
+src/remote/remote_daemon_dispatch_qemu_stubs.h
+src/remote/remote_daemon_stream.c
 src/remote/remote_driver.c
 src/rpc/virkeepalive.c
 src/rpc/virnetclient.c
diff --git i/src/Makefile.am w/src/Makefile.am
index a1e5fa573..decdb9c3e 100644
--- i/src/Makefile.am
+++ w/src/Makefile.am
@@ -544,14 +544,14 @@ remote/remote_daemon_dispatch_stubs.h: $(top_srcdir)/src/rpc/gendispatch.pl \
 	  --mode=server remote REMOTE $(REMOTE_PROTOCOL) \
 	  > $(srcdir)/remote/remote_daemon_dispatch_stubs.h
 
-remote/remote_daemon_dispatch_lxc_stubs.h: $(top_srcdir)/src/rpc/gendispatch.pl \
-		$(LXC_PROTOCOL) Makefile.am
+remote/remote_daemon_dispatch_lxc_stubs.h: \
+	$(top_srcdir)/src/rpc/gendispatch.pl $(LXC_PROTOCOL) Makefile.am
 	$(AM_V_GEN)$(PERL) -w $(top_srcdir)/src/rpc/gendispatch.pl \
 	  --mode=server lxc LXC $(LXC_PROTOCOL) \
 	  > $(srcdir)/remote/remote_daemon_dispatch_lxc_stubs.h
 
-remote/remote_daemon_dispatch_qemu_stubs.h: $(top_srcdir)/src/rpc/gendispatch.pl \
-		$(QEMU_PROTOCOL) Makefile.am
+remote/remote_daemon_dispatch_qemu_stubs.h: \
+	$(top_srcdir)/src/rpc/gendispatch.pl $(QEMU_PROTOCOL) Makefile.am
 	$(AM_V_GEN)$(PERL) -w $(top_srcdir)/src/rpc/gendispatch.pl \
 	  --mode=server qemu QEMU $(QEMU_PROTOCOL) \
 	  > $(srcdir)/remote/remote_daemon_dispatch_qemu_stubs.h
diff --git i/src/remote/remote_daemon.c w/src/remote/remote_daemon.c
index a452c72b5..f8082f62f 100644
--- i/src/remote/remote_daemon.c
+++ w/src/remote/remote_daemon.c
@@ -1466,9 +1466,7 @@ int main(int argc, char **argv) {
      */
     if (statuswrite != -1) {
         char status = 0;
-        while (write(statuswrite, &status, 1) == -1 &&
-               errno == EINTR)
-            ;
+        ignore_value(safewrite(statuswrite, &status, 1));
         VIR_FORCE_CLOSE(statuswrite);
     }
 
@@ -1534,9 +1532,7 @@ int main(int argc, char **argv) {
         if (ret != 0) {
             /* Tell parent of daemon what failed */
             char status = ret;
-            while (write(statuswrite, &status, 1) == -1 &&
-                   errno == EINTR)
-                ;
+            ignore_value(safewrite(statuswrite, &status, 1));
         }
         VIR_FORCE_CLOSE(statuswrite);
     }
diff --git i/src/remote/remote_daemon_config.c w/src/remote/remote_daemon_config.c
index 2317115b8..b1516befb 100644
--- i/src/remote/remote_daemon_config.c
+++ w/src/remote/remote_daemon_config.c
@@ -1,5 +1,5 @@
 /*
- * remote_daemon_config.h: libvirtd config file handling
+ * remote_daemon_config.c: libvirtd config file handling
  *
  * Copyright (C) 2006-2018 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange



Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux