aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2008-05-23 08:24:41 +0000
committerRichard W.M. Jones <rjones@redhat.com>2008-05-23 08:24:41 +0000
commit1d8d4f86b6f8594b67fdb5da3fbe2c6dbbc95cf2 (patch)
tree7d2e79d2960fddc5ed4f25586557f38c6c4d9a5d /HACKING
parentFix type-punning warning in remote code. (diff)
downloadlibvirt-1d8d4f86b6f8594b67fdb5da3fbe2c6dbbc95cf2.tar.gz
libvirt-1d8d4f86b6f8594b67fdb5da3fbe2c6dbbc95cf2.tar.bz2
libvirt-1d8d4f86b6f8594b67fdb5da3fbe2c6dbbc95cf2.zip
Standardize use of header files, making internal.h primary.
* qemud/internal.h, qemud/qemud.h: Rename this file so it doesn't conflict with src/internal.h. * HACKING: Document how header files should be used. * qemud/Makefile.am: Add src/ directory to includes. * qemud/event.c, qemud/mdns.c, qemud/qemud.c, qemud/remote.c, qemud/remote_protocol.c, qemud/remote_protocol.h, qemud/remote_protocol.x, src/buf.c, src/libvirt.c, src/nodeinfo.c, src/qemu_conf.c, src/qemu_driver.c, src/stats_linux.c, src/storage_backend.c, src/storage_backend_fs.c, src/storage_backend_iscsi.c, src/storage_backend_logical.c, src/storage_conf.c, src/storage_driver.c, src/util.c, src/util.h, src/virsh.c, src/virterror.c, src/xend_internal.c, src/xml.c, tests/reconnect.c, tests/xmlrpctest.c, tests/qparamtest.c: Standardize use of header files. * docs/*, po/*: Rebuild docs.
Diffstat (limited to 'HACKING')
-rw-r--r--HACKING41
1 files changed, 41 insertions, 0 deletions
diff --git a/HACKING b/HACKING
index e780ce779..c4ec6ca03 100644
--- a/HACKING
+++ b/HACKING
@@ -158,3 +158,44 @@ eg typical usage is as follows:
return virBufferContentAndReset(&buf);
}
+
+
+Include files
+=============
+
+There are now quite a large number of include files, both libvirt
+internal and external, and system includes. To manage all this
+complexity it's best to stick to the following general plan for all
+*.c source files:
+
+ /*
+ * Copyright notice
+ * ....
+ * ....
+ * ....
+ *
+ */
+
+ #include <config.h> Must come first in every file.
+
+ #include <stdio.h> Any system includes you need.
+ #include <string.h>
+ #include <limits.h>
+
+ #if HAVE_NUMACTL Some system includes aren't supported
+ #include <numa.h> everywhere so need these #if defences.
+ #endif
+
+ #include "internal.h" Include this first, after system includes.
+
+ #include "util.h" Any libvirt internal header files.
+ #include "buf.h"
+
+ static myInternalFunc () The actual code.
+ {
+ ...
+
+Of particular note: *DO NOT* include libvirt/libvirt.h or
+libvirt/virterror.h. It is included by "internal.h" already and there
+are some special reasons why you cannot include these files
+explicitly. \ No newline at end of file