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

mdi_end_of_contig_segment(D3mdi)


mdi_end_of_contig_segment -- return pointer to end of physically contiguous segment in buffer

Synopsis (Not in SVR5 version)

   #include <sys/mdi.h>
   

u_char * mdi_end_of_contig_segment (u_char *vstart, u_char * vend);

Description

The mdi_end_of_contig_segment( ) function returns a pointer to the end of the physically contiguous segment in the specified buffer.

Arguments


vstart
pointer to the beginning of the buffer

vend
pointer to the last byte of the buffer

Usage

Return values

mdi_end_of_contig_segment( ) returns a pointer in the buffer that marks the end of the physically contiguous segment within the buffer. If the whole buffer is physically contiguous, then the pointer returned will be the same as vend.

Examples

The following code fragment illustrates how to use mdi_end_of_contig_segment( ) to check each block and break it into separate scatter elements if necessary.
   XXuwput {
   

scatter_list_cnt = 0; for ( ; mp; mp = mp->b_cont ) { for (start = mp->b_rptr; start < mp->b_wptr; ) { end = mdi_end_of_contig_segment(start, mp->b_wptr - 1); seglen = (end - start) +1; list[scatter_list_cnt].address_start = start; list[scatter_list_cnt].length = seglen; scatter_list_cnt++; start = end + 1; } } }

Context and synchronization

Interrupt context

Hardware applicability

All

Version applicability

mdi: 1 and mdi: 2 with DDI versions 7 and 7.1.

Differences between versions

This function is not supported for MDI drivers that use DDI version 8 and later. In DDI 8, use the msgscgth(D3str) function to construct a DMA scatter/gather list for a message block; see also scgth(D4).

The SCO OpenServer STREAMS subsystem allows STREAMS blocks greater than 4K to be allocated. The pages in these STREAMS blocks are virtually contiguous but are not guaranteed to be physically contiguous. Drivers that support adapters that use Bus Master DMA expect that each (address_start, length) scatter element represents a physically contiguous region of memory. On earlier UNIX systems, the data contained within the b_rptr and b_wptr -1 members of the Streams message block, msgb(D4str), was guaranteed to be physically contiguous, but on newer systems, it may not be. Consequently, the driver must check each block and, if necessary, break it into separate scatter elements.

References

allocb_physreq(D3str), msgscgth(D3str), scgth(D4)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005