replace switch-*/ by todo-*/

This commit is contained in:
root 2011-09-21 13:30:11 +02:00 committed by Thomas Schoebel-Theuer
parent 96ed04574d
commit 9d00314c49
2 changed files with 21 additions and 20 deletions

View File

@ -655,7 +655,7 @@ int check_logfile(struct mars_peerinfo *peer, struct mars_dent *dent, struct mar
}
// 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
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);
// 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.
* 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;
}
// 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);
@ -2331,7 +2331,7 @@ static int make_sync(void *buf, struct mars_dent *dent)
copy_path = backskip_replace(dent->d_path, '/', true, "/copy-");
// 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;
if (unlikely(!src || !dst || !copy_path || !switch_path))
@ -2389,8 +2389,8 @@ enum {
CL_DEFAULTS,
CL_DEFAULTS_ITEMS0,
CL_DEFAULTS_ITEMS,
CL_SWITCH,
CL_SWITCH_ITEMS,
CL_TODO,
CL_TODO_ITEMS,
CL_ACTUAL,
CL_ACTUAL_ITEMS,
CL_CONNECT,
@ -2481,8 +2481,8 @@ static const struct light_class light_classes[] = {
/* Subdirectory for controlling items...
*/
[CL_SWITCH] = {
.cl_name = "switch-",
[CL_TODO] = {
.cl_name = "todo-",
.cl_len = 7,
.cl_type = 'd',
.cl_hostcontext = false,
@ -2490,11 +2490,11 @@ static const struct light_class light_classes[] = {
},
/* ... and its contents
*/
[CL_SWITCH_ITEMS] = {
[CL_TODO_ITEMS] = {
.cl_name = "",
.cl_len = 0, // catch any
.cl_type = 'l',
.cl_father = CL_SWITCH,
.cl_father = CL_TODO,
},
/* Subdirectory for actual state

View File

@ -321,10 +321,11 @@ sub create_res {
mkdir("$tmp/defaults") unless -d "$tmp/defaults";
mkdir("$tmp/defaults-$host");
mkdir("$tmp/actual-$host");
mkdir("$tmp/switch-$host");
symlink("1", "$tmp/switch-$host/attach");
symlink("0", "$tmp/switch-$host/connect");
symlink("1", "$tmp/switch-$host/sync");
my $todo = "$tmp/todo-$host";
mkdir($todo);
symlink("1", "$todo/attach");
symlink("0", "$todo/connect");
symlink("1", "$todo/sync");
system("rm -f $tmp/syncstatus-$host");
if($create) {
@ -364,14 +365,14 @@ sub logrotate_res {
sub attach_res {
my ($cmd, $res) = @_;
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);
}
sub connect_res {
my ($cmd, $res) = @_;
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) {
_switch($cmd, $res, $path, !$disconnect);
}
@ -380,14 +381,14 @@ sub connect_res {
sub connect_local_res {
my ($cmd, $res) = @_;
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);
}
sub pause_res {
my ($cmd, $res) = @_;
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) {
_switch($cmd, $res, $path, !$pause);
}
@ -396,7 +397,7 @@ sub pause_res {
sub pause_local_res {
my ($cmd, $res) = @_;
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);
}
@ -416,7 +417,7 @@ sub up_res {
sub fake_local_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);
#check_status($res, "copy-syncstatus-$host", 0);
my $size = readlink("$mars/resource-$res/size") or die "cannot read size\n";