Sowmini.Varadhan at Sun.COM wrote:
> On (06/19/07 17:32), Dan Groves wrote:
>> I've decided that the linkprop.c code in libdladm will be the basis for the
>> flat file for storing link configuration information that I'm prototyping.
>> Note that the version of linkprop.c in the Project Clearview gate no longer
>> has code in it to parse or write /etc/dladm/linkprop.c, so I'm using the
>> linkprop.c in the Nevada gate as my basis. When I mention linkprop.c, the
>> Nevada gate version is the version I'm referring to unless I state
>> otherwise.
>
> Do you mean linkprop.conf in the paragraph above? It's a bit confusing
> because you seem to be referring to both "/etc/dladm/linkprop.c" and
> code in "linkprop.c".
>
Oops. You're correct. I thought I proofread this before I sent it, I
do mean /etc/dladm/linkprop.conf.
>> I would put this code under src/cmd/linkmgmtd in a new file:
>> linkmgmtd_repository_interface.c.
>>
>> The linkprop.c code refers to a function i_dladm_rw_db which is in
>> usr/src/lib/libdladm/common/libdladm.c (in both the Project Clearview gate
>> and the Nevada gate). i_dladm_rw_db provides locking and provides some
>> protection against a system crash in the middle of trying to write to the
>> file. The function does not process the file, that is handled by a
>> callback function passed into the i_dladm_rw_db function.
>
> the i_dladm_rw_db in nevada is called from
> 2 linkprop.c i_dladm_set_prop_db 699 return (LINKPROP_RW_DB(&state, B_TRUE));
> 3 linkprop.c i_dladm_get_prop_db 714 return (LINKPROP_RW_DB(&state, B_FALSE));
> 4 linkprop.c dladm_init_linkprop 728 return (LINKPROP_RW_DB(&state, B_FALSE));
>
> Is this function going to be moved to some other library? I'm not
> sure I follow your proposal.
>
i_dladm_rw_db is also called by the secobj.conf handling code in libdladm:
lib/libdladm/common/secobj.c 545 (i_dladm_rw_db("/etc/dladm/secobj.conf",
S_IRUSR | S_IWUSR, \
My idea was to move it to another library, sorry if that wasn't clear.
>> It would be rather strange to have linkmgmtd call into i_dladm_rw_db, which
>> is currently in libdladm. It could be done, and would be fairly easy to
>> expose that function. However, it would make more sense to more this
>> function elsewhere. Remember, the write requests linkmgmtd receives are a
>> result of a door call from libdladm. I would rather move it.
>
> It sounds like you would either have to link libdladm into libdladmd,
> or link the new library into dladm (and other programs that invoke
> libdladm- e.g., nwamd). If I understand your proposal correctly,
> it might be easier (since nwamd is also using dladm_init_linkprop)
> to just add -ldladm to the Makefile in linkmgmtd.
>
[...]
I think libdladm is already linked into dladmd.
thanks!
Dan