Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add PCQ_MAXLEN constant.
details: https://anonhg.NetBSD.org/src/rev/94b4a2aacee2
branches: trunk
changeset: 329785:94b4a2aacee2
user: rmind <rmind%NetBSD.org@localhost>
date: Mon Jun 09 12:44:06 2014 +0000
description:
Add PCQ_MAXLEN constant.
diffstat:
sys/kern/subr_pcq.c | 7 ++++---
sys/sys/pcq.h | 6 +++++-
2 files changed, 9 insertions(+), 4 deletions(-)
diffs (61 lines):
diff -r 1e9ee276b127 -r 94b4a2aacee2 sys/kern/subr_pcq.c
--- a/sys/kern/subr_pcq.c Mon Jun 09 11:08:05 2014 +0000
+++ b/sys/kern/subr_pcq.c Mon Jun 09 12:44:06 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_pcq.c,v 1.7 2014/02/06 03:47:16 riastradh Exp $ */
+/* $NetBSD: subr_pcq.c,v 1.8 2014/06/09 12:44:06 rmind Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pcq.c,v 1.7 2014/02/06 03:47:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pcq.c,v 1.8 2014/06/09 12:44:06 rmind Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -60,6 +60,7 @@
* Consumer (c) - in the higher 16 bits.
*
* We have a limitation of 16 bits i.e. 0xffff items in the queue.
+ * The PCQ_MAXLEN constant is set accordingly.
*/
static inline void
@@ -197,7 +198,7 @@
{
pcq_t *pcq;
- KASSERT(nitems > 0 || nitems <= 0xffff);
+ KASSERT(nitems > 0 || nitems <= PCQ_MAXLEN);
pcq = kmem_zalloc(offsetof(pcq_t, pcq_items[nitems]), kmflags);
if (pcq == NULL) {
diff -r 1e9ee276b127 -r 94b4a2aacee2 sys/sys/pcq.h
--- a/sys/sys/pcq.h Mon Jun 09 11:08:05 2014 +0000
+++ b/sys/sys/pcq.h Mon Jun 09 12:44:06 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcq.h,v 1.1 2008/11/11 20:17:27 matt Exp $ */
+/* $NetBSD: pcq.h,v 1.2 2014/06/09 12:44:06 rmind Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -37,12 +37,16 @@
typedef struct pcq pcq_t;
#ifdef _KERNEL
+
+#define PCQ_MAXLEN (0xffffU)
+
bool pcq_put(pcq_t *, void *);
void * pcq_peek(pcq_t *);
void * pcq_get(pcq_t *);
size_t pcq_maxitems(pcq_t *);
pcq_t * pcq_create(size_t, km_flag_t);
void pcq_destroy(pcq_t *);
+
#endif /* _KERNEL */
#endif /* _SYS_PCQ_H_ */
Home |
Main Index |
Thread Index |
Old Index