[ovs-dev] [PATCH 2/3] datapath: Add support for 4.2 kernel.

Pravin Shelar pshelar at nicira.com
Thu Sep 17 20:22:26 UTC 2015


On Thu, Sep 17, 2015 at 1:08 PM, Jesse Gross <jesse at nicira.com> wrote:
> On Thu, Sep 17, 2015 at 11:58 AM, Pravin Shelar <pshelar at nicira.com> wrote:
>> On Wed, Sep 16, 2015 at 3:00 PM, Jesse Gross <jesse at nicira.com> wrote:
>>> On Tue, Sep 15, 2015 at 11:09 AM, Pravin B Shelar <pshelar at nicira.com> wrote:
>>>> diff --git a/datapath/linux/compat/socket.c b/datapath/linux/compat/socket.c
>>>> new file mode 100644
>>>> index 0000000..776f9e2
>>>> --- /dev/null
>>>> +++ b/datapath/linux/compat/socket.c
>>>> +#ifndef HAVE_SOCK_CREATE_KERN_NET
>>>> +int ovs_sock_create_kern(struct net *net, int family, int type, int protocol, struct socket **res)
>>>> +{
>>>> +       int err;
>>>> +
>>>> +       err = sock_create_kern(family, type, protocol, res);
>>>> +       if (err < 0)
>>>> +               return err;
>>>> +
>>>> +       sk_change_net((*res)->sk, net);
>>>> +       return err;
>>>> +}
>>>> +
>>>> +void ovs_sock_release(struct socket *sock)
>>>> +{
>>>> +       sk_release_kernel(sock->sk);
>>>> +}
>>>> +#endif
>>>
>>> Is there a reason we can't use a macro and then keep the original
>>> name? I'm also not sure that we need to put this in a new .c file but
>>> that's more just personal opinion.
>>
>> I also likes to define it in header but there is issue with it. I need
>> to call sk_change_net() which is defined in sock.h. I do not want to
>> include header from different compat header file. I causes all sorts
>> of header dependencies.
>
> OK.
>
>> I changed name since it is no longer same API, it also calls sk_change_net().
>
> But isn't it trying to approximate the semantics of the current
> version of sock_create_kern()?

OK, Since the function arguments are different we do not need to worry
about this API getting automatically used some where else in the code.
I will add function name macro.



More information about the dev mailing list