]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: add virendian.h macros
authorEric Blake <eblake@redhat.com>
Fri, 8 Feb 2013 23:44:21 +0000 (16:44 -0700)
committerEric Blake <eblake@redhat.com>
Tue, 12 Feb 2013 16:00:15 +0000 (09:00 -0700)
commitc6f1060ca7d51e70228718ceee4bba7bfbad6a38
tree943b6c135d95aebea9783dba1739d746b67fc421
parentd1c7b00b60a4e4fa3d336a945e4710a10997ded0
util: add virendian.h macros

We have several cases where we need to read endian-dependent
data regardless of host endianness; rather than open-coding
these call sites, it will be nicer to funnel things through
a macro.

The virendian.h file can be expanded to add writer functions,
and/or 16-bit access patterns, if needed.  Also, if we need
to turn things into a function to avoid multiple evaluations
of buf, that can be done later.  But for now, a macro worked.

* src/util/virendian.h: New file.
* src/Makefile.am (UTIL_SOURCES): Ship it.
* tests/virendiantest.c: New test.
* tests/Makefile.am (test_programs, virendiantest_SOURCES): Run
the test.
* .gitignore: Ignore built file.
.gitignore
src/Makefile.am
src/util/virendian.h [new file with mode: 0644]
tests/Makefile.am
tests/virendiantest.c [new file with mode: 0644]