Due to security concerns there are no methods to get, compare or revert
files. This can be done in the client.
+
+
+Some snapshots cannot be deleted (current, default and active). Delete
+requests for these are ignored.
bool
Filesystem::isDefault(unsigned int num) const
{
- SN_THROW(UnsupportedException());
- __builtin_unreachable();
+ return false;
}
std::pair<bool, unsigned int>
Filesystem::getDefault() const
{
- SN_THROW(UnsupportedException());
- __builtin_unreachable();
+ return std::make_pair(false, 0);
}
std::pair<bool, unsigned int>
Filesystem::getActive() const
{
- SN_THROW(UnsupportedException());
- __builtin_unreachable();
+ return std::make_pair(false, 0);
}
bool
Filesystem::isActive(unsigned int num) const
{
- SN_THROW(UnsupportedException());
- __builtin_unreachable();
+ return false;
}
Hooks::delete_config(snapper->subvolumeDir(), snapper->getFilesystem());
Snapshots& snapshots = snapper->getSnapshots();
+
+ Snapshots::const_iterator default_snapshot = snapshots.getDefault();
+ Snapshots::const_iterator active_snapshot = snapshots.getActive();
+
for (Snapshots::iterator it = snapshots.begin(); it != snapshots.end(); )
{
Snapshots::iterator tmp = it++;
- if (tmp->isCurrent())
+ if (tmp->isCurrent() || tmp == default_snapshot || tmp == active_snapshot)
continue;
try
void
Snapshot::deleteFilesystemSnapshot() const
{
- if (isCurrent())
- SN_THROW(IllegalSnapshotException());
-
snapper->getFilesystem()->umountSnapshot(num);
snapper->getFilesystem()->deleteSnapshot(num);
}
void
Snapshots::deleteSnapshot(iterator snapshot)
{
- if (snapshot == entries.end() || snapshot->isCurrent())
+ if (snapshot == entries.end() || snapshot->isCurrent() || snapshot->isDefault() ||
+ snapshot->isActive())
SN_THROW(IllegalSnapshotException());
snapshot->deleteFilesystemSnapshot();