DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5

msgpullup_physreq(D3str)


msgpullup_physreq -- concatenate bytes in a message with physical requirements

Synopsis (not in ODDI)

   #include <sys/stream.h>
   #include <sys/kmem.h>
   #include <sys/ddi.h>
   

mblk_t *msgpullup_physreq(mblk_t *mp, int len, physreq_t *preqp);

Description

msgpullup_physreq concatenates and aligns the first len data bytes of the message with the same type as mp, copying the data into a new message. All message blocks that remain in the original message once len bytes have been concatenated and aligned (including any partial message blocks) are copied and linked to the end of the new message, so that the length of the new message is equal to the length of the original message.

The memory for the data buffer(s) is identified by the db_base member of the datab(D4str) structure. For the new message block(s), this memory will satisfy the constraints specified by the physreq(D4) structure pointed to by the preqp parameter. The data will always be in the front of the new buffer; that is, b_rptr will equal db_base.

The original message is unaltered. If len equals -1, all data are concatenated. If len bytes of the same message type cannot be found, msgpullup_physreq fails and returns NULL.

Arguments


mp
Pointer to the message whose blocks are to be concatenated.

len
Number of bytes to concatenate.

preqp
Physical requirements for the data buffer.

Return values

On success, msgpullup_physreq returns a pointer to the new message. On failure, msgpullup_physreq returns NULL.

Usage

msgpullup_physreq( ) should be used instead of msgpullup(D3str) whenever the data is to be made accessible to a hardware device via DMA. The message block should be allocated with the esballoc(D3str) function before calling msgpullup_physreq(D3str).

DDI 8 and later STREAMS drivers first call the msgscgth(D3str) function to set up a scatter/gather list. See ``Scatter/gather operations'' in HDK Technical Reference for more information about setting up a scatter/gather list.

msgpullup_physreq( ) can only pull up mblk structures with the same type as the first mblk that was passed in, so even when len is set to -1, it is possible that no message blocks are returned.

Context

Base or Interrupt.

Synchronization constraints

Does not block.

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

Hardware applicability

All

Version applicability

ddi: 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp

SCO OpenServer 5 ODDI compatibility

SCO OpenServer 5 ODDI drivers can use the pullupmsg(D3str) function instead of msgpullup_physreq( ). Note that pullupmsg( ) and pullupmsg_physreq( ) return a new message, leaving the old one intact, whereas pullupmsg( ) concatenates into the given message.

References

allocb_physreq(D3str), kmem_alloc_physreq(D3), msgphysreq(D3str), msgpullup(D3str), msgscgth(D3str), datab(D4str) msgb(D4str) physreq(D4)

``DMA'' in HDK Technical Reference
``Scatter/gather operations'' in HDK Technical Reference

Example

See the msgscgth(D3str) manual page for a code example that uses msgpullup_physreq( ).
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005