diff options
Diffstat (limited to 'src/usr/targeting/common/xmltohb/xmltohb.pl')
-rwxr-xr-x | src/usr/targeting/common/xmltohb/xmltohb.pl | 89 |
1 files changed, 58 insertions, 31 deletions
diff --git a/src/usr/targeting/common/xmltohb/xmltohb.pl b/src/usr/targeting/common/xmltohb/xmltohb.pl index e92bf598e..29727c403 100755 --- a/src/usr/targeting/common/xmltohb/xmltohb.pl +++ b/src/usr/targeting/common/xmltohb/xmltohb.pl @@ -2330,7 +2330,7 @@ namespace TARGETING * Array defining all attribute ids found that are of type hbMutex. * This file is autogenerated and should not be altered. */ -const uint32_t hbMutexAttrIds[] = { +const struct {uint32_t id; bool isRecursive;} hbMutexAttrIds[] = { VERBATIM my @mutexAttrIds; @@ -2340,22 +2340,30 @@ VERBATIM #check if hbmutex tag is present #check that attr is readable/writeable if( (exists $attribute->{simpleType}) - && (exists $attribute->{simpleType}->{hbmutex}) + && (exists $attribute->{simpleType}->{hbmutex} + || exists $attribute->{simpleType}->{hbrecursivemutex}) && (exists $attribute->{readable}) && (exists $attribute->{writeable})) { - push @mutexAttrIds, $attribute->{id}; + my $recursiveType = "false"; + if (exists $attribute->{simpleType}->{hbrecursivemutex}) + { + $recursiveType = "true"; + } + + push @mutexAttrIds, ([ $attribute->{id}, $recursiveType ]); } } # variables that can be used for writing the enums to the file my $attrId; my $hexVal; + my $recursiveVal; # Format below intentionally > 80 chars for clarity format ATTRMUTEXFORMAT = - @>>>>>>>>>> - $hexVal ."," + @>>>>>>>>>>>>>>>>>>>> + "{ ". $hexVal .", ". $recursiveVal ." }," . select($outFile); $~ = 'ATTRMUTEXFORMAT'; @@ -2368,7 +2376,9 @@ VERBATIM $attrId = $enumerator->{name}; foreach my $mutexAttrId (@mutexAttrIds) { - if( $mutexAttrId eq $attrId ) + $recursiveVal = $mutexAttrId->[1]; + + if( $mutexAttrId->[0] eq $attrId ) { write; last; @@ -2494,7 +2504,8 @@ sub writeTraitFileTraits { # Mark the attribute as being a host boot mutex or non-host boot mutex if( (exists $attribute->{simpleType}) - && (exists $attribute->{simpleType}->{hbmutex}) ) + && (exists $attribute->{simpleType}->{hbmutex} + || exists $attribute->{simpleType}->{hbrecursivemutex}) ) { $traits .= " hbMutex,"; } @@ -2751,6 +2762,7 @@ sub writeAttrErrlCFile { !(exists $attribute->{writeable}) || # read-only attributes (exists $attribute->{simpleType} && ( (exists $attribute->{simpleType}->{hbmutex}) || + (exists $attribute->{simpleType}->{hbrecrusivemutex}) || (exists $attribute->{simpleType}->{fspmutex}))) # mutex attributes ) { print $outFile " case (ATTR_",$attribute->{id},"): { break; }\n"; @@ -2923,6 +2935,7 @@ sub writeAttrErrlCFile { !(exists $attribute->{writeable}) || # read-only attributes (exists $attribute->{simpleType} && ( (exists $attribute->{simpleType}->{hbmutex}) || + (exists $attribute->{simpleType}->{hbrecursivemutex}) || (exists $attribute->{simpleType}->{fspmutex}))) # mutex attributes ) { next; @@ -3040,6 +3053,7 @@ sub writeAttrErrlHFile { !(exists $attribute->{writeable}) || # read-only attributes (exists $attribute->{simpleType} && ( (exists $attribute->{simpleType}->{hbmutex}) || + (exists $attribute->{simpleType}->{hbrecursivemutex}) || (exists $attribute->{simpleType}->{fspmutex}))) # mutex attributes ) { print $outFile " //not readable\n"; @@ -3069,7 +3083,7 @@ sub writeAttrErrlHFile { } } # makes no sense to dump mutex attributes, so skipping - elsif(exists $attribute->{simpleType} && (exists $attribute->{simpleType}->{hbmutex}) ) { + elsif(exists $attribute->{simpleType} && (exists $attribute->{simpleType}->{hbmutex}) || (exists $attribute->{simpleType}->{hbrecursivemutex}) ) { print $outFile " //Mutex attributes - skipping\n"; } # makes no sense to dump fsp mutex attributes, so skipping @@ -4880,6 +4894,7 @@ sub simpleTypeProperties { $typesHoH{"uint64_t"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 1, typeName => "uint64_t" , bytes => 8, bits => 64, default => \&defaultZero , alignment => 1, specialPolicies =>\&null, packfmt =>\&pack8byte}; $typesHoH{"enumeration"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 0, typeName => "XMLTOHB_USE_PARENT_ATTR_ID" , bytes => 0, bits => 0 , default => \&defaultEnum , alignment => 1, specialPolicies =>\&null, packfmt => "packEnumeration"}; $typesHoH{"hbmutex"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 0, typeName => "mutex_t*" , bytes => 24, bits => 192, default => \&defaultZero , alignment => 8, specialPolicies =>\&enforceHbMutex, packfmt =>\&packMutex}; + $typesHoH{"hbrecursivemutex"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 0, typeName => "mutex_t*" , bytes => 24, bits => 192, default => \&defaultZero , alignment => 8, specialPolicies =>\&enforceHbMutex, packfmt =>\&packMutex}; $typesHoH{"Target_t"} = { supportsArray => 0, canBeHex => 1, complexTypeSupport => 0, typeName => "TARGETING::Target*" , bytes => 8, bits => 64, default => \&defaultZero , alignment => 8, specialPolicies =>\&null, packfmt =>\&pack8byte}; $typesHoH{"fspmutex"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 0, typeName => "util::Mutex*" , bytes => 8, bits => 64, default => \&defaultZero , alignment => 8, specialPolicies =>\&enforceFspMutex, packfmt =>\&pack8byte}; @@ -5038,33 +5053,45 @@ sub mergeComplexAttributeFields { # the two fields. my $mergedFields = dclone $currentAttrFields; - # Iterate over the fields of $newField and look for their corresponding id - # in $currentAttrFields. All the fields in $newField should exist in - # $currentAttrFields, if not, then there is a problem - foreach my $newField (@{$newAttrFields->{default}->{field}}) + # If the merged field's (an alias for the current attribute fields) + # hash is empty, then just assign it the new attribute field's value - + # no merge necessary + if ($mergedFields->{default} == 0) { - my $foundField = 0; - - # Iterate over $mergedFields (really $currentAttrFields) looking - # for the $newField of $newAttrFields - foreach my $currentField (@{$mergedFields->{default}->{field}}) + $mergedFields->{default} = $newAttrFields->{default}; + } + # Only proceed if both attribute pairs have values to merge + elsif ($newAttrFields->{default} != 0) + { + # Iterate over the fields of $newField and look for their corresponding + # id in $currentAttrFields. All the fields in $newField should exist in + # $currentAttrFields, if not, then there is a problem + foreach my $newField (@{$newAttrFields->{default}->{field}}) { - # Found the field in question - if ($currentField->{id} eq $newField->{id}) + my $foundField = 0; + + # Iterate over $mergedFields (really $currentAttrFields) looking + # for the $newField of $newAttrFields + foreach my $currentField (@{$mergedFields->{default}->{field}}) { - # Merge in the new value from $newField - $currentField->{value} = $newField->{value}; - $foundField = 1; - last; - } - } # end foreach my $currentField ... + # Found the field in question + if ($currentField->{id} eq $newField->{id}) + { + # Merge in the new value from $newField + $currentField->{value} = $newField->{value}; + $foundField = 1; + last; + } + } # end foreach my $currentField ... - # A field was not found ... halt execution - if ($foundField == 0) - { - croak("Field $newField is not supported.") - } - } # end foreach my $newField ... + # A field was not found ... halt execution + if ($foundField == 0) + { + croak("Field $newField is not supported.") + } + } # end foreach my $newField ... + } + # else new attribute fields is empty - nothing to merge return $mergedFields; } |