On 2022-01-10 2:18 a.m., Jonathan Gray wrote:
On Sat, Jan 08, 2022 at 01:43:32PM -0700, Ted Bullock wrote:
The manpage incorrectly describes the behaviour and usage of
pci_mapreg_probe(9). This function does not return 0 for success and !0
for failure as described in the manual, see the diff below for a
possible re-wording and corrected description.

I agree the return value is wrong but your description introduces an
error in that type bits can contain PCI_MAPREG_MEM_TYPE_64BIT for example.
Which is something that the pci_mapreg_type text also gets wrong.

How about this to start with?

It certainly corrects the mechanical issue with the returns, it doesn't help though with understanding how to use the function correctly though. Under what circumstances will the type bits get set as you indicate? I wasn't at all clear about that from peering through the call tree.

Anyway it's certainly a weakness of the document. This at least stops the error from the return values.


Index: pci_mapreg_map.9
===================================================================
RCS file: /cvs/src/share/man/man9/pci_mapreg_map.9,v
retrieving revision 1.1
diff -u -p -r1.1 pci_mapreg_map.9
--- pci_mapreg_map.9    23 Feb 2019 04:54:25 -0000      1.1
+++ pci_mapreg_map.9    10 Jan 2022 09:13:30 -0000
@@ -135,12 +135,14 @@ referenced by
  .Fa reg .
  .Sh RETURN VALUES
  .Nm pci_mapreg_map ,
-.Nm pci_mapreg_info ,
  and
-.Nm pci_mapreg_probe
+.Nm pci_mapreg_info
  return 0 on success, or an
  .Xr errno 2
  style value on failure.
+.Pp
+.Nm pci_mapreg_probe
+returns 1 if if the BAR is implemented, 0 if not.
  .Pp
  .Nm pci_mapreg_type
  returns either

--
Ted Bullock <tbull...@comlore.com>

Reply via email to