Specifications
Writing Device-Driver Tables
4.3 Function Decision Table
• FDT_BUF—Creates the buffered function mask within an FDT
• FDT_ACT—Initializes one or more slots in the FDT action routine vector with
the procedure value of an upper-level FDT action routine
The FDT_INI macro creates an FDT, using the DRIVER_DATA macro to place
it within the driver’s data program section ($$$110_DATA). The macro properly
aligns the FDT in memory, assigning it the label specified by the fdt argument.
FDT_INI initializes the FDT by clearing the buffered function mask and entering
the address of the illegal I/O function processing routine (EXE$ILLIOFUNC) in
all FDT action routine vector slots.
If a driver does not explicitly invoke the FDT_INI macro, the FDT_BUF and
FDT_ACT macros will automatically invoke it on the driver’s behalf, resulting in
an FDT named DRIVER$FDT.
The FDT_BUF macro builds the buffered function mask within an FDT from
the specified list of I/O functions. The macro takes a single argument: a list of
codes (enclosed within angle brackets and separated by commas) for I/O functions
supported by the driver that require an intermediate system buffer. The macro
expansion prefixes each code with the string IO$_; for example, READVBLK
expands to IO$_READVBLK. (See Table 4–1 for a list of symbolic names for I/O
functions defined by the $IODEF macro in SYS$LIBRARY:STARLET.MLB.)
If no buffered I/O functions are defined for the device, you can omit the FDT_BUF
invocation.
In selecting the functions that are to be buffered, consider the following:
• Direct I/O is intended only for devices whose I/O operations always complete
quickly. For example, although terminal I/O appears fast, users can prevent
the I/O operation from completing by using Ctrl/S to halt the operation
indefinitely; therefore, terminal I/O operations are buffered I/O.
• Use of direct I/O requires that the process pages containing the buffer be
locked in memory. Locking pages in memory increases the overhead of
swapping the process that contains the pages.
• Use of buffered I/O requires that the data be moved from the system buffer to
the user buffer. Moving data requires additional time.
• Routines that manipulate data before delivering it to the user (for example,
an interrupt service routine for a terminal) cannot gain access to the data if
direct I/O is used. Therefore, transfers that require data manipulation must
be buffered I/O.
• The operating system handles the quotas differently for direct I/O and
buffered I/O, as described in the OpenVMS System Manager’s Manual.
• Generally, direct-memory-access (DMA) devices use direct I/O, while
programmed I/O devices use buffered I/O.
The FDT_ACT macro identifies the upper-level FDT action routine that processes
one or more specified I/O function codes. An upper-level FDT action routine must
either be an FDT completion routine or eventually transfer control to an FDT
completion routine. An FDT completion routine either queues an I/O request
packet (IRP) to a driver, inserts an IRP in the postprocessing queue, or aborts the
I/O request. See Chapter 5 for additional information on upper-level FDT action
routines, FDT support routines, and FDT completion routines.
4–5










