From owner-freebsd-hackers Sun Jul 20 21:46:20 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id VAA22103 for hackers-outgoing; Sun, 20 Jul 1997 21:46:20 -0700 (PDT) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id VAA22098 for ; Sun, 20 Jul 1997 21:46:00 -0700 (PDT) Received: (from msmith@localhost) by genesis.atrad.adelaide.edu.au (8.8.5/8.7.3) id OAA21177; Mon, 21 Jul 1997 14:14:40 +0930 (CST) From: Michael Smith Message-Id: <199707210444.OAA21177@genesis.atrad.adelaide.edu.au> Subject: Re: suggested enhancement: linux_ioctl.c diagnostic output In-Reply-To: from Chris Timmons at "Jul 20, 97 10:46:36 am" To: skynyrd@opus.cts.cwu.edu (Chris Timmons) Date: Mon, 21 Jul 1997 14:14:39 +0930 (CST) Cc: freebsd-hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Chris Timmons stands accused of saying: > > I tried to get some comments about this from -emulation but perhaps the > subject line wasn't to the point enough. It was; you're just buried in my to-do list 8( > If you read down to the end I've sketched out a proposed change to > linux_ioctl.c. I'd like to know: > > 1. Overall is this a worthwile change? Yes. > 2. Is the long comment which documents linux ioctl encoding > inappropriate for this source file? No. > 3. I see from style(9) that I should have spaces between the > operands to the bitwise and operator. What about the > style of the nested conditional? I guess there might also be > some unnecessary parens in the printf argument list. Bruce will have his own interpretation; I would be inclined to say : uprintf("LINUX: unimplemented ioctl: fd=%d, cmd=0x%lx (IO%s%s, '%c', %lu, %lu)\n", args->fd, args->cmd, (args->cmd & 0x400000000) ? "W" : "", (args->cmd & 0x800000000) ? "R" : "", ((args->cmd & 0x0000ff00) >> 8) >= 0x20) ? (char)((args->cmd & 0x0000ff00)>>8) : '?', args->cmd & 0xff, (args->cmd & 0x3fff0000) >> 16); return EINVAL; } The other implementation of the IO[WR] decoding I would consider would use a small lookup table and a large shift to generate an index. The massively nested ? set you used makes for very difficult reading. I don't think that the performance of the printf() should be a consideration in contrast to the usefulness of verbose output. -- ]] Mike Smith, Software Engineer msmith@gsoft.com.au [[ ]] Genesis Software genesis@gsoft.com.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control. (ph) +61-8-8267-3493 [[ ]] Unix hardware collector. "Where are your PEZ?" The Tick [[