Module Name: src
Committed By: joe
Date: Wed Jan 22 22:41:39 UTC 2025
Modified Files:
src/sys/altq: altq_classq.h
Log Message:
remove redundant and dead #ifdef _KERNEL branches and use cprng directly
the entire code is in a _KERNEL block. move the header decl in in the original
_KERNEL block.
redefining _KERNEL to use cprng is purely a dead branch and we should either
use random or cprng.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/altq/altq_classq.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/altq/altq_classq.h
diff -u src/sys/altq/altq_classq.h:1.11 src/sys/altq/altq_classq.h:1.12
--- src/sys/altq/altq_classq.h:1.11 Sat Jan 18 21:53:13 2025
+++ src/sys/altq/altq_classq.h Wed Jan 22 22:41:38 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_classq.h,v 1.11 2025/01/18 21:53:13 kre Exp $ */
+/* $NetBSD: altq_classq.h,v 1.12 2025/01/22 22:41:38 joe Exp $ */
/* $KAME: altq_classq.h,v 1.6 2003/01/07 07:33:38 kjc Exp $ */
/*
@@ -39,10 +39,6 @@
#ifndef _ALTQ_ALTQ_CLASSQ_H_
#define _ALTQ_ALTQ_CLASSQ_H_
-#ifdef _KERNEL
-#include <sys/cprng.h>
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -57,6 +53,8 @@ extern "C" {
#ifdef _KERNEL
+#include <sys/cprng.h>
+
/*
* Packet Queue structures and macros to manipulate them.
*/
@@ -159,11 +157,7 @@ _getq_random(class_queue_t *q)
else {
struct mbuf *prev = NULL;
-#ifdef _KERNEL
n = cprng_fast32() % qlen(q) + 1;
-#else
- n = random() % qlen(q) + 1;
-#endif
for (i = 0; i < n; i++) {
prev = m;
m = m->m_nextpkt;