All of lore.kernel.org
 help / color / mirror / Atom feed
From: john.levon@sun.com
To: xen-devel@lists.xensource.com
Subject: [PATCH] Fix libxenstat on Solaris
Date: Tue, 26 Feb 2008 07:17:23 -0800	[thread overview]
Message-ID: <472989331ad1f71fa99b.1204039043@hatchback> (raw)

# HG changeset patch
# User john.levon@sun.com
# Date 1204039041 28800
# Node ID 472989331ad1f71fa99b8b6418073d4036c802ba
# Parent  6a09ea2f3b4e44a76962f6f62cd43039c1610824
Fix libxenstat on Solaris

Recent Solaris enhancements have changed the way virtual NIC statistics
are collected - fix libxenstat up for this.

Signed-off-by: John Levon <john.levon@sun.com>

diff --git a/tools/xenstat/libxenstat/src/xenstat_solaris.c b/tools/xenstat/libxenstat/src/xenstat_solaris.c
--- a/tools/xenstat/libxenstat/src/xenstat_solaris.c
+++ b/tools/xenstat/libxenstat/src/xenstat_solaris.c
@@ -113,49 +113,23 @@ static void xenstat_uninit_devs(xenstat_
 	priv->kc = NULL;
 }
 
-static int parse_nic(const char *nic, char *module, int *instance)
-{
-	const char *c;
-
-	for (c = &nic[strlen(nic) - 1]; c != nic && isdigit(*c); c--)
-		;
-
-	if (c == nic)
-		return 0;
-
-	c++;
-
-	if (sscanf(c, "%d", instance) != 1)
-		return 0;
-
-	strncpy(module, nic, c - nic);
-	module[c - nic] = '\0';
-	return 1;
-}
-
 static int update_dev_stats(priv_data_t *priv, stdevice_t *dev)
 {
-	char mod[256];
-	const char *name;
-	int inst;
 	kstat_t *ksp;
-
-	if (dev->type == DEVICE_NIC) {
-		if (!parse_nic(dev->name, mod, &inst))
-			return 0;
-		name = "mac";
-	} else {
-		strcpy(mod, "xdb");
-		inst = dev->instance;
-		name = "req_statistics";
-	}
 
 	if (kstat_chain_update(priv->kc) == -1)
 		return 0;
 
-	ksp = kstat_lookup(priv->kc, mod, inst, (char *)name);
+	if (dev->type == DEVICE_NIC) {
+		ksp = kstat_lookup(priv->kc, "link", 0, (char *)dev->name);
+	} else {
+		ksp = kstat_lookup(priv->kc, "xdb", dev->instance,
+		    (char *)"req_statistics");
+	}
+
 	if (ksp == NULL)
 		return 0;
+
 	if (kstat_read(priv->kc, ksp, NULL) == -1)
 		return 0;

                 reply	other threads:[~2008-02-26 15:17 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=472989331ad1f71fa99b.1204039043@hatchback \
    --to=john.levon@sun.com \
    --cc=xen-devel@lists.xensource.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.