From owner-cvs-src-old@FreeBSD.ORG Tue Feb 3 19:59:06 2009 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A3A2106568A for ; Tue, 3 Feb 2009 19:59:06 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 336E58FC12 for ; Tue, 3 Feb 2009 19:59:06 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n13Jx5T3069094 for ; Tue, 3 Feb 2009 19:59:05 GMT (envelope-from ed@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n13Jx5bv069093 for cvs-src-old@freebsd.org; Tue, 3 Feb 2009 19:59:05 GMT (envelope-from ed@repoman.freebsd.org) Message-Id: <200902031959.n13Jx5bv069093@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to ed@repoman.freebsd.org using -f From: Ed Schouten Date: Tue, 3 Feb 2009 19:58:28 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/dev/snp snp.c src/sys/kern tty.c tty_inq.c tty_outq.c src/sys/sys ttyqueue.h X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Feb 2009 19:59:08 -0000 ed 2009-02-03 19:58:28 UTC FreeBSD src repository Modified files: sys/dev/snp snp.c sys/kern tty.c tty_inq.c tty_outq.c sys/sys ttyqueue.h Log: SVN rev 188096 on 2009-02-03 19:58:28Z by ed Slightly improve the design of the TTY buffer. The TTY buffers used the standard 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. Revision Changes Path 1.113 +0 -1 src/sys/dev/snp/snp.c 1.307 +0 -3 src/sys/kern/tty.c 1.3 +50 -28 src/sys/kern/tty_inq.c 1.4 +52 -42 src/sys/kern/tty_outq.c 1.4 +17 -31 src/sys/sys/ttyqueue.h