Sometimes, `bindPath` will detect the source is a symlink and we are not using the new mount API which support symlinks (kernel ≥ 5.12 IIRC?). In those instances, we copy the inode to the target. But some callers may want to follow the symlink in such circumstances, we add a new default argument to the previous value and let caller decide for themselves. Change-Id: I8505b613fc614ce539eb89258fbbb7eaecebe23b Signed-off-by: Raito Bezarius <raito@lix.systems>
24 lines
628 B
C++
24 lines
628 B
C++
#pragma once
|
|
///@file
|
|
|
|
#include "lix/libutil/types.hh"
|
|
#include "lix/libutil/file-system.hh"
|
|
|
|
#if __linux__
|
|
namespace nix {
|
|
|
|
/**
|
|
* Bind-mount file or directory from `source` to `destination`.
|
|
* If source does not exist this will fail unless `optional` is set
|
|
*
|
|
* If `source` is a symlink, it will perform a copy instead of a bind mount
|
|
* because symlinks cannot be bind mounted on all versions of the Linux kernel.
|
|
*
|
|
* If a copy is performed, extra flags to the copy can be passed using `flags`.
|
|
*/
|
|
void bindPath(
|
|
const Path & source, const Path & target, bool optional = false, CopyFileFlags flags = {}
|
|
);
|
|
}
|
|
#endif
|