Merge branch 'v0.20.x'
This commit is contained in:
commit
28c5e7e6a7
5
NEWS
5
NEWS
@ -19,6 +19,11 @@ ver 0.21 (not yet released)
|
|||||||
- sndio: new mixer plugin
|
- sndio: new mixer plugin
|
||||||
* require GCC 5.0
|
* require GCC 5.0
|
||||||
|
|
||||||
|
ver 0.20.15 (not yet released)
|
||||||
|
* state file
|
||||||
|
- make mount point restore errors non-fatal
|
||||||
|
- fix crash when restoring mounts with incompatible database plugin
|
||||||
|
|
||||||
ver 0.20.14 (2018/01/01)
|
ver 0.20.14 (2018/01/01)
|
||||||
* database
|
* database
|
||||||
- simple: fix file corruption in the presence of mount points
|
- simple: fix file corruption in the presence of mount points
|
||||||
|
@ -47,6 +47,9 @@ static constexpr Domain storage_domain("storage");
|
|||||||
void
|
void
|
||||||
storage_state_save(BufferedOutputStream &os, const Instance &instance)
|
storage_state_save(BufferedOutputStream &os, const Instance &instance)
|
||||||
{
|
{
|
||||||
|
if (instance.storage == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
const auto visitor = [&os](const char *mount_uri, const Storage &storage) {
|
const auto visitor = [&os](const char *mount_uri, const Storage &storage) {
|
||||||
std::string uri = storage.MapUTF8("");
|
std::string uri = storage.MapUTF8("");
|
||||||
if (uri.empty() || StringIsEmpty(mount_uri))
|
if (uri.empty() || StringIsEmpty(mount_uri))
|
||||||
@ -84,6 +87,12 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
|
|||||||
FormatError(storage_domain, "Unrecognized line in mountpoint state: %s", line);
|
FormatError(storage_domain, "Unrecognized line in mountpoint state: %s", line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (instance.storage == nullptr)
|
||||||
|
/* without storage (a CompositeStorage instance), we
|
||||||
|
cannot mount, and therefore we silently ignore the
|
||||||
|
state file */
|
||||||
|
return true;
|
||||||
|
|
||||||
if (url.empty() || uri.empty()) {
|
if (url.empty() || uri.empty()) {
|
||||||
LogError(storage_domain, "Missing value in mountpoint state.");
|
LogError(storage_domain, "Missing value in mountpoint state.");
|
||||||
return true;
|
return true;
|
||||||
@ -98,16 +107,18 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DATABASE
|
|
||||||
Database *db = instance.database;
|
Database *db = instance.database;
|
||||||
if (db != nullptr && db->IsPlugin(simple_db_plugin)) {
|
if (db != nullptr && db->IsPlugin(simple_db_plugin)) {
|
||||||
try {
|
try {
|
||||||
((SimpleDatabase *)db)->Mount(uri.c_str(), url.c_str());
|
((SimpleDatabase *)db)->Mount(uri.c_str(), url.c_str());
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
throw;
|
delete storage;
|
||||||
|
FormatError(std::current_exception(),
|
||||||
|
"Failed to restore mount to %s",
|
||||||
|
url.c_str());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
((CompositeStorage*)instance.storage)->Mount(uri.c_str(), storage);
|
((CompositeStorage*)instance.storage)->Mount(uri.c_str(), storage);
|
||||||
|
|
||||||
@ -117,6 +128,9 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
|
|||||||
unsigned
|
unsigned
|
||||||
storage_state_get_hash(const Instance &instance)
|
storage_state_get_hash(const Instance &instance)
|
||||||
{
|
{
|
||||||
|
if (instance.storage == nullptr)
|
||||||
|
return 0;
|
||||||
|
|
||||||
std::set<std::string> mounts;
|
std::set<std::string> mounts;
|
||||||
|
|
||||||
const auto visitor = [&mounts](const char *mount_uri, const Storage &storage) {
|
const auto visitor = [&mounts](const char *mount_uri, const Storage &storage) {
|
||||||
|
Loading…
Reference in New Issue
Block a user