mirror of https://github.com/schoebel/mars
replace switch-*/ by todo-*/
This commit is contained in:
parent
96ed04574d
commit
9d00314c49
|
@ -655,7 +655,7 @@ int check_logfile(struct mars_peerinfo *peer, struct mars_dent *dent, struct mar
|
||||||
}
|
}
|
||||||
|
|
||||||
// check whether connection is allowed
|
// check whether connection is allowed
|
||||||
switch_path = path_make("%s/switch-%s/connect", parent->d_path, my_id());
|
switch_path = path_make("%s/todo-%s/connect", parent->d_path, my_id());
|
||||||
|
|
||||||
// start / treat copy brick instance
|
// start / treat copy brick instance
|
||||||
status = _update_file(peer->global, switch_path, copy_path, dent->d_path, peer->peer, src_size);
|
status = _update_file(peer->global, switch_path, copy_path, dent->d_path, peer->peer, src_size);
|
||||||
|
@ -1424,7 +1424,7 @@ int make_log_init(void *buf, struct mars_dent *dent)
|
||||||
MARS_DBG("logfile '%s' size = %lld\n", aio_path, rot->aio_info.current_size);
|
MARS_DBG("logfile '%s' size = %lld\n", aio_path, rot->aio_info.current_size);
|
||||||
|
|
||||||
// check whether attach is allowed
|
// check whether attach is allowed
|
||||||
switch_path = path_make("%s/switch-%s/attach", parent->d_path, my_id());
|
switch_path = path_make("%s/todo-%s/attach", parent->d_path, my_id());
|
||||||
|
|
||||||
/* Fetch / make the transaction logger.
|
/* Fetch / make the transaction logger.
|
||||||
* We deliberately "forget" to connect the log input here.
|
* We deliberately "forget" to connect the log input here.
|
||||||
|
@ -2237,7 +2237,7 @@ static int _make_copy(void *buf, struct mars_dent *dent)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
// check whether connection is allowed
|
// check whether connection is allowed
|
||||||
switch_path = path_make("%s/switch-%s/connect", dent->d_parent->d_path, my_id());
|
switch_path = path_make("%s/todo-%s/connect", dent->d_parent->d_path, my_id());
|
||||||
|
|
||||||
status = __make_copy(global, dent, switch_path, copy_path, dent->d_parent->d_path, (const char**)dent->d_argv, -1, NULL);
|
status = __make_copy(global, dent, switch_path, copy_path, dent->d_parent->d_path, (const char**)dent->d_argv, -1, NULL);
|
||||||
|
|
||||||
|
@ -2331,7 +2331,7 @@ static int make_sync(void *buf, struct mars_dent *dent)
|
||||||
copy_path = backskip_replace(dent->d_path, '/', true, "/copy-");
|
copy_path = backskip_replace(dent->d_path, '/', true, "/copy-");
|
||||||
|
|
||||||
// check whether connection is allowed
|
// check whether connection is allowed
|
||||||
switch_path = path_make("%s/switch-%s/sync", dent->d_parent->d_path, my_id());
|
switch_path = path_make("%s/todo-%s/sync", dent->d_parent->d_path, my_id());
|
||||||
|
|
||||||
status = -ENOMEM;
|
status = -ENOMEM;
|
||||||
if (unlikely(!src || !dst || !copy_path || !switch_path))
|
if (unlikely(!src || !dst || !copy_path || !switch_path))
|
||||||
|
@ -2389,8 +2389,8 @@ enum {
|
||||||
CL_DEFAULTS,
|
CL_DEFAULTS,
|
||||||
CL_DEFAULTS_ITEMS0,
|
CL_DEFAULTS_ITEMS0,
|
||||||
CL_DEFAULTS_ITEMS,
|
CL_DEFAULTS_ITEMS,
|
||||||
CL_SWITCH,
|
CL_TODO,
|
||||||
CL_SWITCH_ITEMS,
|
CL_TODO_ITEMS,
|
||||||
CL_ACTUAL,
|
CL_ACTUAL,
|
||||||
CL_ACTUAL_ITEMS,
|
CL_ACTUAL_ITEMS,
|
||||||
CL_CONNECT,
|
CL_CONNECT,
|
||||||
|
@ -2481,8 +2481,8 @@ static const struct light_class light_classes[] = {
|
||||||
|
|
||||||
/* Subdirectory for controlling items...
|
/* Subdirectory for controlling items...
|
||||||
*/
|
*/
|
||||||
[CL_SWITCH] = {
|
[CL_TODO] = {
|
||||||
.cl_name = "switch-",
|
.cl_name = "todo-",
|
||||||
.cl_len = 7,
|
.cl_len = 7,
|
||||||
.cl_type = 'd',
|
.cl_type = 'd',
|
||||||
.cl_hostcontext = false,
|
.cl_hostcontext = false,
|
||||||
|
@ -2490,11 +2490,11 @@ static const struct light_class light_classes[] = {
|
||||||
},
|
},
|
||||||
/* ... and its contents
|
/* ... and its contents
|
||||||
*/
|
*/
|
||||||
[CL_SWITCH_ITEMS] = {
|
[CL_TODO_ITEMS] = {
|
||||||
.cl_name = "",
|
.cl_name = "",
|
||||||
.cl_len = 0, // catch any
|
.cl_len = 0, // catch any
|
||||||
.cl_type = 'l',
|
.cl_type = 'l',
|
||||||
.cl_father = CL_SWITCH,
|
.cl_father = CL_TODO,
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Subdirectory for actual state
|
/* Subdirectory for actual state
|
||||||
|
|
|
@ -321,10 +321,11 @@ sub create_res {
|
||||||
mkdir("$tmp/defaults") unless -d "$tmp/defaults";
|
mkdir("$tmp/defaults") unless -d "$tmp/defaults";
|
||||||
mkdir("$tmp/defaults-$host");
|
mkdir("$tmp/defaults-$host");
|
||||||
mkdir("$tmp/actual-$host");
|
mkdir("$tmp/actual-$host");
|
||||||
mkdir("$tmp/switch-$host");
|
my $todo = "$tmp/todo-$host";
|
||||||
symlink("1", "$tmp/switch-$host/attach");
|
mkdir($todo);
|
||||||
symlink("0", "$tmp/switch-$host/connect");
|
symlink("1", "$todo/attach");
|
||||||
symlink("1", "$tmp/switch-$host/sync");
|
symlink("0", "$todo/connect");
|
||||||
|
symlink("1", "$todo/sync");
|
||||||
system("rm -f $tmp/syncstatus-$host");
|
system("rm -f $tmp/syncstatus-$host");
|
||||||
|
|
||||||
if($create) {
|
if($create) {
|
||||||
|
@ -364,14 +365,14 @@ sub logrotate_res {
|
||||||
sub attach_res {
|
sub attach_res {
|
||||||
my ($cmd, $res) = @_;
|
my ($cmd, $res) = @_;
|
||||||
my $detach = ($cmd eq "detach");
|
my $detach = ($cmd eq "detach");
|
||||||
my $path = "$mars/resource-$res/switch-$host/attach";
|
my $path = "$mars/resource-$res/todo-$host/attach";
|
||||||
_switch($cmd, $res, $path, !$detach);
|
_switch($cmd, $res, $path, !$detach);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub connect_res {
|
sub connect_res {
|
||||||
my ($cmd, $res) = @_;
|
my ($cmd, $res) = @_;
|
||||||
my $disconnect = ($cmd eq "disconnect");
|
my $disconnect = ($cmd eq "disconnect");
|
||||||
my @paths = glob("$mars/resource-$res/switch-*/connect");
|
my @paths = glob("$mars/resource-$res/todo-*/connect");
|
||||||
for my $path (@paths) {
|
for my $path (@paths) {
|
||||||
_switch($cmd, $res, $path, !$disconnect);
|
_switch($cmd, $res, $path, !$disconnect);
|
||||||
}
|
}
|
||||||
|
@ -380,14 +381,14 @@ sub connect_res {
|
||||||
sub connect_local_res {
|
sub connect_local_res {
|
||||||
my ($cmd, $res) = @_;
|
my ($cmd, $res) = @_;
|
||||||
my $disconnect = ($cmd eq "disconnect-local");
|
my $disconnect = ($cmd eq "disconnect-local");
|
||||||
my $path = "$mars/resource-$res/switch-$host/connect";
|
my $path = "$mars/resource-$res/todo-$host/connect";
|
||||||
_switch($cmd, $res, $path, !$disconnect);
|
_switch($cmd, $res, $path, !$disconnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub pause_res {
|
sub pause_res {
|
||||||
my ($cmd, $res) = @_;
|
my ($cmd, $res) = @_;
|
||||||
my $pause = ($cmd eq "pause-sync");
|
my $pause = ($cmd eq "pause-sync");
|
||||||
my @paths = glob("$mars/resource-$res/switch-*/sync");
|
my @paths = glob("$mars/resource-$res/todo-*/sync");
|
||||||
for my $path (@paths) {
|
for my $path (@paths) {
|
||||||
_switch($cmd, $res, $path, !$pause);
|
_switch($cmd, $res, $path, !$pause);
|
||||||
}
|
}
|
||||||
|
@ -396,7 +397,7 @@ sub pause_res {
|
||||||
sub pause_local_res {
|
sub pause_local_res {
|
||||||
my ($cmd, $res) = @_;
|
my ($cmd, $res) = @_;
|
||||||
my $pause = ($cmd eq "pause-sync-local");
|
my $pause = ($cmd eq "pause-sync-local");
|
||||||
my $path = "$mars/resource-$res/switch-$host/sync";
|
my $path = "$mars/resource-$res/todo-$host/sync";
|
||||||
_switch($cmd, $res, $path, !$pause);
|
_switch($cmd, $res, $path, !$pause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +417,7 @@ sub up_res {
|
||||||
|
|
||||||
sub fake_local_res {
|
sub fake_local_res {
|
||||||
my ($cmd, $res) = @_;
|
my ($cmd, $res) = @_;
|
||||||
my $path = "$mars/resource-$res/switch-$host/sync";
|
my $path = "$mars/resource-$res/todo-$host/sync";
|
||||||
_switch($cmd, $res, $path, 0);
|
_switch($cmd, $res, $path, 0);
|
||||||
#check_status($res, "copy-syncstatus-$host", 0);
|
#check_status($res, "copy-syncstatus-$host", 0);
|
||||||
my $size = readlink("$mars/resource-$res/size") or die "cannot read size\n";
|
my $size = readlink("$mars/resource-$res/size") or die "cannot read size\n";
|
||||||
|
|
Loading…
Reference in New Issue