light: add transferstatus symlink

This commit is contained in:
Thomas Schoebel-Theuer 2013-08-28 16:27:00 +02:00
parent ebe0ca6ad9
commit 9134c1b771
1 changed files with 31 additions and 0 deletions

View File

@ -767,6 +767,9 @@ int _update_link_when_necessary(struct mars_rotate *rot, const char *type, const
int status = -EIO; int status = -EIO;
bool res = false; bool res = false;
if (unlikely(!old || !new))
goto out;
/* Check whether something really has changed (avoid /* Check whether something really has changed (avoid
* useless/disturbing timestamp updates) * useless/disturbing timestamp updates)
*/ */
@ -1311,6 +1314,23 @@ int _update_file(struct mars_rotate *rot, const char *switch_path, const char *c
MARS_DBG("src = '%s' dst = '%s'\n", tmp, file); MARS_DBG("src = '%s' dst = '%s'\n", tmp, file);
status = __make_copy(global, NULL, switch_path, copy_path, NULL, argv, -1, -1, false, false, &copy); status = __make_copy(global, NULL, switch_path, copy_path, NULL, argv, -1, -1, false, false, &copy);
if (status >= 0 && copy) { if (status >= 0 && copy) {
char *src = path_make("%d,%s,%lld,%lld,%d,%d",
copy->power.led_on,
file,
copy->copy_start,
copy->copy_last,
copy->copy_end,
copy->copy_error,
copy->copy_error_count);
char *dst = path_make("%s/transferstatus-%s",
rot->parent_path,
my_id());
(void)_update_link_when_necessary(rot, "transferstatus", src, dst);
brick_string_free(src);
brick_string_free(dst);
copy->copy_limiter = &rot->file_limiter; copy->copy_limiter = &rot->file_limiter;
// FIXME: code is dead // FIXME: code is dead
if (copy->append_mode && copy->power.led_on && if (copy->append_mode && copy->power.led_on &&
@ -3777,6 +3797,7 @@ enum {
CL_ACTSIZE, CL_ACTSIZE,
CL_PRIMARY, CL_PRIMARY,
CL__FILE, CL__FILE,
CL_TRANSFER,
CL_SYNC, CL_SYNC,
CL_VERIF, CL_VERIF,
CL_SYNCPOS, CL_SYNCPOS,
@ -4075,6 +4096,16 @@ static const struct light_class light_classes[] = {
.cl_forward = make_bio, .cl_forward = make_bio,
.cl_backward = kill_any, .cl_backward = kill_any,
}, },
/* informational symlink indicating the current
* status / start / pos / end of logfile transfers.
*/
[CL_TRANSFER] = {
.cl_name = "transferstatus-",
.cl_len = 15,
.cl_type = 'l',
.cl_hostcontext = true,
.cl_father = CL_RESOURCE,
},
/* symlink indicating the current status / end /* symlink indicating the current status / end
* of initial data sync. * of initial data sync.
*/ */