Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Sep 2003 10:33:40 -0400 (EDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        net@freebsd.org
Subject:   Re: finishing the if.h/if_var.h split
Message-ID:  <XFMail.20030930103340.jhb@FreeBSD.org>
In-Reply-To: <20030930172536.U3713@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 30-Sep-2003 Bruce Evans wrote:
> On Mon, 29 Sep 2003, Brooks Davis wrote:
> 
>> Six years and eight months ago, net/if.h was split into if.h and
>> if_var.h.  At the time, if_var.h was included at the end if if.h as
>> follows (this is the current code, but it's equivalent):
>>
>> #ifdef _KERNEL
>> struct thread;
>>
>> /* XXX - this should go away soon. */
>> #include <net/if_var.h>
>> #endif
>>
>> Unfortunately, "soon" hasn't happened yet and it is now tripping me
>> up.  To add the if_dev member to struct ifnet (see the forthcoming
>> post on that subject), it is necessary for sys/bus.h to be included in
>> net/if_var.h
> 
> That would be namespace pollution, so it is not permitted :-).  Requiring
> all files that include <sys/if_var.h> (and especially <sys/if.h> to
> include <sys/bus.h> would be interface breakage so it is even less
> permitted.

Well, if if.h stops including if_var.h, then only kernel files that
include net/if_var.h would need sys/bus.h.  I think that's manageable.

>> which in turn requires that if_var.h NOT be included in
>> genassym.c.
> 
> Do you mean in userland?  There don't seem to be any immediate problems
> for genassym.c or any other file in the kernel from including <sys/bus.h>
> unconditionally in <net/if_var.h>.  However, the pollution may be harmful
> for userland.  In fact, including <sys/bus.h> would just not work for
> userland, since the declaration of device_t is only made in the _KERNEL
> case, so use of it in struct ifnet (which is exported to userland for
> some reason) would be a syntax error in userland whether or not
> <sys/bus.h> is included.  Oops, <net/if.h> doesn't include <net/if_var.h>
> in the !_KERNEL case, so the problem is a little different...

The problem is that the newbus foo_if.h files don't exist when genassym
is compiled and used.  sys/bus.h needs bus_if.h and device_if.h, hence
the breakage.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20030930103340.jhb>