Display file system configuration when loading

This commit is contained in:
Sebastian Messmer 2020-07-19 16:57:37 -07:00
parent 959bbab99c
commit cf19fc4f30
1 changed files with 17 additions and 0 deletions

View File

@ -223,11 +223,28 @@ namespace cryfs_cli {
cipher, blocksizeBytes, missingBlockIsIntegrityViolation).loadOrCreate(std::move(configFilePath), allowFilesystemUpgrade, allowReplacedFilesystem);
}
namespace {
void printConfig(const CryConfig& config) {
std::cout
<< "\n----------------------------------------------------"
<< "\nFilesystem configuration:"
<< "\n----------------------------------------------------"
<< "\n- Filesystem format version: " << config.Version()
<< "\n- Created with: CryFS " << config.CreatedWithVersion()
<< "\n- Last opened with: CryFS " << config.LastOpenedWithVersion()
<< "\n- Cipher: " << config.Cipher()
<< "\n- Blocksize: " << config.BlocksizeBytes() << " bytes"
<< "\n- Filesystem Id: " << config.FilesystemId().ToString()
<< "\n----------------------------------------------------\n";
}
}
void Cli::_runFilesystem(const ProgramOptions &options, std::function<void()> onMounted) {
try {
LocalStateDir localStateDir(Environment::localStateDir());
auto blockStore = make_unique_ref<OnDiskBlockStore2>(options.baseDir());
auto config = _loadOrCreateConfig(options, localStateDir);
printConfig(*config.configFile->config());
unique_ptr<fspp::fuse::Fuse> fuse = nullptr;
bool stoppedBecauseOfIntegrityViolation = false;