Feature #11960

Add topo module and hdl api for freeing string array

Added by Rob Johnston 5 months ago. Updated 4 months ago.

Start date:
Due date:
% Done:


Estimated time:


There are a number of one-off implementations of routines for free'ing a string array scattered across libtopo - all of which are basically identical. This is a sign that this should be promoted to a module API. So this CR is to add such an interface and replace all the one-offs with it.

This would add two new interfaces:

topo_mod_strfreev(topo_mod_t *mod, char **strarr, uint_t nelem)

topo_hdl_strfreev(topo_hdl_t *thp, char **strarr, uint_t nelem)

Note. This change has already been made downstream in illumos-joyent via the following commit:

commit b4f12da28f2cbdf1900e7fa9d5cd12c565501fc8
Author: Rob Johnston <>
Date:   Sat Jun 1 01:57:43 2019 +0000

    OS-6707 Add topo module and hdl api for freeing string array
    Reviewed by: Jordan Hendricks <>
    Approved by: Joshua M. Clulow <>

So this ticket is simply to track porting the above commit upstream.



Updated by Rob Johnston 4 months ago


Did a full debug build and made sure there were no compiler warnings. Also verified that the changes were pbchk and smatch-clean.

Built a PI with this change and then booted it on a handful of systems in the Joyent lab and then manually inspected the output of "fmtopo -V" to verify that topo snapshots were still being created correctly. Generating a topo snapshot exercises all of the changed code with the exception of the change to platform-mem/mem.c, which is sparc only.

To sanity check the upstream port, I installed an openindiana system with this fix using onu and compared the topo snapshot with and without the fix and verified there were no differences.


Updated by Electric Monk 4 months ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit e2336878c3b2087bcf5c52436847f37afaec8666

commit  e2336878c3b2087bcf5c52436847f37afaec8666
Author: Rob Johnston <>
Date:   2019-11-23T22:03:25.000Z

    11960 Add topo module and hdl api for freeing string array
    Reviewed by: Jordan Hendricks <>
    Reviewed by: Matthias Scheler <>
    Approved by: Robert Mustacchi <>

Also available in: Atom PDF