[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [RFC][PATCH v5 03/21] virtagent: common code for managi
From: |
Jes Sorensen |
Subject: |
[Qemu-devel] Re: [RFC][PATCH v5 03/21] virtagent: common code for managing client/server rpc jobs |
Date: |
Tue, 07 Dec 2010 14:38:19 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Lightning/1.0b3pre Thunderbird/3.1.6 |
On 12/03/10 19:03, Michael Roth wrote:
> This implements a simple state machine to manage client/server rpc
> jobs being multiplexed over a single channel.
>
> A client job consists of sending an rpc request, reading an
> rpc response, then making the appropriate callbacks. We allow one
> client job to be processed at a time, which will make the following
> state transitions:
>
> VA_CLIENT_IDLE -> VA_CLIENT_SEND (job queued, send channel open)
> VA_CLIENT_SEND -> VA_CLIENT_WAIT (request sent, awaiting response)
> VA_CLIENT_WAIT -> VA_CLIENT_IDLE (response recieved, callbacks made)
>
> A server job consists of recieving an rpc request, generating a
> response, then sending the response. We expect to receive one server
> request at a time due to the 1 at a time restriction for client jobs.
> Server jobs make the following transitions:
>
> VA_SERVER_IDLE -> VA_SERVER_WAIT (recieved/executed request, send
> channel busy, response deferred)
> VA_SERVER_IDLE -> VA_SERVER_SEND (recieved/executed request, send
> channel open, sending response)
> VA_SERVER_WAIT -> VA_SERVER_SEND (send channel now open, sending
> response)
> VA_SERVER_SEND -> VA_SERVER_IDLE (response sent)
>
> Signed-off-by: Michael Roth <address@hidden>
As mentioned before, I really don't understand why this is part of QEMU,
the guest agent really should be able to run totally outside of QEMU.
> +
> +#define DEBUG_VA
> +
> +#ifdef DEBUG_VA
> +#define TRACE(msg, ...) do { \
> + fprintf(stderr, "%s:%s():L%d: " msg "\n", \
> + __FILE__, __FUNCTION__, __LINE__, ## __VA_ARGS__); \
> +} while(0)
> +#else
> +#define TRACE(msg, ...) \
> + do { } while (0)
> +#endif
> +
> +#define LOG(msg, ...) do { \
> + fprintf(stderr, "%s:%s(): " msg "\n", \
> + __FILE__, __FUNCTION__, ## __VA_ARGS__); \
> +} while(0)
This must be like the 217th copy of these functions, could you please
use some of the code that is already in the tree, and make it generic if
needed.
> +
> +#define VERSION "1.0"
> +#define EOL "\r\n"
> +
> +#define VA_HDR_LEN_MAX 4096 /* http header limit */
> +#define VA_CONTENT_LEN_MAX 2*1024*1024 /* rpc/http send limit */
> +#define VA_CLIENT_JOBS_MAX 5 /* max client rpcs we can queue */
> +#define VA_SERVER_JOBS_MAX 1 /* max server rpcs we can queue */
As mentioned last time, please make this stuff configurable and not hard
coded.
Cheers,
Jes
- Re: [Qemu-devel] Re: [RFC][PATCH v5 04/21] virtagent: transport definitions and job callbacks, (continued)
[Qemu-devel] [RFC][PATCH v5 02/21] Add qemu_set_fd_handler() wrappers to qemu-tools.c, Michael Roth, 2010/12/03
[Qemu-devel] [RFC][PATCH v5 05/21] virtagent: base client definitions, Michael Roth, 2010/12/03
[Qemu-devel] [RFC][PATCH v5 03/21] virtagent: common code for managing client/server rpc jobs, Michael Roth, 2010/12/03
[Qemu-devel] [RFC][PATCH v5 07/21] virtagent: add va.getfile RPC, Michael Roth, 2010/12/03
- [Qemu-devel] Re: [RFC][PATCH v5 07/21] virtagent: add va.getfile RPC, Adam Litke, 2010/12/06
- [Qemu-devel] Re: [RFC][PATCH v5 07/21] virtagent: add va.getfile RPC, Jes Sorensen, 2010/12/07
- [Qemu-devel] Re: [RFC][PATCH v5 07/21] virtagent: add va.getfile RPC, Adam Litke, 2010/12/07
- [Qemu-devel] Re: [RFC][PATCH v5 07/21] virtagent: add va.getfile RPC, Jes Sorensen, 2010/12/08
- [Qemu-devel] Re: [RFC][PATCH v5 07/21] virtagent: add va.getfile RPC, Adam Litke, 2010/12/09
- [Qemu-devel] Re: [RFC][PATCH v5 07/21] virtagent: add va.getfile RPC, Michael Roth, 2010/12/09
- [Qemu-devel] Re: [RFC][PATCH v5 07/21] virtagent: add va.getfile RPC, Jes Sorensen, 2010/12/10