Skip to content

Commit

Permalink
[meta] Skip objects on (de)serialize acl field data mask (opencompute…
Browse files Browse the repository at this point in the history
…project#1273)

Mask is special, since it's combined with field data, but there is not field corresponded to object or object list so we can skip, them in serialize and deserialize
  • Loading branch information
kcudnik committed Jul 7, 2021
1 parent bf36303 commit e637f8a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions meta/serialize.pm
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,22 @@ sub EmitSerializeHeader
WriteSource "EMIT(\"{\");\n";
}

sub WriteSkipForMask
{
# mask is special, since it's combined with field data, but there
# is not field corresponded to object or object list so we can skip
# them in serialize and deserialize

WriteSource "else if (meta->attrvaluetype == SAI_ATTR_VALUE_TYPE_ACL_FIELD_DATA_OBJECT_ID)";
WriteSource "{";
WriteSource "/* skip */";
WriteSource "}";
WriteSource "else if (meta->attrvaluetype == SAI_ATTR_VALUE_TYPE_ACL_FIELD_DATA_OBJECT_LIST)";
WriteSource "{";
WriteSource "/* skip */";
WriteSource "}";
}

sub EmitSerializeFooter
{
my $refStructInfoEx = shift;
Expand All @@ -463,6 +479,8 @@ sub EmitSerializeFooter
{
my $name = $refStructInfoEx->{name};

WriteSkipForMask() if $name eq "sai_acl_field_data_mask_t";

# NOTE: if it's union, we must check if we serialized something
# (not always true for acl mask)

Expand Down Expand Up @@ -1061,6 +1079,8 @@ sub EmitDeserializeFooter
{
my $name = $refStructInfoEx->{name};

WriteSkipForMask() if $name eq "sai_acl_field_data_mask_t";

# if it's union, we must check if we serialized something
# (not always true for acl mask)

Expand Down

0 comments on commit e637f8a

Please sign in to comment.