/*
- * Copyright (C) 2008 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2008-2010 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
#include <sys/time.h>
#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.
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")) {
free(tmp);
if (ret < 0)
return 0;
- if (num > now)
+ if (num > now || num < s->creation_time)
return 0;
s->completion_time = num;
s->flags = SS_COMPLETE;
static int compare_snapshots(const void *a, const void *b)
{
- struct snapshot *s1 = *(struct snapshot **)a;
- struct snapshot *s2 = *(struct snapshot **)b;
+ struct snapshot *s1 = *(struct snapshot * const *)a;
+ struct snapshot *s2 = *(struct snapshot * const *)b;
return NUM_COMPARE(s2->creation_time, s1->creation_time);
}
void get_snapshot_list(struct snapshot_list *sl, int unit_interval,
int num_intervals)
{
- struct add_snapshot_data asd = {
- .unit_interval = unit_interval,
- .num_intervals = num_intervals,
- .sl = sl
- };
+ struct add_snapshot_data asd;
+ asd.unit_interval = unit_interval;
+ asd.num_intervals = num_intervals;
+ asd.sl = sl;
sl->now = get_current_time();
sl->num_snapshots = 0;
sl->array_size = 0;