> I'm taking a stab at the "dladm -o" command,
 > and trying to see how much of the existing code for the wifi related
 > show* commands can be reused. print_wifi_field() also seems to be more
 > generally usable than just for wifi itself.. and pieces of
 > parse_wifi_fields could be extracted to be less wifi-specific.
 > 
 > It seems like the wifi_field_t structure is a good candidate
 > for generalization to be used by the other show* commands as well. 
 > But I can't see how the wf_cmdtype is used. what am I missing?

The wf_cmdtype determines which of those fields apply to which dladm
subcommands (currently: neither, show-wifi, scan-wifi, or both).

FWIW, I've implemented generic "-o" support as part of the upcoming
ipmpstat utility.  It's loosely based on the dladm/WiFi stuff but I think
it's ultimately more extensible and flexible.  Please check out:

http://cr.opensolaris.org/~meem/clearview-ipmp/raw_files/new/usr/src/cmd/cmd-inet/usr.sbin/ipmpstat/ipmpstat.c

In particular, you'll want to take a look at the ofmt_* functions, and the
ipmpstat_field_t/ipmpstat_ofmt_t structures.  A block comment at the top
of the file describes the basic workflow (which is a bit complex since
there are two layers of function pointers).

-- 
meem

Reply via email to