[Patch v2 3/4] veth: implement ->io_free

Cong Wang xiyou.wangcong at gmail.com
Mon Mar 31 15:16:44 EDT 2014


On Mon, Mar 31, 2014 at 4:07 AM, Thomas Graf <tgraf at suug.ch> wrote:
> On 03/28/14 at 06:08pm, Cong Wang wrote:
>> +static void veth_free(struct rtnl_link *link)
>> +{
>> +     struct rtnl_link *peer = rtnl_link_veth_get_peer(link);
>> +     link->l_info = NULL;
>> +     if (peer) {
>> +             peer->l_info = NULL;
>> +             rtnl_link_put(peer);
>> +     }
>
> I think this should call _release() to not dupliacte code.

The difference between veth_free() and veth_release() is
veth_free() is not supposed to call rtnl_link_put() on `link`,
its caller will do it. So, the code is not duplicated actually.


>> @@ -227,8 +238,12 @@ struct rtnl_link *rtnl_link_veth_get_peer(struct rtnl_link *link)
>>  void rtnl_link_veth_release(struct rtnl_link *link)
>>  {
>>       struct rtnl_link *peer = rtnl_link_veth_get_peer(link);
>> -     rtnl_link_put(peer);
>> +     link->l_info = NULL;
>
> Will need to release the reference as requested in patch 2.

Sure.

Thanks!



More information about the libnl mailing list