- return make_message("%lli-incomplete", (long long)start);
-}
-
-char *being_deleted_name(struct snapshot *s)
-{
- if (s->flags & SS_COMPLETE)
- return make_message("%lli-%lli.being_deleted",
- (long long)s->creation_time,
- (long long)s->completion_time);
- return make_message("%lli-incomplete.being_deleted",
- (long long)s->creation_time);
-}
-
-int complete_name(int64_t start, int64_t end, char **result)
-{
- struct tm start_tm, end_tm;
- time_t *start_seconds = (time_t *) (uint64_t *)&start; /* STFU, gcc */
- time_t *end_seconds = (time_t *) (uint64_t *)&end; /* STFU, gcc */
- char start_str[200], end_str[200];
-
- if (!localtime_r(start_seconds, &start_tm)) {
- make_err_msg("%lli", (long long)start);
- return -E_LOCALTIME;
- }
- if (!localtime_r(end_seconds, &end_tm)) {
- make_err_msg("%lli", (long long)end);
- return -E_LOCALTIME;
- }
- if (!strftime(start_str, sizeof(start_str), "%a_%b_%d_%Y_%H_%M_%S", &start_tm)) {
- make_err_msg("%lli", (long long)start);
- return -E_STRFTIME;
- }
- if (!strftime(end_str, sizeof(end_str), "%a_%b_%d_%Y_%H_%M_%S", &end_tm)) {
- make_err_msg("%lli", (long long)end);
- return -E_STRFTIME;
- }
- *result = make_message("%lli-%lli.%s-%s", (long long) start, (long long) end,
- start_str, end_str);
- return 1;
-}
-
-struct snapshot_list {
- int64_t now;
- unsigned num_snapshots;
- unsigned array_size;
- struct snapshot **snapshots;
- /**
- * Array of size num_intervals + 1
- *
- * It contains the number of snapshots in each interval. interval_count[num_intervals]
- * is the number of snapshots which belong to any interval greater than num_intervals.
- */
- unsigned *interval_count;
-};
-
-#define FOR_EACH_SNAPSHOT(s, i, sl) \
- for ((i) = 0; (i) < (sl)->num_snapshots && ((s) = (sl)->snapshots[(i)]); (i)++)