'\" te .\" Copyright (c) 2003, Sun Microsystems, Inc., All Rights Reserved. .\" Copyright 1989 AT&T .TH strategy 9E "6 Nov 2003" "SunOS 5.11" "Driver Entry Points" .SH NAME strategy \- perform block I/O .SH SYNOPSIS .LP .nf #include #include #include #include \fBint prefix\fR\fBstrategy\fR(\fBstruct buf *\fR\fIbp\fR); .fi .SH INTERFACE LEVEL .sp .LP Architecture independent level 1 (DDI/DKI). This entry point is required for block devices. .SH PARAMETERS .sp .ne 2 .mk .na \fB\fIbp\fR \fR .ad .RS 7n .rt Pointer to the \fBbuf\fR(9S) structure. .RE .SH DESCRIPTION .sp .LP The \fBstrategy()\fR routine is called indirectly (through \fBcb_ops\fR(9S)) by the kernel to read and write blocks of data on the block device. \fBstrategy()\fR may also be called directly or indirectly to support the raw character interface of a block device (\fBread\fR(9E), \fBwrite\fR(9E) and \fBioctl\fR(9E)). The \fBstrategy()\fR routine's responsibility is to set up and initiate the transfer. .sp .LP In general, \fBstrategy()\fR should not block. It can, however, perform a \fBkmem_cache_create\fR(9F) with both the \fBKM_PUSHPAGE\fR and \fBKM_SLEEP\fR flags set, which might block, without causing deadlock in low memory situations. .SH RETURN VALUES .sp .LP The \fBstrategy()\fR function must return \fB0\fR. On an error condition, it should call \fBbioerror\fR(9F) to set \fBb_flags\fR to the proper error code, and call \fBbiodone\fR(9F). Note that a partial transfer is not considered to be an error. .SH SEE ALSO .sp .LP \fBioctl\fR(9E), \fBread\fR(9E), \fBwrite\fR(9E), \fBbiodone\fR(9F), \fBbioerror\fR(9F), \fBbuf\fR(9S), \fBcb_ops\fR(9S), \fBkmem_cache_create\fR(9F) .sp .LP \fIWriting Device Drivers for Oracle Solaris 11.2\fR