summaryrefslogtreecommitdiffstats
path: root/sys/dev/snp
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-02-03 19:58:28 +0000
committered <ed@FreeBSD.org>2009-02-03 19:58:28 +0000
commit85ebf973414dfbc79b1b194bd303e31ad364fc40 (patch)
treef22d7cb17f77953696672862fe82baf97908f1ce /sys/dev/snp
parent51fa332ba90cf11592eb8b8774a83ae028729cf8 (diff)
downloadFreeBSD-src-85ebf973414dfbc79b1b194bd303e31ad364fc40.zip
FreeBSD-src-85ebf973414dfbc79b1b194bd303e31ad364fc40.tar.gz
Slightly improve the design of the TTY buffer.
The TTY buffers used the standard <sys/queue.h> lists. Unfortunately they have a big shortcoming. If you want to have a double linked list, but no tail pointer, it's still not possible to obtain the previous element in the list. Inside the buffers we don't need them. This is why I switched to custom linked list macros. The macros will also keep track of the amount of items in the list. Because it doesn't use a sentinel, we can just initialize the queues with zero. In its simplest form (the output queue), we will only keep two references to blocks in the queue, namely the head of the list and the last block in use. All free blocks are stored behind the last block in use. I noticed there was a very subtle bug in the previous code: in a very uncommon corner case, it would uma_zfree() a block in the queue before calling memcpy() to extract the data from the block.
Diffstat (limited to 'sys/dev/snp')
-rw-r--r--sys/dev/snp/snp.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c
index 8d6485c..4a48037 100644
--- a/sys/dev/snp/snp.c
+++ b/sys/dev/snp/snp.c
@@ -127,7 +127,6 @@ snp_open(struct cdev *dev, int flag, int mode, struct thread *td)
/* Allocate per-snoop data. */
ss = malloc(sizeof(struct snp_softc), M_SNP, M_WAITOK|M_ZERO);
- ttyoutq_init(&ss->snp_outq);
cv_init(&ss->snp_outwait, "snp out");
devfs_set_cdevpriv(ss, snp_dtor);
OpenPOWER on IntegriCloud