On Sep 24, 2013, at 9:05 PM, Ben Pfaff <[email protected]> wrote:
> On Tue, Sep 24, 2013 at 07:48:55PM -0700, Jarno Rajahalme wrote:
>>
>> On Sep 24, 2013, at 5:10 PM, Ben Pfaff <[email protected]> wrote:
>>> On Wed, Sep 18, 2013 at 01:42:41PM -0700, Jarno Rajahalme wrote:
>>> I slightly prefer %# over 0x% in the following cases, because 0 looks
>>> a little less silly than 0x0:
>>
>> "%#03" would print zero as "000". My intent was to output the flags as
>> "0xXXX", where "XXX" are hex digits corresponding to the 12 flags bits, so
>> at to make the width of the flags field explicit.
>> However, if you think the flags should be printed without zero padding in
>> the front, I'm more than happy to change this as you suggested.
>
> Do we zero-pad other fields? I don't usually favor that kind of
> formatting. Do you think that it is especially important for this
> field?
>
I think I took cue from other fields, like:
} else if (wc->masks.vlan_tci == htons(0xffff)) {
ds_put_format(s, "vlan_tci=0x%04"PRIx16",", ntohs(f->vlan_tci));
} else {
ds_put_format(s, "vlan_tci=0x%04"PRIx16"/0x%04"PRIx16",",
ntohs(f->vlan_tci), ntohs(wc->masks.vlan_tci));
}
and
if (!skip_type && wc->masks.dl_type) {
ds_put_format(s, "dl_type=0x%04"PRIx16",", ntohs(f->dl_type));
}
and
if (wc->masks.ipv6_label) {
if (wc->masks.ipv6_label == OVS_BE32_MAX) {
ds_put_format(s, "ipv6_label=0x%05"PRIx32",",
ntohl(f->ipv6_label));
} else {
ds_put_format(s, "ipv6_label=0x%05"PRIx32"/0x%05"PRIx32",",
ntohl(f->ipv6_label),
ntohl(wc->masks.ipv6_label));
}
}
I do not have a strong opinion about this, though.
Jarno
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev