netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gregory Haskins <ghaskins@novell.com>
To: linux-kernel@vger.kernel.org
Cc: kvm@vger.kernel.org, agraf@suse.de, pmullaney@novell.com,
	pmorreale@novell.com, alext@novell.com, anthony@codemonkey.ws,
	rusty@rustcorp.com.au, netdev@vger.kernel.org, avi@redhat.com,
	bhutchings@solarflare.com, andi@firstfloor.org, gregkh@suse.de,
	chrisw@sous-sol.org, shemminger@vyatta.com,
	alex.williamson@hp.com
Subject: [RFC PATCH v3 11/17] venet-tap: add the ability to set the client's mac address via sysfs
Date: Tue, 21 Apr 2009 14:35:15 -0400	[thread overview]
Message-ID: <20090421183515.12548.1567.stgit@dev.haskins.net> (raw)
In-Reply-To: <20090421183341.12548.33393.stgit@dev.haskins.net>

From: Patrick Mullaney <pmullaney@novell.com>

Signed-off-by: Patrick Mullaney <pmullaney@novell.com>
Signed-off-by: Gregory Haskins <ghaskins@novell.com>
---

 drivers/vbus/devices/venet-tap.c |   35 ++++++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/drivers/vbus/devices/venet-tap.c b/drivers/vbus/devices/venet-tap.c
index 5e093a0..33ede4c 100644
--- a/drivers/vbus/devices/venet-tap.c
+++ b/drivers/vbus/devices/venet-tap.c
@@ -1214,6 +1214,39 @@ host_mac_show(struct vbus_device *dev, struct vbus_device_attribute *attr,
 static struct vbus_device_attribute attr_hmac =
 	__ATTR_RO(host_mac);
 
+
+static ssize_t
+cmac_store(struct vbus_device *dev, struct vbus_device_attribute *attr,
+	      const char *buf, size_t count)
+{
+	struct venettap *priv = vdev_to_priv(dev);
+	const char *pbuf = buf;
+	unsigned int uc;
+	int i;
+
+	/*
+	 * Format 00:11:22:33:44:55
+	 */
+	if (count != 18)
+		return -EINVAL;
+
+	for (i = 2; i < 17; i += 3) {
+		if (pbuf[i] != ':')
+			return -EINVAL;
+	}
+
+	if (priv->vbus.opened)
+		return -EINVAL;
+
+	for (i = 0; i < ETH_ALEN; i++) {
+		sscanf(pbuf, "%x", &uc);
+		pbuf = pbuf + 3;
+		priv->cmac[i] = (u8)uc;
+	}
+
+	return count;
+}
+
 static ssize_t
 client_mac_show(struct vbus_device *dev, struct vbus_device_attribute *attr,
 	 char *buf)
@@ -1224,7 +1257,7 @@ client_mac_show(struct vbus_device *dev, struct vbus_device_attribute *attr,
 }
 
 static struct vbus_device_attribute attr_cmac =
-	__ATTR_RO(client_mac);
+	__ATTR(client_mac, S_IRUGO | S_IWUSR, client_mac_show, cmac_store);
 
 static ssize_t
 enabled_show(struct vbus_device *dev, struct vbus_device_attribute *attr,


  parent reply	other threads:[~2009-04-21 18:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-21 18:34 [RFC PATCH v3 00/17] virtual-bus Gregory Haskins
2009-04-21 18:34 ` [RFC PATCH v3 01/17] shm-signal: shared-memory signals Gregory Haskins
2009-04-21 18:34 ` [RFC PATCH v3 02/17] vbus: add virtual-bus definitions Gregory Haskins
2009-04-21 18:34 ` [RFC PATCH v3 03/17] vbus: add connection-client helper infrastructure Gregory Haskins
2009-04-21 18:34 ` [RFC PATCH v3 04/17] vbus: add bus-registration notifiers Gregory Haskins
2009-04-21 18:34 ` [RFC PATCH v3 05/17] vbus: add a "vbus-proxy" bus model for vbus_driver objects Gregory Haskins
2009-04-21 18:34 ` [RFC PATCH v3 06/17] ioq: Add basic definitions for a shared-memory, lockless queue Gregory Haskins
2009-04-21 18:34 ` [RFC PATCH v3 07/17] ioq: add vbus helpers Gregory Haskins
2009-04-21 18:35 ` [RFC PATCH v3 08/17] venet: add the ABI definitions for an 802.x packet interface Gregory Haskins
2009-04-21 18:35 ` [RFC PATCH v3 09/17] net: Add vbus_enet driver Gregory Haskins
2009-04-21 18:35 ` [RFC PATCH v3 10/17] venet-tap: Adds a "venet" compatible "tap" device to VBUS Gregory Haskins
2009-04-21 18:35 ` Gregory Haskins [this message]
2009-04-21 18:35 ` [RFC PATCH v3 12/17] venet: add scatter-gather support Gregory Haskins
2009-04-21 18:35 ` [RFC PATCH v3 13/17] venettap: " Gregory Haskins
2009-04-21 18:35 ` [RFC PATCH v3 14/17] kvm: Add VBUS support to the host Gregory Haskins
2009-04-21 18:35 ` [RFC PATCH v3 15/17] kvm: Add guest-side support for VBUS Gregory Haskins
2009-04-21 18:35 ` [RFC PATCH v3 16/17] vbus: add a userspace connector Gregory Haskins
2009-04-21 18:35 ` [RFC PATCH v3 17/17] virtio: add a vbus transport Gregory Haskins
2009-05-11 11:37 ` [RFC PATCH v3 00/17] virtual-bus Nikola Ciprich
2009-05-11 14:41   ` Gregory Haskins

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=20090421183515.12548.1567.stgit@dev.haskins.net \
    --to=ghaskins@novell.com \
    --cc=agraf@suse.de \
    --cc=alex.williamson@hp.com \
    --cc=alext@novell.com \
    --cc=andi@firstfloor.org \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=bhutchings@solarflare.com \
    --cc=chrisw@sous-sol.org \
    --cc=gregkh@suse.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pmorreale@novell.com \
    --cc=pmullaney@novell.com \
    --cc=rusty@rustcorp.com.au \
    --cc=shemminger@vyatta.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).