From owner-svn-ports-head@freebsd.org Tue Apr 11 17:44:17 2017 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC916D39F8F; Tue, 11 Apr 2017 17:44:17 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D880D8B; Tue, 11 Apr 2017 17:44:17 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3BHiGBx062162; Tue, 11 Apr 2017 17:44:16 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3BHiGo1062161; Tue, 11 Apr 2017 17:44:16 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201704111744.v3BHiGo1062161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 11 Apr 2017 17:44:16 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r438297 - head/emulators/virtualbox-ose/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Apr 2017 17:44:18 -0000 Author: jkim Date: Tue Apr 11 17:44:16 2017 New Revision: 438297 URL: https://svnweb.freebsd.org/changeset/ports/438297 Log: Reduce #if/#endif for code readibility. No functional change. Modified: head/emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_mp-r0drv-freebsd.c Modified: head/emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_mp-r0drv-freebsd.c ============================================================================== --- head/emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_mp-r0drv-freebsd.c Tue Apr 11 17:42:32 2017 (r438296) +++ head/emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_mp-r0drv-freebsd.c Tue Apr 11 17:44:16 2017 (r438297) @@ -1,16 +1,22 @@ ---- src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c.orig 2017-03-15 15:18:08 UTC +--- src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c.orig 2017-03-15 19:18:08 UTC +++ src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c -@@ -36,6 +36,9 @@ +@@ -36,6 +36,15 @@ #include #include "r0drv/mp-r0drv.h" ++#if __FreeBSD_version >= 700000 && __FreeBSD_version < 900000 ++#define cpuset_t cpumask_t ++#define all_cpus (~(cpumask_t)0) ++#define CPU_CLR(n, p) do { *(p) &= ~((cpumask_t)1 << (n)); } while (0) ++#define CPU_SETOF(n, p) do { *(p) = (cpumask_t)1 << (n); } while (0) ++#endif +#if __FreeBSD_version < 1200028 +#define smp_no_rendezvous_barrier smp_no_rendevous_barrier +#endif RTDECL(RTCPUID) RTMpCpuId(void) { -@@ -155,7 +158,7 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnW +@@ -155,7 +164,7 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnW Args.pvUser2 = pvUser2; Args.idCpu = NIL_RTCPUID; Args.cHits = 0; @@ -19,30 +25,87 @@ return VINF_SUCCESS; } -@@ -199,7 +202,7 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER p - # else - Mask = ~(cpumask_t)curcpu; - # endif +@@ -180,10 +189,8 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER p + /* Will panic if no rendezvousing cpus, so check up front. */ + if (RTMpGetOnlineCount() > 1) + { +-#if __FreeBSD_version >= 900000 +- cpuset_t Mask; +-#elif __FreeBSD_version >= 700000 +- cpumask_t Mask; ++#if __FreeBSD_version >= 700000 ++ cpuset_t Cpus; + #endif + RTMPARGS Args; + +@@ -193,13 +200,9 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER p + Args.idCpu = RTMpCpuId(); + Args.cHits = 0; + #if __FreeBSD_version >= 700000 +-# if __FreeBSD_version >= 900000 +- Mask = all_cpus; +- CPU_CLR(curcpu, &Mask); +-# else +- Mask = ~(cpumask_t)curcpu; +-# endif - smp_rendezvous_cpus(Mask, NULL, rtmpOnOthersFreeBSDWrapper, smp_no_rendevous_barrier, &Args); -+ smp_rendezvous_cpus(Mask, NULL, rtmpOnOthersFreeBSDWrapper, smp_no_rendezvous_barrier, &Args); ++ Cpus = all_cpus; ++ CPU_CLR(curcpu, &Cpus); ++ smp_rendezvous_cpus(Cpus, NULL, rtmpOnOthersFreeBSDWrapper, smp_no_rendezvous_barrier, &Args); #else smp_rendezvous(NULL, rtmpOnOthersFreeBSDWrapper, NULL, &Args); #endif -@@ -250,7 +253,7 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu - # else - Mask = (cpumask_t)1 << idCpu; - # endif +@@ -228,10 +231,8 @@ static void rtmpOnSpecificFreeBSDWrapper + + RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) + { +-#if __FreeBSD_version >= 900000 +- cpuset_t Mask; +-#elif __FreeBSD_version >= 700000 +- cpumask_t Mask; ++#if __FreeBSD_version >= 700000 ++ cpuset_t Cpus; + #endif + RTMPARGS Args; + +@@ -245,12 +246,8 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu + Args.idCpu = idCpu; + Args.cHits = 0; + #if __FreeBSD_version >= 700000 +-# if __FreeBSD_version >= 900000 +- CPU_SETOF(idCpu, &Mask); +-# else +- Mask = (cpumask_t)1 << idCpu; +-# endif - smp_rendezvous_cpus(Mask, NULL, rtmpOnSpecificFreeBSDWrapper, smp_no_rendevous_barrier, &Args); -+ smp_rendezvous_cpus(Mask, NULL, rtmpOnSpecificFreeBSDWrapper, smp_no_rendezvous_barrier, &Args); ++ CPU_SETOF(idCpu, &Cpus); ++ smp_rendezvous_cpus(Cpus, NULL, rtmpOnSpecificFreeBSDWrapper, smp_no_rendezvous_barrier, &Args); #else smp_rendezvous(NULL, rtmpOnSpecificFreeBSDWrapper, NULL, &Args); #endif -@@ -288,7 +291,7 @@ RTDECL(int) RTMpPokeCpu(RTCPUID idCpu) - # else - Mask = (cpumask_t)1 << idCpu; - # endif +@@ -273,22 +270,14 @@ static void rtmpFreeBSDPokeCallback(void + + RTDECL(int) RTMpPokeCpu(RTCPUID idCpu) + { +-#if __FreeBSD_version >= 900000 +- cpuset_t Mask; +-#elif __FreeBSD_version >= 700000 +- cpumask_t Mask; +-#endif ++ cpuset_t Cpus; + + /* Will panic if no rendezvousing cpus, so make sure the cpu is online. */ + if (!RTMpIsCpuOnline(idCpu)) + return VERR_CPU_NOT_FOUND; + +-# if __FreeBSD_version >= 900000 +- CPU_SETOF(idCpu, &Mask); +-# else +- Mask = (cpumask_t)1 << idCpu; +-# endif - smp_rendezvous_cpus(Mask, NULL, rtmpFreeBSDPokeCallback, smp_no_rendevous_barrier, NULL); -+ smp_rendezvous_cpus(Mask, NULL, rtmpFreeBSDPokeCallback, smp_no_rendezvous_barrier, NULL); ++ CPU_SETOF(idCpu, &Cpus); ++ smp_rendezvous_cpus(Cpus, NULL, rtmpFreeBSDPokeCallback, smp_no_rendezvous_barrier, NULL); return VINF_SUCCESS; }