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
Unknown Object (File)
Mar 11 2024, 8:46 PM
Unknown Object (File)
Dec 19 2023, 7:32 PM
Unknown Object (File)
Nov 30 2023, 7:15 AM
Unknown Object (File)
Nov 10 2023, 11:14 PM
Unknown Object (File)
Nov 10 2023, 12:41 AM
Unknown Object (File)
Nov 6 2023, 7:26 PM
Unknown Object (File)
Nov 5 2023, 6:16 PM
Unknown Object (File)
Nov 5 2023, 10:41 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 Not Applicable
Unit
Tests Not Applicable

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 ↗(On Diff #15990)

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

568 ↗(On Diff #15990)

See above.

sys/kern/bus_if.m
541 ↗(On Diff #15990)

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 ↗(On Diff #15990)

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 ↗(On Diff #15990)

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 ↗(On Diff #15990)

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.