Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Mar 2026 14:03:46 +0000
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 9c49c393a81b - stable/15 - virtual_oss: Use virtual_oss_timestamp() to avoid duplication
Message-ID:  <69b56ac2.3db11.7d95377c@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=9c49c393a81bd47304ba76f26892faf4fc172d1c

commit 9c49c393a81bd47304ba76f26892faf4fc172d1c
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-03-07 23:46:28 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-03-14 14:03:30 +0000

    virtual_oss: Use virtual_oss_timestamp() to avoid duplication
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    
    (cherry picked from commit e75c8faf277dded0a80d469cb8182583716a2211)
---
 usr.sbin/virtual_oss/virtual_oss/virtual_oss.c | 29 ++++++++++++--------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/usr.sbin/virtual_oss/virtual_oss/virtual_oss.c b/usr.sbin/virtual_oss/virtual_oss/virtual_oss.c
index fc7892df892c..18af38d8e7aa 100644
--- a/usr.sbin/virtual_oss/virtual_oss/virtual_oss.c
+++ b/usr.sbin/virtual_oss/virtual_oss/virtual_oss.c
@@ -39,6 +39,18 @@
 #include "backend.h"
 #include "int.h"
 
+uint64_t
+virtual_oss_timestamp(void)
+{
+	struct timespec ts;
+	uint64_t nsec;
+
+	clock_gettime(CLOCK_MONOTONIC, &ts);
+
+	nsec = ts.tv_sec * 1000000000ULL + ts.tv_nsec;
+	return (nsec);
+}
+
 uint64_t
 virtual_oss_delay_ns(void)
 {
@@ -54,31 +66,16 @@ virtual_oss_delay_ns(void)
 void
 virtual_oss_wait(void)
 {
-	struct timespec ts;
 	uint64_t delay;
 	uint64_t nsec;
 
-	clock_gettime(CLOCK_MONOTONIC, &ts);
-
-	nsec = ts.tv_sec * 1000000000ULL + ts.tv_nsec;
+	nsec = virtual_oss_timestamp();
 
 	delay = virtual_oss_delay_ns();
 
 	usleep((delay - (nsec % delay)) / 1000);
 }
 
-uint64_t
-virtual_oss_timestamp(void)
-{
-	struct timespec ts;
-	uint64_t nsec;
-
-	clock_gettime(CLOCK_MONOTONIC, &ts);
-
-	nsec = ts.tv_sec * 1000000000ULL + ts.tv_nsec;
-	return (nsec);
-}
-
 static size_t
 vclient_read_linear(struct virtual_client *pvc, struct virtual_ring *pvr,
     int64_t *dst, size_t total) __requires_exclusive(atomic_mtx)


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69b56ac2.3db11.7d95377c>