All of lore.kernel.org
 help / color / mirror / Atom feed
From: mornfall@sourceware.org <mornfall@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/daemons/common daemon-client.h
Date: 27 Jun 2011 12:26:55 -0000	[thread overview]
Message-ID: <20110627122655.2356.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall at sourceware.org	2011-06-27 12:26:54

Modified files:
	daemons/common : daemon-client.h 

Log message:
	Sketch out the actual on-wire format in daemon-client.h documentation, and add
	a simplified send interface.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/common/daemon-client.h.diff?cvsroot=lvm2&r1=1.3&r2=1.4

--- LVM2/daemons/common/daemon-client.h	2011/06/14 02:34:18	1.3
+++ LVM2/daemons/common/daemon-client.h	2011/06/27 12:26:54	1.4
@@ -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 {
 	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 @@
  * 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);
 



                 reply	other threads:[~2011-06-27 12:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110627122655.2356.qmail@sourceware.org \
    --to=mornfall@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.