Looks good to me, Acked-by: Alex Wang <[email protected]>
On Wed, Mar 19, 2014 at 4:03 PM, Ben Pfaff <[email protected]> wrote: > MSVC 2013 finally implements them, 14 years after they became part of C, > so we can use them in generic code now. > > Signed-off-by: Ben Pfaff <[email protected]> > --- > CodingStyle | 9 ++++----- > lib/odp-util.c | 11 +++++------ > ofproto/ofproto-dpif-xlate.c | 10 +++++----- > 3 files changed, 14 insertions(+), 16 deletions(-) > > diff --git a/CodingStyle b/CodingStyle > index 6ac0316..bae8cd6 100644 > --- a/CodingStyle > +++ b/CodingStyle > @@ -515,8 +515,7 @@ global variables. > > C DIALECT > > - Some C99 features are OK because they are widely implemented even in > -older compilers: > + Some C99 features are OK because they are widely implemented: > > * Flexible array members (e.g. struct { int foo[]; }). > > @@ -531,12 +530,12 @@ older compilers: > only take on the values 0 or 1, because this behavior can't be > simulated on C89 compilers. > > + * Designated initializers (e.g. "struct foo foo = {.a = 1};" and > + "int a[] = {[2] = 5};"). > + > Don't use other C99 features that are not widely implemented in > older compilers: > > - * Don't use designated initializers (e.g. don't write "struct foo > - foo = {.a = 1};" or "int a[] = {[2] = 5};"). > - > * Don't mix declarations and code within a block. > > * Don't use declarations in iteration statements (e.g. don't write > diff --git a/lib/odp-util.c b/lib/odp-util.c > index 463f008..5cc2757 100644 > --- a/lib/odp-util.c > +++ b/lib/odp-util.c > @@ -149,9 +149,8 @@ static void > format_odp_sample_action(struct ds *ds, const struct nlattr *attr) > { > static const struct nl_policy ovs_sample_policy[] = { > - { NL_A_NO_ATTR, 0, 0, false }, /* OVS_SAMPLE_ATTR_UNSPEC */ > - { NL_A_U32, 0, 0, false }, /* OVS_SAMPLE_ATTR_PROBABILITY */ > - { NL_A_NESTED, 0, 0, false }, /* OVS_SAMPLE_ATTR_ACTIONS */ > + [OVS_SAMPLE_ATTR_PROBABILITY] = { .type = NL_A_U32 }, > + [OVS_SAMPLE_ATTR_ACTIONS] = { .type = NL_A_NESTED } > }; > struct nlattr *a[ARRAY_SIZE(ovs_sample_policy)]; > double percentage; > @@ -255,9 +254,9 @@ static void > format_odp_userspace_action(struct ds *ds, const struct nlattr *attr) > { > static const struct nl_policy ovs_userspace_policy[] = { > - { NL_A_NO_ATTR, 0, 0, false }, /* OVS_USERSPACE_ATTR_UNSPEC */ > - { NL_A_U32, 0, 0, false }, /* OVS_USERSPACE_ATTR_PID */ > - { NL_A_UNSPEC, 0, 0, true }, /* OVS_USERSPACE_ATTR_USERDATA */ > + [OVS_USERSPACE_ATTR_PID] = { .type = NL_A_U32 }, > + [OVS_USERSPACE_ATTR_USERDATA] = { .type = NL_A_UNSPEC, > + .optional = true }, > }; > struct nlattr *a[ARRAY_SIZE(ovs_userspace_policy)]; > const struct nlattr *userdata_attr; > diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c > index 1ff80d9..d0b1f47 100644 > --- a/ofproto/ofproto-dpif-xlate.c > +++ b/ofproto/ofproto-dpif-xlate.c > @@ -201,9 +201,11 @@ struct xlate_ctx { > * it did not arrive on a "real" port. 'ofpp_none_bundle' exists for > * when an input bundle is needed for validation (e.g., mirroring or > * OFPP_NORMAL processing). It is not connected to an 'ofproto' or have > - * any 'port' structs, so care must be taken when dealing with it. > - * The bundle's name and vlan mode are initialized in > lookup_input_bundle() */ > -static struct xbundle ofpp_none_bundle; > + * any 'port' structs, so care must be taken when dealing with it. */ > +static struct xbundle ofpp_none_bundle = { > + .name = "OFPP_NONE", > + .vlan_mode = PORT_VLAN_TRUNK > +}; > > /* Node in 'xport''s 'skb_priorities' map. Used to maintain a map from > * 'priority' (the datapath's term for QoS queue) to the dscp bits which > all > @@ -894,8 +896,6 @@ lookup_input_bundle(const struct xbridge *xbridge, > ofp_port_t in_port, > /* Special-case OFPP_NONE, which a controller may use as the ingress > * port for traffic that it is sourcing. */ > if (in_port == OFPP_NONE) { > - ofpp_none_bundle.name = "OFPP_NONE"; > - ofpp_none_bundle.vlan_mode = PORT_VLAN_TRUNK; > return &ofpp_none_bundle; > } > > -- > 1.7.10.4 > > _______________________________________________ > dev mailing list > [email protected] > http://openvswitch.org/mailman/listinfo/dev >
_______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
