[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20160301.144826.104748964516491333.davem@davemloft.net>
Date: Tue, 01 Mar 2016 14:48:26 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: ben@...adent.org.uk
Cc: nicolas.dichtel@...nd.com, netdev@...r.kernel.org,
nikolay@...ulusnetworks.com, kan.liang@...el.com
Subject: Re: [PATCH net-next] ethtool.h: define DIV_ROUND_UP for userland
From: Ben Hutchings <ben@...adent.org.uk>
Date: Tue, 01 Mar 2016 17:14:06 +0000
> On Tue, 2016-03-01 at 11:42 -0500, David Miller wrote:
>> From: Nicolas Dichtel <nicolas.dichtel@...nd.com>
>> Date: Tue, 1 Mar 2016 16:20:41 +0100
>>
>> > DIV_ROUND_UP and is defined in linux/kernel.h only for the kernel. INT_MAX
>> > needs limits.h in userland.
>>
>> It is wrong to provide a definition of this in the user visible global
>> namespace.
>
> Which is why he's not doing that...
No, that's exactly what he's doing:
+#ifndef __KERNEL__
+#include <limits.h> /* for INT_MAX */
+#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+#endif
in a uapi header file.
"If not kernel, define DEV_ROUND_UP"
Powered by blists - more mailing lists