From owner-freebsd-hackers Mon Jul 21 00:08:58 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id AAA26831 for hackers-outgoing; Mon, 21 Jul 1997 00:08:58 -0700 (PDT) Received: from pahtoh.cwu.edu (root@pahtoh.cwu.edu [198.104.65.27]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id AAA26824 for ; Mon, 21 Jul 1997 00:08:54 -0700 (PDT) Received: from opus.cts.cwu.edu (skynyrd@opus.cts.cwu.edu [198.104.92.71]) by pahtoh.cwu.edu (8.8.5/8.8.5) with ESMTP id AAA23335; Mon, 21 Jul 1997 00:08:53 -0700 (PDT) Received: from localhost (skynyrd@localhost) by opus.cts.cwu.edu (8.8.6/8.8.5) with SMTP id AAA28929; Mon, 21 Jul 1997 00:08:52 -0700 (PDT) Date: Mon, 21 Jul 1997 00:08:52 -0700 (PDT) From: Chris Timmons Reply-To: Chris Timmons To: Michael Smith cc: freebsd-hackers@FreeBSD.ORG Subject: Re: suggested enhancement: linux_ioctl.c diagnostic output In-Reply-To: <199707210444.OAA21177@genesis.atrad.adelaide.edu.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Mike, Thanks for the response. > 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; > } Much easier to understand. I wish I'd thought of your simplification :) As for the is_printable test, would it be also prudent to make sure that the value is < 0x7f as well? I'm pretty naive about character set issues and don't know what some of the values with the 8th bit set might produce. Some of the newer ioctl number assignments start in a range beginning at 0x89 (and beyond.) > 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. Maybe a lookup table would be the best way to do this neatly in terms of the printf statement. I'll think about that for a while. > I don't think that the performance of the printf() should be a > consideration in contrast to the usefulness of verbose output. Agreed. -Chris > > -- > ]] 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 [[ >