The File Link Copy On Write library provides a way to create copy-on-write semantics for file links in a directory tree, allowing multiple versions of a file to exist concurrently without duplicating data.
The FL-COW library is a solution to a problem faced when working with Linux Kernel archives for replication purposes using hard links. In terms of speed and space saving, replicating archives with hard links is efficient but can cause problems while working on kernel sources. The developer, faced with this issue, wrote the FL-COW library to overcome the problem.
The problem occurs when the user replicates a vanilla (Linus) archive into an archive they can begin hacking on using the command: "cp -al linux-2.6-test6 linux-2.6-test6.vm-fix." Manual decoupling of the hard links for each file worked on is required. Failure to do so can result in unintended changes to even the original copy or loss of information, causing the diff command to skip the changes done on that file. The FL-COW library intercepts file open operations in a predetermined path list and decouples the hard links through COW when a write operation is requested.
The library is installed using the environment variable LD_PRELOAD, which enables it to hook glibc open(2) functions and perform the COW when necessary. FLCOW_PATH controls the paths that require COWing. The library performs COWing when the file being opened is a regular file, located in any of the paths listed in the FLCOW_PATH environment variable, opened with O_RDWR or O_WRONLY modes, and the (struct stat) ->st_nlink>1.
To set up and use the FL-COW library, the user can follow a few steps, including building it, running make, make check, make install, and setting the LD_PRELOAD inside .bashrc file. The library is installed in /usr/lib/libflcow.so, ready for use.
Overall, the FL-COW library is a useful solution that saves time, space, and reduces manual errors. The ability to use COWing for file operations is an added advantage, and the library is easy to install and activate.
Version 0.9: N/A