Fix removal of orphaned snapshots.
[dss.git] / snap.h
diff --git a/snap.h b/snap.h
index 508bbf9312d9f2a343ac2af265799677a372c6a0..eca484a462b6d3ad77c23d75d5b0518058dd5057 100644 (file)
--- a/snap.h
+++ b/snap.h
@@ -98,3 +98,13 @@ _static_inline_ struct snapshot *get_oldest_snapshot(struct snapshot_list *sl)
                return NULL;
        return sl->snapshots[0];
 }
+
+/**
+ * Get the newest snapshot in a snapshot list.
+ */
+_static_inline_ struct snapshot *get_newest_snapshot(struct snapshot_list *sl)
+{
+       if (!sl->num_snapshots)
+               return NULL;
+       return sl->snapshots[sl->num_snapshots - 1];
+}