OK here is 20 more...executed in the same vain, with the same script.. let me know if something isn't right.
Thanks On Tue, Apr 14, 2026 at 11:16 AM Samuel Thibault <[email protected]> wrote: > 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" >
From 9e423457d65487f1019c184b768f4c2aa53c0018 Mon Sep 17 00:00:00 2001 From: Milos Nikic <[email protected]> Date: Wed, 15 Apr 2026 10:16:34 -0700 Subject: [PATCH] libdiskfs: Continued cleanup of headers in files. As before replace usage of include priv.h where it is only included for its transitive includes. Instead using more specific includes. --- libdiskfs/dir-readdir.c | 8 +++++++- libdiskfs/disk-pager.c | 12 +++++++++--- libdiskfs/diskfs-pager.h | 1 - libdiskfs/file-access.c | 10 ++++++++-- libdiskfs/file-chflags.c | 3 +++ libdiskfs/file-chg.c | 10 ++++++++-- libdiskfs/file-chmod.c | 4 ++++ libdiskfs/file-chown.c | 5 +++++ libdiskfs/file-exec.c | 11 +++++++---- libdiskfs/file-get-fs-opts.c | 9 ++++++++- libdiskfs/file-get-trans.c | 12 ++++++++++-- libdiskfs/file-get-transcntl.c | 7 ++++++- libdiskfs/file-getcontrol.c | 2 ++ libdiskfs/file-getfh.c | 11 +++++++++-- libdiskfs/file-getlinknode.c | 7 ++++++- libdiskfs/file-lock-stat.c | 9 ++++++--- libdiskfs/file-lock.c | 11 ++++++++--- libdiskfs/file-record-lock.c | 10 ++++++---- libdiskfs/file-reparent.c | 6 +++++- libdiskfs/file-set-size.c | 6 +++++- 20 files changed, 122 insertions(+), 32 deletions(-) diff --git a/libdiskfs/dir-readdir.c b/libdiskfs/dir-readdir.c index a314e9d1..3ee141c5 100644 --- a/libdiskfs/dir-readdir.c +++ b/libdiskfs/dir-readdir.c @@ -20,7 +20,13 @@ /* Written by Michael I. Bushnell. */ #include <fcntl.h> -#include "priv.h" +#include <errno.h> +#include <pthread.h> +#include <sys/stat.h> + +#include <mach.h> +#include "diskfs.h" +#include <hurd/hurd_types.h> #include "fs_S.h" kern_return_t diff --git a/libdiskfs/disk-pager.c b/libdiskfs/disk-pager.c index 886ce157..f392fc42 100644 --- a/libdiskfs/disk-pager.c +++ b/libdiskfs/disk-pager.c @@ -16,10 +16,16 @@ 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-pager.h" -#include <hurd/sigpreempt.h> +#include <assert-backtrace.h> #include <error.h> +#include <errno.h> +#include <stddef.h> + +#include "diskfs.h" +#include <hurd/ports.h> +#include <hurd/sigpreempt.h> +#include <mach.h> +#include "diskfs-pager.h" __thread struct disk_image_user *diskfs_exception_diu; diff --git a/libdiskfs/diskfs-pager.h b/libdiskfs/diskfs-pager.h index f490e776..08f3ed30 100644 --- a/libdiskfs/diskfs-pager.h +++ b/libdiskfs/diskfs-pager.h @@ -23,7 +23,6 @@ #include <hurd/ports.h> #include <setjmp.h> #include <pthread.h> -#include <errno.h> #include <assert-backtrace.h> #include <stdlib.h> diff --git a/libdiskfs/file-access.c b/libdiskfs/file-access.c index f7e129aa..e6fce1d4 100644 --- a/libdiskfs/file-access.c +++ b/libdiskfs/file-access.c @@ -15,9 +15,15 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "priv.h" -#include "fs_S.h" #include <fcntl.h> +#include <errno.h> +#include <pthread.h> +#include <sys/stat.h> + +#include "diskfs.h" +#include <hurd/fshelp.h> +#include <mach.h> +#include "fs_S.h" kern_return_t diskfs_S_file_check_access (struct protid *cred, diff --git a/libdiskfs/file-chflags.c b/libdiskfs/file-chflags.c index a29ff07c..6c2ca30f 100644 --- a/libdiskfs/file-chflags.c +++ b/libdiskfs/file-chflags.c @@ -15,6 +15,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <errno.h> +#include <idvec.h> + #include "priv.h" #include "fs_S.h" diff --git a/libdiskfs/file-chg.c b/libdiskfs/file-chg.c index 9da43e79..18170c25 100644 --- a/libdiskfs/file-chg.c +++ b/libdiskfs/file-chg.c @@ -15,8 +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 "fs_notify_S.h" +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + +#include "diskfs.h" +#include <mach.h> +#include <hurd/hurd_types.h> #include "fs_notify_U.h" kern_return_t diff --git a/libdiskfs/file-chmod.c b/libdiskfs/file-chmod.c index 13f2cb93..da710aa3 100644 --- a/libdiskfs/file-chmod.c +++ b/libdiskfs/file-chmod.c @@ -15,6 +15,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <idvec.h> +#include <sys/stat.h> +#include <fcntl.h> + #include "priv.h" #include "fs_S.h" diff --git a/libdiskfs/file-chown.c b/libdiskfs/file-chown.c index ecb851f2..ae3c279d 100644 --- a/libdiskfs/file-chown.c +++ b/libdiskfs/file-chown.c @@ -15,6 +15,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <errno.h> +#include <idvec.h> +#include <fcntl.h> +#include <sys/stat.h> + #include "priv.h" #include "fs_S.h" diff --git a/libdiskfs/file-exec.c b/libdiskfs/file-exec.c index 254e52ad..926933ed 100644 --- a/libdiskfs/file-exec.c +++ b/libdiskfs/file-exec.c @@ -20,14 +20,17 @@ /* Written by Michael I. Bushnell. */ -#include "priv.h" -#include "fs_S.h" +#include <errno.h> +#include <pthread.h> +#include <idvec.h> #include <sys/stat.h> #include <fcntl.h> + +#include "priv.h" +#include "fs_S.h" #include <hurd/exec.h> +#include <hurd/hurd_types.h> #include <hurd/paths.h> -#include <string.h> -#include <idvec.h> kern_return_t diskfs_S_file_exec (struct protid *cred, diff --git a/libdiskfs/file-get-fs-opts.c b/libdiskfs/file-get-fs-opts.c index e11bc0fd..83da55d2 100644 --- a/libdiskfs/file-get-fs-opts.c +++ b/libdiskfs/file-get-fs-opts.c @@ -22,7 +22,14 @@ #include <errno.h> #include <string.h> #include <argz.h> -#include "priv.h" +#include <pthread.h> +#include <stddef.h> +#include <stdlib.h> + +#include "diskfs.h" +#include <hurd/hurd_types.h> +#include <hurd/iohelp.h> +#include <mach.h> #include "fs_S.h" kern_return_t diff --git a/libdiskfs/file-get-trans.c b/libdiskfs/file-get-trans.c index b0a4b4ee..797cefd7 100644 --- a/libdiskfs/file-get-trans.c +++ b/libdiskfs/file-get-trans.c @@ -15,11 +15,19 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "priv.h" -#include <hurd/paths.h> +#include <pthread.h> +#include <stdlib.h> +#include <sys/stat.h> +#include <sys/mman.h> #include <string.h> #include <stdio.h> #include <errno.h> +#include <assert-backtrace.h> + +#include "diskfs.h" +#include <mach.h> +#include <hurd/hurd_types.h> +#include <hurd/paths.h> #include "fs_S.h" /* Implement file_get_translator as described in <hurd/fs.defs>. */ diff --git a/libdiskfs/file-get-transcntl.c b/libdiskfs/file-get-transcntl.c index 311d23ef..e40c5163 100644 --- a/libdiskfs/file-get-transcntl.c +++ b/libdiskfs/file-get-transcntl.c @@ -15,7 +15,12 @@ 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 "diskfs.h" +#include <hurd/fshelp.h> +#include <mach.h> #include "fs_S.h" /* Implement file_get_translator_cntl as described in <hurd/fs.defs>. */ diff --git a/libdiskfs/file-getcontrol.c b/libdiskfs/file-getcontrol.c index 8f98f4b3..df6023ab 100644 --- a/libdiskfs/file-getcontrol.c +++ b/libdiskfs/file-getcontrol.c @@ -15,6 +15,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <errno.h> + #include "priv.h" #include "fs_S.h" #include <hurd/fshelp.h> diff --git a/libdiskfs/file-getfh.c b/libdiskfs/file-getfh.c index 8023a14f..c8e854cf 100644 --- a/libdiskfs/file-getfh.c +++ b/libdiskfs/file-getfh.c @@ -19,8 +19,15 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <string.h> - -#include "priv.h" +#include <errno.h> +#include <idvec.h> +#include <pthread.h> +#include <assert-backtrace.h> +#include <sys/mman.h> + +#include "diskfs.h" +#include <hurd/hurd_types.h> +#include <mach.h> #include "fs_S.h" #include "fhandle.h" diff --git a/libdiskfs/file-getlinknode.c b/libdiskfs/file-getlinknode.c index 4b346c96..d433744e 100644 --- a/libdiskfs/file-getlinknode.c +++ b/libdiskfs/file-getlinknode.c @@ -15,7 +15,12 @@ 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 "diskfs.h" +#include <hurd/hurd_types.h> +#include <hurd/ports.h> +#include <mach.h> #include "fs_S.h" /* Implement file_getlinknode as described in <hurd/fs.defs>. */ diff --git a/libdiskfs/file-lock-stat.c b/libdiskfs/file-lock-stat.c index c6990c46..c22b0f4c 100644 --- a/libdiskfs/file-lock-stat.c +++ b/libdiskfs/file-lock-stat.c @@ -15,11 +15,14 @@ You should have received a copy of the GNU General Public License along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ -#include "priv.h" +#include <errno.h> +#include <pthread.h> + +#include "diskfs.h" +#include <hurd/fshelp.h> +#include <mach.h> #include "fs_S.h" -#include <fcntl.h> -#include <sys/file.h> kern_return_t diskfs_S_file_lock_stat (struct protid *cred, diff --git a/libdiskfs/file-lock.c b/libdiskfs/file-lock.c index 0446fc3d..703e4dd7 100644 --- a/libdiskfs/file-lock.c +++ b/libdiskfs/file-lock.c @@ -15,12 +15,17 @@ You should have received a copy of the GNU General Public License along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ -#include "priv.h" -#include "fs_S.h" - +#include <errno.h> +#include <pthread.h> +#include <stdio.h> #include <fcntl.h> #include <sys/file.h> +#include "diskfs.h" +#include <hurd/fshelp.h> +#include <mach.h> +#include "fs_S.h" + kern_return_t diskfs_S_file_lock (struct protid *cred, int flags) { diff --git a/libdiskfs/file-record-lock.c b/libdiskfs/file-record-lock.c index 83a05bbd..5156b9a9 100644 --- a/libdiskfs/file-record-lock.c +++ b/libdiskfs/file-record-lock.c @@ -15,12 +15,14 @@ You should have received a copy of the GNU General Public License along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ -#include "priv.h" -#include "diskfs.h" -#include "fs_S.h" - +#include <fcntl.h> +#include <pthread.h> #include <errno.h> + +#include "diskfs.h" +#include <mach.h> #include <hurd/fshelp.h> +#include "fs_S.h" kern_return_t diskfs_S_file_record_lock (struct protid *cred, diff --git a/libdiskfs/file-reparent.c b/libdiskfs/file-reparent.c index fa3479e3..1a39bcbb 100644 --- a/libdiskfs/file-reparent.c +++ b/libdiskfs/file-reparent.c @@ -20,7 +20,11 @@ along with the GNU Hurd; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "priv.h" +#include <errno.h> + +#include "diskfs.h" +#include <hurd/ports.h> +#include <mach.h> #include "fs_S.h" kern_return_t diff --git a/libdiskfs/file-set-size.c b/libdiskfs/file-set-size.c index fe2125ae..090d01d6 100644 --- a/libdiskfs/file-set-size.c +++ b/libdiskfs/file-set-size.c @@ -15,9 +15,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <fcntl.h> +#include <errno.h> +#include <stdio.h> + #include "priv.h" +#include <hurd/hurd_types.h> #include "fs_S.h" -#include <fcntl.h> /* Implement file_set_size as described in <hurd/fs.defs>. */ kern_return_t -- 2.53.0
