Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jul 1997 00:08:52 -0700 (PDT)
From:      Chris Timmons <skynyrd@opus.cts.cwu.edu>
To:        Michael Smith <msmith@atrad.adelaide.edu.au>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: suggested enhancement: linux_ioctl.c diagnostic output
Message-ID:  <Pine.BSF.3.95.970720231428.28614B-100000@opus.cts.cwu.edu>
In-Reply-To: <199707210444.OAA21177@genesis.atrad.adelaide.edu.au>

next in thread | previous in thread | raw e-mail | index | archive | help

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  [[
> 





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.970720231428.28614B-100000>