This introduces (very limited) usage of clang-format for code
formatting. By using the magic comment
/* clang-format off */
we can prevent it from re-formatting the entire source file. This
enables us to use clang-format, exclusively for applying sorting
to #include statements
The following rule is defined
- <config.h> must always be the first header
- System headers before any local headers
- Libvirt system headers after other system header
- "configmake.h"
- Header matching the source file name has built-in
- Virt driver specific local header next
- Secondary driver specific local header next
- Other local headers last
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
.clang-format | 32 +++++++++++++++++++++++++
mark.pl | 41 ++++++++++++++++++++++++++++++++
src/util/glibcompat.c | 2 ++
src/util/glibcompat.h | 4 +++-
src/util/iohelper.c | 10 ++++----
src/util/viralloc.c | 5 +++-
src/util/viralloc.h | 2 ++
src/util/virarch.c | 4 +++-
src/util/virarch.h | 2 ++
src/util/virarptable.c | 2 ++
src/util/virarptable.h | 2 ++
src/util/viraudit.c | 6 +++--
src/util/viraudit.h | 2 ++
src/util/virauth.c | 13 ++++++----
src/util/virauth.h | 2 ++
src/util/virauthconfig.c | 6 +++--
src/util/virauthconfig.h | 2 ++
src/util/virbitmap.c | 5 +++-
src/util/virbitmap.h | 5 ++--
src/util/virbpf.c | 5 +++-
src/util/virbpf.h | 2 ++
src/util/virbuffer.c | 2 ++
src/util/virbuffer.h | 3 ++-
src/util/virccw.c | 4 ++++
src/util/virccw.h | 2 ++
src/util/vircgroup.c | 15 ++++++------
src/util/vircgroup.h | 2 ++
src/util/vircgroupbackend.c | 2 ++
src/util/vircgroupbackend.h | 3 ++-
src/util/vircgrouppriv.h | 2 ++
src/util/vircgroupv1.c | 11 +++++----
src/util/vircgroupv1.h | 2 ++
src/util/vircgroupv2.c | 5 ++--
src/util/vircgroupv2.h | 2 ++
src/util/vircgroupv2devices.c | 5 ++--
src/util/vircgroupv2devices.h | 3 ++-
src/util/vircommand.c | 10 ++++----
src/util/vircommand.h | 2 ++
src/util/vircommandpriv.h | 2 ++
src/util/virconf.c | 20 +++++++++-------
src/util/virconf.h | 3 +++
src/util/vircrypto.c | 9 ++++---
src/util/vircrypto.h | 2 ++
src/util/virdaemon.c | 14 ++++++-----
src/util/virdaemon.h | 2 ++
src/util/virdevmapper.c | 15 +++++++-----
src/util/virdevmapper.h | 2 ++
src/util/virdnsmasq.c | 17 +++++++------
src/util/virdnsmasq.h | 2 ++
src/util/virebtables.c | 7 ++++--
src/util/virebtables.h | 2 ++
src/util/virendian.h | 3 +++
src/util/virenum.c | 2 ++
src/util/virenum.h | 2 ++
src/util/virerror.c | 5 +++-
src/util/virerror.h | 2 ++
src/util/virerrorpriv.h | 2 ++
src/util/virevent.c | 5 +++-
src/util/virevent.h | 2 ++
src/util/vireventglib.c | 5 +++-
src/util/vireventglib.h | 2 ++
src/util/vireventglibwatch.c | 3 +++
src/util/vireventglibwatch.h | 2 ++
src/util/vireventthread.c | 5 +++-
src/util/vireventthread.h | 5 +++-
src/util/virfcp.c | 7 +++---
src/util/virfcp.h | 2 ++
src/util/virfdstream.c | 19 ++++++++-------
src/util/virfdstream.h | 3 +++
src/util/virfile.c | 13 ++++++----
src/util/virfile.h | 2 ++
src/util/virfilecache.c | 13 +++++-----
src/util/virfilecache.h | 5 ++--
src/util/virfirewall.c | 9 ++++---
src/util/virfirewall.h | 4 +++-
src/util/virfirewalld.c | 11 +++++----
src/util/virfirewalld.h | 2 ++
src/util/virfirewalldpriv.h | 2 ++
src/util/virfirmware.c | 5 +++-
src/util/virfirmware.h | 2 ++
src/util/virgdbus.c | 4 +++-
src/util/virgdbus.h | 2 ++
src/util/virgettext.c | 4 +++-
src/util/virgettext.h | 2 ++
src/util/virgic.c | 6 ++++-
src/util/virgic.h | 2 ++
src/util/virglibutil.c | 2 ++
src/util/virglibutil.h | 2 ++
src/util/virhash.c | 8 ++++---
src/util/virhash.h | 2 ++
src/util/virhashcode.c | 5 +++-
src/util/virhashcode.h | 5 +++-
src/util/virhook.c | 16 ++++++++-----
src/util/virhook.h | 2 ++
src/util/virhostcpu.c | 12 ++++++----
src/util/virhostcpu.h | 1 +
src/util/virhostcpupriv.h | 2 ++
src/util/virhostmem.c | 14 ++++++-----
src/util/virhostmem.h | 2 ++
src/util/virhostuptime.c | 8 ++++---
src/util/virhostuptime.h | 2 ++
src/util/viridentity.c | 13 ++++++----
src/util/viridentity.h | 5 +++-
src/util/viridentitypriv.h | 2 ++
src/util/virinitctl.c | 7 ++++--
src/util/virinitctl.h | 2 ++
src/util/viriptables.c | 15 +++++++-----
src/util/viriptables.h | 4 +++-
src/util/viriscsi.c | 2 ++
src/util/viriscsi.h | 2 ++
src/util/virjson.c | 10 ++++----
src/util/virjson.h | 5 ++--
src/util/virkeycode.c | 6 ++++-
src/util/virkeycode.h | 2 ++
src/util/virkmod.c | 6 ++++-
src/util/virkmod.h | 2 ++
src/util/virlease.c | 8 ++++---
src/util/virlease.h | 2 ++
src/util/virlockspace.c | 13 ++++++----
src/util/virlockspace.h | 2 ++
src/util/virlog.c | 24 +++++++++++--------
src/util/virlog.h | 2 ++
src/util/virmacaddr.c | 4 +++-
src/util/virmacaddr.h | 2 ++
src/util/virmacmap.c | 9 ++++---
src/util/virmacmap.h | 2 ++
src/util/virmdev.c | 7 ++++--
src/util/virmdev.h | 4 +++-
src/util/virmodule.c | 5 +++-
src/util/virmodule.h | 2 ++
src/util/virnetdev.c | 24 +++++++++++--------
src/util/virnetdev.h | 9 ++++---
src/util/virnetdevbandwidth.c | 6 ++++-
src/util/virnetdevbandwidth.h | 2 ++
src/util/virnetdevbridge.c | 15 +++++++-----
src/util/virnetdevbridge.h | 2 ++
src/util/virnetdevip.c | 15 +++++++-----
src/util/virnetdevip.h | 2 ++
src/util/virnetdevmacvlan.c | 5 +++-
src/util/virnetdevmacvlan.h | 6 +++--
src/util/virnetdevmidonet.c | 3 +++
src/util/virnetdevmidonet.h | 1 +
src/util/virnetdevopenvswitch.c | 12 ++++++----
src/util/virnetdevopenvswitch.h | 4 +++-
src/util/virnetdevpriv.h | 2 ++
src/util/virnetdevtap.c | 22 ++++++++++-------
src/util/virnetdevtap.h | 4 +++-
src/util/virnetdevveth.c | 5 +++-
src/util/virnetdevveth.h | 2 ++
src/util/virnetdevvlan.c | 5 +++-
src/util/virnetdevvlan.h | 2 ++
src/util/virnetdevvportprofile.c | 5 +++-
src/util/virnetdevvportprofile.h | 6 +++--
src/util/virnetlink.c | 11 +++++----
src/util/virnetlink.h | 2 ++
src/util/virnodesuspend.c | 12 ++++++----
src/util/virnodesuspend.h | 2 ++
src/util/virnuma.c | 14 ++++++-----
src/util/virnuma.h | 1 +
src/util/virnvme.c | 7 ++++--
src/util/virnvme.h | 2 ++
src/util/virobject.c | 6 +++--
src/util/virobject.h | 4 +++-
src/util/virpci.c | 16 +++++++------
src/util/virpci.h | 4 +++-
src/util/virpcivpd.c | 8 ++++---
src/util/virpcivpd.h | 2 ++
src/util/virpcivpdpriv.h | 2 ++
src/util/virperf.c | 6 +++--
src/util/virperf.h | 2 ++
src/util/virpidfile.c | 11 +++++----
src/util/virpidfile.h | 3 +++
src/util/virpolkit.c | 10 +++++---
src/util/virpolkit.h | 2 ++
src/util/virportallocator.c | 9 ++++---
src/util/virportallocator.h | 2 ++
src/util/virprobe.h | 2 ++
src/util/virprocess.c | 13 +++++-----
src/util/virprocess.h | 2 ++
src/util/virqemu.c | 8 ++++---
src/util/virqemu.h | 2 ++
src/util/virrandom.c | 11 +++++----
src/util/virrandom.h | 2 ++
src/util/virresctrl.c | 8 ++++---
src/util/virresctrl.h | 5 ++--
src/util/virresctrlpriv.h | 2 ++
src/util/virrotatingfile.c | 3 +++
src/util/virrotatingfile.h | 2 ++
src/util/virscsi.c | 11 +++++----
src/util/virscsi.h | 2 ++
src/util/virscsihost.c | 6 ++++-
src/util/virscsihost.h | 2 ++
src/util/virscsivhost.c | 8 +++++--
src/util/virscsivhost.h | 2 ++
src/util/virseclabel.c | 5 +++-
src/util/virseclabel.h | 2 ++
src/util/virsecret.c | 5 +++-
src/util/virsecret.h | 5 ++--
src/util/virsecureerase.c | 2 ++
src/util/virsecureerase.h | 2 ++
src/util/virsocket.c | 9 ++++---
src/util/virsocket.h | 2 ++
src/util/virsocketaddr.c | 5 +++-
src/util/virsocketaddr.h | 2 ++
src/util/virstoragefile.c | 5 +++-
src/util/virstoragefile.h | 2 ++
src/util/virstring.c | 6 +++--
src/util/virstring.h | 2 ++
src/util/virsysinfo.c | 9 ++++---
src/util/virsysinfo.h | 2 ++
src/util/virsysinfopriv.h | 2 ++
src/util/virsystemd.c | 17 ++++++-------
src/util/virsystemd.h | 2 ++
src/util/virsystemdpriv.h | 2 ++
src/util/virthread.c | 3 ++-
src/util/virthread.h | 4 +++-
src/util/virthreadjob.c | 5 +++-
src/util/virthreadjob.h | 2 ++
src/util/virthreadpool.c | 5 +++-
src/util/virthreadpool.h | 2 ++
src/util/virtime.c | 5 +++-
src/util/virtime.h | 2 ++
src/util/virtpm.c | 11 +++++----
src/util/virtpm.h | 2 ++
src/util/virtypedparam-public.c | 4 +++-
src/util/virtypedparam.c | 5 +++-
src/util/virtypedparam.h | 2 ++
src/util/viruri.c | 4 +++-
src/util/viruri.h | 2 ++
src/util/virusb.c | 9 ++++---
src/util/virusb.h | 2 ++
src/util/virutil.c | 14 ++++++-----
src/util/virutil.h | 6 +++--
src/util/viruuid.c | 10 ++++----
src/util/viruuid.h | 1 +
src/util/virvhba.c | 5 +++-
src/util/virvhba.h | 2 ++
src/util/virvsock.c | 4 ++--
src/util/virvsock.h | 2 ++
src/util/virxdrdefs.h | 2 ++
src/util/virxml.c | 13 ++++++----
src/util/virxml.h | 7 +++---
242 files changed, 986 insertions(+), 367 deletions(-)
create mode 100644 .clang-format
create mode 100644 mark.pl
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000000..c456fc03d4
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,32 @@
+---
+Language: Cpp
+
+IncludeBlocks: Regroup
+# The intended ordering and grouping is as follows:
+#
+# - <config.h> must always be the first header (priority == -100)
+# - System headers before any local headers (priority == -20)
+# - Libvirt system headers after other system header (priority == -10)
+# - "configmake.h" (priority == -5)
+# - Header matching the source file name has built-in (implicit priority == 0)
+# - Virt driver specific local header next (priority == 10)
+# - Secondary driver specific local header next (priority == 20)
+# - Other local headers last (priority == 100)
+#
+IncludeCategories:
+ - Regex: '^<config.h>'
+ Priority: -100
+ - Regex: '^<libvirt'
+ Priority: -10
+ - Regex: '^<'
+ Priority: -20
+ - Regex: '^"configmake\.h"'
+ Priority: -5
+ - Regex:
'^"(bhyve|ch|esx|hyperv|libxl|lxc|openvz|qemu|remote|vbox|vmware|vz)_.*\.h"'
+ Priority: 10
+ - Regex:
'^"(interface|bridge|node_device|nwfilter|secret|security|storage)_.*\.h"'
+ Priority: 20
+ - Regex: '^".*"'
+ Priority: 100
+IndentPPDirectives: AfterHash
+IndentWidth: 1
diff --git a/mark.pl b/mark.pl
new file mode 100644
index 0000000000..ac7e27eeb3
--- /dev/null
+++ b/mark.pl
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+foreach my $file (@ARGV) {
+ my $old = $file . ".orig";
+ rename $file, $old;
+ open OLD, "<", $old;
+ open FILE, ">", $file;
+
+ my $warn = 0;
+ my $inheader = 1;
+ my $incomment = 0;
+ while (<OLD>) {
+ if (m,/\*,) {
+ if (m,\*/,) {
+ } else {
+ $incomment = 1;
+ }
+ } elsif ($incomment) {
+ if (m,\*/,) {
+ $incomment = 0;
+ }
+ } elsif
(/\s*#\s*((include|if|else|endif|pragma)|(define.*(PRIV_H|LEAN_AND_MEAN)))/) {
+ if (/#\sinclude/ && !$inheader && !$warn) {
+ print "Check: $file\n";
+ $warn = 1;
+ }
+ } elsif (/^\s*$/) {
+
+ } elsif ($inheader){
+ $inheader = 0;
+ print FILE "/* clang-format off */\n\n";
+ } else {
+ }
+
+ print FILE $_;
+ }
+ close FILE
+}
diff --git a/src/util/glibcompat.c b/src/util/glibcompat.c
index fdc32af5e2..5adebf39b5 100644
--- a/src/util/glibcompat.c
+++ b/src/util/glibcompat.c
@@ -63,6 +63,8 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+/* clang-format off */
+
#undef g_canonicalize_filename
#undef g_hash_table_steal_extended
#undef g_fsync
diff --git a/src/util/glibcompat.h b/src/util/glibcompat.h
index 178fea3cf3..afa03009ff 100644
--- a/src/util/glibcompat.h
+++ b/src/util/glibcompat.h
@@ -18,9 +18,11 @@
#pragma once
+#include <glib-object.h>
#include <glib.h>
#include <glib/gstdio.h>
-#include <glib-object.h>
+
+/* clang-format off */
#if GLIB_CHECK_VERSION(2, 67, 0)
diff --git a/src/util/iohelper.c b/src/util/iohelper.c
index dd77bda723..6ce541e220 100644
--- a/src/util/iohelper.c
+++ b/src/util/iohelper.c
@@ -25,16 +25,18 @@
#include <config.h>
-#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
-#include "virfile.h"
#include "virerror.h"
-#include "virstring.h"
+#include "virfile.h"
#include "virgettext.h"
+#include "virstring.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_STORAGE
diff --git a/src/util/viralloc.c b/src/util/viralloc.c
index 4ebbf1cf8c..f8bfc60eff 100644
--- a/src/util/viralloc.c
+++ b/src/util/viralloc.c
@@ -23,8 +23,11 @@
#include <config.h>
#include "viralloc.h"
-#include "virlog.h"
+
#include "virerror.h"
+#include "virlog.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index fe4ecb6620..dabff7c43e 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -24,6 +24,8 @@
#include "internal.h"
+/* clang-format off */
+
/**
* DEPRECATION WARNING
*
diff --git a/src/util/virarch.c b/src/util/virarch.c
index 2134dd6a9d..317de045ec 100644
--- a/src/util/virarch.c
+++ b/src/util/virarch.c
@@ -28,8 +28,10 @@
# include <sys/utsname.h>
#endif
-#include "virlog.h"
#include "virarch.h"
+#include "virlog.h"
+
+/* clang-format off */
VIR_LOG_INIT("util.arch");
diff --git a/src/util/virarch.h b/src/util/virarch.h
index 81b1b27a57..199b392b90 100644
--- a/src/util/virarch.h
+++ b/src/util/virarch.h
@@ -23,6 +23,8 @@
#include "internal.h"
+/* clang-format off */
+
typedef enum {
VIR_ARCH_NONE,
VIR_ARCH_ALPHA, /* Alpha 64 BE
https://en.wikipedia.org/wiki/DEC_Alpha
*/
diff --git a/src/util/virarptable.c b/src/util/virarptable.c
index 7f9fefc160..9321ea1e2d 100644
--- a/src/util/virarptable.c
+++ b/src/util/virarptable.c
@@ -31,6 +31,8 @@
#include "virnetlink.h"
#include "virsocketaddr.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.arptable");
diff --git a/src/util/virarptable.h b/src/util/virarptable.h
index 825c7966b7..2ec3f8cdbf 100644
--- a/src/util/virarptable.h
+++ b/src/util/virarptable.h
@@ -22,6 +22,8 @@
#include "internal.h"
+/* clang-format off */
+
typedef struct _virArpTableEntry virArpTableEntry;
typedef struct _virArpTable virArpTable;
diff --git a/src/util/viraudit.c b/src/util/viraudit.c
index 76ad3a73ed..a838973757 100644
--- a/src/util/viraudit.c
+++ b/src/util/viraudit.c
@@ -25,10 +25,12 @@
# include <libaudit.h>
#endif
-#include "virerror.h"
-#include "virlog.h"
#include "viraudit.h"
+#include "virerror.h"
#include "virfile.h"
+#include "virlog.h"
+
+/* clang-format off */
VIR_LOG_INIT("util.audit");
diff --git a/src/util/viraudit.h b/src/util/viraudit.h
index bc2325da58..072321ed08 100644
--- a/src/util/viraudit.h
+++ b/src/util/viraudit.h
@@ -24,6 +24,8 @@
#include "internal.h"
#include "virlog.h"
+/* clang-format off */
+
typedef enum {
VIR_AUDIT_RECORD_MACHINE_CONTROL,
VIR_AUDIT_RECORD_MACHINE_ID,
diff --git a/src/util/virauth.c b/src/util/virauth.c
index b9c2ae3ed1..74504037c8 100644
--- a/src/util/virauth.c
+++ b/src/util/virauth.c
@@ -22,15 +22,18 @@
#include <config.h>
+#include "configmake.h"
#include "virauth.h"
-#include "viralloc.h"
-#include "virutil.h"
-#include "virlog.h"
+
#include "datatypes.h"
-#include "virerror.h"
-#include "configmake.h"
+#include "viralloc.h"
#include "virauthconfig.h"
+#include "virerror.h"
+#include "virlog.h"
+#include "virutil.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_AUTH
diff --git a/src/util/virauth.h b/src/util/virauth.h
index a0fd84962b..2552e4907b 100644
--- a/src/util/virauth.h
+++ b/src/util/virauth.h
@@ -25,6 +25,8 @@
#include "internal.h"
#include "viruri.h"
+/* clang-format off */
+
int virAuthGetConfigFilePath(virConnectPtr conn,
char **path);
diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c
index dabd7cd217..444343b641 100644
--- a/src/util/virauthconfig.c
+++ b/src/util/virauthconfig.c
@@ -22,9 +22,11 @@
#include "virauthconfig.h"
-#include "virlog.h"
-#include "virerror.h"
#include "viralloc.h"
+#include "virerror.h"
+#include "virlog.h"
+
+/* clang-format off */
struct _virAuthConfig {
GKeyFile *keyfile;
diff --git a/src/util/virauthconfig.h b/src/util/virauthconfig.h
index 4929f138fe..7944786144 100644
--- a/src/util/virauthconfig.h
+++ b/src/util/virauthconfig.h
@@ -22,6 +22,8 @@
#include "internal.h"
+/* clang-format off */
+
typedef struct _virAuthConfig virAuthConfig;
virAuthConfig *virAuthConfigNew(const char *path);
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 5b9204cbd7..b9f2996ad1 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -24,10 +24,13 @@
#include <sys/types.h>
#include "virbitmap.h"
+
#include "viralloc.h"
#include "virbuffer.h"
-#include "virstring.h"
#include "virerror.h"
+#include "virstring.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h
index e2314904b0..cc5d29a8de 100644
--- a/src/util/virbitmap.h
+++ b/src/util/virbitmap.h
@@ -21,10 +21,11 @@
#pragma once
-#include "internal.h"
-
#include <sys/types.h>
+#include "internal.h"
+
+/* clang-format off */
typedef struct _virBitmap virBitmap;
diff --git a/src/util/virbpf.c b/src/util/virbpf.c
index 1169b99d07..e4eb140995 100644
--- a/src/util/virbpf.c
+++ b/src/util/virbpf.c
@@ -17,9 +17,12 @@
*/
#include <config.h>
-#include "virlog.h"
#include "virbpf.h"
+#include "virlog.h"
+
+/* clang-format off */
+
VIR_LOG_INIT("util.bpf");
#define VIR_FROM_THIS VIR_FROM_BPF
diff --git a/src/util/virbpf.h b/src/util/virbpf.h
index 1eafce86c0..0f8068c8b6 100644
--- a/src/util/virbpf.h
+++ b/src/util/virbpf.h
@@ -24,6 +24,8 @@
/* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */
+/* clang-format off */
+
# define VIR_BPF_ALU64_REG(op, dst, src) \
((struct bpf_insn) { \
.code = BPF_ALU64 | BPF_OP(op) | BPF_X, \
diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c
index 01d04cc4f9..45e4869089 100644
--- a/src/util/virbuffer.c
+++ b/src/util/virbuffer.c
@@ -24,6 +24,8 @@
#include "virbuffer.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
/**
diff --git a/src/util/virbuffer.h b/src/util/virbuffer.h
index 0e72d078a6..189028597e 100644
--- a/src/util/virbuffer.h
+++ b/src/util/virbuffer.h
@@ -24,12 +24,13 @@
#include "internal.h"
-
/**
* virBuffer:
*
* A buffer structure.
*/
+/* clang-format off */
+
typedef struct _virBuffer virBuffer;
#define VIR_BUFFER_INITIALIZER { NULL, 0 }
diff --git a/src/util/virccw.c b/src/util/virccw.c
index d741743050..3918c39e6c 100644
--- a/src/util/virccw.c
+++ b/src/util/virccw.c
@@ -19,10 +19,14 @@
*/
#include <config.h>
+
#include "virccw.h"
+
#include "virerror.h"
#include "virstring.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virccw.h b/src/util/virccw.h
index 80cc716811..31ba2d3f19 100644
--- a/src/util/virccw.h
+++ b/src/util/virccw.h
@@ -22,6 +22,8 @@
#include "internal.h"
+/* clang-format off */
+
#define VIR_CCW_DEVICE_MAX_CSSID 254
#define VIR_CCW_DEVICE_MAX_SSID 3
#define VIR_CCW_DEVICE_MAX_DEVNO 65535
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index a6a409af3d..3d12de7a8c 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -21,30 +21,31 @@
#include <config.h>
#ifdef __linux__
+# include <dirent.h>
+# include <fcntl.h>
# include <mntent.h>
+# include <signal.h>
# include <sys/mount.h>
-# include <fcntl.h>
# include <sys/stat.h>
# include <sys/sysmacros.h>
# include <sys/types.h>
-# include <signal.h>
-# include <dirent.h>
# include <unistd.h>
#endif /* __linux__ */
#define LIBVIRT_VIRCGROUPPRIV_H_ALLOW
-#include "vircgrouppriv.h"
-
#include "viralloc.h"
#include "vircgroupbackend.h"
+#include "vircgrouppriv.h"
#include "virerror.h"
-#include "virlog.h"
#include "virfile.h"
#include "virgdbus.h"
+#include "virhostcpu.h"
+#include "virlog.h"
#include "virstring.h"
#include "virsystemd.h"
#include "virtypedparam.h"
-#include "virhostcpu.h"
+
+/* clang-format off */
VIR_LOG_INIT("util.cgroup");
diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
index 690f09465c..769e23c3be 100644
--- a/src/util/vircgroup.h
+++ b/src/util/vircgroup.h
@@ -24,6 +24,8 @@
#include "virbitmap.h"
#include "virenum.h"
+/* clang-format off */
+
struct _virCgroup;
typedef struct _virCgroup virCgroup;
diff --git a/src/util/vircgroupbackend.c b/src/util/vircgroupbackend.c
index 6d6f82cbb1..4d4c8705b1 100644
--- a/src/util/vircgroupbackend.c
+++ b/src/util/vircgroupbackend.c
@@ -27,6 +27,8 @@
#include "virerror.h"
#include "virthread.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_CGROUP
VIR_ENUM_IMPL(virCgroupBackend,
diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h
index c4d56896b0..521f8c7806 100644
--- a/src/util/vircgroupbackend.h
+++ b/src/util/vircgroupbackend.h
@@ -21,9 +21,10 @@
#pragma once
#include "internal.h"
-
#include "vircgroup.h"
+/* clang-format off */
+
#define CGROUP_MAX_VAL 512
typedef enum {
diff --git a/src/util/vircgrouppriv.h b/src/util/vircgrouppriv.h
index caf7ed84db..3b9491edd0 100644
--- a/src/util/vircgrouppriv.h
+++ b/src/util/vircgrouppriv.h
@@ -28,6 +28,8 @@
#include "vircgroup.h"
#include "vircgroupbackend.h"
+/* clang-format off */
+
struct _virCgroupV1Controller {
int type;
char *mountPoint;
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
index cbee08e931..4492673d43 100644
--- a/src/util/vircgroupv1.c
+++ b/src/util/vircgroupv1.c
@@ -23,26 +23,27 @@
#include <unistd.h>
#ifdef __linux__
# include <mntent.h>
-# include <sys/stat.h>
# include <sys/mount.h>
+# include <sys/stat.h>
#endif /* __linux__ */
#include "internal.h"
#define LIBVIRT_VIRCGROUPPRIV_H_ALLOW
-#include "vircgrouppriv.h"
-
+#include "viralloc.h"
#include "vircgroup.h"
#include "vircgroupbackend.h"
+#include "vircgrouppriv.h"
#include "vircgroupv1.h"
+#include "virerror.h"
#include "virfile.h"
#include "virlog.h"
#include "virstring.h"
#include "virsystemd.h"
-#include "virerror.h"
-#include "viralloc.h"
#include "virthread.h"
+/* clang-format off */
+
VIR_LOG_INIT("util.cgroup");
#define VIR_FROM_THIS VIR_FROM_CGROUP
diff --git a/src/util/vircgroupv1.h b/src/util/vircgroupv1.h
index dbef9c7864..a2cee0edf6 100644
--- a/src/util/vircgroupv1.h
+++ b/src/util/vircgroupv1.h
@@ -20,5 +20,7 @@
#pragma once
+/* clang-format off */
+
void
virCgroupV1Register(void);
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index 4c110940cf..3dd27e749f 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -28,12 +28,11 @@
#include "internal.h"
#define LIBVIRT_VIRCGROUPPRIV_H_ALLOW
-#include "vircgrouppriv.h"
-
#include "viralloc.h"
#include "virbpf.h"
#include "vircgroup.h"
#include "vircgroupbackend.h"
+#include "vircgrouppriv.h"
#include "vircgroupv2.h"
#include "vircgroupv2devices.h"
#include "virerror.h"
@@ -42,6 +41,8 @@
#include "virstring.h"
#include "virsystemd.h"
+/* clang-format off */
+
VIR_LOG_INIT("util.cgroup");
#define VIR_FROM_THIS VIR_FROM_CGROUP
diff --git a/src/util/vircgroupv2.h b/src/util/vircgroupv2.h
index 1566154597..f7cbf01d9f 100644
--- a/src/util/vircgroupv2.h
+++ b/src/util/vircgroupv2.h
@@ -20,5 +20,7 @@
#pragma once
+/* clang-format off */
+
void
virCgroupV2Register(void);
diff --git a/src/util/vircgroupv2devices.c b/src/util/vircgroupv2devices.c
index 1769c499c8..cb93d3125d 100644
--- a/src/util/vircgroupv2devices.c
+++ b/src/util/vircgroupv2devices.c
@@ -28,15 +28,16 @@
#include "internal.h"
#define LIBVIRT_VIRCGROUPPRIV_H_ALLOW
-#include "vircgrouppriv.h"
-
#include "virbpf.h"
#include "vircgroup.h"
+#include "vircgrouppriv.h"
#include "vircgroupv2devices.h"
#include "virerror.h"
#include "virfile.h"
#include "virlog.h"
+/* clang-format off */
+
VIR_LOG_INIT("util.cgroup");
#define VIR_FROM_THIS VIR_FROM_CGROUP
diff --git a/src/util/vircgroupv2devices.h b/src/util/vircgroupv2devices.h
index d2d769ba5a..fcc4d7eea3 100644
--- a/src/util/vircgroupv2devices.h
+++ b/src/util/vircgroupv2devices.h
@@ -21,9 +21,10 @@
#include <sys/types.h>
#include "internal.h"
-
#include "vircgroup.h"
+/* clang-format off */
+
bool
virCgroupV2DevicesAvailable(virCgroup *group)
G_NO_INLINE;
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index bbfbe19706..0187295a02 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -46,16 +46,18 @@
#define LIBVIRT_VIRCOMMANDPRIV_H_ALLOW
#include "viralloc.h"
+#include "virbuffer.h"
#include "vircommandpriv.h"
#include "virerror.h"
-#include "virutil.h"
-#include "virlog.h"
#include "virfile.h"
+#include "virlog.h"
#include "virpidfile.h"
#include "virprocess.h"
-#include "virbuffer.h"
-#include "virthread.h"
#include "virstring.h"
+#include "virthread.h"
+#include "virutil.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/vircommand.h b/src/util/vircommand.h
index 98788bcbf7..0240541a57 100644
--- a/src/util/vircommand.h
+++ b/src/util/vircommand.h
@@ -24,6 +24,8 @@
#include "internal.h"
#include "virbuffer.h"
+/* clang-format off */
+
typedef struct _virCommand virCommand;
/* This will execute in the context of the first child
diff --git a/src/util/vircommandpriv.h b/src/util/vircommandpriv.h
index ff17fa5ded..a49ba60217 100644
--- a/src/util/vircommandpriv.h
+++ b/src/util/vircommandpriv.h
@@ -27,6 +27,8 @@
#include "vircommand.h"
+/* clang-format off */
+
typedef void (*virCommandDryRunCallback)(const char *const*args,
const char *const*env,
const char *input,
diff --git a/src/util/virconf.c b/src/util/virconf.c
index 8a96805642..723b499b3d 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -20,19 +20,23 @@
#include <config.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "configmake.h"
-#include "virerror.h"
-#include "virbuffer.h"
#include "virconf.h"
-#include "virutil.h"
-#include "virlog.h"
+
#include "viralloc.h"
+#include "virbuffer.h"
+#include "virerror.h"
#include "virfile.h"
-#include "configmake.h"
+#include "virlog.h"
+#include "virutil.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_CONF
diff --git a/src/util/virconf.h b/src/util/virconf.h
index e656a6a815..5840c0f0ec 100644
--- a/src/util/virconf.h
+++ b/src/util/virconf.h
@@ -22,12 +22,15 @@
#include "virenum.h"
+/* clang-format off */
+
/**
* virConfType:
* one of the possible type for a value from the configuration file
*
* TODO: we probably need a float too.
*/
+
typedef enum {
VIR_CONF_NONE = 0, /* undefined */
VIR_CONF_LLONG, /* a long long int */
diff --git a/src/util/vircrypto.c b/src/util/vircrypto.c
index 828e822d8e..6f67868511 100644
--- a/src/util/vircrypto.c
+++ b/src/util/vircrypto.c
@@ -20,13 +20,16 @@
#include <config.h>
+#include <gnutls/crypto.h>
+#include <gnutls/gnutls.h>
+
#include "vircrypto.h"
-#include "virlog.h"
+
#include "virerror.h"
+#include "virlog.h"
#include "virsecureerase.h"
-#include <gnutls/gnutls.h>
-#include <gnutls/crypto.h>
+/* clang-format off */
VIR_LOG_INIT("util.crypto");
diff --git a/src/util/vircrypto.h b/src/util/vircrypto.h
index 5f079ac335..3c30ff6d70 100644
--- a/src/util/vircrypto.h
+++ b/src/util/vircrypto.h
@@ -22,6 +22,8 @@
#include "internal.h"
+/* clang-format off */
+
#define VIR_CRYPTO_HASH_SIZE_MD5 16
#define VIR_CRYPTO_HASH_SIZE_SHA256 32
diff --git a/src/util/virdaemon.c b/src/util/virdaemon.c
index 00bd7095f6..942d341506 100644
--- a/src/util/virdaemon.c
+++ b/src/util/virdaemon.c
@@ -20,25 +20,27 @@
#include <config.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
#ifndef WIN32
# include <sys/wait.h>
#endif
#include <fcntl.h>
-#include <unistd.h>
#include <stdbool.h>
+#include <unistd.h>
+#include "configmake.h"
+
+#include "viralloc.h"
#include "virdaemon.h"
-#include "virutil.h"
#include "virfile.h"
#include "virlog.h"
-#include "viralloc.h"
-
-#include "configmake.h"
+#include "virutil.h"
#ifndef WIN32
+/* clang-format off */
+
int
virDaemonForkIntoBackground(const char *argv0)
{
diff --git a/src/util/virdaemon.h b/src/util/virdaemon.h
index 9ed0942d6d..0a55beefee 100644
--- a/src/util/virdaemon.h
+++ b/src/util/virdaemon.h
@@ -22,6 +22,8 @@
#include "virenum.h"
+/* clang-format off */
+
enum {
VIR_DAEMON_ERR_NONE = 0,
VIR_DAEMON_ERR_PIDFILE,
diff --git a/src/util/virdevmapper.c b/src/util/virdevmapper.c
index 7796e7719b..c202390823 100644
--- a/src/util/virdevmapper.c
+++ b/src/util/virdevmapper.c
@@ -21,22 +21,25 @@
#include <config.h>
#include "virdevmapper.h"
+
#include "internal.h"
#ifdef __linux__
-# include <sys/sysmacros.h>
+# include <fcntl.h>
# include <linux/dm-ioctl.h>
# include <sys/ioctl.h>
-# include <sys/types.h>
# include <sys/stat.h>
-# include <fcntl.h>
+# include <sys/sysmacros.h>
+# include <sys/types.h>
-# include "virthread.h"
# include "viralloc.h"
-# include "virstring.h"
# include "virfile.h"
-# include "virlog.h"
# include "virglibutil.h"
+# include "virlog.h"
+# include "virstring.h"
+# include "virthread.h"
+
+/* clang-format off */
# define VIR_FROM_THIS VIR_FROM_STORAGE
diff --git a/src/util/virdevmapper.h b/src/util/virdevmapper.h
index 6972050bc5..9943d9f3da 100644
--- a/src/util/virdevmapper.h
+++ b/src/util/virdevmapper.h
@@ -22,6 +22,8 @@
#include "internal.h"
+/* clang-format off */
+
int
virDevMapperGetTargets(const char *path,
GSList **devPaths) G_NO_INLINE;
diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 342b489ab7..58ed5a076c 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -23,22 +23,25 @@
#include <config.h>
-#include <stdarg.h>
-#include <unistd.h>
#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <signal.h>
+#include <stdarg.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
-#include "internal.h"
#include "virdnsmasq.h"
-#include "vircommand.h"
+
+#include "internal.h"
#include "viralloc.h"
+#include "vircommand.h"
#include "virerror.h"
-#include "virlog.h"
#include "virfile.h"
+#include "virlog.h"
#include "virstring.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NETWORK
VIR_LOG_INIT("util.dnsmasq");
diff --git a/src/util/virdnsmasq.h b/src/util/virdnsmasq.h
index cc1c337d41..6509512c6d 100644
--- a/src/util/virdnsmasq.h
+++ b/src/util/virdnsmasq.h
@@ -26,6 +26,8 @@
#include "virobject.h"
#include "virsocketaddr.h"
+/* clang-format off */
+
typedef struct
{
/*
diff --git a/src/util/virebtables.c b/src/util/virebtables.c
index a1f5f7cf1e..7ca0ffb829 100644
--- a/src/util/virebtables.c
+++ b/src/util/virebtables.c
@@ -21,10 +21,13 @@
#include <config.h>
-#include "internal.h"
#include "virebtables.h"
-#include "virlog.h"
+
+#include "internal.h"
#include "virfirewall.h"
+#include "virlog.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virebtables.h b/src/util/virebtables.h
index 9c878971c5..f0ff801eb0 100644
--- a/src/util/virebtables.h
+++ b/src/util/virebtables.h
@@ -23,6 +23,8 @@
#include "virmacaddr.h"
+/* clang-format off */
+
typedef struct _ebtablesContext ebtablesContext;
ebtablesContext *ebtablesContextNew (const char *driver);
diff --git a/src/util/virendian.h b/src/util/virendian.h
index e5b82026ac..4de1c892fa 100644
--- a/src/util/virendian.h
+++ b/src/util/virendian.h
@@ -23,6 +23,8 @@
#include "internal.h"
+/* clang-format off */
+
/* The interfaces in this file are provided as macros for speed. */
/**
@@ -33,6 +35,7 @@
* Read 8 bytes at BUF as a big-endian 64-bit number. Caller is
* responsible to avoid reading beyond array bounds.
*/
+
#define virReadBufInt64BE(buf) \
(((uint64_t)(uint8_t)((buf)[0]) << 56) | \
((uint64_t)(uint8_t)((buf)[1]) << 48) | \
diff --git a/src/util/virenum.c b/src/util/virenum.c
index c6936e58ff..efb1d1e388 100644
--- a/src/util/virenum.c
+++ b/src/util/virenum.c
@@ -19,6 +19,8 @@
#include "virenum.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_ENUM_IMPL(virTristateBool,
diff --git a/src/util/virenum.h b/src/util/virenum.h
index 98f01d574d..72e254ae23 100644
--- a/src/util/virenum.h
+++ b/src/util/virenum.h
@@ -20,6 +20,8 @@
#include "internal.h"
+/* clang-format off */
+
int
virEnumFromString(const char * const *types,
unsigned int ntypes,
diff --git a/src/util/virerror.c b/src/util/virerror.c
index d114c0a346..b7ba9e5a42 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -23,14 +23,17 @@
#include <stdarg.h>
#include "virerror.h"
+
#include "datatypes.h"
#include "viralloc.h"
+#include "virbuffer.h"
#include "virlog.h"
#include "virthread.h"
-#include "virbuffer.h"
#define LIBVIRT_VIRERRORPRIV_H_ALLOW
#include "virerrorpriv.h"
+/* clang-format off */
+
#undef LIBVIRT_VIRERRORPRIV_H_ALLOW
VIR_LOG_INIT("util.error");
diff --git a/src/util/virerror.h b/src/util/virerror.h
index bec3863c3f..4405d3af30 100644
--- a/src/util/virerror.h
+++ b/src/util/virerror.h
@@ -23,6 +23,8 @@
#include "internal.h"
+/* clang-format off */
+
extern virErrorFunc virErrorHandler;
extern void *virUserData;
diff --git a/src/util/virerrorpriv.h b/src/util/virerrorpriv.h
index 66acf0b4be..1bb75084fc 100644
--- a/src/util/virerrorpriv.h
+++ b/src/util/virerrorpriv.h
@@ -20,6 +20,8 @@
#pragma once
+/* clang-format off */
+
const char *
virErrorMsg(virErrorNumber error,
const char *info);
diff --git a/src/util/virevent.c b/src/util/virevent.c
index e625183a7f..ba00aa08c2 100644
--- a/src/util/virevent.c
+++ b/src/util/virevent.c
@@ -22,9 +22,12 @@
#include <config.h>
#include "virevent.h"
+
+#include "virerror.h"
#include "vireventglib.h"
#include "virlog.h"
-#include "virerror.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_EVENT
diff --git a/src/util/virevent.h b/src/util/virevent.h
index 6c8fdcbac4..d8028d73ca 100644
--- a/src/util/virevent.h
+++ b/src/util/virevent.h
@@ -22,4 +22,6 @@
#pragma once
#include "internal.h"
+/* clang-format off */
+
int virEventRequireImpl(void);
diff --git a/src/util/vireventglib.c b/src/util/vireventglib.c
index 023dc37445..05126a48a2 100644
--- a/src/util/vireventglib.c
+++ b/src/util/vireventglib.c
@@ -22,10 +22,11 @@
#include <config.h>
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
#include "vireventglib.h"
+
#include "vireventglibwatch.h"
#include "virlog.h"
#include "virprobe.h"
@@ -34,6 +35,8 @@
# include <io.h>
#endif
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_EVENT
VIR_LOG_INIT("util.eventglib");
diff --git a/src/util/vireventglib.h b/src/util/vireventglib.h
index ef68abaa20..e57dccfe10 100644
--- a/src/util/vireventglib.h
+++ b/src/util/vireventglib.h
@@ -23,6 +23,8 @@
#include "internal.h"
+/* clang-format off */
+
void virEventGLibRegister(void);
int virEventGLibRunOnce(void);
diff --git a/src/util/vireventglibwatch.c b/src/util/vireventglibwatch.c
index b7f3a8786a..126ef67514 100644
--- a/src/util/vireventglibwatch.c
+++ b/src/util/vireventglibwatch.c
@@ -22,7 +22,10 @@
#include "vireventglibwatch.h"
+/* clang-format off */
+
#ifndef WIN32
+
typedef struct virEventGLibFDSource virEventGLibFDSource;
struct virEventGLibFDSource {
GSource parent;
diff --git a/src/util/vireventglibwatch.h b/src/util/vireventglibwatch.h
index f57be1f503..1f5a17cba7 100644
--- a/src/util/vireventglibwatch.h
+++ b/src/util/vireventglibwatch.h
@@ -22,6 +22,8 @@
#include "internal.h"
+/* clang-format off */
+
/**
* virEventGLibCreateSocketWatch:
* @fd: the file descriptor
diff --git a/src/util/vireventthread.c b/src/util/vireventthread.c
index 8342f420f6..ae4d8756fd 100644
--- a/src/util/vireventthread.c
+++ b/src/util/vireventthread.c
@@ -21,8 +21,11 @@
#include <config.h>
#include "vireventthread.h"
-#include "virthread.h"
+
#include "virerror.h"
+#include "virthread.h"
+
+/* clang-format off */
struct _virEventThread {
GObject parent;
diff --git a/src/util/vireventthread.h b/src/util/vireventthread.h
index 5826c25cf4..8ff50936d1 100644
--- a/src/util/vireventthread.h
+++ b/src/util/vireventthread.h
@@ -20,9 +20,12 @@
#pragma once
-#include "internal.h"
#include <glib-object.h>
+#include "internal.h"
+
+/* clang-format off */
+
#define VIR_TYPE_EVENT_THREAD vir_event_thread_get_type()
G_DECLARE_FINAL_TYPE(virEventThread, vir_event_thread, VIR, EVENT_THREAD, GObject);
diff --git a/src/util/virfcp.c b/src/util/virfcp.c
index bb62fa9025..1a8d6a5241 100644
--- a/src/util/virfcp.c
+++ b/src/util/virfcp.c
@@ -20,12 +20,13 @@
#include <config.h>
-#include "internal.h"
+#include "virfcp.h"
-#include "virfile.h"
+#include "internal.h"
#include "virerror.h"
+#include "virfile.h"
-#include "virfcp.h"
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virfcp.h b/src/util/virfcp.h
index 6364f05ebc..86eb4e07c4 100644
--- a/src/util/virfcp.h
+++ b/src/util/virfcp.h
@@ -20,6 +20,8 @@
#pragma once
+/* clang-format off */
+
bool
virFCIsCapableRport(const char *rport);
diff --git a/src/util/virfdstream.c b/src/util/virfdstream.c
index 3de0d59a8b..6444d8b43e 100644
--- a/src/util/virfdstream.c
+++ b/src/util/virfdstream.c
@@ -21,25 +21,28 @@
#include <config.h>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
#ifndef WIN32
# include <termios.h>
#endif
-#include "virfdstream.h"
-#include "virerror.h"
+#include "configmake.h"
+
#include "datatypes.h"
-#include "virlog.h"
#include "viralloc.h"
-#include "virutil.h"
+#include "virerror.h"
+#include "virfdstream.h"
#include "virfile.h"
-#include "configmake.h"
+#include "virlog.h"
+#include "virsocket.h"
#include "virstring.h"
#include "virtime.h"
-#include "virsocket.h"
+#include "virutil.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_STREAMS
diff --git a/src/util/virfdstream.h b/src/util/virfdstream.h
index d7204a4dc3..5d2540664c 100644
--- a/src/util/virfdstream.h
+++ b/src/util/virfdstream.h
@@ -23,8 +23,11 @@
#include "internal.h"
+/* clang-format off */
+
/* internal callback, the generic one is used up by daemon stream driver */
/* the close callback is called with fdstream private data locked */
+
typedef void (*virFDStreamInternalCloseCb)(virStreamPtr st, void *opaque);
typedef void (*virFDStreamInternalCloseCbFreeOpaque)(void *opaque);
diff --git a/src/util/virfile.c b/src/util/virfile.c
index ec40c04b1f..f59026c673 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -23,9 +23,10 @@
*/
#include <config.h>
-#include "internal.h"
#include <fcntl.h>
+
+#include "internal.h"
#ifndef WIN32
# include <termios.h>
#endif
@@ -45,8 +46,8 @@
#if defined(WITH_SYS_MOUNT_H)
# include <sys/mount.h>
#endif
-#include <unistd.h>
#include <dirent.h>
+#include <unistd.h>
#if defined WITH_MNTENT_H && defined WITH_GETMNTENT_R
# include <mntent.h>
#endif
@@ -69,10 +70,11 @@
# if WITH_DECL_LO_FLAGS_AUTOCLEAR
# include <linux/loop.h>
# endif
-# include <sys/ioctl.h>
# include <linux/cdrom.h>
+# include <sys/ioctl.h>
/* These come from linux/fs.h, but that header conflicts with
* sys/mount.h on glibc 2.36+ */
+
# define FS_IOC_GETFLAGS _IOR('f', 1, long)
# define FS_IOC_SETFLAGS _IOW('f', 2, long)
# define FS_NOCOW_FL 0x00800000
@@ -83,6 +85,7 @@
#endif
#include "configmake.h"
+
#include "viralloc.h"
#include "vircommand.h"
#include "virerror.h"
@@ -90,9 +93,11 @@
#include "virkmod.h"
#include "virlog.h"
#include "virprocess.h"
+#include "virsocket.h"
#include "virstring.h"
#include "virutil.h"
-#include "virsocket.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virfile.h b/src/util/virfile.h
index f7a31d9f57..5aebeaf9bb 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -30,6 +30,8 @@
#include "virbitmap.h"
#include "virenum.h"
+/* clang-format off */
+
typedef enum {
VIR_FILE_CLOSE_PRESERVE_ERRNO = 1 << 0,
VIR_FILE_CLOSE_IGNORE_EBADF = 1 << 1,
diff --git a/src/util/virfilecache.c b/src/util/virfilecache.c
index bad37c9f00..df359bfab2 100644
--- a/src/util/virfilecache.c
+++ b/src/util/virfilecache.c
@@ -19,23 +19,24 @@
*
*/
-
#include <config.h>
-#include "internal.h"
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "virfilecache.h"
+#include "internal.h"
#include "virbuffer.h"
#include "vircrypto.h"
#include "virerror.h"
#include "virfile.h"
-#include "virfilecache.h"
#include "virhash.h"
#include "virlog.h"
#include "virobject.h"
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virfilecache.h b/src/util/virfilecache.h
index 81be8feef5..77e10b4049 100644
--- a/src/util/virfilecache.h
+++ b/src/util/virfilecache.h
@@ -22,9 +22,10 @@
#pragma once
#include "internal.h"
-
-#include "virobject.h"
#include "virhash.h"
+#include "virobject.h"
+
+/* clang-format off */
typedef struct _virFileCache virFileCache;
diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c
index fbb0e438b3..43ab27a921 100644
--- a/src/util/virfirewall.c
+++ b/src/util/virfirewall.c
@@ -23,14 +23,17 @@
#include <stdarg.h>
#include "virfirewall.h"
-#include "virfirewalld.h"
+
#include "viralloc.h"
-#include "virerror.h"
#include "vircommand.h"
-#include "virlog.h"
+#include "virerror.h"
#include "virfile.h"
+#include "virfirewalld.h"
+#include "virlog.h"
#include "virthread.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_FIREWALL
VIR_LOG_INIT("util.firewall");
diff --git a/src/util/virfirewall.h b/src/util/virfirewall.h
index 187748b2bf..d6ff2f6ac4 100644
--- a/src/util/virfirewall.h
+++ b/src/util/virfirewall.h
@@ -1,4 +1,4 @@
- /*
+/*
* virfirewall.h: integration with firewalls
*
* Copyright (C) 2014 Red Hat, Inc.
@@ -22,6 +22,8 @@
#include "internal.h"
+/* clang-format off */
+
typedef struct _virFirewall virFirewall;
typedef struct _virFirewallRule virFirewallRule;
diff --git a/src/util/virfirewalld.c b/src/util/virfirewalld.c
index ad879164c3..4aaa2ccb7b 100644
--- a/src/util/virfirewalld.c
+++ b/src/util/virfirewalld.c
@@ -22,17 +22,20 @@
#include <stdarg.h>
-#include "virfirewall.h"
#include "virfirewalld.h"
+
+#include "virfirewall.h"
#define LIBVIRT_VIRFIREWALLDPRIV_H_ALLOW
-#include "virfirewalldpriv.h"
#include "viralloc.h"
+#include "virenum.h"
#include "virerror.h"
-#include "virlog.h"
+#include "virfirewalldpriv.h"
#include "virgdbus.h"
-#include "virenum.h"
+#include "virlog.h"
#include "virstring.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_FIREWALLD
VIR_LOG_INIT("util.firewalld");
diff --git a/src/util/virfirewalld.h b/src/util/virfirewalld.h
index fa4c9e702c..633f47bbc1 100644
--- a/src/util/virfirewalld.h
+++ b/src/util/virfirewalld.h
@@ -20,6 +20,8 @@
#pragma once
+/* clang-format off */
+
#define VIR_FIREWALL_FIREWALLD_SERVICE "org.fedoraproject.FirewallD1"
typedef enum {
diff --git a/src/util/virfirewalldpriv.h b/src/util/virfirewalldpriv.h
index 4500a452eb..1e50f91d3c 100644
--- a/src/util/virfirewalldpriv.h
+++ b/src/util/virfirewalldpriv.h
@@ -24,4 +24,6 @@
#pragma once
+/* clang-format off */
+
#define VIR_FIREWALL_FIREWALLD_SERVICE "org.fedoraproject.FirewallD1"
diff --git a/src/util/virfirmware.c b/src/util/virfirmware.c
index 9b333cf04b..8042202c7d 100644
--- a/src/util/virfirmware.c
+++ b/src/util/virfirmware.c
@@ -20,11 +20,14 @@
#include <config.h>
-#include "virerror.h"
#include "virfirmware.h"
+
+#include "virerror.h"
#include "virlog.h"
#include "virstring.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.firmware");
diff --git a/src/util/virfirmware.h b/src/util/virfirmware.h
index 7c9b078b7c..709c3fc61b 100644
--- a/src/util/virfirmware.h
+++ b/src/util/virfirmware.h
@@ -22,6 +22,8 @@
#include "internal.h"
+/* clang-format off */
+
typedef struct _virFirmware virFirmware;
struct _virFirmware {
char *name;
diff --git a/src/util/virgdbus.c b/src/util/virgdbus.c
index 87b48256af..a3c4d8b523 100644
--- a/src/util/virgdbus.c
+++ b/src/util/virgdbus.c
@@ -19,11 +19,13 @@
#include <config.h>
+#include "virgdbus.h"
+
#include "virerror.h"
#include "virlog.h"
-#include "virgdbus.h"
#include "virthread.h"
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_DBUS
diff --git a/src/util/virgdbus.h b/src/util/virgdbus.h
index ca7073e27c..ed42d0e2a9 100644
--- a/src/util/virgdbus.h
+++ b/src/util/virgdbus.h
@@ -27,6 +27,8 @@
#include "internal.h"
+/* clang-format off */
+
void
virGDBusSetSharedBus(bool shared);
diff --git a/src/util/virgettext.c b/src/util/virgettext.c
index 35dfba07fc..c4a5e7a45c 100644
--- a/src/util/virgettext.c
+++ b/src/util/virgettext.c
@@ -26,16 +26,18 @@
#endif
#include "configmake.h"
+
#include "internal.h"
#include "virgettext.h"
-
/**
* virGettextInitialize:
*
* Initialize standard gettext setup
* Returns -1 on fatal error
*/
+/* clang-format off */
+
int
virGettextInitialize(void)
{
diff --git a/src/util/virgettext.h b/src/util/virgettext.h
index 3142124bbe..4e5ede9d12 100644
--- a/src/util/virgettext.h
+++ b/src/util/virgettext.h
@@ -20,4 +20,6 @@
#pragma once
+/* clang-format off */
+
int virGettextInitialize(void);
diff --git a/src/util/virgic.c b/src/util/virgic.c
index dcae97356d..9410082925 100644
--- a/src/util/virgic.c
+++ b/src/util/virgic.c
@@ -19,9 +19,13 @@
*/
#include <config.h>
-#include "internal.h"
+
#include "virgic.h"
+#include "internal.h"
+
+/* clang-format off */
+
VIR_ENUM_IMPL(virGICVersion,
VIR_GIC_VERSION_LAST,
"none",
diff --git a/src/util/virgic.h b/src/util/virgic.h
index 1c469f20ce..4e4186d227 100644
--- a/src/util/virgic.h
+++ b/src/util/virgic.h
@@ -22,6 +22,8 @@
#include "virenum.h"
+/* clang-format off */
+
typedef enum {
VIR_GIC_VERSION_NONE = 0,
VIR_GIC_VERSION_HOST,
diff --git a/src/util/virglibutil.c b/src/util/virglibutil.c
index 8d93e27fc9..664f690116 100644
--- a/src/util/virglibutil.c
+++ b/src/util/virglibutil.c
@@ -20,6 +20,8 @@
#include "virglibutil.h"
+/* clang-format off */
+
void
virGSListStringFree(GSList *l)
{
diff --git a/src/util/virglibutil.h b/src/util/virglibutil.h
index 2bff69f22f..f165145a0d 100644
--- a/src/util/virglibutil.h
+++ b/src/util/virglibutil.h
@@ -20,6 +20,8 @@
#include "internal.h"
+/* clang-format off */
+
void
virGSListStringFree(GSList *l);
diff --git a/src/util/virhash.c b/src/util/virhash.c
index c72c248186..cfdd6ef92a 100644
--- a/src/util/virhash.c
+++ b/src/util/virhash.c
@@ -18,13 +18,15 @@
#include <config.h>
+#include "virhash.h"
#include "virerror.h"
-#include "virhash.h"
-#include "virlog.h"
#include "virhashcode.h"
-#include "virrandom.h"
+#include "virlog.h"
#include "virobject.h"
+#include "virrandom.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virhash.h b/src/util/virhash.h
index 8a6b8a7d37..e2de2bdc8d 100644
--- a/src/util/virhash.h
+++ b/src/util/virhash.h
@@ -9,6 +9,8 @@
#pragma once
+/* clang-format off */
+
typedef struct _virHashAtomic virHashAtomic;
/*
diff --git a/src/util/virhashcode.c b/src/util/virhashcode.c
index baa7a0b1c0..3dbfda0233 100644
--- a/src/util/virhashcode.c
+++ b/src/util/virhashcode.c
@@ -17,7 +17,8 @@
* License along with this library. If not, see
* <
http://www.gnu.org/licenses/>.
*
- * The hash code generation is based on the public domain MurmurHash3 from Austin
Appleby:
+ * The hash code generation is based on the public domain MurmurHash3 from
+ * Austin Appleby:
*
https://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp
*
* We use only the 32 bit variant because the 2 produce different results while
@@ -29,6 +30,8 @@
#include "virhashcode.h"
+/* clang-format off */
+
static uint32_t rotl32(uint32_t x, int8_t r)
{
return (x << r) | (x >> (32 - r));
diff --git a/src/util/virhashcode.h b/src/util/virhashcode.h
index 5c68e5a89a..8b1d603ecb 100644
--- a/src/util/virhashcode.h
+++ b/src/util/virhashcode.h
@@ -17,7 +17,8 @@
* License along with this library. If not, see
* <
http://www.gnu.org/licenses/>.
*
- * The hash code generation is based on the public domain MurmurHash3 from Austin
Appleby:
+ * The hash code generation is based on the public domain MurmurHash3 from
+ * Austin Appleby:
*
https://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp
*
* We use only the 32 bit variant because the 2 produce different result while
@@ -29,5 +30,7 @@
#include "internal.h"
+/* clang-format off */
+
uint32_t virHashCodeGen(const void *key, size_t len, uint32_t seed)
G_NO_INLINE;
diff --git a/src/util/virhook.c b/src/util/virhook.c
index 871bfcc670..a70766a6b0 100644
--- a/src/util/virhook.c
+++ b/src/util/virhook.c
@@ -21,18 +21,22 @@
#include <config.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
-#include "virerror.h"
-#include "virhook.h"
-#include "virlog.h"
-#include "virfile.h"
#include "configmake.h"
+
+#include "virhook.h"
+
#include "vircommand.h"
-#include "virstring.h"
+#include "virerror.h"
+#include "virfile.h"
#include "virglibutil.h"
+#include "virlog.h"
+#include "virstring.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_HOOK
diff --git a/src/util/virhook.h b/src/util/virhook.h
index d8237c837e..457c9b7331 100644
--- a/src/util/virhook.h
+++ b/src/util/virhook.h
@@ -23,6 +23,8 @@
#include "internal.h"
+/* clang-format off */
+
typedef enum {
VIR_HOOK_DRIVER_DAEMON = 0, /* Daemon related events */
VIR_HOOK_DRIVER_QEMU, /* QEMU domains related events */
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index c1e8dc8078..8acf7a925e 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -33,20 +33,22 @@
#endif
#if defined(__FreeBSD__) || defined(__APPLE__)
+# include <sys/resource.h>
+# include <sys/sysctl.h>
# include <sys/time.h>
# include <sys/types.h>
-# include <sys/sysctl.h>
-# include <sys/resource.h>
#endif
#include "viralloc.h"
#define LIBVIRT_VIRHOSTCPUPRIV_H_ALLOW
-#include "virhostcpupriv.h"
-#include "virerror.h"
#include "virarch.h"
+#include "virerror.h"
#include "virfile.h"
-#include "virstring.h"
+#include "virhostcpupriv.h"
#include "virlog.h"
+#include "virstring.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virhostcpu.h b/src/util/virhostcpu.h
index 5232fee36d..274d7c0b98 100644
--- a/src/util/virhostcpu.h
+++ b/src/util/virhostcpu.h
@@ -26,6 +26,7 @@
#include "virbitmap.h"
#include "virenum.h"
+/* clang-format off */
typedef struct _virHostCPUTscInfo virHostCPUTscInfo;
struct _virHostCPUTscInfo {
diff --git a/src/util/virhostcpupriv.h b/src/util/virhostcpupriv.h
index f7b1e7c93c..831c824656 100644
--- a/src/util/virhostcpupriv.h
+++ b/src/util/virhostcpupriv.h
@@ -27,6 +27,8 @@
#include "virhostcpu.h"
+/* clang-format off */
+
#ifdef __linux__
int virHostCPUGetInfoPopulateLinux(FILE *cpuinfo,
virArch arch,
diff --git a/src/util/virhostmem.c b/src/util/virhostmem.c
index 052f7cd935..ac5f598ecc 100644
--- a/src/util/virhostmem.c
+++ b/src/util/virhostmem.c
@@ -25,10 +25,10 @@
#include <unistd.h>
#if defined(__FreeBSD__) || defined(__APPLE__)
+# include <sys/resource.h>
+# include <sys/sysctl.h>
# include <sys/time.h>
# include <sys/types.h>
-# include <sys/sysctl.h>
-# include <sys/resource.h>
#endif
#ifdef WIN32
@@ -36,14 +36,16 @@
# include <windows.h>
#endif
-#include "virhostmem.h"
#include "virerror.h"
#include "virfile.h"
-#include "virtypedparam.h"
-#include "virstring.h"
-#include "virnuma.h"
+#include "virhostmem.h"
#include "virlog.h"
+#include "virnuma.h"
+#include "virstring.h"
#include "virthread.h"
+#include "virtypedparam.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virhostmem.h b/src/util/virhostmem.h
index 79e1a300a8..321804b1f5 100644
--- a/src/util/virhostmem.h
+++ b/src/util/virhostmem.h
@@ -23,6 +23,8 @@
#include "internal.h"
+/* clang-format off */
+
int virHostMemGetStats(int cellNum,
virNodeMemoryStatsPtr params,
int *nparams,
diff --git a/src/util/virhostuptime.c b/src/util/virhostuptime.c
index 3d41fa081d..f5a87f8185 100644
--- a/src/util/virhostuptime.c
+++ b/src/util/virhostuptime.c
@@ -24,14 +24,16 @@
# include <utmpx.h>
#endif
-#include "virhostuptime.h"
+#include <math.h>
+
#include "virfile.h"
+#include "virhostuptime.h"
#include "virlog.h"
#include "virstring.h"
-#include "virtime.h"
#include "virthread.h"
+#include "virtime.h"
-#include <math.h>
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virhostuptime.h b/src/util/virhostuptime.h
index 44a91b5b52..f0381a16d9 100644
--- a/src/util/virhostuptime.h
+++ b/src/util/virhostuptime.h
@@ -22,6 +22,8 @@
#include "internal.h"
+/* clang-format off */
+
int
virHostGetBootTime(unsigned long long *when)
G_NO_INLINE;
diff --git a/src/util/viridentity.c b/src/util/viridentity.c
index 4e9a783cee..d5d60ee023 100644
--- a/src/util/viridentity.c
+++ b/src/util/viridentity.c
@@ -21,25 +21,28 @@
#include <config.h>
-#include <unistd.h>
#include <fcntl.h>
+#include <unistd.h>
#if WITH_SELINUX
# include <selinux/selinux.h>
#endif
#define LIBVIRT_VIRIDENTITYPRIV_H_ALLOW
+#include "configmake.h"
+
#include "internal.h"
#include "virerror.h"
+#include "virfile.h"
#include "viridentitypriv.h"
#include "virlog.h"
+#include "virprocess.h"
#include "virrandom.h"
#include "virthread.h"
-#include "virutil.h"
-#include "virprocess.h"
#include "virtypedparam.h"
-#include "virfile.h"
-#include "configmake.h"
+#include "virutil.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_IDENTITY
diff --git a/src/util/viridentity.h b/src/util/viridentity.h
index 5f87d7268b..9da6e9b6c0 100644
--- a/src/util/viridentity.h
+++ b/src/util/viridentity.h
@@ -21,10 +21,13 @@
#pragma once
-#include "internal.h"
#include <glib-object.h>
+
+#include "internal.h"
#include "virtypedparam.h"
+/* clang-format off */
+
#define VIR_TYPE_IDENTITY vir_identity_get_type()
G_DECLARE_FINAL_TYPE(virIdentity, vir_identity, VIR, IDENTITY, GObject);
diff --git a/src/util/viridentitypriv.h b/src/util/viridentitypriv.h
index 63357d891a..4c71d40c6a 100644
--- a/src/util/viridentitypriv.h
+++ b/src/util/viridentitypriv.h
@@ -26,5 +26,7 @@
#include "viridentity.h"
+/* clang-format off */
+
char *
virIdentityEnsureSystemToken(void) G_NO_INLINE;
diff --git a/src/util/virinitctl.c b/src/util/virinitctl.c
index 1b9f2ad022..bffe44aa14 100644
--- a/src/util/virinitctl.c
+++ b/src/util/virinitctl.c
@@ -20,14 +20,17 @@
#include <config.h>
-#include <sys/param.h>
#include <fcntl.h>
+#include <sys/param.h>
-#include "internal.h"
#include "virinitctl.h"
+
+#include "internal.h"
#include "virerror.h"
#include "virfile.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_INITCTL
#if defined(__linux__) || \
diff --git a/src/util/virinitctl.h b/src/util/virinitctl.h
index 46b2935a39..37a491251b 100644
--- a/src/util/virinitctl.h
+++ b/src/util/virinitctl.h
@@ -20,6 +20,8 @@
#pragma once
+/* clang-format off */
+
typedef enum {
VIR_INITCTL_RUNLEVEL_POWEROFF = 0,
VIR_INITCTL_RUNLEVEL_1 = 1,
diff --git a/src/util/viriptables.c b/src/util/viriptables.c
index 6275760de4..1454eddf05 100644
--- a/src/util/viriptables.c
+++ b/src/util/viriptables.c
@@ -20,18 +20,21 @@
#include <config.h>
-#include <stdarg.h>
-#include <unistd.h>
#include <fcntl.h>
-#include <sys/types.h>
+#include <stdarg.h>
#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
-#include "internal.h"
#include "viriptables.h"
-#include "virfirewalld.h"
+
+#include "internal.h"
#include "virerror.h"
-#include "virlog.h"
+#include "virfirewalld.h"
#include "virhash.h"
+#include "virlog.h"
+
+/* clang-format off */
VIR_LOG_INIT("util.iptables");
diff --git a/src/util/viriptables.h b/src/util/viriptables.h
index bb13f3292d..24c792922b 100644
--- a/src/util/viriptables.h
+++ b/src/util/viriptables.h
@@ -20,8 +20,10 @@
#pragma once
-#include "virsocketaddr.h"
#include "virfirewall.h"
+#include "virsocketaddr.h"
+
+/* clang-format off */
int iptablesSetupPrivateChains (virFirewallLayer layer);
diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c
index fbf84c9305..0e72af436e 100644
--- a/src/util/viriscsi.c
+++ b/src/util/viriscsi.c
@@ -30,6 +30,8 @@
#include "virlog.h"
#include "virrandom.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.iscsi");
diff --git a/src/util/viriscsi.h b/src/util/viriscsi.h
index 6d17d139eb..06c8edc0c5 100644
--- a/src/util/viriscsi.h
+++ b/src/util/viriscsi.h
@@ -23,6 +23,8 @@
#include "internal.h"
+/* clang-format off */
+
char *
virISCSIGetSession(const char *devpath,
bool probe)
diff --git a/src/util/virjson.c b/src/util/virjson.c
index ef59b5deb4..24aba9dac0 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -20,17 +20,17 @@
*
*/
-
#include <config.h>
#include "virjson.h"
+
#include "viralloc.h"
+#include "virbitmap.h"
+#include "virbuffer.h"
+#include "virenum.h"
#include "virerror.h"
#include "virlog.h"
#include "virstring.h"
-#include "virbuffer.h"
-#include "virenum.h"
-#include "virbitmap.h"
#if WITH_YAJL
# include <yajl/yajl_gen.h>
@@ -39,6 +39,8 @@
#endif
/* XXX fixme */
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.json");
diff --git a/src/util/virjson.h b/src/util/virjson.h
index ce181dcb82..54ec5d3951 100644
--- a/src/util/virjson.h
+++ b/src/util/virjson.h
@@ -22,11 +22,12 @@
#pragma once
+#include <stdarg.h>
+
#include "internal.h"
#include "virbuffer.h"
-#include <stdarg.h>
-
+/* clang-format off */
typedef enum {
VIR_JSON_TYPE_OBJECT,
diff --git a/src/util/virkeycode.c b/src/util/virkeycode.c
index 8ca1b573d3..e9d214ecb7 100644
--- a/src/util/virkeycode.c
+++ b/src/util/virkeycode.c
@@ -18,9 +18,11 @@
*/
#include <config.h>
-#include "virkeycode.h"
+
#include <stddef.h>
+#include "virkeycode.h"
+
#include "virkeycodetable_atset1.h"
#include "virkeycodetable_atset2.h"
#include "virkeycodetable_atset3.h"
@@ -34,6 +36,8 @@
#include "virkeynametable_osx.h"
#include "virkeynametable_win32.h"
+/* clang-format off */
+
static const char **virKeymapNames[VIR_KEYCODE_SET_LAST] = {
[VIR_KEYCODE_SET_LINUX] = virKeyNameTable_linux,
[VIR_KEYCODE_SET_OSX] = virKeyNameTable_osx,
diff --git a/src/util/virkeycode.h b/src/util/virkeycode.h
index b725613458..44d91a9862 100644
--- a/src/util/virkeycode.h
+++ b/src/util/virkeycode.h
@@ -23,6 +23,8 @@
#include "virenum.h"
+/* clang-format off */
+
VIR_ENUM_DECL(virKeycodeSet);
int virKeycodeValueFromString(virKeycodeSet codeset, const char *keyname);
int virKeycodeValueTranslate(virKeycodeSet from_codeset,
diff --git a/src/util/virkmod.c b/src/util/virkmod.c
index 4c709f8659..bbcbb3e936 100644
--- a/src/util/virkmod.c
+++ b/src/util/virkmod.c
@@ -20,10 +20,14 @@
*/
#include <config.h>
-#include "viralloc.h"
+
#include "virkmod.h"
+
+#include "viralloc.h"
#include "vircommand.h"
+/* clang-format off */
+
static int
doModprobe(const char *opts, const char *module, char **outbuf, char **errbuf)
{
diff --git a/src/util/virkmod.h b/src/util/virkmod.h
index bb043d4876..56466dce6c 100644
--- a/src/util/virkmod.h
+++ b/src/util/virkmod.h
@@ -23,6 +23,8 @@
#include "internal.h"
+/* clang-format off */
+
char *virKModLoad(const char *)
ATTRIBUTE_NONNULL(1);
char *virKModUnload(const char *)
diff --git a/src/util/virlease.c b/src/util/virlease.c
index 357bacd83d..8e4140dade 100644
--- a/src/util/virlease.c
+++ b/src/util/virlease.c
@@ -22,13 +22,15 @@
#include <config.h>
-#include "virlease.h"
-
#include <time.h>
+#include "virlease.h"
+
+#include "virerror.h"
#include "virfile.h"
#include "virstring.h"
-#include "virerror.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NETWORK
diff --git a/src/util/virlease.h b/src/util/virlease.h
index d2e440c654..7f3290fecb 100644
--- a/src/util/virlease.h
+++ b/src/util/virlease.h
@@ -24,6 +24,8 @@
#include "virjson.h"
+/* clang-format off */
+
int virLeaseReadCustomLeaseFile(virJSONValue *leases_array_new,
const char *custom_lease_file,
const char *ip_to_delete,
diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c
index d54162b3d7..0f9624fc9c 100644
--- a/src/util/virlockspace.c
+++ b/src/util/virlockspace.c
@@ -21,18 +21,21 @@
#include <config.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
#include "virlockspace.h"
-#include "virlog.h"
+
#include "viralloc.h"
#include "virerror.h"
-#include "virutil.h"
#include "virfile.h"
#include "virhash.h"
+#include "virlog.h"
#include "virthread.h"
+#include "virutil.h"
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/stat.h>
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_LOCKSPACE
diff --git a/src/util/virlockspace.h b/src/util/virlockspace.h
index da83c001e9..66985b0d36 100644
--- a/src/util/virlockspace.h
+++ b/src/util/virlockspace.h
@@ -24,6 +24,8 @@
#include "internal.h"
#include "virjson.h"
+/* clang-format off */
+
typedef struct _virLockSpace virLockSpace;
virLockSpace *virLockSpaceNew(const char *directory);
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 443e948917..d20c862566 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -21,35 +21,39 @@
#include <config.h>
+#include <fcntl.h>
#include <stdarg.h>
-#include <time.h>
-#include <sys/time.h>
#include <sys/stat.h>
-#include <fcntl.h>
+#include <sys/time.h>
+#include <time.h>
#include <unistd.h>
#if WITH_SYSLOG_H
# include <syslog.h>
#endif
-#include "virerror.h"
-#include "virlog.h"
+#include "configmake.h"
+
#include "viralloc.h"
-#include "virutil.h"
#include "virbuffer.h"
-#include "virthread.h"
+#include "virerror.h"
#include "virfile.h"
-#include "virtime.h"
-#include "virstring.h"
-#include "configmake.h"
+#include "virlog.h"
#include "virsocket.h"
+#include "virstring.h"
+#include "virthread.h"
+#include "virtime.h"
+#include "virutil.h"
/* Journald output is only supported on Linux new enough to expose
* htole64. */
#if WITH_SYSLOG_H && defined(__linux__) && WITH_DECL_HTOLE64
+
# define USE_JOURNALD 1
# include <sys/uio.h>
#endif
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.log");
diff --git a/src/util/virlog.h b/src/util/virlog.h
index 4f755c543b..0f46425931 100644
--- a/src/util/virlog.h
+++ b/src/util/virlog.h
@@ -23,6 +23,8 @@
#include "internal.h"
+/* clang-format off */
+
#ifdef PACKAGER_VERSION
# ifdef PACKAGER
# define VIR_LOG_VERSION_STRING \
diff --git a/src/util/virmacaddr.c b/src/util/virmacaddr.c
index 073f298b5b..90a978b694 100644
--- a/src/util/virmacaddr.c
+++ b/src/util/virmacaddr.c
@@ -20,10 +20,12 @@
#include <config.h>
-
#include "virmacaddr.h"
+
#include "virrandom.h"
+/* clang-format off */
+
static const unsigned char virMacAddrBroadcastAddrRaw[VIR_MAC_BUFLEN] =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
diff --git a/src/util/virmacaddr.h b/src/util/virmacaddr.h
index f32b58805a..515743727a 100644
--- a/src/util/virmacaddr.h
+++ b/src/util/virmacaddr.h
@@ -22,6 +22,8 @@
#include "internal.h"
+/* clang-format off */
+
#define VIR_MAC_BUFLEN 6
#define VIR_MAC_HEXLEN (VIR_MAC_BUFLEN * 2)
#define VIR_MAC_PREFIX_BUFLEN 3
diff --git a/src/util/virmacmap.c b/src/util/virmacmap.c
index 98be64fb31..79eed1f0ae 100644
--- a/src/util/virmacmap.c
+++ b/src/util/virmacmap.c
@@ -21,11 +21,14 @@
#include <config.h>
#include "virmacmap.h"
-#include "virobject.h"
-#include "virlog.h"
-#include "virjson.h"
+
#include "virfile.h"
#include "virhash.h"
+#include "virjson.h"
+#include "virlog.h"
+#include "virobject.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NETWORK
diff --git a/src/util/virmacmap.h b/src/util/virmacmap.h
index c0efa2b20f..fa1b5c3ecd 100644
--- a/src/util/virmacmap.h
+++ b/src/util/virmacmap.h
@@ -23,6 +23,8 @@
#include "internal.h"
#include "virobject.h"
+/* clang-format off */
+
typedef struct virMacMap virMacMap;
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virMacMap, virObjectUnref)
diff --git a/src/util/virmdev.c b/src/util/virmdev.c
index 41d4cef8b9..ee448f638a 100644
--- a/src/util/virmdev.c
+++ b/src/util/virmdev.c
@@ -19,11 +19,14 @@
#include <config.h>
#include "virmdev.h"
-#include "virlog.h"
+
+#include "viralloc.h"
#include "virerror.h"
#include "virfile.h"
+#include "virlog.h"
#include "virstring.h"
-#include "viralloc.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virmdev.h b/src/util/virmdev.h
index bc8306d0e1..34c6eb1afb 100644
--- a/src/util/virmdev.h
+++ b/src/util/virmdev.h
@@ -19,8 +19,10 @@
#pragma once
#include "internal.h"
-#include "virobject.h"
#include "virenum.h"
+#include "virobject.h"
+
+/* clang-format off */
typedef enum {
VIR_MDEV_MODEL_TYPE_VFIO_PCI = 0,
diff --git a/src/util/virmodule.c b/src/util/virmodule.c
index 36cf77ac46..001ef7a19c 100644
--- a/src/util/virmodule.c
+++ b/src/util/virmodule.c
@@ -21,13 +21,16 @@
#include <config.h>
-#include "internal.h"
#include "virmodule.h"
+
+#include "internal.h"
#include "virerror.h"
#include "virfile.h"
#include "virlog.h"
#include "virutil.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.module");
diff --git a/src/util/virmodule.h b/src/util/virmodule.h
index ca59d837d6..94cbb19456 100644
--- a/src/util/virmodule.h
+++ b/src/util/virmodule.h
@@ -21,6 +21,8 @@
#pragma once
+/* clang-format off */
+
int virModuleLoad(const char *path,
const char *regfunc,
bool required);
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 66cfc5d781..47e7b92eb6 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -17,22 +17,23 @@
*/
#include <config.h>
+
#include <math.h>
#define LIBVIRT_VIRNETDEVPRIV_H_ALLOW
-#include "virnetdevpriv.h"
#include "viralloc.h"
-#include "virnetlink.h"
-#include "virmacaddr.h"
-#include "virfile.h"
-#include "virerror.h"
#include "vircommand.h"
-#include "virpci.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virjson.h"
#include "virlog.h"
+#include "virmacaddr.h"
+#include "virnetdevpriv.h"
+#include "virnetlink.h"
+#include "virpci.h"
#include "virstring.h"
#include "virutil.h"
-#include "virjson.h"
#ifndef WIN32
# include <sys/ioctl.h>
@@ -40,8 +41,9 @@
#include <fcntl.h>
#ifdef __linux__
-# include <linux/sockios.h>
# include <linux/if_vlan.h>
+# include <linux/sockios.h>
+
# define VIR_NETDEV_FAMILY AF_UNIX
#elif defined(WITH_STRUCT_IFREQ) && defined(AF_LOCAL)
# define VIR_NETDEV_FAMILY AF_LOCAL
@@ -50,13 +52,13 @@
#endif
#if defined(SIOCETHTOOL) && defined(WITH_STRUCT_IFREQ)
-# include <linux/types.h>
# include <linux/ethtool.h>
+# include <linux/types.h>
#endif
#if WITH_DECL_LINK_ADDR
-# include <sys/sockio.h>
# include <net/if_dl.h>
+# include <sys/sockio.h>
#endif
#if WITH_LINUX_DEVLINK_H
@@ -67,6 +69,8 @@
# define IFNAMSIZ 16
#endif
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.netdev");
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index 05daed09e9..8cf152f8b1 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -19,17 +19,20 @@
#pragma once
#include "virbitmap.h"
-#include "virsocketaddr.h"
+#include "virenum.h"
#include "virmacaddr.h"
-#include "virpci.h"
#include "virnetdevvlan.h"
-#include "virenum.h"
+#include "virpci.h"
+#include "virsocketaddr.h"
#ifdef WITH_NET_IF_H
# include <net/if.h>
#endif
+/* clang-format off */
+
#ifdef WITH_STRUCT_IFREQ
+
typedef struct ifreq virIfreq;
#else
typedef void virIfreq;
diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c
index d816bcbf06..b1a3882c37 100644
--- a/src/util/virnetdevbandwidth.c
+++ b/src/util/virnetdevbandwidth.c
@@ -17,15 +17,19 @@
*/
#include <config.h>
+
#include <unistd.h>
#include "virnetdevbandwidth.h"
-#include "vircommand.h"
+
#include "viralloc.h"
+#include "vircommand.h"
#include "virerror.h"
#include "virlog.h"
#include "virutil.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.netdevbandwidth");
diff --git a/src/util/virnetdevbandwidth.h b/src/util/virnetdevbandwidth.h
index 6d268fb119..0d53668803 100644
--- a/src/util/virnetdevbandwidth.h
+++ b/src/util/virnetdevbandwidth.h
@@ -21,6 +21,8 @@
#include "internal.h"
#include "virmacaddr.h"
+/* clang-format off */
+
typedef struct _virNetDevBandwidthRate virNetDevBandwidthRate;
struct _virNetDevBandwidthRate {
unsigned long long average; /* kilobytes/s */
diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
index f1a1c7f509..e8eff1b724 100644
--- a/src/util/virnetdevbridge.c
+++ b/src/util/virnetdevbridge.c
@@ -19,10 +19,11 @@
#include <config.h>
#include "virnetdevbridge.h"
-#include "virnetdev.h"
+
#include "virerror.h"
#include "virfile.h"
#include "virlog.h"
+#include "virnetdev.h"
#include "virstring.h"
#ifdef WITH_NET_IF_H
@@ -33,13 +34,13 @@
# if defined(WITH_LIBNL)
# include "virnetlink.h"
# endif
-# include <linux/sockios.h>
-# include <linux/param.h> /* HZ */
-# include <linux/in6.h>
# include <linux/if_bridge.h> /* SYSFS_BRIDGE_ATTR */
+# include <linux/in6.h>
+# include <linux/param.h> /* HZ */
+# include <linux/sockios.h>
-# define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
-# define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
+# define JIFFIES_TO_MS(j) (((j)*1000) / HZ)
+# define MS_TO_JIFFIES(ms) (((ms)*HZ) / 1000)
#endif
#if defined(WITH_BSD_BRIDGE_MGMT)
@@ -47,6 +48,8 @@
# include <net/if_bridgevar.h>
#endif
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.netdevbridge");
diff --git a/src/util/virnetdevbridge.h b/src/util/virnetdevbridge.h
index db4099bf0b..5042d24359 100644
--- a/src/util/virnetdevbridge.h
+++ b/src/util/virnetdevbridge.h
@@ -21,6 +21,8 @@
#include "internal.h"
#include "virmacaddr.h"
+/* clang-format off */
+
int virNetDevBridgeCreate(const char *brname,
const virMacAddr *mac)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c
index 2eacb64ebe..cbb04256ea 100644
--- a/src/util/virnetdevip.c
+++ b/src/util/virnetdevip.c
@@ -19,14 +19,15 @@
#include <config.h>
#include "virnetdevip.h"
-#include "virnetdev.h"
-#include "virnetlink.h"
-#include "virfile.h"
+
+#include "viralloc.h"
+#include "vircommand.h"
#include "virerror.h"
+#include "virfile.h"
#include "virlog.h"
+#include "virnetdev.h"
+#include "virnetlink.h"
#include "virstring.h"
-#include "vircommand.h"
-#include "viralloc.h"
#if WITH_GETIFADDRS
# include <ifaddrs.h>
@@ -41,11 +42,13 @@
#include <fcntl.h>
#ifdef __linux__
-# include <linux/sockios.h>
# include <linux/if_vlan.h>
# include <linux/ipv6_route.h>
+# include <linux/sockios.h>
#endif
+/* clang-format off */
+
#define PROC_NET_IPV6_ROUTE "/proc/net/ipv6_route"
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virnetdevip.h b/src/util/virnetdevip.h
index fdf116f509..730ddb7f1c 100644
--- a/src/util/virnetdevip.h
+++ b/src/util/virnetdevip.h
@@ -20,6 +20,8 @@
#include "virsocketaddr.h"
+/* clang-format off */
+
typedef struct _virNetDevIPAddr virNetDevIPAddr;
struct _virNetDevIPAddr {
virSocketAddr address; /* ipv4 or ipv6 address */
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 94968a8b4d..72d7c3f2ed 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -22,8 +22,11 @@
#include <config.h>
#include "virnetdevmacvlan.h"
-#include "virmacaddr.h"
+
#include "virerror.h"
+#include "virmacaddr.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NET
diff --git a/src/util/virnetdevmacvlan.h b/src/util/virnetdevmacvlan.h
index 29bb8123f4..6b205fe847 100644
--- a/src/util/virnetdevmacvlan.h
+++ b/src/util/virnetdevmacvlan.h
@@ -20,10 +20,12 @@
#pragma once
#include "internal.h"
+#include "virenum.h"
#include "virmacaddr.h"
-#include "virnetdevvportprofile.h"
#include "virnetdevvlan.h"
-#include "virenum.h"
+#include "virnetdevvportprofile.h"
+
+/* clang-format off */
/* the mode type for macvtap devices */
typedef enum {
diff --git a/src/util/virnetdevmidonet.c b/src/util/virnetdevmidonet.c
index 202808ef0f..dcd7e0fc1d 100644
--- a/src/util/virnetdevmidonet.c
+++ b/src/util/virnetdevmidonet.c
@@ -19,10 +19,13 @@
#include <config.h>
#include "virnetdevmidonet.h"
+
#include "vircommand.h"
#include "virerror.h"
#include "viruuid.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
/**
diff --git a/src/util/virnetdevmidonet.h b/src/util/virnetdevmidonet.h
index 87ac3d74a1..bfc5c785b5 100644
--- a/src/util/virnetdevmidonet.h
+++ b/src/util/virnetdevmidonet.h
@@ -21,6 +21,7 @@
#include "internal.h"
#include "virnetdevvportprofile.h"
+/* clang-format off */
int virNetDevMidonetBindPort(const char *ifname,
const virNetDevVPortProfile *virtualport)
diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index 7418716600..2d9d7e55ae 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -20,18 +20,20 @@
#include <config.h>
-
#include "virnetdevopenvswitch.h"
-#include "vircommand.h"
+
#include "viralloc.h"
+#include "vircommand.h"
#include "virerror.h"
+#include "virfile.h"
+#include "virjson.h"
+#include "virlog.h"
#include "virmacaddr.h"
#include "virstring.h"
-#include "virlog.h"
-#include "virjson.h"
-#include "virfile.h"
#include "virutil.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.netdevopenvswitch");
diff --git a/src/util/virnetdevopenvswitch.h b/src/util/virnetdevopenvswitch.h
index e6ee985f17..13d437893b 100644
--- a/src/util/virnetdevopenvswitch.h
+++ b/src/util/virnetdevopenvswitch.h
@@ -22,8 +22,10 @@
#include "internal.h"
#include "virnetdevbandwidth.h"
-#include "virnetdevvportprofile.h"
#include "virnetdevvlan.h"
+#include "virnetdevvportprofile.h"
+
+/* clang-format off */
#define VIR_NETDEV_OVS_DEFAULT_TIMEOUT 5
diff --git a/src/util/virnetdevpriv.h b/src/util/virnetdevpriv.h
index 8c0094b2b5..89d6494616 100644
--- a/src/util/virnetdevpriv.h
+++ b/src/util/virnetdevpriv.h
@@ -26,6 +26,8 @@
#include "virnetdev.h"
+/* clang-format off */
+
int
virNetDevSendVfSetLinkRequest(const char *ifname,
int vfInfoType,
diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index 112a1e8b99..a4e96165c7 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -18,20 +18,21 @@
#include <config.h>
-#include "virmacaddr.h"
+#include <sys/types.h>
+#include <unistd.h>
+
#include "virnetdevtap.h"
+
+#include "viralloc.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
+#include "virmacaddr.h"
#include "virnetdev.h"
#include "virnetdevbridge.h"
#include "virnetdevmidonet.h"
#include "virnetdevopenvswitch.h"
-#include "virerror.h"
-#include "virfile.h"
-#include "viralloc.h"
-#include "virlog.h"
#include "virstring.h"
-
-#include <unistd.h>
-#include <sys/types.h>
#ifndef WIN32
# include <sys/ioctl.h>
#endif
@@ -40,7 +41,8 @@
#endif
#include <fcntl.h>
#ifdef __linux__
-# include <linux/if_tun.h> /* IFF_TUN, IFF_NO_PI */
+# include <linux/if_tun.h> /* IFF_TUN, IFF_NO_PI */
+
#elif defined(__FreeBSD__)
# include <net/if_mib.h>
# include <sys/sysctl.h>
@@ -49,6 +51,8 @@
# include <ifaddrs.h>
#endif
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.netdevtap");
diff --git a/src/util/virnetdevtap.h b/src/util/virnetdevtap.h
index 197ea10f94..5605bd3d2d 100644
--- a/src/util/virnetdevtap.h
+++ b/src/util/virnetdevtap.h
@@ -20,8 +20,10 @@
#include "internal.h"
#include "virnetdev.h"
-#include "virnetdevvportprofile.h"
#include "virnetdevvlan.h"
+#include "virnetdevvportprofile.h"
+
+/* clang-format off */
#ifdef __FreeBSD__
/* This should be defined on OSes that don't automatically
diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c
index ad1f517039..a112841fe7 100644
--- a/src/util/virnetdevveth.c
+++ b/src/util/virnetdevveth.c
@@ -20,13 +20,16 @@
#include <config.h>
#include "virnetdevveth.h"
+
#include "viralloc.h"
-#include "virlog.h"
#include "vircommand.h"
#include "virerror.h"
+#include "virlog.h"
#include "virnetdev.h"
#include "virnetlink.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.netdevveth");
diff --git a/src/util/virnetdevveth.h b/src/util/virnetdevveth.h
index 830b37d046..ea7fba6cc5 100644
--- a/src/util/virnetdevveth.h
+++ b/src/util/virnetdevveth.h
@@ -21,6 +21,8 @@
#include "internal.h"
+/* clang-format off */
+
/* Function declarations */
int virNetDevVethCreate(char **veth1, char **veth2)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
diff --git a/src/util/virnetdevvlan.c b/src/util/virnetdevvlan.c
index 67daa5d3b4..fcddbe452c 100644
--- a/src/util/virnetdevvlan.c
+++ b/src/util/virnetdevvlan.c
@@ -18,10 +18,13 @@
#include <config.h>
-#include "internal.h"
#include "virnetdevvlan.h"
+
+#include "internal.h"
#include "viralloc.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
void
diff --git a/src/util/virnetdevvlan.h b/src/util/virnetdevvlan.h
index 228d270869..77963a32c6 100644
--- a/src/util/virnetdevvlan.h
+++ b/src/util/virnetdevvlan.h
@@ -20,6 +20,8 @@
#include "virenum.h"
+/* clang-format off */
+
typedef enum {
VIR_NATIVE_VLAN_MODE_DEFAULT = 0,
VIR_NATIVE_VLAN_MODE_TAGGED,
diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c
index ae23f795b2..7c9e36766b 100644
--- a/src/util/virnetdevvportprofile.c
+++ b/src/util/virnetdevvportprofile.c
@@ -19,10 +19,13 @@
#include <config.h>
#include "virnetdevvportprofile.h"
-#include "virerror.h"
+
#include "viralloc.h"
+#include "virerror.h"
#include "virstring.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NET
VIR_ENUM_IMPL(virNetDevVPort,
diff --git a/src/util/virnetdevvportprofile.h b/src/util/virnetdevvportprofile.h
index 600b2093c5..54c0f7e7f7 100644
--- a/src/util/virnetdevvportprofile.h
+++ b/src/util/virnetdevvportprofile.h
@@ -19,9 +19,11 @@
#pragma once
#include "internal.h"
-#include "viruuid.h"
-#include "virmacaddr.h"
#include "virenum.h"
+#include "virmacaddr.h"
+#include "viruuid.h"
+
+/* clang-format off */
#define LIBVIRT_IFLA_VF_PORT_PROFILE_MAX 40
diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index 98f75652e9..867615646f 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -24,12 +24,15 @@
#include <unistd.h>
#include "virnetlink.h"
-#include "virnetdev.h"
+
+#include "viralloc.h"
+#include "virerror.h"
#include "virlog.h"
-#include "virthread.h"
#include "virmacaddr.h"
-#include "virerror.h"
-#include "viralloc.h"
+#include "virnetdev.h"
+#include "virthread.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NET
diff --git a/src/util/virnetlink.h b/src/util/virnetlink.h
index 75192f645f..01cc0e19c2 100644
--- a/src/util/virnetlink.h
+++ b/src/util/virnetlink.h
@@ -26,6 +26,8 @@
# include <netlink/msg.h>
+/* clang-format off */
+
typedef struct nl_msg virNetlinkMsg;
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetlinkMsg, nlmsg_free);
diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c
index 5feef79c43..9b375dd510 100644
--- a/src/util/virnodesuspend.c
+++ b/src/util/virnodesuspend.c
@@ -21,17 +21,19 @@
*/
#include <config.h>
+
#include "virnodesuspend.h"
-#include "virsystemd.h"
-#include "vircommand.h"
-#include "virthread.h"
#include "datatypes.h"
-
#include "viralloc.h"
+#include "vircommand.h"
+#include "virerror.h"
#include "virfile.h"
#include "virlog.h"
-#include "virerror.h"
+#include "virsystemd.h"
+#include "virthread.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virnodesuspend.h b/src/util/virnodesuspend.h
index f767961bff..0e9c977be0 100644
--- a/src/util/virnodesuspend.h
+++ b/src/util/virnodesuspend.h
@@ -23,6 +23,8 @@
#include "internal.h"
+/* clang-format off */
+
int virNodeSuspend(unsigned int target,
unsigned long long duration,
unsigned int flags);
diff --git a/src/util/virnuma.c b/src/util/virnuma.c
index 2306ab0cb1..32f2d1e4f8 100644
--- a/src/util/virnuma.c
+++ b/src/util/virnuma.c
@@ -34,20 +34,22 @@
#endif /* WITH_NUMACTL */
-#include <sys/types.h>
#include <dirent.h>
+#include <sys/types.h>
-#include "virnuma.h"
-#include "vircommand.h"
-#include "virerror.h"
-#include "virlog.h"
#include "viralloc.h"
#include "virbitmap.h"
-#include "virstring.h"
+#include "vircommand.h"
+#include "virerror.h"
#include "virfile.h"
#include "virhostmem.h"
+#include "virlog.h"
+#include "virnuma.h"
+#include "virstring.h"
#include "virutil.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.numa");
diff --git a/src/util/virnuma.h b/src/util/virnuma.h
index c35acd47cb..d494e5a587 100644
--- a/src/util/virnuma.h
+++ b/src/util/virnuma.h
@@ -24,6 +24,7 @@
#include "internal.h"
#include "virbitmap.h"
+/* clang-format off */
char *virNumaGetAutoPlacementAdvice(unsigned short vcpus,
unsigned long long balloon);
diff --git a/src/util/virnvme.c b/src/util/virnvme.c
index d0f0c04aba..675317486a 100644
--- a/src/util/virnvme.c
+++ b/src/util/virnvme.c
@@ -19,10 +19,13 @@
#include <config.h>
#include "virnvme.h"
-#include "virobject.h"
-#include "virpci.h"
+
#include "viralloc.h"
#include "virlog.h"
+#include "virobject.h"
+#include "virpci.h"
+
+/* clang-format off */
VIR_LOG_INIT("util.nvme");
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virnvme.h b/src/util/virnvme.h
index ceef402c4b..8cfea73912 100644
--- a/src/util/virnvme.h
+++ b/src/util/virnvme.h
@@ -20,6 +20,8 @@
#include "virpci.h"
+/* clang-format off */
+
typedef struct _virNVMeDevice virNVMeDevice;
/* Note that this list is lockable, and in fact, it is caller's
diff --git a/src/util/virobject.c b/src/util/virobject.c
index b74d74a545..afa90d3e5b 100644
--- a/src/util/virobject.c
+++ b/src/util/virobject.c
@@ -22,11 +22,13 @@
#include <config.h>
#define VIR_PARENT_REQUIRED /* empty, to allow virObject to have no parent */
-#include "virobject.h"
-#include "virthread.h"
#include "virerror.h"
#include "virlog.h"
+#include "virobject.h"
#include "virprobe.h"
+#include "virthread.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virobject.h b/src/util/virobject.h
index 8c06c1b929..baf34edcd9 100644
--- a/src/util/virobject.h
+++ b/src/util/virobject.h
@@ -21,10 +21,12 @@
#pragma once
+#include <glib-object.h>
+
#include "internal.h"
#include "virthread.h"
-#include <glib-object.h>
+/* clang-format off */
typedef struct _virClass virClass;
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 7800966963..9862ec004f 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -20,23 +20,25 @@
#include <config.h>
-#include "virpci.h"
-#include "virnetdev.h"
-
#include <dirent.h>
#include <fcntl.h>
#include <inttypes.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
-#include "virlog.h"
+#include "virpci.h"
+
+#include "viralloc.h"
#include "virerror.h"
#include "virfile.h"
#include "virkmod.h"
-#include "virstring.h"
-#include "viralloc.h"
+#include "virlog.h"
+#include "virnetdev.h"
#include "virpcivpd.h"
+#include "virstring.h"
+
+/* clang-format off */
VIR_LOG_INIT("util.pci");
diff --git a/src/util/virpci.h b/src/util/virpci.h
index 4d9193f24e..7b5e7e237a 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -21,11 +21,13 @@
#pragma once
#include "internal.h"
+#include "virenum.h"
#include "virmdev.h"
#include "virobject.h"
-#include "virenum.h"
#include "virpcivpd.h"
+/* clang-format off */
+
typedef struct _virPCIDevice virPCIDevice;
typedef struct _virPCIDeviceAddress virPCIDeviceAddress;
typedef struct _virPCIDeviceList virPCIDeviceList;
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
index 39557c7347..2409140b54 100644
--- a/src/util/virpcivpd.c
+++ b/src/util/virpcivpd.c
@@ -26,10 +26,12 @@
#define LIBVIRT_VIRPCIVPDPRIV_H_ALLOW
-#include "virthread.h"
-#include "virpcivpdpriv.h"
-#include "virlog.h"
#include "virerror.h"
+#include "virlog.h"
+#include "virpcivpdpriv.h"
+#include "virthread.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virpcivpd.h b/src/util/virpcivpd.h
index 9bfec43e03..a06bea340d 100644
--- a/src/util/virpcivpd.h
+++ b/src/util/virpcivpd.h
@@ -22,6 +22,8 @@
#include "internal.h"
+/* clang-format off */
+
typedef struct virPCIVPDResourceCustom virPCIVPDResourceCustom;
struct virPCIVPDResourceCustom {
char idx;
diff --git a/src/util/virpcivpdpriv.h b/src/util/virpcivpdpriv.h
index 0f565f81ae..344ea48347 100644
--- a/src/util/virpcivpdpriv.h
+++ b/src/util/virpcivpdpriv.h
@@ -26,6 +26,8 @@
#include "virpcivpd.h"
+/* clang-format off */
+
/*
* PCI Local bus (2.2+, Appendix I) and PCIe 4.0+ (7.9.19 VPD Capability) define
* the VPD capability structure (8 bytes in total) and VPD registers that can be used to
access
diff --git a/src/util/virperf.c b/src/util/virperf.c
index 434d1d99c4..a87796cc9b 100644
--- a/src/util/virperf.c
+++ b/src/util/virperf.c
@@ -25,12 +25,14 @@
# include <sys/syscall.h>
#endif
-#include "virperf.h"
#include "virerror.h"
-#include "virlog.h"
#include "virfile.h"
+#include "virlog.h"
+#include "virperf.h"
#include "virstring.h"
+/* clang-format off */
+
VIR_LOG_INIT("util.perf");
#define VIR_FROM_THIS VIR_FROM_PERF
diff --git a/src/util/virperf.h b/src/util/virperf.h
index 34e4e1f4c7..73babd9760 100644
--- a/src/util/virperf.h
+++ b/src/util/virperf.h
@@ -20,6 +20,8 @@
#include "virenum.h"
+/* clang-format off */
+
/* Some Intel processor families introduced some RDT (Resource Director
* Technology) features to monitor or control shared resource based on
* the perf framework in the linux kernel. */
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index bfd967c1af..7e318d9aae 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -28,13 +28,16 @@
#include <sys/stat.h>
#include "virpidfile.h"
-#include "virfile.h"
+
#include "virbuffer.h"
-#include "virutil.h"
-#include "virlog.h"
#include "virerror.h"
-#include "virstring.h"
+#include "virfile.h"
+#include "virlog.h"
#include "virprocess.h"
+#include "virstring.h"
+#include "virutil.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virpidfile.h b/src/util/virpidfile.h
index e84542f298..87c10de7a7 100644
--- a/src/util/virpidfile.h
+++ b/src/util/virpidfile.h
@@ -24,8 +24,11 @@
#pragma once
#include <sys/types.h>
+
#include "internal.h"
+/* clang-format off */
+
char *virPidFileBuildPath(const char *dir,
const char *name);
diff --git a/src/util/virpolkit.c b/src/util/virpolkit.c
index 6c83eaf412..dcf90060a2 100644
--- a/src/util/virpolkit.c
+++ b/src/util/virpolkit.c
@@ -20,17 +20,21 @@
*/
#include <config.h>
+
#include <fcntl.h>
#include <unistd.h>
#include "virpolkit.h"
-#include "virerror.h"
-#include "virlog.h"
+
#include "viralloc.h"
-#include "virgdbus.h"
+#include "virerror.h"
#include "virfile.h"
+#include "virgdbus.h"
+#include "virlog.h"
#include "virutil.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_POLKIT
VIR_LOG_INIT("util.polkit");
diff --git a/src/util/virpolkit.h b/src/util/virpolkit.h
index 7bcd040e5e..d030988972 100644
--- a/src/util/virpolkit.h
+++ b/src/util/virpolkit.h
@@ -24,6 +24,8 @@
#include "internal.h"
#include "vircommand.h"
+/* clang-format off */
+
#define PKTTYAGENT "/usr/bin/pkttyagent"
int virPolkitCheckAuth(const char *actionid,
diff --git a/src/util/virportallocator.c b/src/util/virportallocator.c
index 87835a3ed7..4c11cb58ee 100644
--- a/src/util/virportallocator.c
+++ b/src/util/virportallocator.c
@@ -23,13 +23,16 @@
#include <unistd.h>
-#include "virsocket.h"
-#include "virbitmap.h"
#include "virportallocator.h"
-#include "virthread.h"
+
+#include "virbitmap.h"
#include "virerror.h"
+#include "virsocket.h"
+#include "virthread.h"
#include "virutil.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
#define VIR_PORT_ALLOCATOR_NUM_PORTS 65536
diff --git a/src/util/virportallocator.h b/src/util/virportallocator.h
index 0d6dabb8ac..8dc761a69c 100644
--- a/src/util/virportallocator.h
+++ b/src/util/virportallocator.h
@@ -24,6 +24,8 @@
#include "internal.h"
#include "virobject.h"
+/* clang-format off */
+
typedef struct _virPortAllocatorRange virPortAllocatorRange;
virPortAllocatorRange *
diff --git a/src/util/virprobe.h b/src/util/virprobe.h
index 80a5f48ec8..d55ea65905 100644
--- a/src/util/virprobe.h
+++ b/src/util/virprobe.h
@@ -24,6 +24,8 @@
#include "internal.h"
#include "virlog.h"
+/* clang-format off */
+
#if WITH_DTRACE_PROBES
# ifndef LIBVIRT_PROBES_H
# define LIBVIRT_PROBES_H
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 39ca5de811..6876be079f 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -19,7 +19,6 @@
*
*/
-
#include <config.h>
#include <fcntl.h>
@@ -31,8 +30,8 @@
# include <sys/mount.h>
#endif
#if WITH_SETRLIMIT
-# include <sys/time.h>
# include <sys/resource.h>
+# include <sys/time.h>
#endif
#if WITH_SCHED_H
# include <sched.h>
@@ -60,14 +59,16 @@
# include <sys/prctl.h>
#endif
-#include "virprocess.h"
-#include "virerror.h"
#include "viralloc.h"
+#include "vircommand.h"
+#include "virerror.h"
#include "virfile.h"
#include "virlog.h"
-#include "virutil.h"
+#include "virprocess.h"
#include "virstring.h"
-#include "vircommand.h"
+#include "virutil.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virprocess.h b/src/util/virprocess.h
index 4e21678838..34ff5b0345 100644
--- a/src/util/virprocess.h
+++ b/src/util/virprocess.h
@@ -27,6 +27,8 @@
#include "virbitmap.h"
#include "virenum.h"
+/* clang-format off */
+
typedef enum {
VIR_PROC_POLICY_NONE = 0,
VIR_PROC_POLICY_BATCH,
diff --git a/src/util/virqemu.c b/src/util/virqemu.c
index 9dc0eab386..38c4e9af17 100644
--- a/src/util/virqemu.c
+++ b/src/util/virqemu.c
@@ -19,14 +19,16 @@
*
*/
-
#include <config.h>
+#include "virqemu.h"
+
+#include "virbitmap.h"
#include "virbuffer.h"
#include "virerror.h"
#include "virlog.h"
-#include "virqemu.h"
-#include "virbitmap.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virqemu.h b/src/util/virqemu.h
index 472f24de53..3fa6354f38 100644
--- a/src/util/virqemu.h
+++ b/src/util/virqemu.h
@@ -26,6 +26,8 @@
#include "virbuffer.h"
#include "virjson.h"
+/* clang-format off */
+
typedef int (*virQEMUBuildCommandLineJSONArrayFormatFunc)(const char *key,
virJSONValue *array,
virBuffer *buf,
diff --git a/src/util/virrandom.c b/src/util/virrandom.c
index e23ddf8e1d..e968218afb 100644
--- a/src/util/virrandom.c
+++ b/src/util/virrandom.c
@@ -18,19 +18,22 @@
#include <config.h>
+#include <fcntl.h>
+#include <gnutls/crypto.h>
+#include <gnutls/gnutls.h>
#include <inttypes.h>
#include <math.h>
-#include <time.h>
-#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <gnutls/gnutls.h>
-#include <gnutls/crypto.h>
+#include <time.h>
#include "virrandom.h"
+
#include "virerror.h"
#include "virlog.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.random");
diff --git a/src/util/virrandom.h b/src/util/virrandom.h
index 8a20401954..5586daba94 100644
--- a/src/util/virrandom.h
+++ b/src/util/virrandom.h
@@ -20,6 +20,8 @@
#include "internal.h"
+/* clang-format off */
+
uint64_t virRandomBits(int nbits) G_NO_INLINE;
double virRandom(void);
uint32_t virRandomInt(uint32_t max);
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index c46a78f113..8be94b6415 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -18,21 +18,23 @@
#include <config.h>
+#include <fcntl.h>
#include <sys/file.h>
-#include <sys/types.h>
#include <sys/stat.h>
-#include <fcntl.h>
+#include <sys/types.h>
#include <unistd.h>
#define LIBVIRT_VIRRESCTRLPRIV_H_ALLOW
-#include "virresctrlpriv.h"
#include "viralloc.h"
#include "virbuffer.h"
#include "virfile.h"
#include "virlog.h"
#include "virobject.h"
+#include "virresctrlpriv.h"
#include "virstring.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_RESCTRL
VIR_LOG_INIT("util.virresctrl");
diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h
index 0e4b535f9e..17a54cc023 100644
--- a/src/util/virresctrl.h
+++ b/src/util/virresctrl.h
@@ -19,9 +19,10 @@
#pragma once
#include "internal.h"
-
-#include "virobject.h"
#include "virenum.h"
+#include "virobject.h"
+
+/* clang-format off */
typedef enum {
VIR_CACHE_TYPE_BOTH,
diff --git a/src/util/virresctrlpriv.h b/src/util/virresctrlpriv.h
index 803f9b62ab..9eed2f2a01 100644
--- a/src/util/virresctrlpriv.h
+++ b/src/util/virresctrlpriv.h
@@ -24,5 +24,7 @@
#include "virresctrl.h"
+/* clang-format off */
+
virResctrlAlloc *
virResctrlAllocGetUnused(virResctrlInfo *resctrl);
diff --git a/src/util/virrotatingfile.c b/src/util/virrotatingfile.c
index d339e58e1c..15102aa35b 100644
--- a/src/util/virrotatingfile.c
+++ b/src/util/virrotatingfile.c
@@ -26,11 +26,14 @@
#include <unistd.h>
#include "virrotatingfile.h"
+
#include "viralloc.h"
#include "virerror.h"
#include "virfile.h"
#include "virlog.h"
+/* clang-format off */
+
VIR_LOG_INIT("util.rotatingfile");
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virrotatingfile.h b/src/util/virrotatingfile.h
index 1ed8838e7d..fb36cab13e 100644
--- a/src/util/virrotatingfile.h
+++ b/src/util/virrotatingfile.h
@@ -23,6 +23,8 @@
#include "internal.h"
+/* clang-format off */
+
typedef struct virRotatingFileWriter virRotatingFileWriter;
typedef struct virRotatingFileReader virRotatingFileReader;
diff --git a/src/util/virscsi.c b/src/util/virscsi.c
index 6a90d9002f..722bf99abe 100644
--- a/src/util/virscsi.c
+++ b/src/util/virscsi.c
@@ -24,16 +24,19 @@
#include <dirent.h>
#include <fcntl.h>
#include <inttypes.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
-#include "virlog.h"
#include "virscsi.h"
+
+#include "viralloc.h"
+#include "virerror.h"
#include "virfile.h"
+#include "virlog.h"
#include "virstring.h"
-#include "virerror.h"
-#include "viralloc.h"
+
+/* clang-format off */
#define SYSFS_SCSI_DEVICES "/sys/bus/scsi/devices"
diff --git a/src/util/virscsi.h b/src/util/virscsi.h
index ec34303bdc..50fc32d439 100644
--- a/src/util/virscsi.h
+++ b/src/util/virscsi.h
@@ -23,6 +23,8 @@
#include "internal.h"
#include "virobject.h"
+/* clang-format off */
+
typedef struct _virSCSIDevice virSCSIDevice;
typedef struct _virSCSIDeviceList virSCSIDeviceList;
diff --git a/src/util/virscsihost.c b/src/util/virscsihost.c
index 969cdd9f79..bb5ed6f7d9 100644
--- a/src/util/virscsihost.c
+++ b/src/util/virscsihost.c
@@ -17,15 +17,19 @@
*/
#include <config.h>
+
#include <dirent.h>
+#include "virscsihost.h"
+
#include "viralloc.h"
#include "virerror.h"
#include "virfile.h"
#include "virlog.h"
-#include "virscsihost.h"
#include "virstring.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.scsi_host");
diff --git a/src/util/virscsihost.h b/src/util/virscsihost.h
index ccc10f772d..b98550960e 100644
--- a/src/util/virscsihost.h
+++ b/src/util/virscsihost.h
@@ -20,6 +20,8 @@
#include "internal.h"
+/* clang-format off */
+
int virSCSIHostGetUniqueId(const char *sysfs_prefix, int host);
char *virSCSIHostFindByPCI(const char *sysfs_prefix,
diff --git a/src/util/virscsivhost.c b/src/util/virscsivhost.c
index 1ea6a1ee2a..12742e2445 100644
--- a/src/util/virscsivhost.c
+++ b/src/util/virscsivhost.c
@@ -19,13 +19,17 @@
*/
#include <config.h>
+
#include <fcntl.h>
#include "virscsivhost.h"
-#include "virlog.h"
+
+#include "viralloc.h"
#include "virerror.h"
#include "virfile.h"
-#include "viralloc.h"
+#include "virlog.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virscsivhost.h b/src/util/virscsivhost.h
index a7299382db..764ee4f0c5 100644
--- a/src/util/virscsivhost.h
+++ b/src/util/virscsivhost.h
@@ -23,6 +23,8 @@
#include "internal.h"
#include "virobject.h"
+/* clang-format off */
+
typedef struct _virSCSIVHostDevice virSCSIVHostDevice;
typedef struct _virSCSIVHostDeviceList virSCSIVHostDeviceList;
diff --git a/src/util/virseclabel.c b/src/util/virseclabel.c
index d7e4834d5f..c6e4c4d6ab 100644
--- a/src/util/virseclabel.c
+++ b/src/util/virseclabel.c
@@ -21,9 +21,12 @@
#include <config.h>
-#include "internal.h"
#include "virseclabel.h"
+#include "internal.h"
+
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virseclabel.h b/src/util/virseclabel.h
index eca4d09d24..1f2af2cd29 100644
--- a/src/util/virseclabel.h
+++ b/src/util/virseclabel.h
@@ -21,6 +21,8 @@
#pragma once
+/* clang-format off */
+
typedef enum {
VIR_DOMAIN_SECLABEL_DEFAULT,
VIR_DOMAIN_SECLABEL_NONE,
diff --git a/src/util/virsecret.c b/src/util/virsecret.c
index c01f3fb967..f6c401f457 100644
--- a/src/util/virsecret.c
+++ b/src/util/virsecret.c
@@ -21,13 +21,16 @@
#include <config.h>
+#include "virsecret.h"
+
#include "datatypes.h"
#include "viralloc.h"
#include "virerror.h"
#include "virlog.h"
-#include "virsecret.h"
#include "viruuid.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.secret");
diff --git a/src/util/virsecret.h b/src/util/virsecret.h
index c803f0fe33..2ae45afcfa 100644
--- a/src/util/virsecret.h
+++ b/src/util/virsecret.h
@@ -22,9 +22,10 @@
#pragma once
#include "internal.h"
-
-#include "virxml.h"
#include "virenum.h"
+#include "virxml.h"
+
+/* clang-format off */
VIR_ENUM_DECL(virSecretUsage);
diff --git a/src/util/virsecureerase.c b/src/util/virsecureerase.c
index ead12803da..037707cc34 100644
--- a/src/util/virsecureerase.c
+++ b/src/util/virsecureerase.c
@@ -33,6 +33,8 @@
*
* Also note that there are possible leftover direct uses of memset.
*/
+/* clang-format off */
+
void
virSecureErase(void *ptr,
size_t size)
diff --git a/src/util/virsecureerase.h b/src/util/virsecureerase.h
index 7aa2f970f7..656d44e891 100644
--- a/src/util/virsecureerase.h
+++ b/src/util/virsecureerase.h
@@ -21,6 +21,8 @@
#include "internal.h"
+/* clang-format off */
+
void
virSecureErase(void *ptr, size_t size);
diff --git a/src/util/virsocket.c b/src/util/virsocket.c
index a6f185114d..68da291cad 100644
--- a/src/util/virsocket.c
+++ b/src/util/virsocket.c
@@ -19,14 +19,17 @@
#include <config.h>
+#include <fcntl.h>
+
#include "virsocket.h"
-#include "virutil.h"
-#include "virfile.h"
-#include <fcntl.h>
+#include "virfile.h"
+#include "virutil.h"
#ifdef WIN32
+/* clang-format off */
+
# define FD2SK(fd) _get_osfhandle(fd)
# define SK2FD(sk) (_open_osfhandle((intptr_t) (sk), O_RDWR | O_BINARY))
diff --git a/src/util/virsocket.h b/src/util/virsocket.h
index 419da8b3ae..29cdb3613e 100644
--- a/src/util/virsocket.h
+++ b/src/util/virsocket.h
@@ -20,6 +20,8 @@
#include "internal.h"
+/* clang-format off */
+
int virSocketSendFD(int sock, int fd);
int virSocketRecvFD(int sock, int fdflags);
diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
index 0480485ab7..5316e45051 100644
--- a/src/util/virsocketaddr.c
+++ b/src/util/virsocketaddr.c
@@ -19,8 +19,11 @@
#include <config.h>
#include "virsocketaddr.h"
-#include "virerror.h"
+
#include "virbuffer.h"
+#include "virerror.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virsocketaddr.h b/src/util/virsocketaddr.h
index ec265d6e44..bd19a6d1ec 100644
--- a/src/util/virsocketaddr.h
+++ b/src/util/virsocketaddr.h
@@ -20,6 +20,8 @@
#include "virsocket.h"
+/* clang-format off */
+
#define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1"
typedef struct {
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 873da65d42..09470b16d8 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -20,14 +20,17 @@
*/
#include <config.h>
+
#include "virstoragefile.h"
#include "viralloc.h"
+#include "vircommand.h"
#include "virerror.h"
#include "virlog.h"
-#include "vircommand.h"
#include "virstring.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_STORAGE
VIR_LOG_INIT("util.storagefile");
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 62185e6f4f..67845ec99a 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -23,6 +23,8 @@
#include "internal.h"
+/* clang-format off */
+
int virStorageFileParseBackingStoreStr(const char *str,
char **target,
unsigned int *chainIndex)
diff --git a/src/util/virstring.c b/src/util/virstring.c
index 7b7aee6179..9346e2746b 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -24,12 +24,14 @@
# include <xlocale.h>
#endif
-#include "virstring.h"
-#include "virthread.h"
#include "viralloc.h"
#include "virbuffer.h"
#include "virerror.h"
#include "virlog.h"
+#include "virstring.h"
+#include "virthread.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virstring.h b/src/util/virstring.h
index ec8ceb0022..61a821e7b3 100644
--- a/src/util/virstring.h
+++ b/src/util/virstring.h
@@ -20,6 +20,8 @@
#include "internal.h"
+/* clang-format off */
+
#define VIR_INT64_STR_BUFLEN 21
int virStrToLong_i(char const *s,
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 376d5d4816..9b4713a0e5 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -21,22 +21,25 @@
#include <config.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
-#include "virerror.h"
#include "virsysinfo.h"
+
#include "viralloc.h"
#include "vircommand.h"
-#include "virlog.h"
+#include "virerror.h"
#include "virfile.h"
+#include "virlog.h"
#include "virstring.h"
#include "virxml.h"
#define LIBVIRT_VIRSYSINFOPRIV_H_ALLOW
#include "virsysinfopriv.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_SYSINFO
VIR_LOG_INIT("util.sysinfo");
diff --git a/src/util/virsysinfo.h b/src/util/virsysinfo.h
index 5fa91d9611..32a2a0a265 100644
--- a/src/util/virsysinfo.h
+++ b/src/util/virsysinfo.h
@@ -25,6 +25,8 @@
#include "virbuffer.h"
#include "virenum.h"
+/* clang-format off */
+
typedef enum {
VIR_SYSINFO_SMBIOS,
VIR_SYSINFO_FWCFG,
diff --git a/src/util/virsysinfopriv.h b/src/util/virsysinfopriv.h
index e47bd3c361..4e34d2ffb9 100644
--- a/src/util/virsysinfopriv.h
+++ b/src/util/virsysinfopriv.h
@@ -23,6 +23,8 @@
#pragma once
+/* clang-format off */
+
void
virSysinfoSetup(const char *sysinfo,
const char *cpuinfo);
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 18bf2932a4..becfe0973b 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -22,19 +22,20 @@
#include <config.h>
#define LIBVIRT_VIRSYSTEMDPRIV_H_ALLOW
-#include "virsystemdpriv.h"
-
-#include "virsystemd.h"
-#include "virbuffer.h"
-#include "virgdbus.h"
-#include "virstring.h"
#include "viralloc.h"
-#include "virutil.h"
-#include "virlog.h"
+#include "virbuffer.h"
#include "virerror.h"
#include "virfile.h"
+#include "virgdbus.h"
#include "virhash.h"
+#include "virlog.h"
#include "virsocketaddr.h"
+#include "virstring.h"
+#include "virsystemd.h"
+#include "virsystemdpriv.h"
+#include "virutil.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_SYSTEMD
diff --git a/src/util/virsystemd.h b/src/util/virsystemd.h
index 19fb714132..d5880803c7 100644
--- a/src/util/virsystemd.h
+++ b/src/util/virsystemd.h
@@ -23,6 +23,8 @@
#include "internal.h"
+/* clang-format off */
+
typedef struct _virSystemdActivation virSystemdActivation;
char *virSystemdMakeScopeName(const char *name,
diff --git a/src/util/virsystemdpriv.h b/src/util/virsystemdpriv.h
index 736c53d3fa..e6de6495a3 100644
--- a/src/util/virsystemdpriv.h
+++ b/src/util/virsystemdpriv.h
@@ -27,5 +27,7 @@
#include "virsystemd.h"
+/* clang-format off */
+
void virSystemdHasMachinedResetCachedValue(void);
void virSystemdHasLogindResetCachedValue(void);
diff --git a/src/util/virthread.c b/src/util/virthread.c
index 5422bb74fd..d2ee929ae3 100644
--- a/src/util/virthread.c
+++ b/src/util/virthread.c
@@ -27,8 +27,8 @@
# include <pthread_np.h>
#endif
-#include <unistd.h>
#include <inttypes.h>
+#include <unistd.h>
#if WITH_SYS_SYSCALL_H
# include <sys/syscall.h>
#endif
@@ -36,6 +36,7 @@
#include "viralloc.h"
#include "virthreadjob.h"
+/* clang-format off */
int virOnce(virOnceControl *once, virOnceFunc init)
{
diff --git a/src/util/virthread.h b/src/util/virthread.h
index 23abe0b6c9..e83a13225a 100644
--- a/src/util/virthread.h
+++ b/src/util/virthread.h
@@ -21,10 +21,12 @@
#pragma once
+#include <pthread.h>
+
#include "internal.h"
#include "virerror.h"
-#include <pthread.h>
+/* clang-format off */
typedef struct virMutex virMutex;
struct virMutex {
diff --git a/src/util/virthreadjob.c b/src/util/virthreadjob.c
index 2c6f45fd51..c6a53abb39 100644
--- a/src/util/virthreadjob.c
+++ b/src/util/virthreadjob.c
@@ -20,11 +20,14 @@
#include <config.h>
+#include "virthreadjob.h"
+
#include "internal.h"
#include "virerror.h"
#include "virlog.h"
#include "virthread.h"
-#include "virthreadjob.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_THREAD
VIR_LOG_INIT("util.threadjob");
diff --git a/src/util/virthreadjob.h b/src/util/virthreadjob.h
index aac23c7780..1a1b66b97e 100644
--- a/src/util/virthreadjob.h
+++ b/src/util/virthreadjob.h
@@ -20,6 +20,8 @@
#pragma once
+/* clang-format off */
+
const char *virThreadJobGet(void);
void virThreadJobSetWorker(const char *caller);
diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c
index 2f1d49d665..07a9d1790c 100644
--- a/src/util/virthreadpool.c
+++ b/src/util/virthreadpool.c
@@ -23,9 +23,12 @@
#include <config.h>
#include "virthreadpool.h"
+
#include "viralloc.h"
-#include "virthread.h"
#include "virerror.h"
+#include "virthread.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virthreadpool.h b/src/util/virthreadpool.h
index c6b9f31916..be0b8c2e34 100644
--- a/src/util/virthreadpool.h
+++ b/src/util/virthreadpool.h
@@ -24,6 +24,8 @@
#include "internal.h"
#include "viridentity.h"
+/* clang-format off */
+
typedef struct _virThreadPool virThreadPool;
typedef void (*virThreadPoolJobFunc)(void *jobdata, void *opaque);
diff --git a/src/util/virtime.c b/src/util/virtime.c
index baf4ce5db7..46b9f1fc9a 100644
--- a/src/util/virtime.c
+++ b/src/util/virtime.c
@@ -31,14 +31,17 @@
#include <config.h>
-#include <unistd.h>
#include <sys/time.h>
+#include <unistd.h>
#include "virtime.h"
+
#include "viralloc.h"
#include "virerror.h"
#include "virlog.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.time");
diff --git a/src/util/virtime.h b/src/util/virtime.h
index d4fba4aff5..4b92721629 100644
--- a/src/util/virtime.h
+++ b/src/util/virtime.h
@@ -24,6 +24,8 @@
#include "internal.h"
+/* clang-format off */
+
/* The format string we intend to use is:
*
* Yr Mon Day Hour Min Sec Ms TZ
diff --git a/src/util/virtpm.c b/src/util/virtpm.c
index 19850de1c8..82066fb489 100644
--- a/src/util/virtpm.c
+++ b/src/util/virtpm.c
@@ -22,16 +22,19 @@
#include <sys/stat.h>
-#include "virerror.h"
-#include "viralloc.h"
-#include "virfile.h"
#include "virtpm.h"
-#include "vircommand.h"
+
+#include "viralloc.h"
#include "virbitmap.h"
+#include "vircommand.h"
+#include "virerror.h"
+#include "virfile.h"
#include "virjson.h"
#include "virlog.h"
#include "virthread.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_TPM
VIR_LOG_INIT("util.tpm");
diff --git a/src/util/virtpm.h b/src/util/virtpm.h
index fb330effa8..1c8ee14d44 100644
--- a/src/util/virtpm.h
+++ b/src/util/virtpm.h
@@ -20,6 +20,8 @@
#pragma once
+/* clang-format off */
+
char *virTPMCreateCancelPath(const char *devpath) G_NO_INLINE;
char *virTPMGetSwtpm(void);
diff --git a/src/util/virtypedparam-public.c b/src/util/virtypedparam-public.c
index 5bd207d1e6..a5ddf9d0d5 100644
--- a/src/util/virtypedparam-public.c
+++ b/src/util/virtypedparam-public.c
@@ -17,11 +17,13 @@
*
*/
#include <config.h>
-#include "virtypedparam.h"
#include "viralloc.h"
#include "virerror.h"
#include "virstring.h"
+#include "virtypedparam.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c
index ae676d02fe..db19d3726b 100644
--- a/src/util/virtypedparam.c
+++ b/src/util/virtypedparam.c
@@ -20,14 +20,17 @@
*/
#include <config.h>
-#include "virtypedparam.h"
#include <stdarg.h>
+#include "virtypedparam.h"
+
#include "viralloc.h"
#include "virerror.h"
#include "virstring.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_ENUM_IMPL(virTypedParameter,
diff --git a/src/util/virtypedparam.h b/src/util/virtypedparam.h
index 936dac24ea..a0e6300615 100644
--- a/src/util/virtypedparam.h
+++ b/src/util/virtypedparam.h
@@ -24,6 +24,8 @@
#include "internal.h"
#include "virenum.h"
+/* clang-format off */
+
/**
* VIR_TYPED_PARAM_MULTIPLE:
*
diff --git a/src/util/viruri.c b/src/util/viruri.c
index 88bb0cc1f8..b71ba20bab 100644
--- a/src/util/viruri.c
+++ b/src/util/viruri.c
@@ -25,11 +25,13 @@
#include "viruri.h"
#include "viralloc.h"
-#include "virerror.h"
#include "virbuffer.h"
+#include "virerror.h"
#include "virlog.h"
#include "virstring.h"
+/* clang-format off */
+
#define VIR_FROM_THIS VIR_FROM_URI
VIR_LOG_INIT("util.uri");
diff --git a/src/util/viruri.h b/src/util/viruri.h
index 4f27fa26d2..007ac03707 100644
--- a/src/util/viruri.h
+++ b/src/util/viruri.h
@@ -23,6 +23,8 @@
#include "internal.h"
#include "virconf.h"
+/* clang-format off */
+
typedef struct _virURI virURI;
typedef struct _virURIParam virURIParam;
diff --git a/src/util/virusb.c b/src/util/virusb.c
index 9e6ec9c9cf..bc6338b562 100644
--- a/src/util/virusb.c
+++ b/src/util/virusb.c
@@ -23,16 +23,19 @@
#include <dirent.h>
#include <fcntl.h>
#include <inttypes.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
#include "virusb.h"
-#include "virlog.h"
+
+#include "viralloc.h"
#include "virerror.h"
#include "virfile.h"
+#include "virlog.h"
#include "virstring.h"
-#include "viralloc.h"
+
+/* clang-format off */
#define USB_SYSFS "/sys/bus/usb"
#define USB_ID_LEN 10 /* "1234 5678" */
diff --git a/src/util/virusb.h b/src/util/virusb.h
index d2b3f69942..4906b4571a 100644
--- a/src/util/virusb.h
+++ b/src/util/virusb.h
@@ -23,6 +23,8 @@
#include "internal.h"
#include "virobject.h"
+/* clang-format off */
+
#define USB_DEVFS "/dev/bus/usb/"
typedef struct _virUSBDevice virUSBDevice;
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 7e246d22d1..b98e9d78b2 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -23,9 +23,9 @@
#include <config.h>
-#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
+#include <unistd.h>
#ifdef WIN32
# include <conio.h>
@@ -38,22 +38,24 @@
#include <sys/types.h>
#ifdef WITH_GETPWUID_R
-# include <pwd.h>
# include <grp.h>
+# include <pwd.h>
#endif
#if WITH_CAPNG
# include <cap-ng.h>
# include <sys/prctl.h>
#endif
-#include "virerror.h"
-#include "virlog.h"
#include "viralloc.h"
-#include "virfile.h"
#include "vircommand.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
+#include "virsocket.h"
#include "virstring.h"
#include "virutil.h"
-#include "virsocket.h"
+
+/* clang-format off */
G_STATIC_ASSERT(sizeof(gid_t) <= sizeof(unsigned int) &&
sizeof(uid_t) <= sizeof(unsigned int));
diff --git a/src/util/virutil.h b/src/util/virutil.h
index ab8511bf8d..cb3b97c872 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -22,10 +22,12 @@
#pragma once
-#include "internal.h"
-#include <unistd.h>
#include <sys/types.h>
+#include <unistd.h>
+
+#include "internal.h"
+/* clang-format off */
int virSetBlocking(int fd, bool blocking) G_GNUC_WARN_UNUSED_RESULT;
int virSetNonBlock(int fd) G_GNUC_WARN_UNUSED_RESULT;
diff --git a/src/util/viruuid.c b/src/util/viruuid.c
index ca22c91d48..420dc943e3 100644
--- a/src/util/viruuid.c
+++ b/src/util/viruuid.c
@@ -20,18 +20,20 @@
#include <config.h>
-#include "viruuid.h"
-
#include <fcntl.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
+#include "viruuid.h"
+
#include "internal.h"
-#include "virlog.h"
#include "virfile.h"
+#include "virlog.h"
#include "virrandom.h"
+/* clang-format off */
+
VIR_LOG_INIT("util.uuid");
static unsigned char host_uuid[VIR_UUID_BUFLEN];
diff --git a/src/util/viruuid.h b/src/util/viruuid.h
index 9667bd3200..853c758e87 100644
--- a/src/util/viruuid.h
+++ b/src/util/viruuid.h
@@ -22,6 +22,7 @@
#include "internal.h"
+/* clang-format off */
/**
* VIR_UUID_DEBUG:
diff --git a/src/util/virvhba.c b/src/util/virvhba.c
index 5ceedc8076..80d202ddf0 100644
--- a/src/util/virvhba.c
+++ b/src/util/virvhba.c
@@ -18,12 +18,15 @@
#include <config.h>
+#include "virvhba.h"
+
#include "viralloc.h"
#include "virerror.h"
#include "virfile.h"
#include "virlog.h"
#include "virstring.h"
-#include "virvhba.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virvhba.h b/src/util/virvhba.h
index 1aecbf2b00..91c228bdaf 100644
--- a/src/util/virvhba.h
+++ b/src/util/virvhba.h
@@ -20,6 +20,8 @@
#include "internal.h"
+/* clang-format off */
+
enum {
VPORT_CREATE,
VPORT_DELETE,
diff --git a/src/util/virvsock.c b/src/util/virvsock.c
index 4bbbf78167..2e22fff0f7 100644
--- a/src/util/virvsock.c
+++ b/src/util/virvsock.c
@@ -25,11 +25,11 @@
# include <linux/vhost.h>
#endif
-#include "virvsock.h"
-
#include "virerror.h"
#include "virlog.h"
+#include "virvsock.h"
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/src/util/virvsock.h b/src/util/virvsock.h
index d6ba2faabf..62e8dbd961 100644
--- a/src/util/virvsock.h
+++ b/src/util/virvsock.h
@@ -18,6 +18,8 @@
#pragma once
+/* clang-format off */
+
int
virVsockSetGuestCid(int fd,
unsigned int guest_cid);
diff --git a/src/util/virxdrdefs.h b/src/util/virxdrdefs.h
index b6f6ad5a4d..081a1d862d 100644
--- a/src/util/virxdrdefs.h
+++ b/src/util/virxdrdefs.h
@@ -20,6 +20,8 @@
#pragma once
+/* clang-format off */
+
/* The portablexdr implementation lacks IXDR_PUT_U_INT32 and IXDR_GET_U_INT32
*/
#ifndef IXDR_PUT_U_INT32
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 870ba194b0..9794c273bc 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -20,21 +20,24 @@
#include <config.h>
+#include <libxml/xpathInternals.h>
+#include <math.h> /* for isnan() */
#include <stdarg.h>
-#include <math.h> /* for isnan() */
#include <sys/stat.h>
-#include <libxml/xpathInternals.h>
+#include "configmake.h"
-#include "virerror.h"
#include "virxml.h"
-#include "virbuffer.h"
+
#include "viralloc.h"
+#include "virbuffer.h"
+#include "virerror.h"
#include "virfile.h"
#include "virstring.h"
#include "virutil.h"
#include "viruuid.h"
-#include "configmake.h"
+
+/* clang-format off */
#define VIR_FROM_THIS VIR_FROM_XML
diff --git a/src/util/virxml.h b/src/util/virxml.h
index f19cbe59ae..4f1ab108b4 100644
--- a/src/util/virxml.h
+++ b/src/util/virxml.h
@@ -20,16 +20,17 @@
#pragma once
-#include "internal.h"
-
#include <libxml/parser.h>
+#include <libxml/relaxng.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
-#include <libxml/relaxng.h>
+#include "internal.h"
#include "virbuffer.h"
#include "virenum.h"
+/* clang-format off */
+
typedef enum {
VIR_XML_PROP_NONE = 0,
VIR_XML_PROP_REQUIRED = 1 << 0, /* Attribute may not be absent */
--
2.37.3