SCO OpenServer
read(D2oddi)
read --
read data character-by-character
Synopsis
void prefixread (dev_t dev);
Description
The
read( )
entry point routine
initiates and supervises the raw I/O data transfer
from the character device to the user data area.
Arguments
dev-
device number
Return values
None
Usage
When the device being accessed is a true character device
(rather than a block device being accessed
in raw mode through the cdevsw table),
the transferred data is usually buffered by the driver.
For example, using the tty structure
to get a cblock, the
ttread(D3oddi)
and
ttwrite(D3oddi)
functions handle character driver buffering.
Drivers for low-speed character devices
such as terminals and printers
perform semantic processing of data.
These drivers typically use the
clist data structure
and the TTY subsystem to perform buffering.
These transfer data in and out
of the user data area.
Drivers for high-speed character devices
such as network interface boards
generally set up their own buffering schemes.
Block devices
Block devices usually include a
read( )
routine to support raw I/O for the device.
The logic for these routines is:
-
Extract the minor device number for use by
physio(D3oddi)
when performing physical I/O.
-
Check the minor device number against
the information in the
scsi_dev_cfg(D4osdi)
configuration table.
If it is improper, use the
cmn_err(D3oddi)
function to issue an error message,
set
u.u_error
to ENODEV, and return.
-
For disk devices,
get the size of the device from a local driver array of disk sizes.
-
Call
physck(D3oddi)
to ensure that the I/O is correct for the device size.
-
Call
physio(D3oddi).
This routine calls
dma_breakup(D3oddi)
or
pio_breakup(D3oddi)
which then calls
strategy(D2oddi)
to perform the raw I/O.
Context and synchronization
User
context.
The driver can block and can do operations such as
copyout(D3)
that require access to
the requesting process's user-level address space.
Hardware applicability
All
Version applicability
oddi:
1, 2, 2mp, 3, 3mp, 4, 4mp, 5, 5mp, 6, 6mp
SVR5 DDI compatibility
The
read(D2)
entry point routine provides similar functionality
for DDI versions prior to DDI 8,
although note that the syntax is different.
DDI 8 drivers use the
biostart(D2)
entry point routine instead of
read( ).
External dependencies
Drivers that contain a
read( )
routine must have a r in the second column of the
mdevice(F)
file.
References
strategy(D2oddi),
write(D2oddi)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 5 HDK - June 2005