All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pádraig Brady" <P@draigBrady.com>
To: "Frank A. Kingswood" <frank@kingswood-consulting.co.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: atomically swap two files
Date: Fri, 26 Nov 2010 11:47:52 +0000	[thread overview]
Message-ID: <4CEF9E68.9080200@draigBrady.com> (raw)
In-Reply-To: <icmfu2$nga$1@dough.gmane.org>

On 25/11/10 20:11, Frank A. Kingswood wrote:
> Hi!
> 
> Is it possible to swap two files in an atomic way, so that after the
> syscall either the two files have exchanged names or neither has been
> modified?
> 
> I suspect that btrfs could do it, but I'm wondering about ext3/4.

I don't think there is anything equivalent to exchangedata() on Linux
http://developer.apple.com/library/mac/#DOCUMENTATION/Darwin/Reference/ManPages/man2/exchangedata.2.html

I've written some notes on atomically replacing
file contents with standard tools here:
http://www.pixelbeat.org/docs/unix_file_replacement.html

cheers,
Pádraig.

  reply	other threads:[~2010-11-26 11:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 20:11 atomically swap two files Frank A. Kingswood
2010-11-26 11:47 ` Pádraig Brady [this message]
2010-11-26 14:19   ` Dave Chinner

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=4CEF9E68.9080200@draigBrady.com \
    --to=p@draigbrady.com \
    --cc=frank@kingswood-consulting.co.uk \
    --cc=linux-kernel@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 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.