mirror of https://gitee.com/openkylin/libvirt.git
remote generator: Add special case for virConnectGetType
This commit is contained in:
parent
ee9ceb3295
commit
f0a5be514d
|
@ -459,41 +459,6 @@ remoteDispatchClose(struct qemud_server *server ATTRIBUTE_UNUSED,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDispatchGetType(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||
remote_error *rerr,
|
||||
void *args ATTRIBUTE_UNUSED, remote_get_type_ret *ret)
|
||||
{
|
||||
const char *type;
|
||||
int rv = -1;
|
||||
|
||||
if (!conn) {
|
||||
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(type = virConnectGetType(conn)))
|
||||
goto cleanup;
|
||||
|
||||
/* We have to strdup because remoteDispatchClientRequest will
|
||||
* free this string after it's been serialised.
|
||||
*/
|
||||
if (!(ret->type = strdup(type))) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rv = 0;
|
||||
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
remoteDispatchError(rerr);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
remoteDispatchDomainGetSchedulerType(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||
|
|
|
@ -429,8 +429,21 @@ elsif ($opt_b) {
|
|||
unshift(@args_list, $conn);
|
||||
}
|
||||
} elsif ($ret_member =~ m/^remote_nonnull_string (\S+);/) {
|
||||
push(@vars_list, "char *$1");
|
||||
push(@ret_list, "ret->$1 = $1;");
|
||||
if ($call->{ProcName} eq "GetType") {
|
||||
# SPECIAL: virConnectGetType returns a constant string that must
|
||||
# not be freed. Therefore, duplicate the string here.
|
||||
push(@vars_list, "const char *$1");
|
||||
push(@ret_list, "/* We have to strdup because remoteDispatchClientRequest will");
|
||||
push(@ret_list, " * free this string after it's been serialised. */");
|
||||
push(@ret_list, "if (!(ret->type = strdup(type))) {");
|
||||
push(@ret_list, " virReportOOMError();");
|
||||
push(@ret_list, " goto cleanup;");
|
||||
push(@ret_list, "}");
|
||||
} else {
|
||||
push(@vars_list, "char *$1");
|
||||
push(@ret_list, "ret->$1 = $1;");
|
||||
}
|
||||
|
||||
$single_ret_var = $1;
|
||||
$single_ret_by_ref = 0;
|
||||
$single_ret_check = " == NULL";
|
||||
|
|
|
@ -2054,7 +2054,7 @@ enum remote_procedure {
|
|||
* it handles src/remote. */
|
||||
REMOTE_PROC_OPEN = 1, /* skipgen skipgen */
|
||||
REMOTE_PROC_CLOSE = 2, /* skipgen skipgen */
|
||||
REMOTE_PROC_GET_TYPE = 3, /* skipgen skipgen */
|
||||
REMOTE_PROC_GET_TYPE = 3, /* autogen skipgen */
|
||||
REMOTE_PROC_GET_VERSION = 4, /* autogen autogen */
|
||||
REMOTE_PROC_GET_MAX_VCPUS = 5, /* autogen autogen */
|
||||
REMOTE_PROC_NODE_GET_INFO = 6, /* autogen autogen */
|
||||
|
|
Loading…
Reference in New Issue