X-Git-Url: http://git.tuebingen.mpg.de/?p=dss.git;a=blobdiff_plain;f=snap.c;h=2ec195653c8ce65091b31f512010326649387bf1;hp=a9383c12cceeb2a29e2113337621ac825af90c49;hb=a4544b07746d58815d78c4f1213ccdb96d256919;hpb=42451d3bbe741ebae3c8ad49aa104ae53efdbcdb diff --git a/snap.c b/snap.c index a9383c1..2ec1956 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. @@ -84,7 +84,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; @@ -232,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; +}