[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 1

devstrat Kernel Service

Purpose

Calls a block device driver's strategy routine.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
int devstrat (bp)
struct buf *bp;

Parameter

bp Points to the buf structure specifying the block transfer parameters.

Description

The kernel or kernel extension calls the devstrat kernel service to request a block data transfer to or from the device with the specified device number. This device number is found in the buf structure. The devstrat service can only be used for the block class of device drivers.

The devstrat service calls the device driver's ddstrategy routine. This routine is found in the device switch table for the device driver associated with the specified device number found in the b_dev field. The b_dev field is found in the buf structure pointed to by the bp parameter. The caller of the devstrat service must have an iodone routine specified in the b_iodone field of the buf structure. Following the return from the device driver's ddstrategy routine, the devstrat service returns without waiting for the I/O to be performed.

On multiprocessor systems, all iodone routines run by default on the first processor started when the system was booted. This ensures compatibility with uniprocessor device drivers. If the iodone routine has been designed to be multiprocessor-safe, set the B_MPSAFE flag in the b_flags field of the buf structure passed to the devstrat kernel service. The iodone routine will then run on any available processor.

If the device major number is not valid or the specified device is not a block device driver, the devstrat service returns the ENODEV return code. If the device number is valid, the device driver's ddstrategy routine is called with the pointer to the buf structure (specified by the bp parameter).

Execution Environment

The devstrat kernel service can be called from either the process or interrupt environment.

Note: The devstrat kernel service can be called in the interrupt environment only if its priority level is INTIODONE or lower.

Return Values

0 Indicates a successful operation.
ENODEV Indicates that the device number is not valid or that no ddstrategy routine registered. This value is also returned when the specified device is not a block device driver. If this error occurs, the devstrat service can cause a page fault.

Implementation Specifics

The devstrat kernel service is part of Base Operating System (BOS) Runtime.

Related Information

The iodone kernel service.

The ddstategy routine.

The buf structure.

Kernel Extension and Device Driver Management Kernel Services and How Device Drivers are Accessed in AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts.


[ Previous | Next | Contents | Home | Search ]