Encapsulate file descriptor into an object, to ensure that an fd will be
closed properly while exception raised, e.g., the block_cache throws
exception during the block_manager's construction.
I hadn't realised that check_file_exists() also checked that it was
a regular file, which we don't want for the couple of uses I recently
added.
This patch adds an optional arg must_be_regular_file, and defaults
it to true, preserving the original behaviour. The recent additions
have this set to false.
* [file_utils] spin-off syscall-related file operations
1. Eliminate the potential circular dependency between
persistent-data/block.h and persistent-data/file_utils.h,
if the former one wants to include the latter.
2. Avoid namespace pollution by removing the "using namespace std"
declaration in block.tcc.
3. Correct the header hierarchy: base/xml_utils.h now no longer
depends on the higher-level persistent-data/file_utils.h
* [file_utils] support block files in get_file_length()