]> git.tuebingen.mpg.de Git - dss.git/blobdiff - snap.c
Fix --config-file for relative paths.
[dss.git] / snap.c
diff --git a/snap.c b/snap.c
index aef0c51203a26b35233ed811f0fb498aa5ec5967..da95c1f342dc09bcc01d1eef58a075dd721472ef 100644 (file)
--- a/snap.c
+++ b/snap.c
@@ -1,8 +1,4 @@
-/*
- * Copyright (C) 2008-2010 Andre Noll <maan@systemlinux.org>
- *
- * Licensed under the GPL v2. For licencing details see COPYING.
- */
+/* SPDX-License-Identifier: GPL-2.0 */
 #include <stdlib.h>
 #include <assert.h>
 #include <inttypes.h>
@@ -84,7 +80,7 @@ static int is_snapshot(const char *dirname, int64_t now, int unit_interval,
        }
        if (!strcmp(dash + 1, "incomplete.being_deleted")) {
                s->completion_time = -1;
-               s->flags = SS_BEING_DELETED; /* mot cpmplete, being deleted */
+               s->flags = SS_BEING_DELETED; /* not complete, being deleted */
                goto success;
        }
        tmp = dash + 1;
@@ -150,7 +146,7 @@ static int compare_snapshots(const void *a, const void *b)
        return NUM_COMPARE(s2->creation_time, s1->creation_time);
 }
 
-
+/* The returned snapshot list is sorted by creation time. */
 void get_snapshot_list(struct snapshot_list *sl, int unit_interval,
                int num_intervals)
 {
@@ -232,3 +228,13 @@ __malloc char *name_of_newest_complete_snapshot(struct snapshot_list *sl)
        return name;
 }
 
+int num_complete_snapshots(struct snapshot_list *sl)
+{
+       struct snapshot *s;
+       int i, ret = 0;
+
+       FOR_EACH_SNAPSHOT(s, i, sl)
+               if (s->flags & SS_COMPLETE)
+                       ret++;
+       return ret;
+}