libtopo: add API for doing deep copy of a topo_list
Review Request #2470 — Created Dec. 10, 2019 and submitted
Libtopo provides a set of typedefs and interfaces for managing and iterating over doubly-linked lists (topo_list). This ticket to cover the work to add a new interface for making a deep copy of a topo_list.
This new interface is currently being leveraged by the tooling that is SAS topology project in illumos-joyent. That tooling exercises the new topo_list_deepcopy() interface. For example:
We're upstreaming this change as one of the prerequisites for upstreaming the larger pieces of the SAS Topology project.
See the ticket for additional testing notes:
I'm not sure if the topo_list_t APIs would let us, but if we can, it might be nice to make the source list
constand the data that we get
const. Though looking at the topo_list_prev/next I'm not sure that'll work.
Do we need to make sure an appropriate error is set on the topo_hdl as topo_hdl_free might clobber one.