From owner-freebsd-drivers@FreeBSD.ORG Wed May 14 10:25:08 2008 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DDB91065677 for ; Wed, 14 May 2008 10:25:08 +0000 (UTC) (envelope-from Matthias.Apitz@oclc.org) Received: from mail.pica.nl (mail.pica.nl [192.87.44.30]) by mx1.freebsd.org (Postfix) with ESMTP id 1B1C38FC2F for ; Wed, 14 May 2008 10:25:07 +0000 (UTC) (envelope-from Matthias.Apitz@oclc.org) Received: from rebelion.Sisis.de ([193.31.10.34]) by mail.pica.nl with Microsoft SMTPSVC(6.0.3790.3959); Wed, 14 May 2008 12:28:13 +0200 Received: (from guru@localhost) by rebelion.Sisis.de (8.14.2/8.13.8/Submit) id m4EAP3mE006132 for freebsd-drivers@freebsd.org; Wed, 14 May 2008 12:25:03 +0200 (CEST) (envelope-from matthias.apitz@oclc.org) X-Authentication-Warning: rebelion.Sisis.de: guru set sender to matthias.apitz@oclc.org using -f Date: Wed, 14 May 2008 12:25:03 +0200 From: Matthias Apitz To: freebsd-drivers@freebsd.org Message-ID: <20080514102503.GA5862@rebelion.Sisis.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.0-RELEASE (i386) X-OriginalArrivalTime: 14 May 2008 10:28:13.0221 (UTC) FILETIME=[36BA5550:01C8B5AD] Subject: question about tty->t_outq && clist && cblock X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Matthias Apitz List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 May 2008 10:25:08 -0000 Hello, I've some small questions about the struct 'clist', 'cblock' and 'tty' /usr/src/sys/sys/tty.h says about 'clist' /* * Clists are character lists, which is a variable length linked list * of cblocks, with a count of the number of characters in the list. */ struct clist { int c_cc; /* Number of characters in the clist. */ int c_cbcount; /* Number of cblocks. */ int c_cbmax; /* Max # cblocks allowed for this clist. */ int c_cbreserved; /* # cblocks reserved for this clist. */ char *c_cf; /* Pointer to the first cblock. */ char *c_cl; /* Pointer to the last cblock. */ }; and about 'tty' struct tty { struct clist t_rawq; /* Device raw input queue. */ long t_rawcc; /* Raw input queue statistics. */ struct clist t_canq; /* Device canonical queue. */ long t_cancc; /* Canonical queue statistics. */ struct clist t_outq; /* Device output queue. */ ... } and /usr/src/sys/sys/clist.h about 'cblock' struct cblock { struct cblock *c_next; /* next cblock in queue */ unsigned char c_quote[CBQSIZE]; /* quoted characters */ unsigned char c_info[CBSIZE]; /* characters */ }; In the driver it seems that tty->t_outq.c_cf is pointing to the data bytes itself which the driver should send to the device and not to a 'cblock' (the comment in 'clist' says *c_cf; is Pointer to the first cblock); is this just a small error in the comment and t_outq.c_cf is really pointing to cblock.c_info[]? what would be the correct way to pick up the next 'cblock' in that chain if there is already more data to deliver when for example tty->t_outq.c_cc says 810 bytes? picking up the 4 byte pointer at t_outq.c_cf - 20? thanks in advance for some clarification matthias -- Matthias Apitz http://www.UnixArea.de/