Hello, Milos Nikic, le dim. 12 avril 2026 22:12:28 -0700, a ecrit: > OK how about this?
Yes, applied, thanks! Samuel > I am developing a python script to try and automate this. I have chosen these > 7 > just to see what you think. > Here priv.h is only included for its transitive includes and nothing from the > content of the file. > Would this work> > > On Sun, Apr 12, 2026 at 4:48 PM Samuel Thibault <[1][email protected]> > wrote: > > Hello, > > Milos Nikic, le ven. 10 avril 2026 21:21:58 -0700, a ecrit: > > Regarding the headers: I come from a background where "Include What You > Use" > > (IWYU) is strictly enforced for stability, so my instinct is to strip > away > > "kitchen sink" headers and make every dependency explicit. > > > > However, it sounds like this codebase prefers using umbrella headers and > > relying on transitive resolution > > In some cases, yes. > > It can be for types reasons: if you use a function that returns a > kern_return_t, well, yes, surely the header that defines that type has > to get included by the header tha declares that function. That's why > you'd essentially never really need to include <sys/types.h> > > Then there are a couple of meta-headers such as <mach.h> which are > really meant to include others. > > And then there can indeed be some opportunistic includes: e.g. <hurd.h> > happens to include <errno.h> (for some extern inlines), but includers of > <hurd.h> should still include <errno.h> themselves if they want to get > E* macros. > > Samuel > > > References: > > [1] mailto:[email protected] > From 7164dde9bd6f0976fec59c2184abd0873a6e46d4 Mon Sep 17 00:00:00 2001 > From: Milos Nikic <[email protected]> > Date: Sun, 12 Apr 2026 22:10:00 -0700 > Subject: [PATCH] libdiskfs: Cleanup of headers in some files. > > Replace the usage of include priv.h where it is only included for its > transitive includes. > Instead use more specific includes. > --- > libdiskfs/dead-name.c | 4 +++- > libdiskfs/demuxer.c | 4 +++- > libdiskfs/dir-chg.c | 9 ++++++++- > libdiskfs/dir-clear.c | 5 ++++- > libdiskfs/direnter.c | 4 +++- > libdiskfs/dirremove.c | 4 +++- > libdiskfs/dirrewrite.c | 4 +++- > 7 files changed, 27 insertions(+), 7 deletions(-) > > diff --git a/libdiskfs/dead-name.c b/libdiskfs/dead-name.c > index 5e0cf787..6e074736 100644 > --- a/libdiskfs/dead-name.c > +++ b/libdiskfs/dead-name.c > @@ -18,7 +18,9 @@ > along with this program; if not, write to the Free Software > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ > > -#include "priv.h" > +#include <hurd/fshelp.h> > +#include <hurd/ports.h> > +#include <mach.h> > > void > ports_dead_name (void *notify, mach_port_t dead_name) > diff --git a/libdiskfs/demuxer.c b/libdiskfs/demuxer.c > index 4a1c4fb4..e0efa82e 100644 > --- a/libdiskfs/demuxer.c > +++ b/libdiskfs/demuxer.c > @@ -15,8 +15,10 @@ > along with this program; if not, write to the Free Software > Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ > > -#include "priv.h" > > +#include "diskfs.h" > +#include <mach.h> > +#include <mach/mig_errors.h> > #include "io_S.h" > #include "fs_S.h" > #include "../libports/notify_S.h" > diff --git a/libdiskfs/dir-chg.c b/libdiskfs/dir-chg.c > index 0657c45b..11626cf9 100644 > --- a/libdiskfs/dir-chg.c > +++ b/libdiskfs/dir-chg.c > @@ -15,7 +15,14 @@ > along with this program; if not, write to the Free Software > Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ > > -#include "priv.h" > +#include <errno.h> > +#include <pthread.h> > +#include <stdlib.h> > +#include <sys/stat.h> > + > +#include "diskfs.h" > +#include <hurd/hurd_types.h> > +#include <mach.h> > #include "fs_S.h" > #include "fs_notify_U.h" > > diff --git a/libdiskfs/dir-clear.c b/libdiskfs/dir-clear.c > index 02a800ed..d61baf98 100644 > --- a/libdiskfs/dir-clear.c > +++ b/libdiskfs/dir-clear.c > @@ -15,7 +15,10 @@ > along with this program; if not, write to the Free Software > Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ > > -#include "priv.h" > +#include <assert-backtrace.h> > +#include <errno.h> > + > +#include "diskfs.h" > > /* Clear the `.' and `..' entries from directory DP. Its parent is PDP, > and the user responsible for this is identified by CRED. Both > diff --git a/libdiskfs/direnter.c b/libdiskfs/direnter.c > index cb9b76ca..17cc618d 100644 > --- a/libdiskfs/direnter.c > +++ b/libdiskfs/direnter.c > @@ -19,7 +19,9 @@ > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ > > > -#include "priv.h" > +#include <errno.h> > + > +#include "diskfs.h" > > /* Add NP to directory DP under the name NAME. This will only be > called after an unsuccessful call to diskfs_lookup of type CREATE > diff --git a/libdiskfs/dirremove.c b/libdiskfs/dirremove.c > index 239daa72..f0e35ba8 100644 > --- a/libdiskfs/dirremove.c > +++ b/libdiskfs/dirremove.c > @@ -18,7 +18,9 @@ > along with this program; if not, write to the Free Software > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ > > -#include "priv.h" > +#include <errno.h> > +#include "diskfs.h" > +#include <hurd/hurd_types.h> > > /* This will only be called after a successful call to diskfs_lookup > of type REMOVE; this call should remove the name found from the > diff --git a/libdiskfs/dirrewrite.c b/libdiskfs/dirrewrite.c > index 8f713960..28bce82d 100644 > --- a/libdiskfs/dirrewrite.c > +++ b/libdiskfs/dirrewrite.c > @@ -18,8 +18,10 @@ > along with this program; if not, write to the Free Software > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ > > +#include <errno.h> > > -#include "priv.h" > +#include "diskfs.h" > +#include <hurd/hurd_types.h> > > /* This will only be called after a successful call to diskfs_lookup > of type RENAME; this call should change the name found in directory > -- > 2.53.0 > -- Samuel Tu as lu les docs. Tu es devenu un informaticien. Que tu le veuilles ou non. Lire la doc, c'est le Premier et Unique Commandement de l'informaticien. -+- TP in: Guide du Linuxien pervers - "L'évangile selon St Thomas"
