Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jul 2016 07:48:26 +0000 (UTC)
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302817 - in head/sys/dev/hyperv: include vmbus
Message-ID:  <201607140748.u6E7mQ4F090786@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Thu Jul 14 07:48:26 2016
New Revision: 302817
URL: https://svnweb.freebsd.org/changeset/base/302817

Log:
  hyperv/vmbus: Field renaming to reflect reality
  
  MFC after:	1 week
  Sponsored by:	Microsoft OSTC
  Differential Revision:	https://reviews.freebsd.org/D7111

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/include/hyperv.h
==============================================================================
--- head/sys/dev/hyperv/include/hyperv.h	Thu Jul 14 07:39:34 2016	(r302816)
+++ head/sys/dev/hyperv/include/hyperv.h	Thu Jul 14 07:48:26 2016	(r302817)
@@ -326,7 +326,7 @@ typedef struct hv_vmbus_channel {
 	void				*hv_chan_priv3;
 
 	struct task			ch_detach_task;
-	TAILQ_ENTRY(hv_vmbus_channel)	ch_link;
+	TAILQ_ENTRY(hv_vmbus_channel)	ch_prilink;	/* primary chan link */
 	uint32_t			ch_subidx;	/* subchan index */
 	volatile uint32_t		ch_stflags;	/* atomic-op */
 							/* VMBUS_CHAN_ST_ */

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c	Thu Jul 14 07:39:34 2016	(r302816)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c	Thu Jul 14 07:48:26 2016	(r302817)
@@ -134,8 +134,8 @@ vmbus_chan_add(struct hv_vmbus_channel *
 		    newchan->ch_id, newchan->ch_subidx);
 	}
 
-	mtx_lock(&sc->vmbus_chlist_lock);
-	TAILQ_FOREACH(prichan, &sc->vmbus_chlist, ch_link) {
+	mtx_lock(&sc->vmbus_prichan_lock);
+	TAILQ_FOREACH(prichan, &sc->vmbus_prichans, ch_prilink) {
 		if (memcmp(&prichan->ch_guid_type, &newchan->ch_guid_type,
 		    sizeof(struct hyperv_guid)) == 0 &&
 		    memcmp(&prichan->ch_guid_inst, &newchan->ch_guid_inst,
@@ -145,18 +145,19 @@ vmbus_chan_add(struct hv_vmbus_channel *
 	if (VMBUS_CHAN_ISPRIMARY(newchan)) {
 		if (prichan == NULL) {
 			/* Install the new primary channel */
-			TAILQ_INSERT_TAIL(&sc->vmbus_chlist, newchan, ch_link);
-			mtx_unlock(&sc->vmbus_chlist_lock);
+			TAILQ_INSERT_TAIL(&sc->vmbus_prichans, newchan,
+			    ch_prilink);
+			mtx_unlock(&sc->vmbus_prichan_lock);
 			return 0;
 		} else {
-			mtx_unlock(&sc->vmbus_chlist_lock);
+			mtx_unlock(&sc->vmbus_prichan_lock);
 			device_printf(sc->vmbus_dev, "duplicated primary "
 			    "chan%u\n", newchan->ch_id);
 			return EINVAL;
 		}
 	} else { /* Sub-channel */
 		if (prichan == NULL) {
-			mtx_unlock(&sc->vmbus_chlist_lock);
+			mtx_unlock(&sc->vmbus_prichan_lock);
 			device_printf(sc->vmbus_dev, "no primary chan for "
 			    "chan%u\n", newchan->ch_id);
 			return EINVAL;
@@ -168,7 +169,7 @@ vmbus_chan_add(struct hv_vmbus_channel *
 		 * XXX refcnt prichan
 		 */
 	}
-	mtx_unlock(&sc->vmbus_chlist_lock);
+	mtx_unlock(&sc->vmbus_prichan_lock);
 
 	/*
 	 * This is a sub-channel; link it with the primary channel.
@@ -406,20 +407,20 @@ vmbus_chan_destroy_all(struct vmbus_soft
 {
 	struct hv_vmbus_channel *chan;
 
-	mtx_lock(&sc->vmbus_chlist_lock);
-	while ((chan = TAILQ_FIRST(&sc->vmbus_chlist)) != NULL) {
+	mtx_lock(&sc->vmbus_prichan_lock);
+	while ((chan = TAILQ_FIRST(&sc->vmbus_prichans)) != NULL) {
 		KASSERT(VMBUS_CHAN_ISPRIMARY(chan), ("not primary channel"));
-		TAILQ_REMOVE(&sc->vmbus_chlist, chan, ch_link);
-		mtx_unlock(&sc->vmbus_chlist_lock);
+		TAILQ_REMOVE(&sc->vmbus_prichans, chan, ch_prilink);
+		mtx_unlock(&sc->vmbus_prichan_lock);
 
 		hv_vmbus_child_device_unregister(chan);
 		vmbus_chan_free(chan);
 
-		mtx_lock(&sc->vmbus_chlist_lock);
+		mtx_lock(&sc->vmbus_prichan_lock);
 	}
 	bzero(sc->vmbus_chmap,
 	    sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX);
-	mtx_unlock(&sc->vmbus_chlist_lock);
+	mtx_unlock(&sc->vmbus_prichan_lock);
 }
 
 /**

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus.c	Thu Jul 14 07:39:34 2016	(r302816)
+++ head/sys/dev/hyperv/vmbus/vmbus.c	Thu Jul 14 07:48:26 2016	(r302817)
@@ -1104,8 +1104,8 @@ vmbus_doattach(struct vmbus_softc *sc)
 
 	mtx_init(&sc->vmbus_scan_lock, "vmbus scan", NULL, MTX_DEF);
 	sc->vmbus_gpadl = VMBUS_GPADL_START;
-	mtx_init(&sc->vmbus_chlist_lock, "vmbus chlist", NULL, MTX_DEF);
-	TAILQ_INIT(&sc->vmbus_chlist);
+	mtx_init(&sc->vmbus_prichan_lock, "vmbus prichan", NULL, MTX_DEF);
+	TAILQ_INIT(&sc->vmbus_prichans);
 	sc->vmbus_chmap = malloc(
 	    sizeof(struct hv_vmbus_channel *) * VMBUS_CHAN_MAX, M_DEVBUF,
 	    M_WAITOK | M_ZERO);
@@ -1176,7 +1176,7 @@ cleanup:
 	}
 	free(sc->vmbus_chmap, M_DEVBUF);
 	mtx_destroy(&sc->vmbus_scan_lock);
-	mtx_destroy(&sc->vmbus_chlist_lock);
+	mtx_destroy(&sc->vmbus_prichan_lock);
 
 	return (ret);
 }
@@ -1258,7 +1258,7 @@ vmbus_detach(device_t dev)
 
 	free(sc->vmbus_chmap, M_DEVBUF);
 	mtx_destroy(&sc->vmbus_scan_lock);
-	mtx_destroy(&sc->vmbus_chlist_lock);
+	mtx_destroy(&sc->vmbus_prichan_lock);
 
 	return (0);
 }

Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_var.h	Thu Jul 14 07:39:34 2016	(r302816)
+++ head/sys/dev/hyperv/vmbus/vmbus_var.h	Thu Jul 14 07:48:26 2016	(r302817)
@@ -102,8 +102,9 @@ struct vmbus_softc {
 #define VMBUS_SCAN_CHCNT_DONE	0x80000000
 	uint32_t		vmbus_scan_devcnt;
 
-	struct mtx		vmbus_chlist_lock;
-	TAILQ_HEAD(, hv_vmbus_channel) vmbus_chlist;
+	/* Primary channels */
+	struct mtx		vmbus_prichan_lock;
+	TAILQ_HEAD(, hv_vmbus_channel) vmbus_prichans;
 };
 
 #define VMBUS_FLAG_ATTACHED	0x0001	/* vmbus was attached */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607140748.u6E7mQ4F090786>