Peter Memishian wrote:
> > > When libdladm is loaded[1], it could call a new function in libwladm to
> > > get the list of properties libwladm supports along with function pointers
> > > to call to set/get/check them and whatnot.
> >
> > But does this already requires libdladm to call into libwladm, which
> already
> > introduce the dependency?
>
> That dependency already exists -- we were trying to avoid libwladm having
> to call back into libdladm, right? I think the function pointer design
> would allow libdladm to not have direct knowledge of libwladm's
> properties; do_*prop() would just use the function pointers provided by
> libwladm to perform the operations.
>
I misunderstood what you mean. I thought that libwladm register its
functions to libdladm is to break the dependency that libdladm depends on
libwladm.
So that libwladm registers function only specific to libwladm in order not
to call back to libdladm.
I think it is doable and nice if we design carefully. But based on the
current case, I think we need too much code changes to go with this design.
Let's see the example of "up" an aggregation in liblaadm:
laadm_up(uint32_t key, const char *root, laadm_diag_t *diag)
{
...
if (i_laadm_walk_db(i_laadm_up, &up, root, diag) < 0) {
...
}
Note that i_laadm_walk_db will be replaced by dladm_datalink_xxx calls which
belong to libdladm. We could generalize this to have liblaadm to register a
up() function pointer. There are lots of places like this in liblaadm
though. Do we really want to rewrite and redesign the whole library?
Thanks
- Cathy