Renee Danson Sommerfeld wrote:
>> code review requested for:
>>
>> 11927 - walkprop shows properties that should be skipped
>> http://defect.opensolaris.org/bz/show_bug.cgi?id=11927
>>
>> http://zhadum.east/export/ws/am223141/temp/nwam1-work/webrev/
>>
> This one makes me a little nervous, given that it's fairly complicated
> logic and recursion is now in the picture. Are we certain that there
> are clear stopping points for the recursion?
>
yes, the recursion always stops. I'll illustrate with an example:
Take the "default-domain" property from the
loc_prop_display_entry_table. It has two rules:
{ NWAM_LOC_PROP_DEFAULT_DOMAIN, NWAM_LOC_PROP_NIS_NAMESERVICE_CONFIGSRC,
{ NWAM_CONFIGSRC_MANUAL, -1 } },
{ NWAM_LOC_PROP_DEFAULT_DOMAIN,
NWAM_LOC_PROP_LDAP_NAMESERVICE_CONFIGSRC,
{ NWAM_CONFIGSRC_MANUAL, -1 } },
For the "default-domain property, the "nis-nameservice-configsrc"
property is checked to see if it is "manual". Let's say, its not, so
show_prop in line 2340 is false. The same applies if
ldap-nameservice-configsrc is not "manual".
Now, let's say "nis-nameservice-configsrc" is set to "manual". Then,
show_prop is true in line 2340, so we call show_prop_test() with
nis-nameservice-configsrc, which has the following rule:
{ NWAM_LOC_PROP_NIS_NAMESERVICE_CONFIGSRC, NWAM_LOC_PROP_NAMESERVICES,
{ NWAM_NAMESERVICES_NIS, -1 } },
"nameservices" property is checked to see if it contains "nis". If it
doesn't contain "nis", then show_prop_test() returns B_FALSE (from line
2351). The first call to show_prop_test() returns this same value. If
"nameservices" contains "nis", then show_prop_test() is called with
"nameservices".
"nameservices" property does not contain a rule. So, prop_found for it
is B_FALSE and thus, it returns B_TRUE (line 2353), which is returned by
show_prop_test() for "nis-nameservice-configsrc", which is returned by
show_prop_test() for "default-domain".
The recursion occurs only if the rules say the property being checked
must be displayed.
At some point in the recursion, the property does not exist in the
table, in which case the recursion stops. Also, the rules may say that
the property should not be displayed and the recursion stops.
Anurag