[lkml]   [2011]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] Cleanup include/net/tcp.h include-files and coding-style

On Sunday, January 09, 2011 wrote Ben Hutchings:
> The cost of repeated inclusion is minimal. GCC's preprocessor
> recognises when the entire content of a file is conditional on #ifndef
> FOO and will not even open it again if FOO is defined.
Thanks, I did not knew about that.

> If a file directly references definitions that are supposed to be
> provided by a certain header, changing it to rely on indirect inclusion
> of that header generally does *not* aid maintenance.
But then, to be coherent, we would need to add the following includes (and I'm
even not 100% sure if it's all we need):

linux/percpu_counter.h (needed for percpu_counter_sum_positive)
linux/mm_types.h (needed for struct page)
linux/aio.h (needed for struct kiocb)
net/inet_sock.h (needed for struct ip_options)
linux/pipe_fs_i.h (needed for struct pipe_inode_info)
linux/poll.h (needed for struct poll_table_struct)
linux/compiler.h (needed for __percpu)

IMO there should be a clear rule for the inclusion of files.

Personally I think it's best to include as few files as possible. Because I
think, that this reduces the risk of including a file, whose structs/functions
aren't even referenced (it's easier to manually check if one include out of 10
is useless, than checking it for 50).

But ok, there may be other stronger reasons for the opposite.
What are the reasons for including these files?


Christoph Paasch
PhD Student

IP Networking Lab ---
MultiPath TCP in the Linux Kernel ---
Université Catholique de Louvain
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2011-01-09 23:35    [W:0.077 / U:6.496 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site