jaulib v1.1.2-28-g30efb27-dirty
Jau Support Library (C++, Java, ..)
|
File types and functionality. More...
Classes | |
class | jau::fs::dir_item |
Representing a directory item split into dirname() and basename(). More... | |
class | jau::fs::file_stats |
Platform agnostic representation of POSIX ::lstat() and ::stat() for a given pathname. More... | |
struct | jau::fs::mount_ctx |
Typedefs | |
typedef jau::function< void(const dir_item &)> | jau::fs::consume_dir_item |
void consume_dir_item(const dir_item& item) More... | |
typedef uint64_t | jau::fs::mountflags_t |
Generic flag bit values for mount() flags . More... | |
typedef jau::function< bool(traverse_event, const file_stats &)> | jau::fs::path_visitor |
path_visitor jau::FunctionDef definition More... | |
typedef int | jau::fs::umountflags_t |
Generic flag bit values for umount() flags . More... | |
Functions | |
std::string | jau::fs::basename (const std::string_view &path) noexcept |
Return stripped leading directory components from given path separated by / . More... | |
bool | jau::fs::compare (const file_stats &source1, const file_stats &source2, const bool verbose=false) noexcept |
Compare the bytes of both files, denoted by source1 and source2. More... | |
bool | jau::fs::compare (const std::string &source1, const std::string &source2, const bool verbose=false) noexcept |
Compare the bytes of both files, denoted by source1 and source2. More... | |
bool | jau::fs::copy (const std::string &source_path, const std::string &dest_path, const copy_options copts=copy_options::none) noexcept |
Copy the given source_path to dest_path using copy_options. More... | |
std::string | jau::fs::dirname (const std::string_view &path) noexcept |
Return stripped last component from given path separated by / , excluding the trailing separator / . More... | |
int | jau::fs::from_named_fd (const std::string &named_fd) noexcept |
Returns the file descriptor from the given named file descriptor. More... | |
std::string | jau::fs::get_cwd () noexcept |
Return the current working directory or empty on failure. More... | |
bool | jau::fs::get_dir_content (const int dirfd, const std::string &path, const consume_dir_item &digest) noexcept |
Returns a list of directory elements excluding . More... | |
bool | jau::fs::get_dir_content (const std::string &path, const consume_dir_item &digest) noexcept |
Returns a list of directory elements excluding . More... | |
constexpr bool | jau::fs::is_set (const copy_options mask, const copy_options bit) noexcept |
constexpr bool | jau::fs::is_set (const file_stats::field_t mask, const file_stats::field_t bits) noexcept |
constexpr bool | jau::fs::is_set (const fmode_t mask, const fmode_t bits) noexcept |
constexpr bool | jau::fs::is_set (const mountflags_linux mask, const mountflags_linux bit) noexcept |
constexpr bool | jau::fs::is_set (const traverse_event mask, const traverse_event bit) noexcept |
constexpr bool | jau::fs::is_set (const traverse_options mask, const traverse_options bit) noexcept |
constexpr bool | jau::fs::is_set (const umountflags_linux mask, const umountflags_linux bit) noexcept |
bool | jau::fs::mkdir (const std::string &path, const fmode_t mode=jau::fs::fmode_t::def_dir_prot, const bool verbose=false) noexcept |
Create directory. More... | |
mount_ctx | jau::fs::mount (const std::string &source, const std::string &target, const std::string &fs_type, const mountflags_t flags, const std::string &fs_options="") |
Attach the filesystem named in source to target using the given filesystem source directly. More... | |
mount_ctx | jau::fs::mount_image (const std::string &image_path, const std::string &target, const std::string &fs_type, const mountflags_t flags, const std::string &fs_options="") |
Attach the filesystem image named in image_path to target using an intermediate platform specific filesystem image loop-device. More... | |
constexpr uint16_t | jau::fs::number (const copy_options rhs) noexcept |
constexpr uint32_t | jau::fs::number (const file_stats::field_t rhs) noexcept |
constexpr uint32_t | jau::fs::number (const fmode_t rhs) noexcept |
constexpr mountflags_t | jau::fs::number (const mountflags_linux rhs) noexcept |
constexpr uint16_t | jau::fs::number (const traverse_event rhs) noexcept |
constexpr uint16_t | jau::fs::number (const traverse_options rhs) noexcept |
constexpr umountflags_t | jau::fs::number (const umountflags_linux rhs) noexcept |
constexpr bool | jau::fs::operator!= (const copy_options lhs, const copy_options rhs) noexcept |
constexpr bool | jau::fs::operator!= (const file_stats::field_t lhs, const file_stats::field_t rhs) noexcept |
constexpr bool | jau::fs::operator!= (const fmode_t lhs, const fmode_t rhs) noexcept |
constexpr bool | jau::fs::operator!= (const mountflags_linux lhs, const mountflags_linux rhs) noexcept |
constexpr bool | jau::fs::operator!= (const traverse_event lhs, const traverse_event rhs) noexcept |
constexpr bool | jau::fs::operator!= (const traverse_options lhs, const traverse_options rhs) noexcept |
constexpr bool | jau::fs::operator!= (const umountflags_linux lhs, const umountflags_linux rhs) noexcept |
constexpr copy_options | jau::fs::operator& (const copy_options lhs, const copy_options rhs) noexcept |
constexpr file_stats::field_t | jau::fs::operator& (const file_stats::field_t lhs, const file_stats::field_t rhs) noexcept |
constexpr fmode_t | jau::fs::operator& (const fmode_t lhs, const fmode_t rhs) noexcept |
constexpr mountflags_linux | jau::fs::operator& (const mountflags_linux lhs, const mountflags_linux rhs) noexcept |
constexpr traverse_event | jau::fs::operator& (const traverse_event lhs, const traverse_event rhs) noexcept |
constexpr traverse_options | jau::fs::operator& (const traverse_options lhs, const traverse_options rhs) noexcept |
constexpr umountflags_linux | jau::fs::operator& (const umountflags_linux lhs, const umountflags_linux rhs) noexcept |
constexpr copy_options & | jau::fs::operator&= (copy_options &lhs, const copy_options rhs) noexcept |
constexpr file_stats::field_t & | jau::fs::operator&= (file_stats::field_t &lhs, const file_stats::field_t rhs) noexcept |
constexpr fmode_t & | jau::fs::operator&= (fmode_t &lhs, const fmode_t rhs) noexcept |
constexpr mountflags_linux & | jau::fs::operator&= (mountflags_linux &lhs, const mountflags_linux rhs) noexcept |
constexpr mountflags_t & | jau::fs::operator&= (mountflags_t &lhs, const mountflags_linux rhs) noexcept |
constexpr traverse_event & | jau::fs::operator&= (traverse_event &lhs, const traverse_event rhs) noexcept |
constexpr traverse_options & | jau::fs::operator&= (traverse_options &lhs, const traverse_options rhs) noexcept |
constexpr umountflags_linux & | jau::fs::operator&= (umountflags_linux &lhs, const umountflags_linux rhs) noexcept |
constexpr umountflags_t & | jau::fs::operator&= (umountflags_t &lhs, const umountflags_linux rhs) noexcept |
constexpr bool | jau::fs::operator== (const copy_options lhs, const copy_options rhs) noexcept |
constexpr bool | jau::fs::operator== (const file_stats::field_t lhs, const file_stats::field_t rhs) noexcept |
constexpr bool | jau::fs::operator== (const fmode_t lhs, const fmode_t rhs) noexcept |
constexpr bool | jau::fs::operator== (const mountflags_linux lhs, const mountflags_linux rhs) noexcept |
constexpr bool | jau::fs::operator== (const traverse_event lhs, const traverse_event rhs) noexcept |
constexpr bool | jau::fs::operator== (const traverse_options lhs, const traverse_options rhs) noexcept |
constexpr bool | jau::fs::operator== (const umountflags_linux lhs, const umountflags_linux rhs) noexcept |
constexpr copy_options | jau::fs::operator^ (const copy_options lhs, const copy_options rhs) noexcept |
constexpr file_stats::field_t | jau::fs::operator^ (const file_stats::field_t lhs, const file_stats::field_t rhs) noexcept |
constexpr fmode_t | jau::fs::operator^ (const fmode_t lhs, const fmode_t rhs) noexcept |
constexpr mountflags_linux | jau::fs::operator^ (const mountflags_linux lhs, const mountflags_linux rhs) noexcept |
constexpr traverse_event | jau::fs::operator^ (const traverse_event lhs, const traverse_event rhs) noexcept |
constexpr traverse_options | jau::fs::operator^ (const traverse_options lhs, const traverse_options rhs) noexcept |
constexpr umountflags_linux | jau::fs::operator^ (const umountflags_linux lhs, const umountflags_linux rhs) noexcept |
constexpr copy_options & | jau::fs::operator^= (copy_options &lhs, const copy_options rhs) noexcept |
constexpr file_stats::field_t & | jau::fs::operator^= (file_stats::field_t &lhs, const file_stats::field_t rhs) noexcept |
constexpr fmode_t & | jau::fs::operator^= (fmode_t &lhs, const fmode_t rhs) noexcept |
constexpr mountflags_linux & | jau::fs::operator^= (mountflags_linux &lhs, const mountflags_linux rhs) noexcept |
constexpr mountflags_t & | jau::fs::operator^= (mountflags_t &lhs, const mountflags_linux rhs) noexcept |
constexpr traverse_event & | jau::fs::operator^= (traverse_event &lhs, const traverse_event rhs) noexcept |
constexpr traverse_options & | jau::fs::operator^= (traverse_options &lhs, const traverse_options rhs) noexcept |
constexpr umountflags_linux & | jau::fs::operator^= (umountflags_linux &lhs, const umountflags_linux rhs) noexcept |
constexpr umountflags_t & | jau::fs::operator^= (umountflags_t &lhs, const umountflags_linux rhs) noexcept |
constexpr copy_options | jau::fs::operator| (const copy_options lhs, const copy_options rhs) noexcept |
constexpr file_stats::field_t | jau::fs::operator| (const file_stats::field_t lhs, const file_stats::field_t rhs) noexcept |
constexpr fmode_t | jau::fs::operator| (const fmode_t lhs, const fmode_t rhs) noexcept |
constexpr mountflags_linux | jau::fs::operator| (const mountflags_linux lhs, const mountflags_linux rhs) noexcept |
constexpr traverse_event | jau::fs::operator| (const traverse_event lhs, const traverse_event rhs) noexcept |
constexpr traverse_options | jau::fs::operator| (const traverse_options lhs, const traverse_options rhs) noexcept |
constexpr umountflags_linux | jau::fs::operator| (const umountflags_linux lhs, const umountflags_linux rhs) noexcept |
constexpr copy_options & | jau::fs::operator|= (copy_options &lhs, const copy_options rhs) noexcept |
constexpr file_stats::field_t & | jau::fs::operator|= (file_stats::field_t &lhs, const file_stats::field_t rhs) noexcept |
constexpr fmode_t & | jau::fs::operator|= (fmode_t &lhs, const fmode_t rhs) noexcept |
constexpr mountflags_linux & | jau::fs::operator|= (mountflags_linux &lhs, const mountflags_linux rhs) noexcept |
constexpr mountflags_t & | jau::fs::operator|= (mountflags_t &lhs, const mountflags_linux rhs) noexcept |
constexpr traverse_event & | jau::fs::operator|= (traverse_event &lhs, const traverse_event rhs) noexcept |
constexpr traverse_options & | jau::fs::operator|= (traverse_options &lhs, const traverse_options rhs) noexcept |
constexpr umountflags_linux & | jau::fs::operator|= (umountflags_linux &lhs, const umountflags_linux rhs) noexcept |
constexpr umountflags_t & | jau::fs::operator|= (umountflags_t &lhs, const umountflags_linux rhs) noexcept |
constexpr copy_options | jau::fs::operator~ (const copy_options rhs) noexcept |
constexpr file_stats::field_t | jau::fs::operator~ (const file_stats::field_t rhs) noexcept |
constexpr fmode_t | jau::fs::operator~ (const fmode_t rhs) noexcept |
constexpr mountflags_linux | jau::fs::operator~ (const mountflags_linux rhs) noexcept |
constexpr traverse_event | jau::fs::operator~ (const traverse_event rhs) noexcept |
constexpr traverse_options | jau::fs::operator~ (const traverse_options rhs) noexcept |
constexpr umountflags_linux | jau::fs::operator~ (const umountflags_linux rhs) noexcept |
constexpr ::mode_t | jau::fs::posix_protection_bits (const fmode_t mask) noexcept |
Returns the POSIX protection bits: rwx_all | set_uid | set_gid | sticky, i.e. More... | |
bool | jau::fs::remove (const std::string &path, const traverse_options topts=traverse_options::none) noexcept |
Remove the given path. More... | |
bool | jau::fs::rename (const std::string &oldpath, const std::string &newpath) noexcept |
Rename oldpath to newpath using POSIX rename() , with the following combinations. More... | |
void | jau::fs::sync () noexcept |
Synchronizes filesystems, i.e. More... | |
std::string | jau::fs::to_named_fd (const int fd) noexcept |
Returns platform dependent named file descriptor of given file descriptor, if supported. More... | |
std::string | jau::fs::to_string (const copy_options mask) noexcept |
std::string | jau::fs::to_string (const file_stats::field_t mask) noexcept |
std::string | jau::fs::to_string (const fmode_t mask, const bool show_rwx=false) noexcept |
Return the string representation of fmode_t. More... | |
std::string | jau::fs::to_string (const traverse_event mask) noexcept |
std::string | jau::fs::to_string (const traverse_options mask) noexcept |
bool | jau::fs::touch (const std::string &path, const fmode_t mode=jau::fs::fmode_t::def_file_prot) noexcept |
Touch the file with current time and create file if not existing yet. More... | |
bool | jau::fs::touch (const std::string &path, const jau::fraction_timespec &atime, const jau::fraction_timespec &mtime, const fmode_t mode=jau::fs::fmode_t::def_file_prot) noexcept |
Touch the file with given atime and mtime and create file if not existing yet. More... | |
bool | jau::fs::umount (const mount_ctx &context, const umountflags_t flags) |
Detach the given mount_ctx context More... | |
bool | jau::fs::umount (const std::string &target, const umountflags_t flags) |
Detach the topmost filesystem mounted on target optionally using given umountflags options if supported. More... | |
bool | jau::fs::visit (const file_stats &item_stats, const traverse_options topts, const path_visitor &visitor, std::vector< int > *dirfds=nullptr) noexcept |
Visit element(s) of a given path, see traverse_options for detailed settings. More... | |
bool | jau::fs::visit (const std::string &path, const traverse_options topts, const path_visitor &visitor, std::vector< int > *dirfds=nullptr) noexcept |
Visit element(s) of a given path, see traverse_options for detailed settings. More... | |
File types and functionality.
typedef jau::function<void(const dir_item&)> jau::fs::consume_dir_item |
void consume_dir_item(const dir_item& item)
Definition at line 713 of file file_util.hpp.
typedef jau::function<bool(traverse_event, const file_stats&)> jau::fs::path_visitor |
path_visitor jau::FunctionDef definition
bool visitor(traverse_event tevt, const file_stats& item_stats)
Definition at line 839 of file file_util.hpp.
typedef uint64_t jau::fs::mountflags_t |
Generic flag bit values for mount() flags
.
See mount(2) for a detailed description.
Definition at line 1150 of file file_util.hpp.
typedef int jau::fs::umountflags_t |
Generic flag bit values for umount() flags
.
See umount(2) for a detailed description.
Definition at line 1287 of file file_util.hpp.
|
strong |
Generic file type and POSIX protection mode bits as used in file_stats, touch(), mkdir() etc.
The POSIX protection mode bits reside in the lower 16-bits and are bit-wise POSIX compliant while the file type bits reside in the upper 16-bits and are platform agnostic.
This enum class
type fulfills C++ named requirements: BitmaskType
.
Definition at line 219 of file file_util.hpp.
|
strong |
Filesystem traverse event used to call path_visitor for path elements from visit().
This enum class
type fulfills C++ named requirements: BitmaskType
.
Enumerator | |
---|---|
none | No value, neither file, symlink nor dir_entry or dir_exit. Implying an error state in file_stat, e.g. !file_stats::has_access(). |
symlink | Visiting a symbolic-link, either to a file or a non-existing entity. Not followed symbolic-links to a directory is expressed via dir_symlink. In case of a symbolic-link to an existing file, file is also set, i.e. file_symlink. |
file | Visiting a file, may be in conjunction with symlink, i.e. file_symlink. |
file_symlink | Visiting a symlink to a file, i.e. symlink | file |
dir_entry | Visiting a directory on entry, see traverse_options::dir_entry. If a directory is visited non-recursive, i.e. traverse_options::recursive not set, dir_entry and dir_exit are set, see dir_non_recursive. If a directory is a symbolic link which is not followed, i.e. traverse_options::follow_symlinks not set, dir_symlink is used instead. |
dir_exit | Visiting a directory on exit, see traverse_options::dir_exit. If a directory is visited non-recursive, i.e. traverse_options::recursive not set, dir_entry and dir_exit are set, see dir_non_recursive. If a directory is a symbolic link which is not followed, i.e. traverse_options::follow_symlinks not set, dir_symlink is used instead. |
dir_symlink | Visiting a symbolic-link to a directory which is not followed, i.e. traverse_options::follow_symlinks not set. |
dir_non_recursive | Visiting a directory non-recursive, i.e. traverse_options::recursive not set. Value is a bit-mask of dir_entry | dir_exit |
Definition at line 746 of file file_util.hpp.
|
strong |
Filesystem traverse options used to visit() path elements.
This enum class
type fulfills C++ named requirements: BitmaskType
.
Enumerator | |
---|---|
none | No option set. |
recursive | Traverse through directories, i.e. perform visit, copy, remove etc actions recursively throughout the directory structure. |
follow_symlinks | Traverse through symbolic linked directories if traverse_options::recursive is set, i.e. directories with property fmode_t::link set. |
lexicographical_order | Traverse through elements in lexicographical order. This might be required when computing an order dependent outcome like a hash value. |
dir_entry | Visit the content's parent directory at entry. Both, dir_entry and dir_exit can be set, only one or none. |
dir_exit | Visit the content's parent directory at exit. Both, dir_entry and dir_exit can be set, only one or none. |
verbose | Enable verbosity mode, potentially used by a path_visitor implementation like remove(). |
Definition at line 849 of file file_util.hpp.
|
strong |
Filesystem copy options used to copy() path elements.
By default, the fmode_t POSIX protection mode bits are preserved while using the caller's uid and gid as well as current timestamps.
Use copy_options::preserve_all to preserve uid and gid if allowed from the caller and access- and modification-timestamps.
This enum class
type fulfills C++ named requirements: BitmaskType
.
Enumerator | |
---|---|
none | No option set. |
recursive | Traverse through directories, i.e. perform visit, copy, remove etc actions recursively throughout the directory structure. |
follow_symlinks | Copy referenced symbolic linked files or directories instead of just the symbolic link with property fmode_t::link set. |
into_existing_dir | Copy source dir content into an already existing destination directory as if destination directory did not exist. Otherwise, if destination directory already exist, the source directory will be copied below the destination directory. |
ignore_symlink_errors | Ignore errors from erroneous symlinks, e.g. non-existing link-targets, recursive loop-errors.or unsupported symmlinks on target filesystem. This flag is required to
|
overwrite | Overwrite existing destination files. |
preserve_all | Preserve uid and gid if allowed and access- and modification-timestamps, i.e. producing a most exact meta-data copy. |
sync | Ensure data and meta-data file synchronization is performed via ::fsync() after asynchronous copy operations of a file's content. |
verbose | Enable verbosity mode, show error messages on stderr. |
Definition at line 994 of file file_util.hpp.
|
strong |
Flag bit values for mount() flags
under GNU/Linux.
See mount(2) for a detailed description.
Definition at line 1157 of file file_util.hpp.
|
strong |
Flag bit values for umount() flags
under GNU/Linux.
See umount(2) for a detailed description.
Enumerator | |
---|---|
force | |
detach | |
expire | |
nofollow |
Definition at line 1294 of file file_util.hpp.
|
noexcept |
Return the current working directory or empty on failure.
Definition at line 81 of file file_util.cpp.
|
noexcept |
Return stripped last component from given path separated by /
, excluding the trailing separator /
.
If no directory separator /
is contained, return .
.
If only the root path /
is given, return /
.
path | given path |
.
Definition at line 100 of file file_util.cpp.
|
noexcept |
Return stripped leading directory components from given path separated by /
.
If only the root path /
is given, return /
.
path | given path |
.
Definition at line 122 of file file_util.cpp.
|
constexprnoexcept |
Definition at line 295 of file file_util.hpp.
Definition at line 298 of file file_util.hpp.
Definition at line 301 of file file_util.hpp.
Definition at line 304 of file file_util.hpp.
Definition at line 307 of file file_util.hpp.
Definition at line 311 of file file_util.hpp.
Definition at line 315 of file file_util.hpp.
Definition at line 319 of file file_util.hpp.
Definition at line 322 of file file_util.hpp.
|
noexcept |
Return the string representation of fmode_t.
mask | the fmode_t to convert |
show_rwx | if true, return verbose POSIX protection bit string representation using rwx for user, group and others. Otherwise simply show the octal representation (default) |
Definition at line 334 of file file_util.cpp.
|
noexcept |
Returns the POSIX protection bits: rwx_all | set_uid | set_gid | sticky, i.e.
fmode_t masked with fmode_t::protection_mask.
Definition at line 337 of file file_util.hpp.
|
noexcept |
Returns platform dependent named file descriptor of given file descriptor, if supported.
Implementation returns (d
stands for integer):
/dev/fd/d
(GNU/Linux, FreeBSD, ..)Following standard POSIX mappings exist
/dev/fd/0
, /dev/stdin
/dev/fd/1
, /dev/stdout
/dev/fd/2
, /dev/stderr
/dev/fd/[0-99]
Currently implementation always returns above pattern, not handling the target OS differences.
fd | file descriptor. |
Definition at line 367 of file file_util.cpp.
|
noexcept |
Returns the file descriptor from the given named file descriptor.
Detected named file descriptors are (d
stands for integer)
/dev/fd/d
(GNU/Linux, FreeBSD, ..)/proc/self/fd/d
(GNU/Linux)named_fd | the named file descriptor |
Definition at line 376 of file file_util.cpp.
|
constexprnoexcept |
Definition at line 644 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 647 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 650 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 653 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 656 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 659 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 663 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 667 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 671 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 674 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 677 of file file_util.hpp.
|
noexcept |
Definition at line 402 of file file_util.cpp.
|
noexcept |
Create directory.
path | full path to new directory |
mode | fmode_t POSIX protection bits used, defaults to jau::fs::fmode_t::def_dir_prot |
verbose | defaults to false |
Definition at line 875 of file file_util.cpp.
|
noexcept |
Touch the file with given atime and mtime and create file if not existing yet.
path | full path to file |
atime | new access time |
mtime | new modification time |
mode | fmode_t POSIX protection bits used, defaults to jau::fs::fmode_t::def_file_prot |
Definition at line 897 of file file_util.cpp.
|
noexcept |
Touch the file with current time and create file if not existing yet.
path | full path to file |
mode | fmode_t POSIX protection bits used, defaults to jau::fs::fmode_t::def_file_prot |
Definition at line 915 of file file_util.cpp.
|
noexcept |
Returns a list of directory elements excluding .
and ..
for the given path, non recursive.
The custom consume_dir_item digest
may also be used to filter the element, besides storing it.
path | path to directory |
digest | consume_dir_item function to receive each directory item, e.g. void consume_dir_item(const dir_item& item) |
Definition at line 932 of file file_util.cpp.
|
noexcept |
Returns a list of directory elements excluding .
and ..
for the given path, non recursive.
The custom consume_dir_item digest
may also be used to filter the element, besides storing it.
dirfd | file descriptor to given path left untouched as a copy is being used to retrieve the directory content. |
path | path to directory |
digest | consume_dir_item function to receive each directory item, e.g. void consume_dir_item(const dir_item& item) |
Definition at line 950 of file file_util.cpp.
|
constexprnoexcept |
Definition at line 797 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 800 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 803 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 806 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 809 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 812 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 816 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 820 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 824 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 827 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 830 of file file_util.hpp.
|
noexcept |
Definition at line 979 of file file_util.cpp.
|
constexprnoexcept |
Definition at line 871 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 874 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 877 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 880 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 883 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 886 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 890 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 894 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 898 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 901 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 904 of file file_util.hpp.
|
noexcept |
Definition at line 995 of file file_util.cpp.
|
noexcept |
Visit element(s) of a given path, see traverse_options for detailed settings.
All elements of type fmode_t::file, fmode_t::dir and fmode_t::no_access or fmode_t::not_existing will be visited by the given path_visitor visitor
.
Processing ends if the visitor returns
false`.
path | the starting path |
topts | given traverse_options for this operation |
visitor | path_visitor function bool visitor(const file_stats& item_stats) . |
dirfds | optional empty dirfd stack pointer defaults to nullptr. If user provided, exposes the used dirfd stack, which last entry represents the current visitor parent directory. The dirfd stack starts and ends empty, i.e. all directory file descriptor are closed. |
Definition at line 1117 of file file_util.cpp.
|
noexcept |
Visit element(s) of a given path, see traverse_options for detailed settings.
All elements of type fmode_t::file, fmode_t::dir and fmode_t::no_access or fmode_t::not_existing will be visited by the given path_visitor visitor
.
Processing ends if the visitor returns
false`.
item_stats | pre-fetched file_stats for a given dir_item, used for efficiency |
topts | given traverse_options for this operation |
visitor | path_visitor function bool visitor(const file_stats& item_stats) . |
dirfds | optional empty dirfd stack pointer defaults to nullptr. If user provided, exposes the used dirfd stack, which last entry represents the current visitor parent directory. The dirfd stack starts and ends empty, i.e. all directory file descriptor are closed. |
Definition at line 1079 of file file_util.cpp.
|
noexcept |
Remove the given path.
If path represents a director, recursive
must be set to true.
The given traverse_options options
are handled as follows:
Implementation is most data-race-free (DRF), utilizes following safeguards
openat()
and unlinkat()
operations against concurrent mutationpath | path to remove |
topts | given traverse_options for this operation, defaults to traverse_options::none |
Definition at line 1121 of file file_util.cpp.
|
noexcept |
Compare the bytes of both files, denoted by source1 and source2.
source1 | first source file to compare |
source2 | second source file to compare |
verbose | defaults to false |
Definition at line 1196 of file file_util.cpp.
|
noexcept |
Compare the bytes of both files, denoted by source1 and source2.
source1 | first source file to compare |
source2 | second source file to compare |
verbose | defaults to false |
Definition at line 1190 of file file_util.cpp.
|
constexprnoexcept |
Definition at line 1033 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1036 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1039 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1042 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1045 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1048 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1052 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1056 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1060 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1063 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1066 of file file_util.hpp.
|
noexcept |
Definition at line 1303 of file file_util.cpp.
|
noexcept |
Copy the given source_path to dest_path using copy_options.
The behavior is similar like POSIX cp
commandline tooling.
The following behavior is being followed regarding dest_path:
Implementation either uses ::sendfile() if running under GNU/Linux
, otherwise POSIX ::read() and ::write().
Implementation is most data-race-free (DRF), utilizes following safeguards on recursive directory copy
openat()
operations against concurrent mutationSee copy_options for details.
source_path | |
dest_path | |
copts |
Definition at line 1647 of file file_util.cpp.
|
noexcept |
Rename oldpath to newpath using POSIX rename()
, with the following combinations.
oldpath | previous path |
newpath | new path |
Definition at line 1842 of file file_util.cpp.
|
noexcept |
Synchronizes filesystems, i.e.
all pending modifications to filesystem metadata and cached file data will be written to the underlying filesystems.
Definition at line 1858 of file file_util.cpp.
|
constexprnoexcept |
Definition at line 1186 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1189 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1192 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1195 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1198 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1201 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1205 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1209 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1213 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1216 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1219 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1222 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1226 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1230 of file file_util.hpp.
jau::fs::mount_ctx jau::fs::mount_image | ( | const std::string & | image_path, |
const std::string & | target, | ||
const std::string & | fs_type, | ||
const mountflags_t | flags, | ||
const std::string & | fs_options = "" |
||
) |
Attach the filesystem image named in image_path
to target
using an intermediate platform specific filesystem image loop-device.
This method either requires root permissions
or the following capabilities: cap_sys_admin
,cap_setuid
, cap_setgid
.
Unmounting shall be done via umount() with mount_ctx argument to ensure all intermediate resources are released.
image_path | path of image source file |
target | directory where image_path filesystem shall be attached to |
fs_type | type of filesystem, e.g. squashfs , tmpfs , iso9660 , etc. |
flags | filesystem agnostic mount flags, see mountflags_linux. |
fs_options | comma separated options for the filesystem fs_type , see mount(8) for available options for the used filesystem. |
Definition at line 1870 of file file_util.cpp.
mount_ctx jau::fs::mount | ( | const std::string & | source, |
const std::string & | target, | ||
const std::string & | fs_type, | ||
const mountflags_t | flags, | ||
const std::string & | fs_options = "" |
||
) |
Attach the filesystem named in source
to target
using the given filesystem source directly.
This method either requires root permissions
or the following capabilities: cap_sys_admin
,cap_setuid
, cap_setgid
.
source | filesystem path for device, directory, file or dummy-string which shall be attached |
target | directory where source filesystem shall be attached to |
fs_type | type of filesystem, e.g. squashfs , tmpfs , iso9660 , etc. |
flags | filesystem agnostic mount flags, see mountflags_linux. |
fs_options | comma separated options for the filesystem fs_type , see mount(8) for available options for the used filesystem. |
Definition at line 1997 of file file_util.cpp.
|
constexprnoexcept |
Definition at line 1300 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1303 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1306 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1309 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1312 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1315 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1319 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1323 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1327 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1330 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1333 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1336 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1340 of file file_util.hpp.
|
constexprnoexcept |
Definition at line 1344 of file file_util.hpp.
bool jau::fs::umount | ( | const mount_ctx & | context, |
const umountflags_t | flags | ||
) |
Detach the given mount_ctx context
This method either requires root permissions
or the following capabilities: cap_sys_admin
,cap_setuid
, cap_setgid
.
context | mount_ctx previously attached via mount_image() or mount() |
flags | optional umount options, if supported by the system. See umount_options_linux. |
Definition at line 2069 of file file_util.cpp.
bool jau::fs::umount | ( | const std::string & | target, |
const umountflags_t | flags | ||
) |
Detach the topmost filesystem mounted on target
optionally using given umountflags
options if supported.
This method either requires root permissions
or the following capabilities: cap_sys_admin
,cap_setuid
, cap_setgid
.
target | directory of previously attached filesystem |
flags | optional umount options, if supported by the system. See umount_options_linux. |
Definition at line 2153 of file file_util.cpp.