virtual string snapshotDir(unsigned int num) const = 0;
+ // e.g. /test
virtual SDir openSubvolumeDir() const;
+
+ // e.g. /test/.snapshots
virtual SDir openInfosDir() const = 0;
+
+ // e.g. /test/.snapshots/42
virtual SDir openInfoDir(unsigned int num) const;
+
+ // e.g. /test/.snapshots/42/snapshot
virtual SDir openSnapshotDir(unsigned int num) const = 0;
virtual void createSnapshot(unsigned int num, unsigned int num_parent, bool read_only,
// Since we want all-time unique snapshot numbers there might be empty
// directories.
- SDir infos_dir = snapper->openInfosDir();
+ {
+ SDir infos_dir = snapper->openInfosDir();
+
+ for (const string& tmp : infos_dir.entries(SDir::number_entries))
+ infos_dir.rmdir(tmp);
- for (const string& tmp : infos_dir.entries(SDir::number_entries))
- infos_dir.rmdir(tmp);
+ // call ~SDir - although rmdir below (deleteConfig in LVM case) works on a
+ // busy directory - better save than sorry
+ }
try
{