]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: utility functions for virNetDevVPortProfile
authorLaine Stump <laine@laine.org>
Sat, 4 Aug 2012 07:09:47 +0000 (03:09 -0400)
committerLaine Stump <laine@laine.org>
Tue, 14 Aug 2012 19:47:20 +0000 (15:47 -0400)
commit1c02ed14217f383a77d16c24310503ff165292f2
treec40767364483102fc025fcfea8b8f578f074b075
parent8450d7b20c8099d724676aef128b4c391cbb6d0a
util: utility functions for virNetDevVPortProfile

This patch adds three utility functions that operate on
virNetDevVPortProfile objects.

* virNetDevVPortProfileCheckComplete() - verifies that all attributes
    required for the type of the given virtport are specified.

* virNetDevVPortProfileCheckNoExtras() - verifies that there are no
    attributes specified which are inappropriate for the type of the
    given virtport.

* virNetDevVPortProfileMerge3() - merges 3 virtports into a single,
    newly allocated virtport. If any attributes are specified in
    more than one of the three sources, and do not exactly match,
    an error is logged and the function fails.

These new functions depend on new fields in the virNetDevVPortProfile
object that keep track of whether or not each attribute was
specified. Since the higher level parse function doesn't yet set those
fields, these functions are not actually usable yet (but that's okay,
because they also aren't yet used - all of that functionality comes in
a later patch.)

Note that these three functions return 0 on success and -1 on
failure. This may seem odd for the first two Check functions, since
they could also easily return true/false, but since they actually log
an error when the requested condition isn't met (and should result in
a failure of the calling function), I thought 0/-1 was more
appropriate.
src/libvirt_private.syms
src/util/virnetdevvportprofile.c
src/util/virnetdevvportprofile.h