<br><tt><font size=2>"Daniel P. Berrange" <berrange@redhat.com>
wrote on 02/08/2010 11:59:52 AM:<br>
</font></tt>
<br><tt><font size=2>> <br>
> Please respond to "Daniel P. Berrange"</font></tt>
<br><tt><font size=2>> <br>
> On Thu, Feb 04, 2010 at 08:02:42AM -0500, Stefan Berger wrote:<br>
> > This part adds support to domain_conf.{c|h} for parsing the new<br>
> > interface XML of type 'direct'.<br>
> > <br>
> > Signed-off-by: Stefan Berger <stefanb@us.ibm.com><br>
> <br>
> > Index: libvirt-macvtap/src/conf/domain_conf.c<br>
> > ===================================================================<br>
> > --- libvirt-macvtap.orig/src/conf/domain_conf.c<br>
> > +++ libvirt-macvtap/src/conf/domain_conf.c<br>
> > @@ -41,6 +41,7 @@<br>
> >  #include "c-ctype.h"<br>
> >  #include "logging.h"<br>
> >  #include "network.h"<br>
> > +#include "macvtap.h"<br>
> >  <br>
> >  #define VIR_FROM_THIS VIR_FROM_DOMAIN<br>
> >  <br>
> > @@ -140,7 +141,8 @@ VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_N<br>
> >                "mcast",<br>
> >                "network",<br>
> >                "bridge",<br>
> > -              "internal")<br>
> > +              "internal",<br>
> > +              "direct")<br>
> >  <br>
> >  VIR_ENUM_IMPL(virDomainChrTarget, VIR_DOMAIN_CHR_TARGET_TYPE_LAST,<br>
> >                "null",<br>
> > @@ -222,6 +224,12 @@ VIR_ENUM_IMPL(virDomainSeclabel, VIR_DOM<br>
> >                "dynamic",<br>
> >                "static")<br>
> >  <br>
> > +VIR_ENUM_IMPL(virDomainNetdevMacvtap, VIR_DOMAIN_NETDEV_MACVTAP_MODE_LAST,<br>
> > +              MACVTAP_MODE_PRIVATE_STR,<br>
> > +              MACVTAP_MODE_VEPA_STR,<br>
> > +              MACVTAP_MODE_BRIDGE_STR)<br>
> <br>
> These strings should really be included here directly - other areas<br>
> of the code should only ever see the parsed enum integer value, never<br>
> the string form which is for the XML only.</font></tt>
<br>
<br><tt><font size=2>Ok. The reason why I did not use the returned 'int's
is because the translated value will be passed to the driver and linux/if_link.h
unfortunately defines those as follows:</font></tt>
<br>
<br><tt><font size=2>enum macvlan_mode {</font></tt>
<br><tt><font size=2>        MACVLAN_MODE_PRIVATE =
1,</font></tt>
<br><tt><font size=2>        MACVLAN_MODE_VEPA  
 = 2,</font></tt>
<br><tt><font size=2>        MACVLAN_MODE_BRIDGE  =
4,</font></tt>
<br><tt><font size=2>};</font></tt>
<br>
<br><tt><font size=2>Should I use those values in the array and fill the
0 and 3 with dummy values or have another function that translates the
ones returned by the XYZTypeFromString() call in the actual 'enum macvlan_mode'?</font></tt>
<br>
<br><tt><font size=2>   Stefan</font></tt>
<br>