netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: adobriyan@gmail.com
Cc: dada1@cosmosbay.com, netdev@vger.kernel.org
Subject: Re: [PATCH v2] net: #ifdef inet_bind_bucket::ib_net
Date: Tue, 11 Nov 2008 16:45:54 -0800 (PST)	[thread overview]
Message-ID: <20081111.164554.143409564.davem@davemloft.net> (raw)
In-Reply-To: <20081111111946.GD3665@x200.localdomain>

From: Alexey Dobriyan <adobriyan@gmail.com>
Date: Tue, 11 Nov 2008 14:19:46 +0300

> @@ -35,7 +35,9 @@ struct inet_bind_bucket *inet_bind_bucket_create(struct kmem_cache *cachep,
>  	struct inet_bind_bucket *tb = kmem_cache_alloc(cachep, GFP_ATOMIC);
>  
>  	if (tb != NULL) {
> +#ifdef CONFIG_NET_NS
>  		tb->ib_net       = hold_net(net);
> +#endif
>  		tb->port      = snum;
>  		tb->fastreuse = 0;
>  		INIT_HLIST_HEAD(&tb->owners);

No, this is exactly what we don't want.

If you have to add ifdefs to core C files, you're doing something
wrong.

All the details of ifdef this or ifdef that should be hidden in the
header files.

You cited an example where there are a ton of ifdefs in some header
fule inline function, but that is EXACTLY how this stuff should be
done.  Those header files are where such ugly implementation details
belong.

When people read actual code, they should be concerning themselves
with control flow, what the code is trying to do, etc. rather then
being continually interrupted with ifdef this and ifdef that.

  reply	other threads:[~2008-11-12  0:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-07 15:44 [PATCH] net: introduce read_pnet() and write_pnet() functions Eric Dumazet
2008-11-07 17:41 ` Alexey Dobriyan
2008-11-07 17:49   ` Eric Dumazet
2008-11-07 18:07     ` Alexey Dobriyan
2008-11-11  0:44       ` David Miller
2008-11-11 11:08         ` [PATCH] net: #ifdef inet_bind_bucket::ib_net Alexey Dobriyan
2008-11-11 11:19           ` [PATCH v2] " Alexey Dobriyan
2008-11-12  0:45             ` David Miller [this message]
2008-11-12  6:20               ` [PATCH] nets: Introduce read_pnet() and write_pnet() helpers Eric Dumazet
2008-11-12  6:31                 ` [PATCH] net: Cleanup of neighbour code Eric Dumazet
2008-11-12  8:55                   ` David Miller
2008-11-12  8:53                 ` [PATCH] nets: Introduce read_pnet() and write_pnet() helpers David Miller
2008-11-12  6:21               ` [PATCH] net: ib_net pointer should depends on CONFIG_NET_NS Eric Dumazet
2008-11-12  8:54                 ` David Miller
2008-11-12 10:44               ` [PATCH v2] net: #ifdef inet_bind_bucket::ib_net Alexey Dobriyan
2008-11-12 10:50                 ` Eric Dumazet
2008-11-12 12:24                   ` [PATCH v3] " Alexey Dobriyan
2008-11-12 12:24                     ` David Miller
2008-11-12 10:55                 ` [PATCH v2] " Eric Dumazet
2008-11-12 11:16                 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081111.164554.143409564.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=adobriyan@gmail.com \
    --cc=dada1@cosmosbay.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).