[virt-tools-list] [PATCH 00/47] Restructure libosinfo codebase

Daniel P. Berrange berrange at redhat.com
Wed Aug 25 19:36:55 UTC 2010


This (huge) patch series updates libosinfo to more closely follow
common GLib/GObject design practice/coding standards.

The bulk of this is re-engineering the public API and object
relationships. The current code has created separate objects and
classes for all major functional items, but the private data
for each object is not kept private. Instead every object's
internals are fully exposed to every other object. This is a
serious burden for further development, because any change to
an object ripples through the entire codebase and alot of the
resulting problems can't be caught by the compile type checker.
At the end of the series, every object's internals are fully
private. All changes / queries of object state are done via
formal public APIs.

Style wise, the API naming convention is change from mixedCaps()
to lower_case_with_underscores(). This is the standard GObject
style and is expected by tools such as the GObject introspection
code scanner. Nearly all uses of GError have been removed since
they were being used for reporting coding errors. GLib recommends
against this usage, as GError only intended for runtime errors
that can be recovered from.

pkgconfig integration has been added and RPM builds provided
for native RPMs and Mingw32 RPMs. The library now has ELF
versioning and versioning of individual symbols. Every source
file has had the LGPLv2+ license header added. More GCC warnings
are now enabled and the code compiles cleanly with all warnings
enabled.

Finally, initial support for GObject Introspection is included.
This consists of generating the GIR and TypeLib files. Before
this can seriously be used though, the API needs to be audited
to ensure the calling conventions are correct. ie who owns
object reference counts on parameters & return values.

The big todo item is better unit testing of each object. With
the cleaned up code structure & relationships between objects,
it should be quite straightforward to exhaustively test every
codepath.

The diffstat doesn't show it, because of the addition of many
lines of license header comment, but the number of lines of
code is actually significantly reduced at the end of this
series.

Daniel





More information about the virt-tools-list mailing list