]> sourceware.org Git - lvm2.git/commitdiff
Sketch out the actual on-wire format in daemon-client.h documentation, and add
authorPetr Rockai <prockai@redhat.com>
Mon, 27 Jun 2011 12:26:54 +0000 (12:26 +0000)
committerPetr Rockai <prockai@redhat.com>
Mon, 27 Jun 2011 12:26:54 +0000 (12:26 +0000)
a simplified send interface.

daemons/common/daemon-client.h

index fc0989864c0b3c28cda6a0a9c1815827f319b0c3..d266ba75dfde1061ec734e18404cde1661c832bf 100644 (file)
@@ -20,7 +20,6 @@
 typedef struct {
        int socket_fd; /* the fd we use to talk to the daemon */
        int protocol;  /* version of the protocol the daemon uses */
-       char *read_buf;
 } daemon_handle;
 
 typedef struct {
@@ -31,6 +30,17 @@ typedef struct {
 
 typedef struct {
        char *buffer;
+       /*
+        * The request looks like this:
+        *    request = "id"
+        *    arg_foo = "something"
+        *    arg_bar = 3
+        *    arg_wibble {
+        *        something_special = "here"
+        *        amount = 75
+        *        knobs = [ "twiddle", "tweak" ]
+        *    }
+        */
        struct config_node *cft;
 } daemon_request;
 
@@ -53,9 +63,22 @@ daemon_handle daemon_open(daemon_info i);
  * Send a request to the daemon, waiting for the reply. All communication with
  * the daemon is synchronous. The function handles the IO details and parses the
  * response, handling common error conditions. See "daemon_reply" for details.
+ *
+ * In case the request contains a non-NULL buffer pointer, this buffer is sent
+ * *verbatim* to the server. In this case, the cft pointer may be NULL (but will
+ * be ignored even if non-NULL). If the buffer is NULL, the cft is required to
+ * be a valid pointer, and is used to build up the request.
  */
 daemon_reply daemon_send(daemon_handle h, daemon_request r);
 
+/*
+ * A simple interface to daemon_send. This function just takes the command id
+ * and possibly a list of parameters (of the form "name = %?", "value"). The
+ * type (string, integer) of the value is indicated by a character substituted
+ * for ? in %?: d for integer, s for string.
+ */
+daemon_reply daemon_send_simple(daemon_handle h, char *id, ...);
+
 /* Shut down the communication to the daemon. Compulsory. */
 void daemon_close(daemon_handle h);
 
This page took 0.039029 seconds and 5 git commands to generate.