2 /** We are ready to take the next snapshot. */
4 /** The pre-creation hook has been started. */
6 /** The pre-creation hook exited successfully. */
8 /** The rsync process is running. */
10 /** The rsync process exited successfully. */
12 /** The post-create hook has been started- */
13 SCS_POST_HOOK_RUNNING,
17 * complete, not being deleted: 1204565370-1204565371.Sun_Mar_02_2008_14_33-Sun_Mar_02_2008_14_43
18 * complete, being deleted: 1204565370-1204565371.being_deleted
19 * incomplete, not being deleted: 1204565370-incomplete
20 * incomplete, being deleted: 1204565370-incomplete.being_deleted
22 enum snapshot_status_flags {
23 /** The rsync process terminated successfully. */
25 /** The rm process is running to remove this snapshot. */
31 int64_t creation_time;
32 int64_t completion_time;
33 enum snapshot_status_flags flags;
37 struct snapshot_list {
39 unsigned num_snapshots;
41 struct snapshot **snapshots;
43 * Array of size num_intervals + 1
45 * It contains the number of snapshots in each interval. interval_count[num_intervals]
46 * is the number of snapshots which belong to any interval greater than num_intervals.
48 unsigned *interval_count;
51 #define FOR_EACH_SNAPSHOT(s, i, sl) \
52 for ((i) = 0; (i) < (sl)->num_snapshots && ((s) = (sl)->snapshots[(i)]); (i)++)
54 #define FOR_EACH_SNAPSHOT_REVERSE(s, i, sl) \
55 for ((i) = (sl)->num_snapshots; (i) > 0 && ((s) = (sl)->snapshots[(i - 1)]); (i)--)
58 unsigned desired_number_of_snapshots(int interval_num, int num_intervals);
59 void get_snapshot_list(struct snapshot_list *sl, int unit_interval,
61 void free_snapshot_list(struct snapshot_list *sl);
62 __malloc char *incomplete_name(int64_t start);
63 __malloc char *being_deleted_name(struct snapshot *s);
64 int complete_name(int64_t start, int64_t end, char **result);
65 __malloc char *name_of_newest_complete_snapshot(struct snapshot_list *sl);
67 static inline struct snapshot *get_oldest_snapshot(struct snapshot_list *sl)
69 if (!sl->num_snapshots)
71 return sl->snapshots[0];