public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* _IOR('t',90,int)
@ 2001-08-16  2:27 Sarada prasanna
  2001-08-16 21:40 ` _IOR('t',90,int) Randy.Dunlap
  0 siblings, 1 reply; 2+ messages in thread
From: Sarada prasanna @ 2001-08-16  2:27 UTC (permalink / raw)
  To: 'linux-kernel@vger.kernel.org'

Hi friends,
	  While reading a source code of pppd i came across a macro
declaration 
like


#define PPPIOCGFLAGS    _IOR('t', 90, int)      /* get configuration flags
*/

I refered to the book called "Linux kernel internals by Beck and others" and
on 
the page 219 (chap implementing a device driver) i found out the line
telling

_IOR(c,d,t)   for commands which write back to the user address space a
value of 
              the C type t

but still i am not being able to understand the macro declaration. Can
someone 
kindly tell me about the _IOW

			thanx	 

*********************************************************************
"UNIX SAYS DO YOUR OWN WAY"
LINUX ENABLES U TO DEFINE "YOUR OWN WAY" 

Choudhury Sarada Prasanna Nanda
Trainee T:24
Motorola India Electronics
TSR Towers, Raj Bhavan Road
Somajiguda,Hyderabad-500082
<cspn_stud@yahoo.com <mailto:cspn_stud@yahoo.com>>
<csaradap@mihy.mot.com <mailto:csaradap@mihy.mot.com>>
Phone:98492-61736 
*********************************************************************



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: _IOR('t',90,int)
  2001-08-16  2:27 _IOR('t',90,int) Sarada prasanna
@ 2001-08-16 21:40 ` Randy.Dunlap
  0 siblings, 0 replies; 2+ messages in thread
From: Randy.Dunlap @ 2001-08-16 21:40 UTC (permalink / raw)
  To: Sarada prasanna; +Cc: 'linux-kernel@vger.kernel.org'

Sarada prasanna wrote:
> 
> Hi friends,
>           While reading a source code of pppd i came across a macro
> declaration like
> 
> #define PPPIOCGFLAGS    _IOR('t', 90, int)      /* get configuration flags
> */
> 
> I refered to the book called "Linux kernel internals by Beck and others" and
> on
> the page 219 (chap implementing a device driver) i found out the line
> telling
> 
> _IOR(c,d,t)   for commands which write back to the user address space a
> value of
>               the C type t
> 
> but still i am not being able to understand the macro declaration. Can
> someone kindly tell me about the _IOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A better reference would be "Linux Device Drivers", 2nd edition.
See http://www.xml.com/ldd/chapter/book/ch05.html#t1 for info
on I/O controls.  (search for /_IOR/ or /_IOW/ for example)

In general, _IOR() and _IOW() take 3 parameters and make a
number out of them.  That number is used in a driver's ioctl
function to decide what the request is, its direction (in or out),
its data type, and data size.

For example, on x86, _IOR and _IOW make a 32-bit number, used as:

  |dd|ssssssssssssss|tttttttt|nnnnnnnn|
   |    \-size        \-type  \-number
   \-direction

Size is limited to 14 bits; Direction is Read, Write, or None.
Type is usually (meant to be) a constant for any one driver,
such as 'T' for ttys, 'S' for SCSI, 'M' for MTRR driver,
'A' for APM, 'a' for ATM, 0x93 for autofs, 'C' for CAPI,
'B' for CCISS, 's' for cdk, 'c' for coda, 'd' for devfsd,
0x89 for DECNET, 'f' and 'v' for ext2/3, 'F' for frame buffer,
2 for floppy driver, 0x12 for block layer, 'H' for HID driver,

Is there a registry of IOCTL magic numbers?  Yep, see
linux/Documentation/ioctl-number.txt for more info and numbers.

See linux/include/asm-i386/ioctl.h for macro specifics.

-- 
~Randy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-08-16 21:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-16  2:27 _IOR('t',90,int) Sarada prasanna
2001-08-16 21:40 ` _IOR('t',90,int) Randy.Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox