Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ physiock(D3DK) — Motorola System V 88k Release 4 Version 4.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

physiock(D3DK)  —  

.IX \f4physiock\fP(D3DK)

NAME

physiock − validate and issue raw I/O request

SYNOPSIS

#include <sys/types.h>
#include <sys/buf.h>
#include <sys/uio.h>
int physiock(int (∗strat)(), buf_t ∗bp, dev_t dev, int
rwflag, daddr_t nblocks, uio_t ∗uiop);

ARGUMENTS

stratAddress of the driver strategy(D2DK) routine. 

bpPointer to the buf(D4DK) structure describing the I/O request.  If set to NULL, then a buffer is allocated from the buffer pool and returned to the free list after the transfer completes. 

devExternal device number. 

rwflagFlag indicating whether the access is a read or a write.  If set to B_READ, the direction of the data transfer will be from the kernel to the user’s buffer.  If set to B_WRITE, the direction of the data transfer will be from the user’s buffer to the kernel. 

nblocksNumber of blocks that a logical device can support.  One block is equal to NBPSCTR bytes.  NBPSCTR is defined in sys/param.h. 

uiopPointer to the uio(D4DK) structure that defines the user space of the I/O request. 

DESCRIPTION

physiock is called by the character interface (ioctl(D2DK), read(D2DK), and write(D2DK)) routines of block drivers to help perform unbuffered I/O while maintaining the buffer header as the interface structure. 

physiock performs the following functions:

Verifies the requested transfer is valid by checking if the offset is at or past the end of the device. 

Sets up a buffer header describing the transfer. 

Faults pages in and locks the pages impacted by the I/O transfer so they can’t be swapped out. 

Calls the driver strategy routine passed to it (strat). 

Sleeps until the transfer is complete and is awakened by a call to biodone(D3DK) from the driver’s I/O completion handler. 

Performs the necessary cleanup and updates, then returns to the driver routine. 

A transfer using physiock is considered valid if the specified data location exists on the device, and the user has specified a storage area large enough that exists in user memory space. 

RETURN VALUE

physiock returns 0 if the result is successful, or the appropriate error number on failure.  If a partial transfer occurs, the uio structure is updated to indicate the amount not transferred.  If a read request is made at or past the end of device, a zero length read will result.  If a write request is made at or past the end of device, ENXIO is returned.  EFAULT is returned if user memory is not valid.  EAGAIN is returned if physiock could not lock pages for DMA. 

LEVEL

Base Only. 

NOTES

Can sleep. 

Driver-defined basic locks and read/write locks may not be held across calls to this function. 

Driver-defined sleep locks may be held across calls to this function. 

It is possible to express a device size larger than can be handled by the uio structure with the nblocks argument.  If this occurs the size of the device will be truncated to the maximum size that can be successfully specified in the uio structure before the end of device comparision is made. 

SEE ALSO

ioctl(D2DK), read(D2DK), strategy(D2DK), write(D2DK), dma_pageio(D3DK), uiophysio(D3DK), buf(D4DK), uio(D4DK)

EXAMPLE

See dma_pageio(D3DK) for an example of physiock. 

DDI/DKI

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026