X-Git-Url: http://git.tuebingen.mpg.de/?p=dss.git;a=blobdiff_plain;f=snap.c;h=7c16d2e870b8e4e918a1486ab801bf31f1344c47;hp=71b7e30c5f9d248c4815d0c8d0e409eb6c41254e;hb=331602985a9b73157dfba5ceffd2c257e078c197;hpb=97fbf4e7ae1416c60e70657e5b918e9e0d129383 diff --git a/snap.c b/snap.c index 71b7e30..7c16d2e 100644 --- a/snap.c +++ b/snap.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2010 Andre Noll + * Copyright (C) 2008-2010 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -14,11 +14,11 @@ #include #include "gcc-compat.h" -#include "error.h" +#include "err.h" #include "snap.h" -#include "string.h" -#include "time.h" -#include "fd.h" +#include "str.h" +#include "tv.h" +#include "file.h" /** * Wrapper for isdigit. @@ -75,7 +75,6 @@ static int is_snapshot(const char *dirname, int64_t now, int unit_interval, if (num > now) return 0; s->creation_time = num; - //DSS_DEBUG_LOG("%s start time: %lli\n", dirname, (long long)s->creation_time); s->interval = (long long) ((now - s->creation_time) / unit_interval / 24 / 3600); if (!strcmp(dash + 1, "incomplete")) { @@ -233,3 +232,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; +}