Page MenuHomeFreeBSD

Document the formatting requirements of location of pnpinfo strings.
ClosedPublic

Authored by jhb on May 6 2016, 6:43 PM.
Tags
None
Referenced Files
F106135592: D6252.diff
Wed, Dec 25, 11:55 PM
Unknown Object (File)
Nov 21 2024, 1:30 PM
Unknown Object (File)
Nov 8 2024, 1:28 AM
Unknown Object (File)
Nov 7 2024, 5:16 PM
Unknown Object (File)
Nov 5 2024, 3:45 AM
Unknown Object (File)
Nov 1 2024, 3:20 PM
Unknown Object (File)
Oct 18 2024, 7:45 PM
Unknown Object (File)
Oct 2 2024, 5:35 AM
Subscribers
None

Details

Summary

Document the formatting requirements of location and pnpinfo strings.

devd requires location and pnpinfo strings generated by bus drivers
to be formatted as a list of name=value keypairs. Non-conforming
bus drivers cause devd to mis-parse device events for these buses.

For example, PCI bus events have been broken since the location string
was changed to use a bare 'pciD.B.S.F' as the location string.

Test Plan
  • try to create a devd script to load if_ral when inserting a ral pci-express card and realize devd doesn't parse any variables out of the nomatch event via devd -d

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 3774
Build 3817: arc lint + arc unit

Event Timeline

jhb retitled this revision from to Document the formatting requirements of location of pnpinfo strings..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added a reviewer: imp.
sys/kern/bus_if.m
541

The parser recognizes \" as an escape. PC Card uses this. If devd's parser is broken, then we need to fix it.

568

See above.

sys/kern/bus_if.m
541

Which PC-Card parser, one in pccardd? devd's parser (which is the only one I'm aware of for these strings) is:

bool
config::chop_var(char *&buffer, char *&lhs, char *&rhs) const
{
   ...
        walker++;               // skip =
        if (*walker == '"') {
                walker++;       // skip "
                rhs = walker;
                while (*walker && *walker != '"')
                        walker++;
                if (*walker != '"')
                        return (false);
                rhs[-2] = '\0';
                *walker++ = '\0';

Once that sees the first '"' in the value it just eats everything up to the second '"'. It does not check if the '"' was preceded by a '\'.

sys/kern/bus_if.m
541

Then I need to fix that. The PC Card bus code currently quotes the " with \ when it encounters them.

sys/kern/bus_if.m
541

Ah, I see. All the more reason to have some methods in libdevinfo to parse these out perhaps. :) (By which I mean methods that accept the string as input and return an nvlist as output. devd could map the nvlist into the vector it uses, or it could just use the nvlist directly perhaps)

sys/kern/bus_if.m
541

Hmm, devctl_safe_quote() also needs to escape any '\' characters. Otherwise you can't have a '\' at the end of a value.

This revision was automatically updated to reflect the committed changes.