lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sun, 15 Mar 2009 05:54:46 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Li Zefan <lizf@...fujitsu.com>
Cc:	Jaswinder Singh Rajput <jaswinder@...nel.org>,
	x86 maintainers <x86@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -tip] x86: kdebugfs.c cleanup


* Li Zefan <lizf@...fujitsu.com> wrote:

> >  #include <linux/debugfs.h>
> >  #include <linux/uaccess.h>
> > -#include <linux/stat.h>
> > +#include <linux/module.h>
> >  #include <linux/init.h>
> > +#include <linux/stat.h>
> >  #include <linux/io.h>
> >  #include <linux/mm.h>
> > -#include <linux/module.h>
> >  
> 
> Just curious about the rule to sort those includes, and why they need
> to be rearranged.

Such includes (the 'reverse christmas tree'):

#include <linux/interrupt.h>
#include <linux/mmiotrace.h>
#include <linux/bootmem.h>
#include <linux/compiler.h>
#include <linux/highmem.h>
#include <linux/kprobes.h>
#include <linux/uaccess.h>
#include <linux/vmalloc.h>
#include <linux/vt_kern.h>
#include <linux/signal.h>
#include <linux/kernel.h>
#include <linux/ptrace.h>
#include <linux/string.h>
#include <linux/module.h>
#include <linux/kdebug.h>
#include <linux/errno.h>
#include <linux/magic.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/mman.h>
#include <linux/tty.h>
#include <linux/smp.h>
#include <linux/mm.h>

#include <asm/kmemcheck.h>
#include <asm/tlbflush.h>
#include <asm/pgalloc.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <asm/proto.h>
#include <asm/traps.h>
#include <asm/desc.h>

are used by x86 architecture code (and some other subsystems) to 
reduce the likelyhood of patch conflicts in commonly modified 
kernel files.

Without such ordering developers typically append to the 
existing list of include files when introducing a new header - 
creating an almost certain patch conflict. Via the above 
ordering, new headers get distributed roughly evenly amongst the 
full range - and thus the chance of patch conflicts is much 
smaller.

This way it also looks a bit more structured and bit less messy. 
It looks unprofessional and sloppy if a .c file starts with a 
big block of thrown-together include files.

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ