From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934414AbcKOTjX (ORCPT ); Tue, 15 Nov 2016 14:39:23 -0500 Received: from mail.kapsi.fi ([217.30.184.167]:58507 "EHLO mail.kapsi.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753240AbcKOTjV (ORCPT ); Tue, 15 Nov 2016 14:39:21 -0500 Date: Tue, 15 Nov 2016 21:39:17 +0200 From: Mikko Rapeli To: Frans Klaver Cc: David Miller , "linux-kernel@vger.kernel.org" , zhangshengju@cmss.chinamobile.com Subject: Re: [PATCH v05 27/72] linux/if.h linux/hdlc/ioctl.h: move IFNAMSIZ definition to hdlc/ioctl.h Message-ID: <20161115193917.GI8342@lakka.kapsi.fi> References: <1471890809-4383-28-git-send-email-mikko.rapeli@iki.fi> <20160822.163032.1005091075765531174.davem@davemloft.net> <20160823.000514.536168139289568958.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-SA-Exim-Connect-IP: 2001:1bc8:1004::1 X-SA-Exim-Mail-From: mikko.rapeli@iki.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 24, 2016 at 08:57:21AM +0200, Frans Klaver wrote: > On Tue, Aug 23, 2016 at 10:03 AM, Frans Klaver wrote: > > On Tue, Aug 23, 2016 at 9:05 AM, David Miller wrote: > >> From: Frans Klaver > >> Date: Tue, 23 Aug 2016 09:03:20 +0200 > >> > >>> On Tue, Aug 23, 2016 at 1:30 AM, David Miller wrote: > >>>> From: Mikko Rapeli > >>>> 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 on lkml message > >>>>> <20150530195223.GA15645@bugger.home>. > >>>>> > >>>>> Signed-off-by: Mikko Rapeli > >>>> > >>>> 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. Thanks! I will do this and send a new patch. -Mikko