ostree/src/rofiles-fuse
Marcus Folkesson 6bf4b3e1d8 Add SPDX-License-Identifier to source files
SPDX License List is a list of (common) open source
licenses that can be referred to by a “short identifier”.
It has several advantages compared to the common "license header texts"
usually found in source files.

Some of the advantages:
* It is precise; there is no ambiguity due to variations in license header
  text
* It is language neutral
* It is easy to machine process
* It is concise
* It is simple and can be used without much cost in interpreted
  environments like java Script, etc.
* An SPDX license identifier is immutable.
* It provides simple guidance for developers who want to make sure the
  license for their code is respected

See http://spdx.org for further reading.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>

Closes: #1439
Approved by: cgwalters
2018-01-30 20:03:42 +00:00
..
Makefile-inc.am Add SPDX-License-Identifier to source files 2018-01-30 20:03:42 +00:00
README.md Import rofiles-fuse 2016-02-10 13:11:25 +01:00
main.c Add SPDX-License-Identifier to source files 2018-01-30 20:03:42 +00:00

README.md

rofiles-fuse

Create a mountpoint that represents an underlying directory hierarchy, but where non-directory inodes cannot have content or xattrs changed. Files can still be unlinked, and new ones created.

This filesystem is designed for OSTree and other systems that create "hardlink farms", i.e. filesystem trees deduplicated via hardlinks.

Normally with hard links, if you change one, you change them all.

There are two approaches to dealing with that:

Usage

Let's say that you have immutable data in /srv/backups/20150410, and you want to update it with a new version, storing the result in /srv/backups/20150411. Further assume that all software operating on the directory does the "create tempfile and rename()" dance rather than in-place edits.

$ mkdir -p /srv/backups/mnt   # Ensure we have a mount point
$ cp -al /srv/backups/20150410 /srv/backups/20150411
$ rofiles-fuse /srv/backups/20150411 /srv/backups/mnt

Now we have a "rofiles" mount at /srv/backups/mnt. If we try this:

$ echo new doc content > /srv/backups/mnt/document
bash: /srv/backups/mnt/document: Read-only file system

It failed because the > redirection operator will try to truncate the existing file. If instead we create document.tmp and then rename it atomically over the old one, it will work:

$ echo new doc content > /srv/backups/mnt/document.tmp
$ mv /srv/backups/mnt/document.tmp /srv/backups/mnt/document

Let's unmount:

$ fusermount -u /srv/backups/mnt

Now we have two directories /srv/backups/20150410 /srv/backups/20150411 which share all file storage except for the new document.