On Tue, Aug 23, 2016 at 10:03 AM, Frans Klaver <franskla...@gmail.com> wrote:
> On Tue, Aug 23, 2016 at 9:05 AM, David Miller <da...@davemloft.net> wrote:
>> From: Frans Klaver <franskla...@gmail.com>
>> Date: Tue, 23 Aug 2016 09:03:20 +0200
>>
>>> On Tue, Aug 23, 2016 at 1:30 AM, David Miller <da...@davemloft.net> wrote:
>>>> From: Mikko Rapeli <mikko.rap...@iki.fi>
>>>> Date: Mon, 22 Aug 2016 20:32:44 +0200
>>>>
>>>>> Fixes userspace compiler error:
>>>>>
>>>>> error: ‘IFNAMSIZ’ undeclared here (not in a function)
>>>>>
>>>>> Suggested by Frans Klaver <franskla...@gmail.com> on lkml message
>>>>> <20150530195223.ga15...@bugger.home>.
>>>>>
>>>>> Signed-off-by: Mikko Rapeli <mikko.rap...@iki.fi>
>>>>
>>>> IFNAMSIZ has to be in linux/if.h, you aren't explaining why you have
>>>> to move it to the hdlc header instead of having the hdlc header
>>>> include linux/if.h
>>>
>>> Circular references. linux/if.h includes hdlc/ioctl.h, and has to
>>> define IFNAMSIZ before doing so.
>>
>> That's not acceptable.  Use forward declarations or similar to avoid
>> the circular dependency.
>>
>> IFNAMSIZ belongs in linux/if.h, please keep it there.
>
> I went back to one of the previous patch sets, but couldn't find why
> the circular dependency had to be broken. So if this can be fixed by
> including linux/if.h instead, I'm all for it.

Alright, so the core of the 'problem' is that the structs in
hdlc/ioctl.h are typedefs of anonymous structs, and linux/if.h points
to those types. We can't really forward declare these structs unless
we name them, so the proper approach would be to name them and use
forward declarations in linux/if.h. hdlc/ioctl.h can then include
linux/if.h. linux/if.h should probably keep including hdlc/ioctl.h to
keep depending application builds from breaking.

Reply via email to