[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 3/3] Move TIME_* macros to util.h


  • To: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>, "win-pv-devel@xxxxxxxxxxxxxxxxxxxx" <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Thu, 17 Sep 2026 13:36:24 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=U1PgnLoDTjBYLTW71ZOnMXX1UJWp7UE26mbKk74S8+Y=; b=RrHzmhXHAobEGblFbxMPiOjTMokJjVx2IhgvtUuTHX6lmlwzmYLDY10Wn0JqZ+9en+QUH+WzYKDl/2+Tt9drbEJJSdNTOs7fYdruhKts56Gf0QdJf3M3fN0CCnjq16tftdJa62JDGEXUV6Tkxe3hmU4PvbMhbTc373V6G1JymwLACwsr1/+2BB4KIPFosi/bIFHq/1VcOl8CI0qVrfap6S22rlQ+5sRLwjw6YULzV2O0peRcaFrJ7QYzTNXBj79Fu06D98XfSR99SIaDt6MaGD1GSAZE4CBfSRfP9QDJL5UKobtODXIVBTh7F+omRmBuEygm6T5jLSaDAhCi0Exprg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wNJnc5d+zyIA54GEkEuE2Sk/DM0i5DDDvHU0sVG856rJN6DoQte/ngW0x4keeDdgSgEMCcGVF6X63ZMrh7Z69Q7WomMXWCQjTguJkfSDY2F00UjJORGRmzghQ6LerH1p4HT1Pj7knDELG9U1WCxnp4w7JmH4szfr267v2p/oPL2zlEM6mrrxl3vuwTTEWZtTmKD/QAepewgGjyqK1LXAp/2WyHs0gi92v1Oxa95NfQZbkNqGuLE3O+ggLT39MGUx73/EzNWE3T27LR1f5zJeJsSc8xik27BN0AR/DEOpT5fK33vlfVRbJyHeDrIJHDB59z054JSnYFkzUZYy6WtZMA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Delivery-date: Thu, 17 Sep 2026 13:36:31 +0000
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Msip_labels:
  • Thread-index: AQHdRdfhQGPhPS6qZUGpYEeXPXuXT7bSx139
  • Thread-topic: [PATCH v2 3/3] Move TIME_* macros to util.h

Reviewed-by: Owen Smith <owen.smith@xxxxxxxxxx>

________________________________________
From: win-pv-devel <win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx> on behalf of Tu 
Dinh <ngoc-tu.dinh@xxxxxxxxxx>
Sent: 16 September 2026 1:35 PM
To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
Cc: Tu Dinh
Subject: [PATCH v2 3/3] Move TIME_* macros to util.h

These macros were being repeatedly used and so should share the same
definition.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/common/util.h  |  5 +++++
 src/xenbus/cache.c |  5 -----
 src/xenbus/fdo.c   |  5 -----
 src/xenbus/store.c | 10 ----------
 4 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/src/common/util.h b/src/common/util.h
index dbf64fd..36f71f9 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -41,6 +41,11 @@
 #define        P2ROUNDUP(_t, _x, _a)   \
         (-(-((_t)(_x)) & -(((_t)(_a)))))

+#define TIME_US(_us)            ((_us) * 10ll)
+#define TIME_MS(_ms)            (TIME_US((_ms) * 1000ll))
+#define TIME_S(_s)              (TIME_MS((_s) * 1000ll))
+#define TIME_RELATIVE(_t)       (-(_t))
+
 static FORCEINLINE LONG
 __ffs(
     _In_ unsigned long long mask
diff --git a/src/xenbus/cache.c b/src/xenbus/cache.c
index ae72464..e513f77 100644
--- a/src/xenbus/cache.c
+++ b/src/xenbus/cache.c
@@ -1056,11 +1056,6 @@ CacheDebugCallback(
     }
 }

-#define TIME_US(_us)        ((_us) * 10)
-#define TIME_MS(_ms)        (TIME_US((_ms) * 1000))
-#define TIME_S(_s)          (TIME_MS((_s) * 1000))
-#define TIME_RELATIVE(_t)   (-(_t))
-
 #define XENBUS_CACHE_MONITOR_PERIOD 5

 static NTSTATUS
diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 50075f7..0537654 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -1642,11 +1642,6 @@ loop:
     return STATUS_SUCCESS;
 }

-#define TIME_US(_us)            ((_us) * 10ll)
-#define TIME_MS(_ms)            (TIME_US((_ms) * 1000ll))
-#define TIME_S(_s)              (TIME_MS((_s) * 1000ll))
-#define TIME_RELATIVE(_t)       (-(_t))
-
 static FORCEINLINE NTSTATUS
 __FdoBalloonSetActive(
     _In_ PXENBUS_FDO        Fdo
diff --git a/src/xenbus/store.c b/src/xenbus/store.c
index bd9067e..fe3efcc 100644
--- a/src/xenbus/store.c
+++ b/src/xenbus/store.c
@@ -909,11 +909,6 @@ StoreDpc(
     __StorePoll(Context);
 }

-#define TIME_US(_us)        ((_us) * 10)
-#define TIME_MS(_ms)        (TIME_US((_ms) * 1000))
-#define TIME_S(_s)          (TIME_MS((_s) * 1000))
-#define TIME_RELATIVE(_t)   (-(_t))
-
 #define XENBUS_STORE_POLL_PERIOD 5

 static PXENBUS_STORE_RESPONSE
@@ -1994,11 +1989,6 @@ StorePoll(
     __StorePoll(Interface->Context);
 }

-#define TIME_US(_us)        ((_us) * 10)
-#define TIME_MS(_ms)        (TIME_US((_ms) * 1000))
-#define TIME_S(_s)          (TIME_MS((_s) * 1000))
-#define TIME_RELATIVE(_t)   (-(_t))
-
 #define XENBUS_STORE_WATCHDOG_PERIOD 15

 static NTSTATUS
--
2.55.0.windows.3



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.