<dd>If checked, this allows the timeshift buffer to grow unbounded until
your storage media runs out of space (WARNING: this could be dangerous!).
- <!--
<dt>Max. Size (MegaBytes)
<dd>Specifies the maximum combined size of all timeshift buffers. If you
specify an unlimited period its highly recommended you specifying a value
<dd>If checked, this allows the combined size of all timeshift buffers to
potentially grow unbounded until your storage media runs out of space
(WARNING: this could be dangerous!).
- -->
</dl>
Changes to any of these settings must be confirmed by pressing the
extern int timeshift_unlimited_size;
extern size_t timeshift_max_size;
+extern size_t timeshift_total_size;
+extern pthread_mutex_t timeshift_size_lock;
+
void timeshift_init ( void );
void timeshift_term ( void );
void timeshift_save ( void );
static pthread_mutex_t timeshift_reaper_lock;
static pthread_cond_t timeshift_reaper_cond;
+pthread_mutex_t timeshift_size_lock;
+size_t timeshift_total_size;
+
/* **************************************************************************
* File reaper thread
* *************************************************************************/
if (errno != ENOTEMPTY)
tvhlog(LOG_ERR, "timeshift", "failed to remove %s [e=%s]",
dpath, strerror(errno));
+ pthread_mutex_lock(×hift_size_lock);
+ assert(tsf->size >= timeshift_total_size);
+ timeshift_total_size -= tsf->size;
+ pthread_mutex_unlock(×hift_size_lock);
/* Free memory */
while ((ti = TAILQ_FIRST(&tsf->iframes))) {
}
/* Check size */
- // TODO: need to implement this
-
+ pthread_mutex_lock(×hift_size_lock);
+ if (!timeshift_unlimited_size && timeshift_total_size >= timeshift_max_size) {
+ tvhlog(LOG_DEBUG, "timshift", "ts %d buffer full", ts->id);
+ ts->full = 1;
+ }
+ pthread_mutex_unlock(×hift_size_lock);
+
/* Create new file */
tsf_tmp = NULL;
if (!ts->full) {
timeshift_filemgr_get_root(path, sizeof(path));
rmtree(path);
+ /* Size processing */
+ timeshift_total_size = 0;
+ pthread_mutex_init(×hift_size_lock, NULL);
+
/* Start the reaper thread */
timeshift_reaper_run = 1;
pthread_mutex_init(×hift_reaper_lock, NULL);
fieldLabel: 'Max. Size (MB)',
name: 'timeshift_max_size',
allowBlank: false,
- width: 300,
- hidden : true
+ width: 300
});
var timeshiftUnlSize = new Ext.form.Checkbox({
fieldLabel: ' (unlimited)',
name: 'timeshift_unlimited_size',
- Width: 300,
- hidden : true
+ Width: 300
});
/* ****************************************************************