qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 01/11] QMP: Introduce specification file


From: Filip Navara
Subject: Re: [Qemu-devel] [PATCH 01/11] QMP: Introduce specification file
Date: Wed, 24 Jun 2009 17:57:22 +0200

On Wed, Jun 24, 2009 at 2:46 PM, Anthony Liguori<address@hidden> wrote:
[snip]
> With respect to RPC choice, if we did go that route, I'd be very concerned
> about using jsonrpc verses a more well established rpc.  I would honestly
> prefer xml-rpc over jsonrpc.
>
> One reason to choose an RPC is based on the adoption of it.  You want to use
> something that has a vibrant community with well established client
> libraries to make writing clients as easy as possible.  Without an active
> jsonrpc C library, it's hard to argue that jsonrpc has that.  xml-rpc
> certainly does.

After reading the XDR specification I realized that the basic blocks
are already implemented in QEMU.

Data type mapping:

Integer <-> qemu_put_sbe32 / qemu_get_sbe32
Unsigned Integer <-> qemu_put_be32 / qemu_get_be32
Enumeration - same as signed integer
Boolean - same as signed interger, limited to values 0 and 1
Hyper Integer <-> qemu_put_sbe64 / qemu_get_sbe64
Unsigned Hyper Integer <-> qemu_put_be64 / qemu_get_be64
Floating-point, Double-precision Floating-point, Quadruple-precision
Floating-point <-> ? (uses IEEE notation)
Fixed-length Opaque Data <->

void qemu_put_xdr_buffer(QEMUFile *f, const uint8_t *buf, int size)
{
    int reminder = size % 4;
    qemu_put_buffer(f, buf, size);
    while (--reminder >= 0)
        qemu_put_byte(f, 0);
}

Variable-length Opaque Data <->

void qemu_put_xdr_var_buffer(QEMUFile *f, const uint8_t *buf, int size)
{
    int reminder = size % 4;
    qemu_put_be32(f, size);
    qemu_put_buffer(f, buf, size);
    while (--reminder >= 0)
        qemu_put_byte(f, 0);
}

String <-> same as qemu_put_xdr_var_buffer, ASCII bytes (*not
characters*, the encoding of characters is not part of the RFC, NFSv4
uses UTF-8 for example), null-terminator is not sent
Fixed-length Array <-> for loop with the elements described using the
basic types above
Variable-length Array <-> qemu_put_be32 + for loop / qemu_get_be32 +
allocation + for loop
Structure, Discriminated Union <-> built from the basic data types, same as in C
Void <-> nothing :)

Given the fact that we practically have the library for XDR it would
be very easy to build Sun RPC server on top of it. So my vote is for
SunRPC.

Best regards,
Filip Navara




reply via email to

[Prev in Thread] Current Thread [Next in Thread]