DevHelp SortRequest

From EDM2
Jump to: navigation, search

This service is used by block (disk) device drivers to add a new request to their work queue. This routine inserts the request packet in the linked list of request packets in the order of starting sector number.

Syntax

C

USHORT APIENTRY DevHelp_SortRequest( NPBYTE Queue,
                                     PBYTE  ReqPktAddr );

Assembler

MOV   SI,OFFSET DS:queue      ; Location to DWORD queue head (which points to
                              ; the first request). It should be initialized to 0.
LES   BX,request_packet       ; Pointer to request packet.
MOV   DL,DevHlp_SortRequest

CALL  [Device_Help]

Parameters

C

Queue (NPBYTE) 
Location of queue head which points to the first request. It should be initialized to 0.
ReqPktAddr 
Pointer to request packet.

Assembler

MOV   SI,OFFSET DS:queue      ; Location to DWORD queue head (which points to
                              ; the first request). It should be initialized to 0.
LES   BX,request_packet       ; Pointer to request packet.

Return Code

C

Success Indicator: None.

Possible errors: None.

Assembler

None .

Remarks

The sorting by sector number is designed to reduce the length and number of disk head seeks. This is a simple algorithm, and does not account for multiple heads that operate on the media or for a target drive in the request packet. SortRequest inserts the current request packet into the specified linked list of packets, sorted by starting sector number. SortRequest can only be used to place request packets that were allocated by AllocReqPacket in the request packet queue.

Example Code

C

#include  "dhcalls.h"

USHORT APIENTRY DevHelp_SortRequest( NPBYTE Queue,
                                     PBYTE  ReqPktAddr );

Related Functions