All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Harald Welte <laforge@netfilter.org>,
	Netfilter Development Mailinglist
	<netfilter-devel@lists.netfilter.org>
Subject: Re: [PATCH 2/3][CTNETLINK] Atomically set/unset status bits
Date: Tue, 28 Nov 2006 23:31:09 +0100	[thread overview]
Message-ID: <456CB8AD.8090809@trash.net> (raw)
In-Reply-To: <456C806B.9060806@netfilter.org>

Pablo Neira Ayuso wrote:
> [CTNETLINK] Atomically set/unset status bits
> 
> This patch guarantees that status bits are atomically set/unset. A minor
> cleanup to save one extra useless line in the code is introduced.
> 
> -	ct->status |= status & ~(IPS_NAT_DONE_MASK | IPS_NAT_MASK);
> +	d &= ~(IPS_NAT_DONE_MASK | IPS_NAT_MASK);
> +
> +	for (i = 0; i < sizeof(ct->status); i++)
> +		if (d & (1 << i)) {
> +			if (status & (1 << i))
> +				set_bit(i, &ct->status);
> +			else
> +				clear_bit(i, &ct->status);
> +		}
> +
>  	return 0;

We already hold the lock, what is the purpose of this change?

It also changes the API, so far bits can only be set. I wonder
where this comes from, I'm pretty sure my original code allowed
to unset specific bits and the checks at the top of that function
indicate that unsetting is possible as well.

  reply	other threads:[~2006-11-28 22:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-28 17:46 [PATCH 2/3][CTNETLINK] Atomically set/unset status bits Pablo Neira Ayuso
2006-11-28 18:31 ` Pablo Neira Ayuso
2006-11-28 22:31   ` Patrick McHardy [this message]
2006-11-29 14:59     ` Pablo Neira Ayuso
2006-11-29 15:28       ` Patrick McHardy
  -- strict thread matches above, loose matches on Subject: below --
2006-11-28 17:09 Pablo Neira Ayuso

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=456CB8AD.8090809@trash.net \
    --to=kaber@trash.net \
    --cc=laforge@netfilter.org \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=pablo@netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.