virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Ky Srinivasan <ksrinivasan@novell.com>
Cc: devel@driverdev.osuosl.org, Virtualization@lists.osdl.org,
	Haiyang Zhang <haiyangz@microsoft.com>, Greg KH <gregkh@suse.de>
Subject: Re: [PATCH]: An implementation of HyperV  KVP  functionality
Date: Thu, 11 Nov 2010 12:49:04 -0800	[thread overview]
Message-ID: <20101111124904.24010ee5@nehalam> (raw)
In-Reply-To: <4CDBE98E02000030000902C9@novprvoes0310.provo.novell.com>

On Thu, 11 Nov 2010 13:03:10 -0700
"Ky Srinivasan" <ksrinivasan@novell.com> wrote:

> +static char *kvp_keys[KVP_MAX_KEY] = {"FullyQualifiedDomainName",
> +				"IntegrationServicesVersion",
> +				"NetworkAddressIPv4",
> +				"NetworkAddressIPv6",
> +				"OSBuildNumber",
> +				"OSName",
> +				"OSMajorVersion",
> +				"OSMinorVersion",
> +				"OSVersion",
> +				"ProcessorArchitecture",
> +				};

Minor nit:
static const char *kvp_keys[KVP_MAX_KEY] = {
	"FullQualifiedDomainName",
...

+/*
+ * Global state maintained for transaction that is being processed.
+ * Note that only one transaction can be active at any point in time.
+ *
+ * This state is set when we receive a request from the host; we
+ * cleanup this state when the transaction is completed - when we respond
+ * to the host with the key value.
+ */
+
+static u8 *recv_buffer; /* the receive buffer that we allocated */
+static int recv_len; /* number of bytes received. */
+static struct vmbus_channel *recv_channel; /*chn on which we got the request*/
+static u64 recv_req_id; /* request ID. */
+static int kvp_current_index;
+

I would put all the state variables for the transaction in one
structure, 

+static void kvp_timer_func(unsigned long __data)
+{
+	u32	key = *((u32 *)__data);
+	/*
+	 * If the timer fires, the user-mode component has not responded;
+	 * process the pending transaction.
+	 */
+	kvp_respond_to_host(key, "Guest timed out");
+}

delayed_work is sometimes better for things like this, since it
runs in user context and can sleep.

+			case (KVP_MAX_KEY):
+				/*
+				 * We don't support this key
+				 * and any key beyond this.
+				 */
+				icmsghdrp->status = HV_E_FAIL;
+				goto callback_done;
+

case labels do not need parens

  reply	other threads:[~2010-11-11 20:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11 20:03 [PATCH]: An implementation of HyperV KVP functionality Ky Srinivasan
2010-11-11 20:49 ` Stephen Hemminger [this message]
2010-11-12 16:57   ` Ky Srinivasan
2010-11-12 16:57   ` Ky Srinivasan
2010-11-12 16:57   ` Ky Srinivasan
2010-11-11 21:15 ` Greg KH
2010-11-12 18:06   ` Ky Srinivasan
2010-11-12 18:47     ` Greg KH
2010-11-12 20:59       ` Ky Srinivasan
2010-11-12 21:38         ` Greg KH
2010-11-11 21:19 ` Greg KH
2010-11-12 18:29   ` Ky Srinivasan
2010-11-12 19:22     ` Greg KH
2010-11-14 10:46 ` Dor Laor

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=20101111124904.24010ee5@nehalam \
    --to=shemminger@vyatta.com \
    --cc=Virtualization@lists.osdl.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=haiyangz@microsoft.com \
    --cc=ksrinivasan@novell.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).