[PATCH 1/2] Fix many mistakes & inconsistencies in header file layout

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

 



This introduces a syntax-check script that validates header files use a
common layout:

  /*
   ...copyright header...
   */
  <one blank line>
  #ifndef SYMBOL
  # define SYMBOL
  ....content....
  #endif /* SYMBOL */

For any file ending priv.h, before the #ifndef, we will require a
guard to prevent bogus imports:

  #ifndef SYMBOL_ALLOW
  # error ....
  #endif /* SYMBOL_ALLOW */
  <one blank line>

The many mistakes this script identifies are then fixed.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 build-aux/header-ifdef.pl                   | 149 ++++++++++++++++++++
 cfg.mk                                      |   7 +-
 src/bhyve/bhyve_capabilities.h              |   2 +-
 src/bhyve/bhyve_parse_command.h             |   2 +-
 src/conf/domain_event.h                     |   5 +-
 src/conf/domain_nwfilter.h                  |   1 +
 src/conf/netdev_vlan_conf.h                 |   2 +-
 src/conf/network_event.h                    |  10 +-
 src/conf/node_device_event.h                |  10 +-
 src/conf/nwfilter_conf.h                    |   1 +
 src/conf/nwfilter_params.h                  |   1 +
 src/conf/object_event.h                     |  10 +-
 src/conf/object_event_private.h             |   6 +-
 src/conf/secret_conf.h                      |   3 +-
 src/conf/secret_event.h                     |  10 +-
 src/conf/storage_event.h                    |  10 +-
 src/conf/virchrdev.h                        |   4 +-
 src/conf/virnwfilterbindingdef.h            |   1 +
 src/conf/virnwfilterbindingobj.h            |   1 +
 src/conf/virnwfilterobj.h                   |   1 +
 src/conf/virsavecookie.h                    |   3 +-
 src/datatypes.h                             |   2 +-
 src/interface/interface_driver.h            |   1 -
 src/internal.h                              |   2 +-
 src/libvirt_internal.h                      |   2 +-
 src/libxl/libxl_migration.h                 |   2 +-
 src/locking/lock_daemon_config.h            |   2 +-
 src/logging/log_daemon_config.h             |   2 +-
 src/logging/log_handler.h                   |   2 +-
 src/logging/log_manager.h                   |   1 -
 src/lxc/lxc_domain.h                        |   1 -
 src/network/bridge_driver.h                 |   1 -
 src/node_device/node_device_udev.h          |  13 +-
 src/nwfilter/nwfilter_ebiptables_driver.h   |   3 +-
 src/nwfilter/nwfilter_gentech_driver.h      |   3 +-
 src/openvz/openvz_driver.h                  |   3 +-
 src/openvz/openvz_util.h                    |   3 +-
 src/qemu/qemu_agent.h                       |   1 -
 src/qemu/qemu_alias.h                       |   2 +-
 src/qemu/qemu_capabilities.h                |   2 +-
 src/qemu/qemu_capspriv.h                    |   5 +-
 src/qemu/qemu_command.h                     |   2 +-
 src/qemu/qemu_domain_address.h              |   3 +-
 src/qemu/qemu_extdevice.h                   |   1 +
 src/qemu/qemu_hotplug.c                     |   1 +
 src/qemu/qemu_hotplugpriv.h                 |   4 +
 src/qemu/qemu_migration_params.c            |   1 +
 src/qemu/qemu_migration_paramspriv.h        |   4 +
 src/qemu/qemu_monitor.h                     |   1 -
 src/qemu/qemu_monitor_json.h                |   1 -
 src/qemu/qemu_monitor_priv.h                |   4 +-
 src/qemu/qemu_monitor_text.h                |   1 -
 src/qemu/qemu_parse_command.h               |   2 +-
 src/qemu/qemu_process.c                     |   1 +
 src/qemu/qemu_processpriv.h                 |   4 +
 src/qemu/qemu_tpm.h                         |   1 +
 src/remote/remote_daemon.h                  |   1 -
 src/remote/remote_daemon_stream.h           |   1 -
 src/rpc/virnetlibsshsession.h               |   3 +-
 src/rpc/virnetserverservice.h               |   2 +-
 src/rpc/virnetsshsession.h                  |   3 +-
 src/rpc/virnettlscontext.h                  |   2 +-
 src/security/security_apparmor.h            |   1 +
 src/security/security_dac.h                 |   4 +-
 src/security/security_driver.h              |   1 +
 src/security/security_selinux.h             |   1 +
 src/security/security_stack.h               |   4 +-
 src/storage/storage_backend_iscsi_direct.h  |  16 +++
 src/storage/storage_backend_sheepdog.c      |   1 +
 src/storage/storage_backend_sheepdog_priv.h |   4 +
 src/uml/uml_driver.h                        |   1 -
 src/util/viralloc.h                         |   1 -
 src/util/viratomic.h                        |   2 +-
 src/util/viraudit.h                         |   1 -
 src/util/virbitmap.h                        |   2 +-
 src/util/vircgrouppriv.h                    |   2 +-
 src/util/vircommandpriv.h                   |   2 +-
 src/util/virdbus.c                          |   1 +
 src/util/virdbuspriv.h                      |   4 +
 src/util/virebtables.h                      |   2 +-
 src/util/virerror.h                         |   2 +-
 src/util/vireventpoll.h                     |   2 +-
 src/util/virfcp.h                           |   2 +-
 src/util/virfdstream.h                      |   1 -
 src/util/virfile.h                          |   3 +-
 src/util/virfirewallpriv.h                  |   2 +-
 src/util/virgettext.h                       |   1 +
 src/util/virhash.h                          |   2 +-
 src/util/virhostcpu.c                       |   1 +
 src/util/virhostcpu.h                       |   2 +-
 src/util/virhostcpupriv.h                   |   4 +
 src/util/virhostmem.h                       |   2 +-
 src/util/virinitctl.h                       |   2 +-
 src/util/viriscsi.h                         |   3 +-
 src/util/virjson.h                          |   1 -
 src/util/virkeycode.h                       |   2 +-
 src/util/virlease.h                         |   3 +-
 src/util/virlog.h                           |   2 +-
 src/util/virmacmap.h                        |   3 +-
 src/util/virnetdevvlan.h                    |   1 +
 src/util/virnodesuspend.h                   |   1 -
 src/util/virobject.h                        |   2 +-
 src/util/virqemu.h                          |   1 -
 src/util/virresctrl.c                       |   1 +
 src/util/virresctrl.h                       |   2 +-
 src/util/virresctrlpriv.h                   |   4 +
 src/util/virsexpr.h                         |   2 +-
 src/util/virsysinfopriv.h                   |   2 +-
 src/util/virsystemdpriv.h                   |   2 +-
 src/util/virthread.h                        |   2 +-
 src/util/virthreadjob.h                     |   2 +-
 src/util/virthreadpool.h                    |   2 +-
 src/util/virtime.h                          |   2 +-
 src/util/virtpm.h                           |   1 +
 src/util/virtypedparam.h                    |   3 +-
 src/util/virvhba.h                          |   2 +-
 src/util/virxml.h                           |   2 +-
 src/vbox/vbox_driver.h                      |   6 +-
 src/vbox/vbox_snapshot_conf.h               |   2 +-
 src/vmware/vmware_conf.h                    |   4 +-
 src/vmware/vmware_driver.h                  |   7 +-
 src/vz/vz_driver.h                          |   2 +-
 src/vz/vz_sdk.h                             |   9 +-
 src/vz/vz_utils.h                           |   4 +-
 src/xenapi/xenapi_driver.h                  |   1 -
 src/xenapi/xenapi_driver_private.h          |   1 -
 tests/qemuhotplugtest.c                     |   1 +
 tests/qemumigparamstest.c                   |   1 +
 tests/qemumonitorjsontest.c                 |   1 +
 tests/qemumonitortestutils.c                |   1 +
 tests/storagebackendsheepdogtest.c          |   1 +
 tests/testutilshostcpus.h                   |  27 +++-
 tests/testutilslxc.h                        |  27 +++-
 tests/testutilsqemu.h                       |  35 ++++-
 tests/testutilsqemuschema.h                 |  11 +-
 tests/testutilsxen.h                        |  16 +++
 tests/virdbustest.c                         |   2 +-
 tests/virfilewrapper.h                      |   1 +
 tests/virfirewalltest.c                     |   1 +
 tests/virhashdata.h                         |  21 +++
 tests/virhostcputest.c                      |   1 +
 tests/virnettlshelpers.h                    |  17 ++-
 tests/virresctrltest.c                      |   1 +
 tools/virsh-completer.h                     |   2 +-
 tools/virt-admin-completer.h                |   2 +-
 tools/wireshark/src/packet-libvirt.h        |   1 +
 146 files changed, 496 insertions(+), 169 deletions(-)
 create mode 100644 build-aux/header-ifdef.pl

diff --git a/build-aux/header-ifdef.pl b/build-aux/header-ifdef.pl
new file mode 100644
index 0000000000..48a2bd4e31
--- /dev/null
+++ b/build-aux/header-ifdef.pl
@@ -0,0 +1,149 @@
+#!/usr/bin/perl
+#
+# Validate that header files follow a standard layout:
+#
+# /*
+#  ...copyright header...
+#  */
+# <one blank line>
+# #ifndef SYMBOL
+# # define SYMBOL
+# ....content....
+# #endif /* SYMBOL */
+#
+# For any file ending priv.h, before the #ifndef
+# We will have a further section
+#
+# #ifndef SYMBOL_ALLOW
+# # error ....
+# #endif /* SYMBOL_ALLOW */
+# <one blank line>
+
+use strict;
+use warnings;
+
+my $STATE_COPYRIGHT_COMMENT = 0;
+my $STATE_COPYRIGHT_BLANK = 1;
+my $STATE_PRIV_START = 2;
+my $STATE_PRIV_ERROR = 3;
+my $STATE_PRIV_END = 4;
+my $STATE_PRIV_BLANK = 5;
+my $STATE_GUARD_START = 6;
+my $STATE_GUARD_DEFINE = 7;
+my $STATE_GUARD_END = 8;
+my $STATE_EOF = 9;
+
+my $file = " ";
+my $ret = 0;
+my $ifdef = "";
+my $ifdefpriv = "";
+
+my $state = $STATE_EOF;
+my $mistake = 0;
+
+sub mistake {
+    my $msg = shift;
+    warn $msg;
+    $mistake = 1;
+    $ret = 1;
+}
+
+while (<>) {
+    if (not $file eq $ARGV) {
+        if ($state == $STATE_COPYRIGHT_COMMENT) {
+            &mistake("$file: missing copyright comment");
+        } elsif ($state == $STATE_COPYRIGHT_BLANK) {
+            &mistake("$file: missing blank line after copyright header");
+        } elsif ($state == $STATE_PRIV_START) {
+            &mistake("$file: missing '#ifndef $ifdefpriv'");
+        } elsif ($state == $STATE_PRIV_ERROR) {
+            &mistake("$file: missing '# error ...priv allow...'");
+        } elsif ($state == $STATE_PRIV_END) {
+            &mistake("$file: missing '#endif /* $ifdefpriv */'");
+        } elsif ($state == $STATE_PRIV_BLANK) {
+            &mistake("$file: missing blank line after priv header check");
+        } elsif ($state == $STATE_GUARD_START) {
+            &mistake("$file: missing '#ifndef $ifdef'");
+        } elsif ($state == $STATE_GUARD_DEFINE) {
+            &mistake("$file: missing '# define $ifdef'");
+        } elsif ($state == $STATE_GUARD_END) {
+            &mistake("$file: missing '#endif /* $ifdef */'");
+        }
+
+        $file = $ARGV;
+        $state = $STATE_COPYRIGHT_COMMENT;
+        $mistake = 0;
+    }
+
+    if ($mistake ||
+        $ARGV eq "config-post.h" ||
+        $ARGV =~ /vbox_(CAPI|XPCOM)/) {
+        $state = $STATE_EOF;
+        next;
+    }
+
+    if ($state == $STATE_COPYRIGHT_COMMENT) {
+        if (m,\*/,) {
+            $state = $STATE_COPYRIGHT_BLANK;
+        }
+    } elsif ($state == $STATE_COPYRIGHT_BLANK) {
+        if (! /^$/) {
+            &mistake("$file: missing blank line after copyright header");
+        }
+        if ($ARGV =~ /priv\.h$/) {
+            $state = $STATE_PRIV_START;
+        } else {
+            $state = $STATE_GUARD_START;
+        }
+    } elsif ($state == $STATE_PRIV_START) {
+        if (/^$/) {
+            &mistake("$file: too many blank lines after coyright header");
+        } elsif (/#ifndef\s(.*ALLOW.*)/) {
+            $ifdefpriv = $1;
+            $state = $STATE_PRIV_ERROR;
+        } else {
+            &mistake("$file: missing '#ifndef SYMBOL_ALLOW'");
+        }
+    } elsif ($state == $STATE_PRIV_ERROR) {
+        if (/# error ".*"$/) {
+            $state = $STATE_PRIV_END;
+        } else {
+            &mistake("$file: missing '#error ...priv allow...'");
+        }
+    } elsif ($state == $STATE_PRIV_END) {
+        if (m,#endif /\* $ifdefpriv \*/,) {
+            $state = $STATE_PRIV_BLANK;
+        } else {
+            &mistake("$file: missing '#endif /* $ifdefpriv */'");
+        }
+    } elsif ($state == $STATE_PRIV_BLANK) {
+        if (! /^$/) {
+            &mistake("$file: missing blank line after priv guard");
+        }
+        $state = $STATE_GUARD_START;
+    } elsif ($state == $STATE_GUARD_START) {
+        if (/^$/) {
+            &mistake("$file: too many blank lines after coyright header");
+        } elsif (/#ifndef\s(.*)$/) {
+            $ifdef = $1;
+            $state = $STATE_GUARD_DEFINE;
+        } else {
+            &mistake("$file: missing '#ifndef SYMBOL'");
+        }
+    } elsif ($state == $STATE_GUARD_DEFINE) {
+        if (/# define $ifdef$/) {
+            $state = $STATE_GUARD_END;
+        } else {
+            &mistake("$file: missing '# define $ifdef'");
+        }
+    } elsif ($state == $STATE_GUARD_END) {
+        if (m,#endif /\* $ifdef \*/$,) {
+            $state = $STATE_EOF;
+        }
+    } elsif ($state == $STATE_EOF) {
+        die "$file: unexpected content after '#endif /* $ifdef */'";
+    } else {
+        die "$file: unexpected state $state";
+    }
+}
+exit $ret;
diff --git a/cfg.mk b/cfg.mk
index bd037ff3da..c739edf604 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1122,7 +1122,8 @@ _autogen_error:
 
 ifneq ($(_gl-Makefile),)
 syntax-check: spacing-check test-wrap-argv \
-	prohibit-duplicate-header mock-noinline group-qemu-caps
+	prohibit-duplicate-header mock-noinline group-qemu-caps \
+        header-ifdef
 endif
 
 # Don't include duplicate header in the source (either *.c or *.h)
@@ -1139,6 +1140,10 @@ mock-noinline:
 	$(AM_V_GEN)files=`$(VC_LIST) | grep '\.[ch]$$'`; \
 	$(PERL) $(top_srcdir)/build-aux/mock-noinline.pl $$files
 
+header-ifdef:
+	$(AM_V_GEN)files=`$(VC_LIST) | grep '\.[h]$$'`; \
+	$(PERL) $(top_srcdir)/build-aux/header-ifdef.pl $$files
+
 test-wrap-argv:
 	$(AM_V_GEN)files=`$(VC_LIST) | grep -E '\.(ldargs|args)'`; \
 	$(PERL) $(top_srcdir)/tests/test-wrap-argv.pl --check $$files
diff --git a/src/bhyve/bhyve_capabilities.h b/src/bhyve/bhyve_capabilities.h
index 873bc9c12d..9d3218127e 100644
--- a/src/bhyve/bhyve_capabilities.h
+++ b/src/bhyve/bhyve_capabilities.h
@@ -55,4 +55,4 @@ typedef enum {
 int virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps);
 int virBhyveProbeCaps(unsigned int *caps);
 
-#endif
+#endif /* _BHYVE_CAPABILITIES */
diff --git a/src/bhyve/bhyve_parse_command.h b/src/bhyve/bhyve_parse_command.h
index 793685c338..236444e777 100644
--- a/src/bhyve/bhyve_parse_command.h
+++ b/src/bhyve/bhyve_parse_command.h
@@ -25,4 +25,4 @@ virDomainDefPtr bhyveParseCommandLineString(const char* nativeConfig,
                                             unsigned caps,
                                             virDomainXMLOptionPtr xmlopt);
 
-#endif /* __BHYVE_PARSE_COMMAND_H__*/
+#endif /* __BHYVE_PARSE_COMMAND_H__ */
diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h
index 4266930272..c70117526a 100644
--- a/src/conf/domain_event.h
+++ b/src/conf/domain_event.h
@@ -20,11 +20,10 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include "internal.h"
-
 #ifndef __DOMAIN_EVENT_H__
 # define __DOMAIN_EVENT_H__
 
+# include "internal.h"
 # include "object_event.h"
 # include "domain_conf.h"
 
@@ -325,4 +324,4 @@ virDomainQemuMonitorEventNew(int id,
                              const char *details)
     ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
 
-#endif
+#endif /* __DOMAIN_EVENT_H__ */
diff --git a/src/conf/domain_nwfilter.h b/src/conf/domain_nwfilter.h
index 8f1bcbacad..4ab9fbbfa7 100644
--- a/src/conf/domain_nwfilter.h
+++ b/src/conf/domain_nwfilter.h
@@ -18,6 +18,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef DOMAIN_NWFILTER_H
 # define DOMAIN_NWFILTER_H
 
diff --git a/src/conf/netdev_vlan_conf.h b/src/conf/netdev_vlan_conf.h
index 4f21873aad..88667d47fa 100644
--- a/src/conf/netdev_vlan_conf.h
+++ b/src/conf/netdev_vlan_conf.h
@@ -27,4 +27,4 @@
 int virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr def);
 int virNetDevVlanFormat(const virNetDevVlan *def, virBufferPtr buf);
 
-#endif /* __VIR_NETDEV_VPORT_PROFILE_CONF_H__ */
+#endif /* __VIR_NETDEV_VLAN_CONF_H__ */
diff --git a/src/conf/network_event.h b/src/conf/network_event.h
index 269475a3b1..fb43a27359 100644
--- a/src/conf/network_event.h
+++ b/src/conf/network_event.h
@@ -19,13 +19,13 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include "internal.h"
-#include "object_event.h"
-#include "object_event_private.h"
-
 #ifndef __NETWORK_EVENT_H__
 # define __NETWORK_EVENT_H__
 
+# include "internal.h"
+# include "object_event.h"
+# include "object_event_private.h"
+
 int
 virNetworkEventStateRegisterID(virConnectPtr conn,
                                virObjectEventStatePtr state,
@@ -56,4 +56,4 @@ virNetworkEventLifecycleNew(const char *name,
                             int type,
                             int detail);
 
-#endif
+#endif /* __NETWORK_EVENT_H__ */
diff --git a/src/conf/node_device_event.h b/src/conf/node_device_event.h
index 5a32d33abe..6c4fc50ef8 100644
--- a/src/conf/node_device_event.h
+++ b/src/conf/node_device_event.h
@@ -20,13 +20,13 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include "internal.h"
-#include "object_event.h"
-#include "object_event_private.h"
-
 #ifndef __NODE_DEVICE_EVENT_H__
 # define __NODE_DEVICE_EVENT_H__
 
+# include "internal.h"
+# include "object_event.h"
+# include "object_event_private.h"
+
 int
 virNodeDeviceEventStateRegisterID(virConnectPtr conn,
                                   virObjectEventStatePtr state,
@@ -59,4 +59,4 @@ virNodeDeviceEventLifecycleNew(const char *name,
 virObjectEventPtr
 virNodeDeviceEventUpdateNew(const char *name);
 
-#endif
+#endif /* __NODE_DEVICE_EVENT_H__ */
diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h
index 9d94dd7937..da70f0d80b 100644
--- a/src/conf/nwfilter_conf.h
+++ b/src/conf/nwfilter_conf.h
@@ -21,6 +21,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef NWFILTER_CONF_H
 # define NWFILTER_CONF_H
 
diff --git a/src/conf/nwfilter_params.h b/src/conf/nwfilter_params.h
index c02ddd20a6..762e94ed0f 100644
--- a/src/conf/nwfilter_params.h
+++ b/src/conf/nwfilter_params.h
@@ -18,6 +18,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef NWFILTER_PARAMS_H
 # define NWFILTER_PARAMS_H
 
diff --git a/src/conf/object_event.h b/src/conf/object_event.h
index c1e87a2423..ebded5ab7a 100644
--- a/src/conf/object_event.h
+++ b/src/conf/object_event.h
@@ -20,13 +20,13 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include "internal.h"
-
-#include "virobject.h"
-
 #ifndef __OBJECT_EVENT_H__
 # define __OBJECT_EVENT_H__
 
+# include "internal.h"
+
+# include "virobject.h"
+
 /**
  * Dispatching domain events that come in while
  * in a call / response rpc
@@ -89,4 +89,4 @@ virObjectEventStateSetRemote(virConnectPtr conn,
                              int remoteID)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
-#endif
+#endif /* __OBJECT_EVENT_H__ */
diff --git a/src/conf/object_event_private.h b/src/conf/object_event_private.h
index a45902827d..6f15290670 100644
--- a/src/conf/object_event_private.h
+++ b/src/conf/object_event_private.h
@@ -20,11 +20,11 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include "datatypes.h"
-
 #ifndef __OBJECT_EVENT_PRIVATE_H__
 # define __OBJECT_EVENT_PRIVATE_H__
 
+# include "datatypes.h"
+
 struct _virObjectMeta {
     int id;
     char *name;
@@ -106,4 +106,4 @@ virObjectEventNew(virClassPtr klass,
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
     ATTRIBUTE_NONNULL(7);
 
-#endif
+#endif /* __OBJECT_EVENT_PRIVATE_H__ */
diff --git a/src/conf/secret_conf.h b/src/conf/secret_conf.h
index 4b824e4023..d871ad7e93 100644
--- a/src/conf/secret_conf.h
+++ b/src/conf/secret_conf.h
@@ -52,5 +52,4 @@ char *virSecretDefFormat(const virSecretDef *def);
                 (VIR_CONNECT_LIST_SECRETS_FILTERS_EPHEMERAL  | \
                  VIR_CONNECT_LIST_SECRETS_FILTERS_PRIVATE)
 
-
-#endif
+#endif /* __VIR_SECRET_CONF_H__ */
diff --git a/src/conf/secret_event.h b/src/conf/secret_event.h
index 5fd52f3fd3..3aa651c533 100644
--- a/src/conf/secret_event.h
+++ b/src/conf/secret_event.h
@@ -20,13 +20,13 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include "internal.h"
-#include "object_event.h"
-#include "object_event_private.h"
-
 #ifndef __SECRET_EVENT_H__
 # define __SECRET_EVENT_H__
 
+# include "internal.h"
+# include "object_event.h"
+# include "object_event_private.h"
+
 int
 virSecretEventStateRegisterID(virConnectPtr conn,
                               virObjectEventStatePtr state,
@@ -62,4 +62,4 @@ virSecretEventValueChangedNew(const unsigned char *uuid,
                               int usage_type,
                               const char *usage_id);
 
-#endif
+#endif /* __SECRET_EVENT_H__ */
diff --git a/src/conf/storage_event.h b/src/conf/storage_event.h
index ea726911fa..936023584d 100644
--- a/src/conf/storage_event.h
+++ b/src/conf/storage_event.h
@@ -20,13 +20,13 @@
  * <http://www.gnu.org/licenses/>.
 */
 
-#include "internal.h"
-#include "object_event.h"
-#include "object_event_private.h"
-
 #ifndef __STORAGE_EVENT_H__
 # define __STORAGE_EVENT_H__
 
+# include "internal.h"
+# include "object_event.h"
+# include "object_event_private.h"
+
 int
 virStoragePoolEventStateRegisterID(virConnectPtr conn,
                                    virObjectEventStatePtr state,
@@ -61,4 +61,4 @@ virObjectEventPtr
 virStoragePoolEventRefreshNew(const char *name,
                               const unsigned char *uuid);
 
-#endif
+#endif /* __STORAGE_EVENT_H__ */
diff --git a/src/conf/virchrdev.h b/src/conf/virchrdev.h
index 652767583b..b9dac9b31d 100644
--- a/src/conf/virchrdev.h
+++ b/src/conf/virchrdev.h
@@ -18,6 +18,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef __VIR_CHRDEV_H__
 # define __VIR_CHRDEV_H__
 
@@ -32,4 +33,5 @@ void virChrdevFree(virChrdevsPtr devs);
 
 int virChrdevOpen(virChrdevsPtr devs, virDomainChrSourceDefPtr source,
                   virStreamPtr st, bool force);
-#endif /*__VIR_CHRDEV_H__*/
+
+#endif /* __VIR_CHRDEV_H__ */
diff --git a/src/conf/virnwfilterbindingdef.h b/src/conf/virnwfilterbindingdef.h
index af7fab6064..8a78278bee 100644
--- a/src/conf/virnwfilterbindingdef.h
+++ b/src/conf/virnwfilterbindingdef.h
@@ -18,6 +18,7 @@
  * <http://www.gnu.org/licenses/>.
  *
  */
+
 #ifndef VIR_NWFILTER_BINDING_DEF_H
 # define VIR_NWFILTER_BINDING_DEF_H
 
diff --git a/src/conf/virnwfilterbindingobj.h b/src/conf/virnwfilterbindingobj.h
index 21ae85b064..2455a44dd8 100644
--- a/src/conf/virnwfilterbindingobj.h
+++ b/src/conf/virnwfilterbindingobj.h
@@ -18,6 +18,7 @@
  * <http://www.gnu.org/licenses/>.
  *
  */
+
 #ifndef VIR_NWFILTER_BINDING_OBJ_H
 # define VIR_NWFILTER_BINDING_OBJ_H
 
diff --git a/src/conf/virnwfilterobj.h b/src/conf/virnwfilterobj.h
index 4a54dd50da..b047a7c88d 100644
--- a/src/conf/virnwfilterobj.h
+++ b/src/conf/virnwfilterobj.h
@@ -16,6 +16,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef VIRNWFILTEROBJ_H
 # define VIRNWFILTEROBJ_H
 
diff --git a/src/conf/virsavecookie.h b/src/conf/virsavecookie.h
index 4aed18466c..c225c8d0bc 100644
--- a/src/conf/virsavecookie.h
+++ b/src/conf/virsavecookie.h
@@ -17,6 +17,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef __VIR_SAVE_COOKIE_H__
 # define __VIR_SAVE_COOKIE_H__
 
@@ -59,4 +60,4 @@ char *
 virSaveCookieFormat(virObjectPtr obj,
                     virSaveCookieCallbacksPtr saveCookie);
 
-#endif /*__VIR_SAVE_COOKIE_H__ */
+#endif /* __VIR_SAVE_COOKIE_H__ */
diff --git a/src/datatypes.h b/src/datatypes.h
index e1b38706dc..08f1e033bb 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -777,4 +777,4 @@ int virAdmConnectCloseCallbackDataRegister(virAdmConnectCloseCallbackDataPtr cbd
 int virAdmConnectCloseCallbackDataUnregister(virAdmConnectCloseCallbackDataPtr cbdata,
                                              virAdmConnectCloseFunc cb);
 
-#endif /* __VIR_DATATYPES_H__ */
+#endif /* __VIR_DATATYPES_H_ */
diff --git a/src/interface/interface_driver.h b/src/interface/interface_driver.h
index 59d8564801..575f297953 100644
--- a/src/interface/interface_driver.h
+++ b/src/interface/interface_driver.h
@@ -18,7 +18,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef __VIR_INTERFACE__DRIVER_H
 # define __VIR_INTERFACE__DRIVER_H
 
diff --git a/src/internal.h b/src/internal.h
index d30d5da499..fb2b56b662 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -513,4 +513,4 @@ enum {
 #  define ENODATA EIO
 # endif
 
-#endif                          /* __VIR_INTERNAL_H__ */
+#endif /* __VIR_INTERNAL_H__ */
diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h
index 0e008a6551..5d60f2654d 100644
--- a/src/libvirt_internal.h
+++ b/src/libvirt_internal.h
@@ -298,4 +298,4 @@ int virStreamInData(virStreamPtr stream,
                     int *data,
                     long long *length);
 
-#endif
+#endif /* __LIBVIRT_H_ */
diff --git a/src/libxl/libxl_migration.h b/src/libxl/libxl_migration.h
index db5cdfcd03..954968deef 100644
--- a/src/libxl/libxl_migration.h
+++ b/src/libxl/libxl_migration.h
@@ -98,4 +98,4 @@ libxlDomainMigrationSrcConfirm(libxlDriverPrivatePtr driver,
                                unsigned int flags,
                                int cancelled);
 
-#endif /* LIBXL_DRIVER_H */
+#endif /* LIBXL_MIGRATION_H */
diff --git a/src/locking/lock_daemon_config.h b/src/locking/lock_daemon_config.h
index 9b2a8c2ebb..cda71311f5 100644
--- a/src/locking/lock_daemon_config.h
+++ b/src/locking/lock_daemon_config.h
@@ -43,4 +43,4 @@ int virLockDaemonConfigLoadFile(virLockDaemonConfigPtr data,
                                 const char *filename,
                                 bool allow_missing);
 
-#endif /* __LIBVIRTD_CONFIG_H__ */
+#endif /* __VIR_LOCK_DAEMON_CONFIG_H__ */
diff --git a/src/logging/log_daemon_config.h b/src/logging/log_daemon_config.h
index 35914fc4ef..12610ba7ac 100644
--- a/src/logging/log_daemon_config.h
+++ b/src/logging/log_daemon_config.h
@@ -46,4 +46,4 @@ int virLogDaemonConfigLoadFile(virLogDaemonConfigPtr data,
                                const char *filename,
                                bool allow_missing);
 
-#endif /* __LIBVIRTD_CONFIG_H__ */
+#endif /* __VIR_LOG_DAEMON_CONFIG_H__ */
diff --git a/src/logging/log_handler.h b/src/logging/log_handler.h
index 16bcd0df65..670504bec4 100644
--- a/src/logging/log_handler.h
+++ b/src/logging/log_handler.h
@@ -77,4 +77,4 @@ int virLogHandlerDomainAppendLogFile(virLogHandlerPtr handler,
 
 virJSONValuePtr virLogHandlerPreExecRestart(virLogHandlerPtr handler);
 
-#endif /** __VIR_LOG_HANDLER_H__ */
+#endif /* __VIR_LOG_HANDLER_H__ */
diff --git a/src/logging/log_manager.h b/src/logging/log_manager.h
index 0f3d55a5f0..a16f3b1989 100644
--- a/src/logging/log_manager.h
+++ b/src/logging/log_manager.h
@@ -18,7 +18,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef __VIR_LOG_MANAGER_H__
 # define __VIR_LOG_MANAGER_H__
 
diff --git a/src/lxc/lxc_domain.h b/src/lxc/lxc_domain.h
index b248cdfd6f..77ec523a63 100644
--- a/src/lxc/lxc_domain.h
+++ b/src/lxc/lxc_domain.h
@@ -19,7 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef __LXC_DOMAIN_H__
 # define __LXC_DOMAIN_H__
 
diff --git a/src/network/bridge_driver.h b/src/network/bridge_driver.h
index dff37930d3..5d621521cb 100644
--- a/src/network/bridge_driver.h
+++ b/src/network/bridge_driver.h
@@ -19,7 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef __VIR_NETWORK__DRIVER_H
 # define __VIR_NETWORK__DRIVER_H
 
diff --git a/src/node_device/node_device_udev.h b/src/node_device/node_device_udev.h
index af877160cd..79e7278cc6 100644
--- a/src/node_device/node_device_udev.h
+++ b/src/node_device/node_device_udev.h
@@ -18,8 +18,13 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include <libudev.h>
+#ifndef __NODE_DEVICE_UDEV_H__
+# define __NODE_DEVICE_UDEV_H__
 
-#define SYSFS_DATA_SIZE 4096
-#define DMI_DEVPATH "/sys/devices/virtual/dmi/id"
-#define DMI_DEVPATH_FALLBACK "/sys/class/dmi/id"
+# include <libudev.h>
+
+# define SYSFS_DATA_SIZE 4096
+# define DMI_DEVPATH "/sys/devices/virtual/dmi/id"
+# define DMI_DEVPATH_FALLBACK "/sys/class/dmi/id"
+
+#endif /* __NODE_DEVICE_UDEV_H__ */
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.h b/src/nwfilter/nwfilter_ebiptables_driver.h
index 2b6b74277f..a8e696aa37 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.h
+++ b/src/nwfilter/nwfilter_ebiptables_driver.h
@@ -18,6 +18,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef VIR_NWFILTER_EBTABLES_DRIVER_H__
 # define VIR_NWFILTER_EBTABLES_DRIVER_H__
 
@@ -31,4 +32,4 @@ extern virNWFilterTechDriver ebiptables_driver;
 
 # define IPTABLES_MAX_COMMENT_LENGTH  256
 
-#endif
+#endif /* VIR_NWFILTER_EBTABLES_DRIVER_H__ */
diff --git a/src/nwfilter/nwfilter_gentech_driver.h b/src/nwfilter/nwfilter_gentech_driver.h
index 57ce5d05ec..71a8cad938 100644
--- a/src/nwfilter/nwfilter_gentech_driver.h
+++ b/src/nwfilter/nwfilter_gentech_driver.h
@@ -19,6 +19,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef __NWFILTER_GENTECH_DRIVER_H
 # define __NWFILTER_GENTECH_DRIVER_H
 
@@ -55,4 +56,4 @@ virHashTablePtr virNWFilterCreateVarHashmap(const char *macaddr,
 int virNWFilterBuildAll(virNWFilterDriverStatePtr driver,
                         bool newFilters);
 
-#endif
+#endif /* __NWFILTER_GENTECH_DRIVER_H */
diff --git a/src/openvz/openvz_driver.h b/src/openvz/openvz_driver.h
index d78a877c51..68d2c1f03c 100644
--- a/src/openvz/openvz_driver.h
+++ b/src/openvz/openvz_driver.h
@@ -20,7 +20,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef OPENVZ_DRIVER_H
 # define OPENVZ_DRIVER_H
 
@@ -38,4 +37,4 @@
 
 int openvzRegister(void);
 
-#endif
+#endif /* OPENVZ_DRIVER_H */
diff --git a/src/openvz/openvz_util.h b/src/openvz/openvz_util.h
index 0c8d55ae29..98d13ae336 100644
--- a/src/openvz/openvz_util.h
+++ b/src/openvz/openvz_util.h
@@ -19,11 +19,10 @@
  *
  */
 
-
 #ifndef OPENVZ_UTIL_H
 # define OPENVZ_UTIL_H
 
 long openvzKBPerPages(void);
 char *openvzVEGetStringParam(virDomainPtr dom, const char *param);
 
-#endif
+#endif /* OPENVZ_UTIL_H */
diff --git a/src/qemu/qemu_agent.h b/src/qemu/qemu_agent.h
index 219cb9e1dd..698b2e0639 100644
--- a/src/qemu/qemu_agent.h
+++ b/src/qemu/qemu_agent.h
@@ -19,7 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef __QEMU_AGENT_H__
 # define __QEMU_AGENT_H__
 
diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h
index 441cb16bc1..4afa6f1256 100644
--- a/src/qemu/qemu_alias.h
+++ b/src/qemu/qemu_alias.h
@@ -97,4 +97,4 @@ const char *qemuDomainGetManagedPRAlias(void);
 
 char *qemuDomainGetUnmanagedPRAlias(const char *parentalias);
 
-#endif /* __QEMU_ALIAS_H__*/
+#endif /* __QEMU_ALIAS_H__ */
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 2a3057e249..e19b9d070f 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -636,4 +636,4 @@ bool virQEMUCapsCPUFilterFeatures(const char *name,
 virSEVCapabilityPtr
 virQEMUCapsGetSEVCapabilities(virQEMUCapsPtr qemuCaps);
 
-#endif /* __QEMU_CAPABILITIES_H__*/
+#endif /* __QEMU_CAPABILITIES_H__ */
diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
index 3262a63eae..b4183b5e66 100644
--- a/src/qemu/qemu_capspriv.h
+++ b/src/qemu/qemu_capspriv.h
@@ -21,7 +21,7 @@
 
 #ifndef __QEMU_CAPSPRIV_H_ALLOW__
 # error "qemu_capspriv.h may only be included by qemu_capabilities.c or test suites"
-#endif
+#endif /* __QEMU_CAPSPRIV_H_ALLOW__ */
 
 #ifndef __QEMU_CAPSPRIV_H__
 # define __QEMU_CAPSPRIV_H__
@@ -98,4 +98,5 @@ virQEMUCapsSetMicrocodeVersion(virQEMUCapsPtr qemuCaps,
 
 void
 virQEMUCapsStripMachineAliases(virQEMUCapsPtr qemuCaps);
-#endif
+
+#endif /* __QEMU_CAPSPRIV_H__ */
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 2ee0633d6c..c5bca612c1 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -227,4 +227,4 @@ qemuBuildTPMOpenBackendFDs(const char *tpmdev,
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_NONNULL(4);
 
-#endif /* __QEMU_COMMAND_H__*/
+#endif /* __QEMU_COMMAND_H__ */
diff --git a/src/qemu/qemu_domain_address.h b/src/qemu/qemu_domain_address.h
index 62d92777bc..0f360fcc49 100644
--- a/src/qemu/qemu_domain_address.h
+++ b/src/qemu/qemu_domain_address.h
@@ -20,6 +20,7 @@
  */
 
 #ifndef __QEMU_DOMAIN_ADDRESS_H__
+# define __QEMU_DOMAIN_ADDRESS_H__
 
 # include "domain_addr.h"
 # include "domain_conf.h"
@@ -65,6 +66,4 @@ int qemuDomainEnsureVirtioAddress(bool *releaseAddr,
                                   virDomainDeviceDefPtr dev,
                                   const char *devicename);
 
-# define __QEMU_DOMAIN_ADDRESS_H__
-
 #endif /* __QEMU_DOMAIN_ADDRESS_H__ */
diff --git a/src/qemu/qemu_extdevice.h b/src/qemu/qemu_extdevice.h
index f5d6945636..ad48dbba67 100644
--- a/src/qemu/qemu_extdevice.h
+++ b/src/qemu/qemu_extdevice.h
@@ -17,6 +17,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef __QEMU_EXTDEVICE_H__
 # define __QEMU_EXTDEVICE_H__
 
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 72b09f92ca..aede7b2c7d 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -23,6 +23,7 @@
 #include <config.h>
 
 #include "qemu_hotplug.h"
+#define __QEMU_HOTPLUGPRIV_H_ALLOW__
 #include "qemu_hotplugpriv.h"
 #include "qemu_alias.h"
 #include "qemu_capabilities.h"
diff --git a/src/qemu/qemu_hotplugpriv.h b/src/qemu/qemu_hotplugpriv.h
index c1653ee0d4..2239013701 100644
--- a/src/qemu/qemu_hotplugpriv.h
+++ b/src/qemu/qemu_hotplugpriv.h
@@ -19,6 +19,10 @@
  *
  */
 
+#ifndef __QEMU_HOTPLUGPRIV_H_ALLOW__
+# error "qemu_hotplugpriv.h may only be included by qemu_hotplug.c or test suites"
+#endif /* __QEMU_HOTPLUGPRIV_H_ALLOW__ */
+
 #ifndef __QEMU_HOTPLUGPRIV_H__
 # define __QEMU_HOTPLUGPRIV_H__
 
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 9ecd2ab39d..f34c3f6c06 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -30,6 +30,7 @@
 #include "qemu_hotplug.h"
 #include "qemu_migration.h"
 #include "qemu_migration_params.h"
+#define __QEMU_MIGRATION_PARAMSPRIV_H_ALLOW__
 #include "qemu_migration_paramspriv.h"
 #include "qemu_monitor.h"
 
diff --git a/src/qemu/qemu_migration_paramspriv.h b/src/qemu/qemu_migration_paramspriv.h
index 30773a679d..52f1591251 100644
--- a/src/qemu/qemu_migration_paramspriv.h
+++ b/src/qemu/qemu_migration_paramspriv.h
@@ -19,6 +19,10 @@
  *
  */
 
+#ifndef __QEMU_MIGRATION_PARAMSPRIV_H_ALLOW__
+# error "qemu_migration_paramspriv.h may only be included by qemu_migration_params.c or test suites"
+#endif /* __QEMU_MIGRATION_PARAMSPRIV_H_ALLOW__ */
+
 #ifndef __QEMU_MIGRATION_PARAMSPRIV_H__
 # define __QEMU_MIGRATION_PARAMSPRIV_H__
 
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 5d30973a37..95a21fde05 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -19,7 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef QEMU_MONITOR_H
 # define QEMU_MONITOR_H
 
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index a82814dde6..331419890b 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -19,7 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef QEMU_MONITOR_JSON_H
 # define QEMU_MONITOR_JSON_H
 
diff --git a/src/qemu/qemu_monitor_priv.h b/src/qemu/qemu_monitor_priv.h
index 45bda27c0f..6db3e3769f 100644
--- a/src/qemu/qemu_monitor_priv.h
+++ b/src/qemu/qemu_monitor_priv.h
@@ -18,7 +18,7 @@
 
 #ifndef __QEMU_MONITOR_PRIV_H_ALLOW__
 # error "qemu_monitor_priv.h may only be included by qemu_monitor.c or test suites"
-#endif
+#endif /* __QEMU_MONITOR_PRIV_H_ALLOW__ */
 
 #ifndef __QEMU_MONITOR_PRIV_H__
 # define __QEMU_MONITOR_PRIV_H__
@@ -28,4 +28,4 @@
 void
 qemuMonitorResetCommandID(qemuMonitorPtr mon);
 
-#endif
+#endif /* __QEMU_MONITOR_PRIV_H__ */
diff --git a/src/qemu/qemu_monitor_text.h b/src/qemu/qemu_monitor_text.h
index 8b9a9caeb3..8ebdef67b6 100644
--- a/src/qemu/qemu_monitor_text.h
+++ b/src/qemu/qemu_monitor_text.h
@@ -19,7 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef QEMU_MONITOR_TEXT_H
 # define QEMU_MONITOR_TEXT_H
 
diff --git a/src/qemu/qemu_parse_command.h b/src/qemu/qemu_parse_command.h
index ffada71f58..901b5b438f 100644
--- a/src/qemu/qemu_parse_command.h
+++ b/src/qemu/qemu_parse_command.h
@@ -57,4 +57,4 @@ qemuParseKeywords(const char *str,
                   int *retnkeywords,
                   int allowEmptyValue);
 
-#endif /* __QEMU_PARSE_COMMAND_H__*/
+#endif /* __QEMU_PARSE_COMMAND_H__ */
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2f8e19d29d..6809522d36 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -35,6 +35,7 @@
 #include <sys/utsname.h>
 
 #include "qemu_process.h"
+#define __QEMU_PROCESS_PRIV_H_ALLOW__
 #include "qemu_processpriv.h"
 #include "qemu_alias.h"
 #include "qemu_block.h"
diff --git a/src/qemu/qemu_processpriv.h b/src/qemu/qemu_processpriv.h
index 782fcd5261..a7582558a9 100644
--- a/src/qemu/qemu_processpriv.h
+++ b/src/qemu/qemu_processpriv.h
@@ -19,6 +19,10 @@
  *
  */
 
+#ifndef __QEMU_PROCESS_PRIV_H_ALLOW__
+# error "qemu_process_priv.h may only be included by qemu_process.c or test suites"
+#endif /* __QEMU_PROCESS_PRIV_H_ALLOW__ */
+
 #ifndef __QEMU_PROCESSPRIV_H__
 # define __QEMU_PROCESSPRIV_H__
 
diff --git a/src/qemu/qemu_tpm.h b/src/qemu/qemu_tpm.h
index 93a45b9691..acae9520aa 100644
--- a/src/qemu/qemu_tpm.h
+++ b/src/qemu/qemu_tpm.h
@@ -17,6 +17,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef __QEMU_TPM_H__
 # define __QEMU_TPM_H__
 
diff --git a/src/remote/remote_daemon.h b/src/remote/remote_daemon.h
index 365a31c372..2184f9bda3 100644
--- a/src/remote/remote_daemon.h
+++ b/src/remote/remote_daemon.h
@@ -19,7 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef __REMOTE_DAEMON_H__
 # define __REMOTE_DAEMON_H__
 
diff --git a/src/remote/remote_daemon_stream.h b/src/remote/remote_daemon_stream.h
index 2c1eeddb18..55a483665c 100644
--- a/src/remote/remote_daemon_stream.h
+++ b/src/remote/remote_daemon_stream.h
@@ -18,7 +18,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef __REMOTE_DAEMON_STREAM_H__
 # define __REMOTE_DAEMON_STREAM_H__
 
diff --git a/src/rpc/virnetlibsshsession.h b/src/rpc/virnetlibsshsession.h
index 4dcf398f53..b8844dc3ad 100644
--- a/src/rpc/virnetlibsshsession.h
+++ b/src/rpc/virnetlibsshsession.h
@@ -17,6 +17,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef __VIR_NET_LIBSSH_SESSION_H__
 # define __VIR_NET_LIBSSH_SESSION_H__
 
@@ -72,4 +73,4 @@ ssize_t virNetLibsshChannelWrite(virNetLibsshSessionPtr sess,
 
 bool virNetLibsshSessionHasCachedData(virNetLibsshSessionPtr sess);
 
-#endif /* ___VIR_NET_LIBSSH_SESSION_H_ */
+#endif /* __VIR_NET_LIBSSH_SESSION_H__ */
diff --git a/src/rpc/virnetserverservice.h b/src/rpc/virnetserverservice.h
index 4a76704fb6..32371d979e 100644
--- a/src/rpc/virnetserverservice.h
+++ b/src/rpc/virnetserverservice.h
@@ -88,4 +88,4 @@ void virNetServerServiceToggle(virNetServerServicePtr svc,
 
 void virNetServerServiceClose(virNetServerServicePtr svc);
 
-#endif
+#endif /* __VIR_NET_SERVER_SERVICE_H__ */
diff --git a/src/rpc/virnetsshsession.h b/src/rpc/virnetsshsession.h
index fa70ede414..faecb75064 100644
--- a/src/rpc/virnetsshsession.h
+++ b/src/rpc/virnetsshsession.h
@@ -17,6 +17,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef __VIR_NET_SSH_SESSION_H__
 # define __VIR_NET_SSH_SESSION_H__
 
@@ -84,4 +85,4 @@ ssize_t virNetSSHChannelWrite(virNetSSHSessionPtr sess,
 
 bool virNetSSHSessionHasCachedData(virNetSSHSessionPtr sess);
 
-#endif /* ___VIR_NET_SSH_SESSION_H_ */
+#endif /* __VIR_NET_SSH_SESSION_H__ */
diff --git a/src/rpc/virnettlscontext.h b/src/rpc/virnettlscontext.h
index 6100b45c39..c20ea9a722 100644
--- a/src/rpc/virnettlscontext.h
+++ b/src/rpc/virnettlscontext.h
@@ -100,4 +100,4 @@ int virNetTLSSessionGetKeySize(virNetTLSSessionPtr sess);
 
 const char *virNetTLSSessionGetX509DName(virNetTLSSessionPtr sess);
 
-#endif
+#endif /* __VIR_NET_TLS_CONTEXT_H__ */
diff --git a/src/security/security_apparmor.h b/src/security/security_apparmor.h
index f15238ab86..a3661a82ec 100644
--- a/src/security/security_apparmor.h
+++ b/src/security/security_apparmor.h
@@ -15,6 +15,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef __VIR_SECURITY_APPARMOR_H__
 # define __VIR_SECURITY_APPARMOR_H__
 
diff --git a/src/security/security_dac.h b/src/security/security_dac.h
index 97681c9610..adc5494328 100644
--- a/src/security/security_dac.h
+++ b/src/security/security_dac.h
@@ -18,11 +18,11 @@
  * POSIX DAC security driver
  */
 
-#include "security_driver.h"
-
 #ifndef __VIR_SECURITY_DAC
 # define __VIR_SECURITY_DAC
 
+# include "security_driver.h"
+
 extern virSecurityDriver virSecurityDriverDAC;
 
 int virSecurityDACSetUserAndGroup(virSecurityManagerPtr mgr,
diff --git a/src/security/security_driver.h b/src/security/security_driver.h
index 0de8826f31..1969f7f089 100644
--- a/src/security/security_driver.h
+++ b/src/security/security_driver.h
@@ -15,6 +15,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef __VIR_SECURITY_H__
 # define __VIR_SECURITY_H__
 
diff --git a/src/security/security_selinux.h b/src/security/security_selinux.h
index 5d02d79b47..3d46289849 100644
--- a/src/security/security_selinux.h
+++ b/src/security/security_selinux.h
@@ -15,6 +15,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef __VIR_SECURITY_SELINUX_H__
 # define __VIR_SECURITY_SELINUX_H__
 
diff --git a/src/security/security_stack.h b/src/security/security_stack.h
index b38f9a9481..633182fdd8 100644
--- a/src/security/security_stack.h
+++ b/src/security/security_stack.h
@@ -18,11 +18,11 @@
  * Stacked security driver
  */
 
-#include "security_driver.h"
-
 #ifndef __VIR_SECURITY_STACK
 # define __VIR_SECURITY_STACK
 
+# include "security_driver.h"
+
 extern virSecurityDriver virSecurityDriverStack;
 
 
diff --git a/src/storage/storage_backend_iscsi_direct.h b/src/storage/storage_backend_iscsi_direct.h
index 545579daf7..eb56e857ec 100644
--- a/src/storage/storage_backend_iscsi_direct.h
+++ b/src/storage/storage_backend_iscsi_direct.h
@@ -1,3 +1,19 @@
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
 #ifndef __VIR_STORAGE_BACKEND_ISCSI_H__
 # define __VIR_STORAGE_BACKEND_ISCSI_H__
 
diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c
index 484a587474..96d825cc1d 100644
--- a/src/storage/storage_backend_sheepdog.c
+++ b/src/storage/storage_backend_sheepdog.c
@@ -25,6 +25,7 @@
 
 #include "virerror.h"
 #include "storage_backend_sheepdog.h"
+#define __VIR_STORAGE_BACKEND_SHEEPDOG_PRIV_ALLOW_H__
 #include "storage_backend_sheepdog_priv.h"
 #include "storage_conf.h"
 #include "vircommand.h"
diff --git a/src/storage/storage_backend_sheepdog_priv.h b/src/storage/storage_backend_sheepdog_priv.h
index e324ef6181..7dc2d7db3c 100644
--- a/src/storage/storage_backend_sheepdog_priv.h
+++ b/src/storage/storage_backend_sheepdog_priv.h
@@ -16,6 +16,10 @@
  * <http://www.gnu.org/licenses/>.
  */
 
+#ifndef __VIR_STORAGE_BACKEND_SHEEPDOG_PRIV_ALLOW_H__
+# error "storage_backend_sheepdog_priv.h may only be included by storage_backend_sheepdog.c or test suites"
+#endif /* __VIR_STORAGE_BACKEND_SHEEPDOG_PRIV_ALLOW_H__ */
+
 #ifndef __VIR_STORAGE_BACKEND_SHEEPDOG_PRIV_H__
 # define __VIR_STORAGE_BACKEND_SHEEPDOG_PRIV_H__
 
diff --git a/src/uml/uml_driver.h b/src/uml/uml_driver.h
index d31b3bda8f..8f877b49c5 100644
--- a/src/uml/uml_driver.h
+++ b/src/uml/uml_driver.h
@@ -19,7 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef UML_DRIVER_H
 # define UML_DRIVER_H
 
diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index ed72caaa13..9e45ab5f11 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -20,7 +20,6 @@
  *
  */
 
-
 #ifndef __VIR_MEMORY_H_
 # define __VIR_MEMORY_H_
 
diff --git a/src/util/viratomic.h b/src/util/viratomic.h
index febe401f77..f63436fb6b 100644
--- a/src/util/viratomic.h
+++ b/src/util/viratomic.h
@@ -451,4 +451,4 @@ virAtomicIntXor(volatile unsigned int *atomic,
 
 # endif
 
-#endif /* __VIR_ATOMIC_H */
+#endif /* __VIR_ATOMIC_H__ */
diff --git a/src/util/viraudit.h b/src/util/viraudit.h
index 478dc8408f..9e3fc89771 100644
--- a/src/util/viraudit.h
+++ b/src/util/viraudit.h
@@ -19,7 +19,6 @@
  *
  */
 
-
 #ifndef __LIBVIRT_AUDIT_H__
 # define __LIBVIRT_AUDIT_H__
 
diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h
index de16b43f63..4318db6766 100644
--- a/src/util/virbitmap.h
+++ b/src/util/virbitmap.h
@@ -156,4 +156,4 @@ void virBitmapShrink(virBitmapPtr map, size_t b);
 
 VIR_DEFINE_AUTOPTR_FUNC(virBitmap, virBitmapFree)
 
-#endif
+#endif /* __BITMAP_H__ */
diff --git a/src/util/vircgrouppriv.h b/src/util/vircgrouppriv.h
index 3bede28bd2..f0e3d349c8 100644
--- a/src/util/vircgrouppriv.h
+++ b/src/util/vircgrouppriv.h
@@ -21,7 +21,7 @@
 
 #ifndef __VIR_CGROUP_ALLOW_INCLUDE_PRIV_H__
 # error "vircgrouppriv.h may only be included by vircgroup.c or its test suite"
-#endif
+#endif /* __VIR_CGROUP_ALLOW_INCLUDE_PRIV_H__ */
 
 #ifndef __VIR_CGROUP_PRIV_H__
 # define __VIR_CGROUP_PRIV_H__
diff --git a/src/util/vircommandpriv.h b/src/util/vircommandpriv.h
index 8930299d45..a21643555a 100644
--- a/src/util/vircommandpriv.h
+++ b/src/util/vircommandpriv.h
@@ -21,7 +21,7 @@
 
 #ifndef __VIR_COMMAND_PRIV_H_ALLOW__
 # error "vircommandpriv.h may only be included by vircommand.c or test suites"
-#endif
+#endif /* __VIR_COMMAND_PRIV_H_ALLOW__ */
 
 #ifndef __VIR_COMMAND_PRIV_H__
 # define __VIR_COMMAND_PRIV_H__
diff --git a/src/util/virdbus.c b/src/util/virdbus.c
index cb5371faef..1c84b9c8bd 100644
--- a/src/util/virdbus.c
+++ b/src/util/virdbus.c
@@ -21,6 +21,7 @@
 
 #include <config.h>
 
+#define __VIR_DBUS_PRIV_H_ALLOW__
 #include "virdbuspriv.h"
 #include "viralloc.h"
 #include "virerror.h"
diff --git a/src/util/virdbuspriv.h b/src/util/virdbuspriv.h
index 74b395f70d..5f97a49676 100644
--- a/src/util/virdbuspriv.h
+++ b/src/util/virdbuspriv.h
@@ -19,6 +19,10 @@
  *
  */
 
+#ifndef __VIR_DBUS_PRIV_H_ALLOW__
+# error "virdbuspriv.h may only be included by virdbus.c or test suites"
+#endif /* __VIR_DBUS_PRIV_H_ALLOW__ */
+
 #ifndef __VIR_DBUS_PRIV_H__
 # define __VIR_DBUS_PRIV_H__
 
diff --git a/src/util/virebtables.h b/src/util/virebtables.h
index baca746f89..b8cb584963 100644
--- a/src/util/virebtables.h
+++ b/src/util/virebtables.h
@@ -38,4 +38,4 @@ int              ebtablesRemoveForwardAllowIn    (ebtablesContext *ctx,
 
 int              ebtablesAddForwardPolicyReject(ebtablesContext *ctx);
 
-#endif /* __QEMUD_ebtabLES_H__ */
+#endif /* __QEMUD_EBTABLES_H__ */
diff --git a/src/util/virerror.h b/src/util/virerror.h
index 31577c5c8c..ff5bde9b10 100644
--- a/src/util/virerror.h
+++ b/src/util/virerror.h
@@ -208,4 +208,4 @@ void virErrorRestore(virErrorPtr *savederr);
 
 VIR_DEFINE_AUTOPTR_FUNC(virError, virFreeError)
 
-#endif
+#endif /* __VIRT_ERROR_H_ */
diff --git a/src/util/vireventpoll.h b/src/util/vireventpoll.h
index 720e72db8d..199a658c2e 100644
--- a/src/util/vireventpoll.h
+++ b/src/util/vireventpoll.h
@@ -127,4 +127,4 @@ int virEventPollToNativeEvents(int events);
 int virEventPollInterrupt(void);
 
 
-#endif /* __VIRTD_EVENT_H__ */
+#endif /* __VIR_EVENT_POLL_H__ */
diff --git a/src/util/virfcp.h b/src/util/virfcp.h
index 3ca1eb1778..fab6e9403b 100644
--- a/src/util/virfcp.h
+++ b/src/util/virfcp.h
@@ -29,4 +29,4 @@ virFCReadRportValue(const char *rport,
                     const char *entry,
                     char **result);
 
-#endif
+#endif /* __VIR_FCP_H__ */
diff --git a/src/util/virfdstream.h b/src/util/virfdstream.h
index 887c991d69..905975ff1e 100644
--- a/src/util/virfdstream.h
+++ b/src/util/virfdstream.h
@@ -19,7 +19,6 @@
  *
  */
 
-
 #ifndef __VIR_FDSTREAM_H_
 # define __VIR_FDSTREAM_H_
 
diff --git a/src/util/virfile.h b/src/util/virfile.h
index 0f7dece958..795c339356 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -22,7 +22,6 @@
  *
  */
 
-
 #ifndef __VIR_FILE_H_
 # define __VIR_FILE_H_
 
@@ -383,4 +382,4 @@ int virFileInData(int fd,
 
 VIR_DEFINE_AUTOPTR_FUNC(virFileWrapperFd, virFileWrapperFdFree)
 
-#endif /* __VIR_FILE_H */
+#endif /* __VIR_FILE_H_ */
diff --git a/src/util/virfirewallpriv.h b/src/util/virfirewallpriv.h
index ab90bf3713..1dca0c5e9a 100644
--- a/src/util/virfirewallpriv.h
+++ b/src/util/virfirewallpriv.h
@@ -20,7 +20,7 @@
 
 #ifndef __VIR_FIREWALL_PRIV_H_ALLOW__
 # error "virfirewallpriv.h may only be included by virfirewall.c or test suites"
-#endif
+#endif /* __VIR_FIREWALL_PRIV_H_ALLOW__ */
 
 #ifndef __VIR_FIREWALL_PRIV_H__
 # define __VIR_FIREWALL_PRIV_H__
diff --git a/src/util/virgettext.h b/src/util/virgettext.h
index 4584d8391c..5e9cfd2719 100644
--- a/src/util/virgettext.h
+++ b/src/util/virgettext.h
@@ -17,6 +17,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef __VIR_GETTEXT_H__
 # define __VIR_GETTEXT_H__
 
diff --git a/src/util/virhash.h b/src/util/virhash.h
index a201b8910d..811b6c5b21 100644
--- a/src/util/virhash.h
+++ b/src/util/virhash.h
@@ -199,4 +199,4 @@ void virHashValueFree(void *value, const void *name);
 
 VIR_DEFINE_AUTOPTR_FUNC(virHashTable, virHashFree)
 
-#endif                          /* ! __VIR_HASH_H__ */
+#endif /* __VIR_HASH_H__ */
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 7200bab16f..9e80c192ac 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -40,6 +40,7 @@
 
 #include "c-ctype.h"
 #include "viralloc.h"
+#define __VIR_HOSTCPU_PRIV_H_ALLOW__
 #include "virhostcpupriv.h"
 #include "physmem.h"
 #include "virerror.h"
diff --git a/src/util/virhostcpu.h b/src/util/virhostcpu.h
index 1d84dd72e5..9107bb32ff 100644
--- a/src/util/virhostcpu.h
+++ b/src/util/virhostcpu.h
@@ -66,4 +66,4 @@ int virHostCPUGetOnline(unsigned int cpu, bool *online);
 
 unsigned int virHostCPUGetMicrocodeVersion(void);
 
-#endif /* __VIR_HOSTCPU_H__*/
+#endif /* __VIR_HOSTCPU_H__ */
diff --git a/src/util/virhostcpupriv.h b/src/util/virhostcpupriv.h
index 5e7ae3b88a..52ab4a9fe0 100644
--- a/src/util/virhostcpupriv.h
+++ b/src/util/virhostcpupriv.h
@@ -19,6 +19,10 @@
  *
  */
 
+#ifndef __VIR_HOSTCPU_PRIV_H_ALLOW__
+# error "virhostcpupriv.h may only be included by virhostcpu.c or test suites"
+#endif /* __VIR_HOSTCPU_PRIV_H_ALLOW__ */
+
 #ifndef __VIR_HOSTCPU_PRIV_H__
 # define __VIR_HOSTCPU_PRIV_H__
 
diff --git a/src/util/virhostmem.h b/src/util/virhostmem.h
index 0b713235b2..c5a3853fdf 100644
--- a/src/util/virhostmem.h
+++ b/src/util/virhostmem.h
@@ -55,4 +55,4 @@ int virHostMemAllocPages(unsigned int npages,
                          unsigned int cellCount,
                          bool add);
 
-#endif /* __VIR_HOSTMEM_H__*/
+#endif /* __VIR_HOSTMEM_H__ */
diff --git a/src/util/virinitctl.h b/src/util/virinitctl.h
index b19742bf1e..83170753da 100644
--- a/src/util/virinitctl.h
+++ b/src/util/virinitctl.h
@@ -35,4 +35,4 @@ typedef enum {
 
 int virInitctlSetRunLevel(virInitctlRunLevel level);
 
-#endif
+#endif /* __VIR_INITCTL_H__ */
diff --git a/src/util/viriscsi.h b/src/util/viriscsi.h
index 4da9becfb2..3fbf906637 100644
--- a/src/util/viriscsi.h
+++ b/src/util/viriscsi.h
@@ -68,4 +68,5 @@ virISCSINodeUpdate(const char *portal,
                    const char *value)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
-#endif
+
+#endif /* __VIR_ISCSI_H__ */
diff --git a/src/util/virjson.h b/src/util/virjson.h
index 75f7f17b44..804cc0ce95 100644
--- a/src/util/virjson.h
+++ b/src/util/virjson.h
@@ -20,7 +20,6 @@
  *
  */
 
-
 #ifndef __VIR_JSON_H_
 # define __VIR_JSON_H_
 
diff --git a/src/util/virkeycode.h b/src/util/virkeycode.h
index 6947cfe913..106dae7a08 100644
--- a/src/util/virkeycode.h
+++ b/src/util/virkeycode.h
@@ -30,4 +30,4 @@ int virKeycodeValueTranslate(virKeycodeSet from_codeset,
                         virKeycodeSet to_offset,
                         int key_value);
 
-#endif
+#endif /* __VIR_UTIL_VIRTKEYCODE_H__ */
diff --git a/src/util/virlease.h b/src/util/virlease.h
index b9f394e9aa..9f151aed74 100644
--- a/src/util/virlease.h
+++ b/src/util/virlease.h
@@ -41,4 +41,5 @@ int virLeaseNew(virJSONValuePtr *lease_ret,
                 const char *hostname,
                 const char *iaid,
                 const char *server_duid);
-#endif /* __VIR_LEASE_H */
+
+#endif /* __VIR_LEASE_H_ */
diff --git a/src/util/virlog.h b/src/util/virlog.h
index 35dba16cfe..1155d35663 100644
--- a/src/util/virlog.h
+++ b/src/util/virlog.h
@@ -239,4 +239,4 @@ int virLogParseOutputs(const char *src,
 int virLogParseFilters(const char *src,
                        virLogFilterPtr **filters) ATTRIBUTE_NONNULL(1);
 
-#endif
+#endif /* __VIRTLOG_H_ */
diff --git a/src/util/virmacmap.h b/src/util/virmacmap.h
index dab7a9f4cb..e34f98f661 100644
--- a/src/util/virmacmap.h
+++ b/src/util/virmacmap.h
@@ -46,4 +46,5 @@ int virMacMapWriteFile(virMacMapPtr mgr,
 
 int virMacMapDumpStr(virMacMapPtr mgr,
                      char **str);
-#endif /* __VIR_MACMAPPING_H__ */
+
+#endif /* __VIR_MACMAP_H__ */
diff --git a/src/util/virnetdevvlan.h b/src/util/virnetdevvlan.h
index ca2793ae34..73e1ab40ad 100644
--- a/src/util/virnetdevvlan.h
+++ b/src/util/virnetdevvlan.h
@@ -15,6 +15,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef __VIR_NETDEV_VLAN_H__
 # define __VIR_NETDEV_VLAN_H__
 
diff --git a/src/util/virnodesuspend.h b/src/util/virnodesuspend.h
index 85941bf1ab..64558ab0a5 100644
--- a/src/util/virnodesuspend.h
+++ b/src/util/virnodesuspend.h
@@ -19,7 +19,6 @@
  *
  */
 
-
 #ifndef __VIR_NODE_SUSPEND_H__
 # define __VIR_NODE_SUSPEND_H__
 
diff --git a/src/util/virobject.h b/src/util/virobject.h
index 77ebad1e8b..6c48fb6249 100644
--- a/src/util/virobject.h
+++ b/src/util/virobject.h
@@ -152,4 +152,4 @@ void
 virObjectListFreeCount(void *list,
                        size_t count);
 
-#endif /* __VIR_OBJECT_H */
+#endif /* __VIR_OBJECT_H__ */
diff --git a/src/util/virqemu.h b/src/util/virqemu.h
index 309be45761..4a4d7e42cf 100644
--- a/src/util/virqemu.h
+++ b/src/util/virqemu.h
@@ -20,7 +20,6 @@
  *
  */
 
-
 #ifndef __VIR_QEMU_H_
 # define __VIR_QEMU_H_
 
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index bc6b614ee9..c823ebb657 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -23,6 +23,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
+#define __VIR_RESCTRL_PRIV_H_ALLOW__
 #include "virresctrlpriv.h"
 #include "viralloc.h"
 #include "virfile.h"
diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h
index 8ea9758b94..04202b5f09 100644
--- a/src/util/virresctrl.h
+++ b/src/util/virresctrl.h
@@ -235,4 +235,4 @@ virResctrlMonitorGetCacheOccupancy(virResctrlMonitorPtr monitor,
 void
 virResctrlMonitorFreeStats(virResctrlMonitorStatsPtr *stats,
                            size_t nstats);
-#endif /*  __VIR_RESCTRL_H__ */
+#endif /* __VIR_RESCTRL_H__ */
diff --git a/src/util/virresctrlpriv.h b/src/util/virresctrlpriv.h
index 72b115afd1..f8743d81ea 100644
--- a/src/util/virresctrlpriv.h
+++ b/src/util/virresctrlpriv.h
@@ -16,6 +16,10 @@
  * <http://www.gnu.org/licenses/>.
  */
 
+#ifndef __VIR_RESCTRL_PRIV_H_ALLOW__
+# error "virresctrlpriv.h may only be included by virresctrl.c or test suites"
+#endif /* __VIR_RESCTRL_PRIV_H_ALLOW__ */
+
 #ifndef __VIR_RESCTRL_PRIV_H__
 # define __VIR_RESCTRL_PRIV_H__
 
diff --git a/src/util/virsexpr.h b/src/util/virsexpr.h
index 72a49e4a41..7b8358cd72 100644
--- a/src/util/virsexpr.h
+++ b/src/util/virsexpr.h
@@ -66,4 +66,4 @@ int sexpr_int(const struct sexpr *sexpr, const char *name);
 double sexpr_float(const struct sexpr *sexpr, const char *name);
 uint64_t sexpr_u64(const struct sexpr *sexpr, const char *name);
 
-#endif
+#endif /* _LIBVIR_SEXPR_H_ */
diff --git a/src/util/virsysinfopriv.h b/src/util/virsysinfopriv.h
index a50b280f64..607a9354fb 100644
--- a/src/util/virsysinfopriv.h
+++ b/src/util/virsysinfopriv.h
@@ -19,7 +19,7 @@
 
 #ifndef __VIR_SYSINFO_PRIV_H_ALLOW__
 # error "virsysinfopriv.h may only be included by virsysinfo.c or test suites"
-#endif
+#endif /* __VIR_SYSINFO_PRIV_H_ALLOW__ */
 
 #ifndef __VIR_SYSINFO_PRIV_H__
 # define __VIR_SYSINFO_PRIV_H__
diff --git a/src/util/virsystemdpriv.h b/src/util/virsystemdpriv.h
index 4f4058b35f..c5423cf426 100644
--- a/src/util/virsystemdpriv.h
+++ b/src/util/virsystemdpriv.h
@@ -21,7 +21,7 @@
 
 #ifndef __VIR_SYSTEMD_PRIV_H_ALLOW__
 # error "virsystemdpriv.h may only be included by virsystemd.c or test suites"
-#endif
+#endif /* __VIR_SYSTEMD_PRIV_H_ALLOW__ */
 
 #ifndef __VIR_SYSTEMD_PRIV_H__
 # define __VIR_SYSTEMD_PRIV_H__
diff --git a/src/util/virthread.h b/src/util/virthread.h
index e468ba941c..e4348e87a9 100644
--- a/src/util/virthread.h
+++ b/src/util/virthread.h
@@ -213,4 +213,4 @@ int virThreadLocalSet(virThreadLocalPtr l, void*) ATTRIBUTE_RETURN_CHECK;
         return 0; \
     }
 
-#endif
+#endif /* __THREADS_H_ */
diff --git a/src/util/virthreadjob.h b/src/util/virthreadjob.h
index 0c62ee6723..343b8b041a 100644
--- a/src/util/virthreadjob.h
+++ b/src/util/virthreadjob.h
@@ -28,4 +28,4 @@ void virThreadJobSetWorker(const char *caller);
 void virThreadJobSet(const char *caller);
 void virThreadJobClear(int rv);
 
-#endif
+#endif /* __VIR_THREAD_JOB_H__ */
diff --git a/src/util/virthreadpool.h b/src/util/virthreadpool.h
index 26fb4b739c..12f12e4fc3 100644
--- a/src/util/virthreadpool.h
+++ b/src/util/virthreadpool.h
@@ -60,4 +60,4 @@ int virThreadPoolSetParameters(virThreadPoolPtr pool,
                                long long int maxWorkers,
                                long long int prioWorkers);
 
-#endif
+#endif /* __VIR_THREADPOOL_H__ */
diff --git a/src/util/virtime.h b/src/util/virtime.h
index dec7238912..340ea5d588 100644
--- a/src/util/virtime.h
+++ b/src/util/virtime.h
@@ -73,4 +73,4 @@ int virTimeBackOffStart(virTimeBackOffVar *var,
 
 bool virTimeBackOffWait(virTimeBackOffVar *var);
 
-#endif
+#endif /* __VIR_TIME_H__ */
diff --git a/src/util/virtpm.h b/src/util/virtpm.h
index 2ceb4a6af6..a363f37ec0 100644
--- a/src/util/virtpm.h
+++ b/src/util/virtpm.h
@@ -17,6 +17,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef __VIR_TPM_H__
 # define __VIR_TPM_H__
 
diff --git a/src/util/virtypedparam.h b/src/util/virtypedparam.h
index 120286a5a1..6df63a1e5c 100644
--- a/src/util/virtypedparam.h
+++ b/src/util/virtypedparam.h
@@ -19,7 +19,6 @@
  *
  */
 
-
 #ifndef __VIR_TYPED_PARAM_H_
 # define __VIR_TYPED_PARAM_H_
 
@@ -135,4 +134,4 @@ VIR_ENUM_DECL(virTypedParameter)
         } \
     } while (0)
 
-#endif /* __VIR_TYPED_PARAM_H */
+#endif /* __VIR_TYPED_PARAM_H_ */
diff --git a/src/util/virvhba.h b/src/util/virvhba.h
index 67b1fa5376..32792918ae 100644
--- a/src/util/virvhba.h
+++ b/src/util/virvhba.h
@@ -59,4 +59,4 @@ virVHBAGetHostByFabricWWN(const char *sysfs_prefix,
                           const char *fabric_wwn)
     ATTRIBUTE_NONNULL(2);
 
-#endif /* __VIR_VBHA_H__ */
+#endif /* __VIR_VHBA_H__ */
diff --git a/src/util/virxml.h b/src/util/virxml.h
index 127560d9d1..43ce031082 100644
--- a/src/util/virxml.h
+++ b/src/util/virxml.h
@@ -221,4 +221,4 @@ virXMLFormatElement(virBufferPtr buf,
                     virBufferPtr attrBuf,
                     virBufferPtr childBuf);
 
-#endif                          /* __VIR_XML_H__ */
+#endif /* __VIR_XML_H__ */
diff --git a/src/vbox/vbox_driver.h b/src/vbox/vbox_driver.h
index bf7db2bf87..38aaaf6e39 100644
--- a/src/vbox/vbox_driver.h
+++ b/src/vbox/vbox_driver.h
@@ -1,7 +1,3 @@
-/** @file vbox_driver.h
- * Core driver methods for managing VirtualBox VM's
- */
-
 /*
  * Copyright (C) 2008-2009 Sun Microsystems, Inc.
  *
@@ -43,4 +39,4 @@ int vboxStorageRegister(void);
 int vboxRegister(void);
 # endif
 
-#endif
+#endif /* VBOX_DRIVER_H */
diff --git a/src/vbox/vbox_snapshot_conf.h b/src/vbox/vbox_snapshot_conf.h
index 3864b30847..7ba3ca03ea 100644
--- a/src/vbox/vbox_snapshot_conf.h
+++ b/src/vbox/vbox_snapshot_conf.h
@@ -138,4 +138,4 @@ virVBoxSnapshotConfSnapshotPtr
 virVBoxSnapshotConfSnapshotByName(virVBoxSnapshotConfSnapshotPtr snapshot,
                                   const char *snapshotName);
 
-#endif /*VBOX_SNAPSHOT_CONF_H*/
+#endif /* VBOX_SNAPSHOT_CONF_H */
diff --git a/src/vmware/vmware_conf.h b/src/vmware/vmware_conf.h
index b3f8cdf253..e7ba403848 100644
--- a/src/vmware/vmware_conf.h
+++ b/src/vmware/vmware_conf.h
@@ -1,4 +1,3 @@
-/*---------------------------------------------------------------------------*/
 /*
  * Copyright (C) 2014 Red Hat, Inc.
  * Copyright 2010, diateam (www.diateam.net)
@@ -18,7 +17,6 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
-/*---------------------------------------------------------------------------*/
 
 #ifndef VMWARE_CONF_H
 # define VMWARE_CONF_H
@@ -87,4 +85,4 @@ int vmwareExtractPid(const char * vmxPath);
 
 char *vmwareCopyVMXFileName(const char *datastorePath, void *opaque);
 
-#endif
+#endif /* VMWARE_CONF_H */
diff --git a/src/vmware/vmware_driver.h b/src/vmware/vmware_driver.h
index e7427bb250..94ed04d023 100644
--- a/src/vmware/vmware_driver.h
+++ b/src/vmware/vmware_driver.h
@@ -1,5 +1,5 @@
-/*---------------------------------------------------------------------------*/
-/* Copyright 2010, diateam (www.diateam.net)
+/*
+ * Copyright 2010, diateam (www.diateam.net)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -15,11 +15,10 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
-/*---------------------------------------------------------------------------*/
 
 #ifndef VMWARE_DRIVER_H
 # define VMWARE_DRIVER_H
 
 int vmwareRegister(void);
 
-#endif
+#endif /* VMWARE_DRIVER_H */
diff --git a/src/vz/vz_driver.h b/src/vz/vz_driver.h
index 3c7610637f..82c77fd0ec 100644
--- a/src/vz/vz_driver.h
+++ b/src/vz/vz_driver.h
@@ -25,4 +25,4 @@
 
 int vzRegister(void);
 
-#endif
+#endif /* PARALLELS_DRIVER_H */
diff --git a/src/vz/vz_sdk.h b/src/vz/vz_sdk.h
index 0a77431db5..d201d6a10d 100644
--- a/src/vz/vz_sdk.h
+++ b/src/vz/vz_sdk.h
@@ -20,9 +20,12 @@
  *
  */
 
-#include <Parallels.h>
+#ifndef __VZ_SDK_H__
+# define __VZ_SDK_H__
 
-#include "vz_utils.h"
+# include <Parallels.h>
+
+# include "vz_utils.h"
 
 int prlsdkInit(void);
 void prlsdkDeinit(void);
@@ -91,3 +94,5 @@ PRL_HANDLE
 prlsdkSdkDomainLookupByName(vzDriverPtr driver, const char *name);
 int prlsdkCancelJob(virDomainObjPtr dom);
 int prlsdkResizeImage(virDomainObjPtr dom, virDomainDiskDefPtr disk, unsigned long long newsize);
+
+#endif /* __VZ_SDK_H__ */
diff --git a/src/vz/vz_utils.h b/src/vz/vz_utils.h
index 7137a2a8b6..93db255f95 100644
--- a/src/vz/vz_utils.h
+++ b/src/vz/vz_utils.h
@@ -151,11 +151,11 @@ int vzCheckUnsupportedGraphics(virDomainGraphicsDefPtr gr);
     OP(wr_req, VIR_DOMAIN_BLOCK_STATS_WRITE_REQ, "write_requests") \
     OP(wr_bytes, VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES, "write_total")
 
-#endif
-
 int
 vzDomainObjBeginJob(virDomainObjPtr dom);
 void
 vzDomainObjEndJob(virDomainObjPtr dom);
 int
 vzDomainJobUpdateTime(vzDomainJobObjPtr job);
+
+#endif /* PARALLELS_UTILS_H */
diff --git a/src/xenapi/xenapi_driver.h b/src/xenapi/xenapi_driver.h
index 7a59c87587..df469aff34 100644
--- a/src/xenapi/xenapi_driver.h
+++ b/src/xenapi/xenapi_driver.h
@@ -17,7 +17,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef __VIR_XENAPI_PRIV_H__
 # define __VIR_XENAPI_PRIV_H__
 
diff --git a/src/xenapi/xenapi_driver_private.h b/src/xenapi/xenapi_driver_private.h
index fb6d1a40be..7d8d8c66d2 100644
--- a/src/xenapi/xenapi_driver_private.h
+++ b/src/xenapi/xenapi_driver_private.h
@@ -17,7 +17,6 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-
 #ifndef __VIR_XENAPI_H__
 # define __VIR_XENAPI_H__
 
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 5b1e0db104..bf334c75ee 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -22,6 +22,7 @@
 #include "qemu/qemu_alias.h"
 #include "qemu/qemu_conf.h"
 #include "qemu/qemu_hotplug.h"
+#define __QEMU_HOTPLUGPRIV_H_ALLOW__
 #include "qemu/qemu_hotplugpriv.h"
 #include "qemumonitortestutils.h"
 #include "testutils.h"
diff --git a/tests/qemumigparamstest.c b/tests/qemumigparamstest.c
index 0532053722..e0117d0261 100644
--- a/tests/qemumigparamstest.c
+++ b/tests/qemumigparamstest.c
@@ -26,6 +26,7 @@
 #include "testutilsqemu.h"
 #include "qemumonitortestutils.h"
 #include "qemu/qemu_migration_params.h"
+#define __QEMU_MIGRATION_PARAMSPRIV_H_ALLOW__
 #include "qemu/qemu_migration_paramspriv.h"
 #include "qemu/qemu_monitor.h"
 
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 5c77db337f..0e7d27a610 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -33,6 +33,7 @@
 #include "cpu/cpu.h"
 #include "qemu/qemu_monitor.h"
 #include "qemu/qemu_migration_params.h"
+#define __QEMU_MIGRATION_PARAMSPRIV_H_ALLOW__
 #include "qemu/qemu_migration_paramspriv.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 9cee0082fa..cc9e0bd0f4 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -26,6 +26,7 @@
 #include "qemumonitortestutils.h"
 
 #include "virthread.h"
+#define __QEMU_PROCESS_PRIV_H_ALLOW__
 #include "qemu/qemu_processpriv.h"
 #include "qemu/qemu_monitor.h"
 #include "qemu/qemu_agent.h"
diff --git a/tests/storagebackendsheepdogtest.c b/tests/storagebackendsheepdogtest.c
index a0bbad3990..88c125236b 100644
--- a/tests/storagebackendsheepdogtest.c
+++ b/tests/storagebackendsheepdogtest.c
@@ -27,6 +27,7 @@
 
 #include "internal.h"
 #include "testutils.h"
+#define __VIR_STORAGE_BACKEND_SHEEPDOG_PRIV_ALLOW_H__
 #include "storage/storage_backend_sheepdog_priv.h"
 #include "virstring.h"
 
diff --git a/tests/testutilshostcpus.h b/tests/testutilshostcpus.h
index f0ab23b962..07e7302d7f 100644
--- a/tests/testutilshostcpus.h
+++ b/tests/testutilshostcpus.h
@@ -1,6 +1,25 @@
-#include "conf/cpu_conf.h"
-#include "internal.h"
-#include "util/virarch.h"
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TESTUTILSHOSTCPUS_H
+# define TESTUTILSHOSTCPUS_H
+
+# include "conf/cpu_conf.h"
+# include "internal.h"
+# include "util/virarch.h"
 
 static virCPUFeatureDef cpuDefaultFeatures[] = {
     { (char *) "ds",        -1 },
@@ -146,3 +165,5 @@ testUtilsHostCpusGetDefForArch(virArch arch)
 
     return NULL;
 }
+
+#endif /* TESTUTILSHOSTCPUS_H */
diff --git a/tests/testutilslxc.h b/tests/testutilslxc.h
index 3f9a67b7f4..0bc69a903f 100644
--- a/tests/testutilslxc.h
+++ b/tests/testutilslxc.h
@@ -1,6 +1,27 @@
-#include "capabilities.h"
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
 
-#define FAKEDEVDIR0 "/fakedevdir0/bla/fasl"
-#define FAKEDEVDIR1 "/fakedevdir1/bla/fasl"
+#ifndef TESTUTILSLXC_H
+# define TESTUTILSLXC_H
+
+# include "capabilities.h"
+
+# define FAKEDEVDIR0 "/fakedevdir0/bla/fasl"
+# define FAKEDEVDIR1 "/fakedevdir1/bla/fasl"
 
 virCapsPtr testLXCCapsInit(void);
+
+#endif /* TESTUTILSLXC_H */
diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h
index efb1baeadd..1aa0034bb9 100644
--- a/tests/testutilsqemu.h
+++ b/tests/testutilsqemu.h
@@ -1,10 +1,29 @@
-#ifdef WITH_QEMU
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
 
-# include "capabilities.h"
-# include "virfilecache.h"
-# include "domain_conf.h"
-# include "qemu/qemu_capabilities.h"
-# include "qemu/qemu_conf.h"
+#ifndef TESTUTILSQEMU_H
+# define TESTUTILSQEMU_H
+
+# ifdef WITH_QEMU
+
+#  include "capabilities.h"
+#  include "virfilecache.h"
+#  include "domain_conf.h"
+#  include "qemu/qemu_capabilities.h"
+#  include "qemu/qemu_conf.h"
 
 enum {
     GIC_NONE = 0,
@@ -44,4 +63,6 @@ char *testQemuGetLatestCapsForArch(const char *dirname,
                                    const char *arch,
                                    const char *suffix);
 
-#endif
+# endif
+
+#endif /* TESTUTILSQEMU_H */
diff --git a/tests/testutilsqemuschema.h b/tests/testutilsqemuschema.h
index c69435f420..081d12ea63 100644
--- a/tests/testutilsqemuschema.h
+++ b/tests/testutilsqemuschema.h
@@ -16,9 +16,12 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include "virhash.h"
-#include "virjson.h"
-#include "virbuffer.h"
+#ifndef __TESTUTILSQEMUSCHEMA_H__
+# define __TESTUTILSQEMUSCHEMA_H__
+
+# include "virhash.h"
+# include "virjson.h"
+# include "virbuffer.h"
 
 int
 testQEMUSchemaValidate(virJSONValuePtr obj,
@@ -31,3 +34,5 @@ testQEMUSchemaGetLatest(void);
 
 virHashTablePtr
 testQEMUSchemaLoad(void);
+
+#endif /* __TESTUTILSQEMUSCHEMA_H__ */
diff --git a/tests/testutilsxen.h b/tests/testutilsxen.h
index c5ccb6d471..0fceb93ae8 100644
--- a/tests/testutilsxen.h
+++ b/tests/testutilsxen.h
@@ -1,3 +1,19 @@
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
 #ifndef _TESTUTILSXEN_H_
 # define _TESTUTILSXEN_H_
 
diff --git a/tests/virdbustest.c b/tests/virdbustest.c
index 3afea6c248..b62a42eca7 100644
--- a/tests/virdbustest.c
+++ b/tests/virdbustest.c
@@ -18,7 +18,7 @@
 
 #include <config.h>
 
-
+#define __VIR_DBUS_PRIV_H_ALLOW__
 #include "virdbuspriv.h"
 #include "virlog.h"
 #include "testutils.h"
diff --git a/tests/virfilewrapper.h b/tests/virfilewrapper.h
index 612322c1d0..441013cec3 100644
--- a/tests/virfilewrapper.h
+++ b/tests/virfilewrapper.h
@@ -17,6 +17,7 @@
  */
 
 #ifndef __VIR_FILE_MOCK_H__
+# define __VIR_FILE_MOCK_H__
 
 int
 virFileWrapperAddPrefix(const char *prefix,
diff --git a/tests/virfirewalltest.c b/tests/virfirewalltest.c
index 39aaa3bda7..7193576102 100644
--- a/tests/virfirewalltest.c
+++ b/tests/virfirewalltest.c
@@ -20,6 +20,7 @@
 
 #define __VIR_FIREWALL_PRIV_H_ALLOW__
 #define __VIR_COMMAND_PRIV_H_ALLOW__
+#define __VIR_DBUS_PRIV_H_ALLOW__
 
 #include "testutils.h"
 
diff --git a/tests/virhashdata.h b/tests/virhashdata.h
index 332e09c3b3..557ed8e923 100644
--- a/tests/virhashdata.h
+++ b/tests/virhashdata.h
@@ -1,3 +1,22 @@
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef VIRHASHDATA_H
+# define VIRHASHDATA_H
+
 const char *uuids[] = {
 /* [  2] */ "a9b02f96-e430-4f7c-a7ff-a647d080447a",
 /* [  4] */ "202e32ca-f82c-4f13-9266-28dc8d002074",
@@ -264,3 +283,5 @@ const char *uuids_new[] = {
     "5920cc9d-62a3-4772-9e73-eb97f0bc483c",
     "53c215dd-bdba-4fdc-887a-86ab6f860df4",
 };
+
+#endif /* VIRHASHDATA_H */
diff --git a/tests/virhostcputest.c b/tests/virhostcputest.c
index 1df4bb8ee6..219de942b7 100644
--- a/tests/virhostcputest.c
+++ b/tests/virhostcputest.c
@@ -4,6 +4,7 @@
 
 #include "testutils.h"
 #include "internal.h"
+#define __VIR_HOSTCPU_PRIV_H_ALLOW__
 #include "virhostcpupriv.h"
 #include "virfile.h"
 #include "virstring.h"
diff --git a/tests/virnettlshelpers.h b/tests/virnettlshelpers.h
index ad72cd6ab8..2ca4b52c3c 100644
--- a/tests/virnettlshelpers.h
+++ b/tests/virnettlshelpers.h
@@ -16,14 +16,17 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include <gnutls/gnutls.h>
-#include <gnutls/x509.h>
+#ifndef VIRNETTLSHELPERS_H
+# define VIRNETTLSHELPERS_H
 
-#if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
+# include <gnutls/gnutls.h>
+# include <gnutls/x509.h>
 
-# include <libtasn1.h>
+# if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
 
-# include "rpc/virnettlscontext.h"
+#  include <libtasn1.h>
+
+#  include "rpc/virnettlscontext.h"
 
 /*
  * This contains parameter about how to generate
@@ -74,4 +77,6 @@ void testTLSDiscardCert(struct testTLSCertReq *req);
 void testTLSInit(const char *keyfile);
 void testTLSCleanup(const char *keyfile);
 
-#endif
+# endif
+
+#endif /* VIRNETTLSHELPERS_H */
diff --git a/tests/virresctrltest.c b/tests/virresctrltest.c
index d2a290035f..d75c73f49e 100644
--- a/tests/virresctrltest.c
+++ b/tests/virresctrltest.c
@@ -2,6 +2,7 @@
 
 #include "testutils.h"
 #include "virfilewrapper.h"
+#define __VIR_RESCTRL_PRIV_H_ALLOW__
 #include "virresctrlpriv.h"
 
 
diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h
index b4fd2a86c6..343b2b9d6c 100644
--- a/tools/virsh-completer.h
+++ b/tools/virsh-completer.h
@@ -109,4 +109,4 @@ char ** virshDomainDeviceAliasCompleter(vshControl *ctl,
 char ** virshCellnoCompleter(vshControl *ctl,
                              const vshCmd *cmd,
                              unsigned int flags);
-#endif
+#endif /* VIRSH_COMPLETER */
diff --git a/tools/virt-admin-completer.h b/tools/virt-admin-completer.h
index 7507b95c1a..311f47fcf6 100644
--- a/tools/virt-admin-completer.h
+++ b/tools/virt-admin-completer.h
@@ -30,4 +30,4 @@ char **
 vshAdmServerCompleter(vshControl *ctl,
                       const vshCmd *cmd,
                       unsigned int flags);
-#endif
+#endif /* VIRT_ADMIN_COMPLETER */
diff --git a/tools/wireshark/src/packet-libvirt.h b/tools/wireshark/src/packet-libvirt.h
index 53197eb2eb..896b33fb6c 100644
--- a/tools/wireshark/src/packet-libvirt.h
+++ b/tools/wireshark/src/packet-libvirt.h
@@ -16,6 +16,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  */
+
 #ifndef _PACKET_LIBVIRT_H_
 # define _PACKET_LIBVIRT_H_
 
-- 
2.19.2

--
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