From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio To: passt-dev@passt.top Subject: Re: [PATCH 3/8] passt.h: Include netinet/if_ether.h before struct ctx declaration Date: Fri, 07 Oct 2022 13:36:41 +0200 Message-ID: <20221007133641.5654554e@elisabeth> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0924178860366533022==" --===============0924178860366533022== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On Fri, 7 Oct 2022 19:40:43 +1100 David Gibson wrote: > On Fri, Oct 07, 2022 at 09:44:17AM +0200, Stefano Brivio wrote: > > On Fri, 7 Oct 2022 17:23:30 +1100 > > David Gibson wrote: > > > > > On Fri, Oct 07, 2022 at 02:47:37AM +0200, Stefano Brivio wrote: > > > > This saves some hassle when including passt.h, as we need ETH_ALEN > > > > there. > > > > > > > > Signed-off-by: Stefano Brivio > > > > > > Hrm. So I had the impression that passt was using the convention that > > > it's the top level files responsibility to include all the > > > dependencies for a header before including the header, rather than > > > having headers include other headers they need. Was I mistaken? I'm > > > ok with either model, they each have their advantages, but I find > > > sticking to one or the other is generally better than a mix of both. > > > > That was my original idea, but it's a bit of a disaster, because it > > turns out we need and a few others pretty much > > everywhere, even though the file at hand will never see an Ethernet > > header. :( > > > > Does this indicate that it's time to move struct ctx out of passt.h > > (and similarly with other structs here and there)? > > Well.. really we want to break struct ctx up so it's not globals by > another name, but that's not news. Okay, that sounds reasonable, and at that point we can probably go back to the original idea, which has a few advantages especially when headers don't have include guards. Until then I would say we could be flexible with it -- including netinet/if_ether.h everywhere looks bad, but if we have an extra include for stdint.h somewhere I don't see it as a drama. -- Stefano --===============0924178860366533022==--