Cathy Zhou wrote:
> Cathy Zhou wrote:
>> Peter Memishian wrote:
>>> > It can work. But I think a more reasonable logic should be:
>>> > > if (is_generic(prop_name)) {
>>> > dladm_gen_set_prop();
>>> > } else (is_wifi(prop_name)) {
>>> > wladm_set_prop();
>>> > } else ... {
>>> > ...
>>> > }
>>>
>>> The problem is that this requires libdladm to have global knowledge of
>>> all properties, which we'd like to avoid.
>>>
>>
>> If we want to have libdladm to do all the optional values check,
>> default value assignment, etc. I would think the libdladm will have
>> the knowledge.
>>
> I forgot to mention that I investigated another option that doesn't
> require libdladm to have global knowledge of all properties. It is to
> make the current do_set_prop() function to be a libdladm function
> which can be called by different libraries. But in my opinion, the
> current signature of this function is not correct:
>
> do_set_prop(int fd, wldp_t *gbuf, prop_desc_t *pdp,
> char **prop_val, uint_t val_cnt)
>
> Which I would think should be
>
> do_set_prop(prop_desc_t *pdp, char **prop_val, uint_t val_cnt)
>
> But it seems the gbuf is deep into the libwladm's implementation which
> needs significant change of the whole libwladm.
>
> I am fine to work on it. But is there any better option?
Now we call wladm_set_prop(const char *link, const char *prop_name, char
**prop_val, uint_t val_cnt) in dladm_set_prop(...).So if you only want
to support props operation in libdladm, how about to add do_set(get)_*
functions or something like them in libdladm only.Libdladm only need
know the interface to libwladm and do not need modify any implementation
in it,right?By this way libdladm do not need know anything about props
of libwladm and the detail implementation.So you can modify
dladm_set_prop only and add some do_set(get)* function in libdladm for
nic link.Is this ok?
Tony
>
> Thanks
> - Cathy