[libvirt] [PATCH 15/23] Add JSON serialization of virNetServerClientPtr objects for process re-exec()

Eric Blake eblake at redhat.com
Fri Aug 17 03:05:56 UTC 2012


On 08/09/2012 09:20 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Add two new APIs virNetServerClientNewPostExecRestart and
> virNetServerClientPreExecRestart which allow a virNetServerClientPtr
> object to be created from a JSON object and saved to a
> JSON object, for the purpose of re-exec'ing a process.
> 
> This includes serialization of the connected socket associated
> with the client
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---

> +virNetServerClientPtr virNetServerClientNewPostExecRestart(virJSONValuePtr object,
> +                                                           virNetServerClientPrivNewPostExecRestart privNew,
> +                                                           virNetServerClientPrivPreExecRestart privPreExecRestart,
> +                                                           virFreeCallback privFree,
> +                                                           void *privOpaque)
> +{
> +    virJSONValuePtr child;
> +    virNetServerClientPtr client = NULL;
> +    virNetSocketPtr sock;
> +    const char *identity = NULL;
> +    int auth;
> +    bool readonly;
> +    unsigned int nrequests_max;
> +
> +    if (virJSONValueObjectGetNumberInt(object, "auth", &auth) < 0) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                       _("Missing auth field in JSON state document"));
> +        return NULL;
> +    }
> +    if (virJSONValueObjectGetBoolean(object, "readonly", &readonly) < 0) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                       _("Missing readonly field in JSON state document"));
> +        return NULL;
> +    }
> +    if (virJSONValueObjectGetNumberUint(object, "nrequests_max",
> +                                        (unsigned int *)&nrequests_max) < 0) {

Why the cast?  &nrequests_max is already (unsigned int *).

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120816/df137f00/attachment-0001.sig>


More information about the libvir-list mailing list