1strategy(9E)                  Driver Entry Points                 strategy(9E)
2
3
4

NAME

6       strategy - perform block I/O
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <sys/buf.h>
11       #include <sys/ddi.h>
12       #include <sys/sunddi.h>
13
14
15
16       int prefixstrategy(struct buf *bp);
17
18

INTERFACE LEVEL

20       Architecture  independent  level  1  (DDI/DKI).  This  entry  point  is
21       required for block devices.
22

PARAMETERS

24       bp     Pointer to the buf(9S) structure.
25
26

DESCRIPTION

28       The strategy() routine is called indirectly (through cb_ops(9S)) by the
29       kernel to read and write blocks of data on the block device. strategy()
30       may also be called directly or indirectly to support the raw  character
31       interface  of  a  block device (read(9E), write(9E) and ioctl(9E)). The
32       strategy() routine's responsibility is  to  set  up  and  initiate  the
33       transfer.
34
35
36       In  general,  strategy()  should  not block. It can, however, perform a
37       kmem_cache_create(9F) with both the KM_PUSHPAGE and KM_SLEEP flags set,
38       which might block, without causing deadlock in low memory situations.
39

RETURN VALUES

41       The strategy() function must return 0. On an error condition, it should
42       call bioerror(9F) to set b_flags to the proper  error  code,  and  call
43       biodone(9F).  Note  that  a partial transfer is not considered to be an
44       error.
45

SEE ALSO

47       ioctl(9E), read(9E),  write(9E),  biodone(9F),  bioerror(9F),  buf(9S),
48       cb_ops(9S), kmem_cache_create(9F)
49
50
51       Writing Device Drivers
52
53
54
55SunOS 5.11                        6 Nov 2003                      strategy(9E)
Impressum