提交 30e9b1a1 编写于 作者: M Matthias Bolte

remote generator: Fix XDR sign mismatch for virNodeGet(Cells)FreeMemory

virNodeGetFreeMemory used unsigned long long in the public API but
signed hyper in the XDR protocol. Convert the XDR protocol to use
unsigned hyper.

As explained by Eric before, this doesn't affect the on-the-wire protocol.
上级 c2de9f4a
......@@ -501,7 +501,7 @@ elsif ($opt_b) {
$single_ret_check = " < 0";
}
}
} elsif ($ret_member =~ m/^hyper (\S+)<(\S+)>;\s*\/\*\s*insert@(\d+)\s*\*\//) {
} elsif ($ret_member =~ m/^(?:unsigned )?hyper (\S+)<(\S+)>;\s*\/\*\s*insert@(\d+)\s*\*\//) {
push(@vars_list, "int len");
push(@ret_list, "ret->$1.$1_len = len;");
push(@free_list_on_error, "VIR_FREE(ret->$1.$1_val);");
......@@ -519,7 +519,7 @@ elsif ($opt_b) {
$single_ret_check = " < 0";
splice(@args_list, int($3), 0, ("ret->$1.$1_val"));
}
} elsif ($ret_member =~ m/^hyper (\S+)<\S+>;/) {
} elsif ($ret_member =~ m/^(?:unsigned )?hyper (\S+)<\S+>;/) {
# error out on unannotated arrays
die "hyper array without insert@<offset> annotation: $ret_member";
} elsif ($ret_member =~ m/^(unsigned )?hyper (\S+);/) {
......@@ -1063,20 +1063,14 @@ elsif ($opt_k) {
push(@ret_list, "rv = 0;");
$single_ret_var = "int rv = -1";
$single_ret_type = "int";
} else {
push(@ret_list, "rv = ret.$arg_name;");
$single_ret_var = "unsigned long rv = 0";
$single_ret_type = "unsigned long";
}
} elsif ($ret_member =~ m/^hyper (\S+);/) {
my $arg_name = $1;
if ($call->{ProcName} eq "NodeGetFreeMemory") {
} elsif ($call->{ProcName} eq "NodeGetFreeMemory") {
push(@ret_list, "rv = ret.$arg_name;");
$single_ret_var = "unsigned long long rv = 0";
$single_ret_type = "unsigned long long";
} else {
die "unhandled type for return value: $ret_member";
push(@ret_list, "rv = ret.$arg_name;");
$single_ret_var = "unsigned long rv = 0";
$single_ret_type = "unsigned long";
}
} elsif ($ret_member =~ m/^(\/)?\*/) {
# ignore comments
......
......@@ -449,11 +449,11 @@ struct remote_node_get_cells_free_memory_args {
};
struct remote_node_get_cells_free_memory_ret {
hyper cells<REMOTE_NODE_MAX_CELLS>; /* insert@1 */
unsigned hyper cells<REMOTE_NODE_MAX_CELLS>; /* insert@1 */
};
struct remote_node_get_free_memory_ret {
hyper freeMem;
unsigned hyper freeMem;
};
struct remote_domain_get_scheduler_type_args {
......
......@@ -158,11 +158,11 @@ struct remote_node_get_cells_free_memory_args {
struct remote_node_get_cells_free_memory_ret {
struct {
u_int cells_len;
int64_t * cells_val;
uint64_t * cells_val;
} cells;
};
struct remote_node_get_free_memory_ret {
int64_t freeMem;
uint64_t freeMem;
};
struct remote_domain_get_scheduler_type_args {
remote_nonnull_domain dom;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册