[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Kernel and Subsystems Technical Reference, Volume 1

fp_write Kernel Service for Data Link Control (DLC) Devices

Purpose

Allows kernel data to be sent using a file pointer.

Syntax

#include <sys/gdlextcb.h>
#include <sys/fp_io.h>

int fp_write (fp, buf, nbytes, ext, segflag, countp)
struct file * fp;
char * buf;
int nbytes;
int ext;
int segflag;
int * countp;>

Parameters

fp Specifies file pointer returned from the fp_open kernel service.
buf Points to a kernel mbuf structure.
nbytes Contains the byte length of the write data. It is not necessary to set this field to the actual length of write data, however, since the mbuf contains a length field. Instead, this field can be set to any non-negative value (generally set to 0).
ext Specifies the extended kernel service parameter. This is a pointer to the dlc_io_ext extended I/O structure for writes. The argument for this parameter must be in the kernel space. For more information on this parameter, see "write Subroutine Extended Parameters for DLC"AIX Version 4.3 Technical Reference: Communications Volume 1.
segflag Specifies the segment flag indicating where the path parameter is located. The only valid value is:
FP_SYS The path parameter is stored in kernel memory.
countp Points to the location where a count of bytes actually written is to be returned (must be in kernel space). GDLC does not provide this information for a kernel user since mbufs are used, but the file system requires a valid address and writes a copy of the nbytes parameter to that location.

Description

Four types of data can be sent to generic data link control (GDLC). Network data can be sent to a service access point (SAP), and normal, exchange identification (XID) or datagram data can be sent to a link station (LS).

Kernel users pass a communications memory buffer (mbuf) directly to GDLC on the fp_write kernel service. In this case, a uiomove kernel service is not required, and maximum performance can be achieved by merely passing the buffer pointer to GDLC. Each write buffer is required to have the proper buffer header information and enough space for the data link headers to be inserted. A write data offset is passed back to the kernel user at start LS completion for this purpose.

All data must fit into a single packet for each write call. That is, GDLC does not separate the user's write data area into multiple transmit packets. A maximum write data size is passed back to the user at DLC_ENABLE_SAP completion and at DLC_START_LS completion for this purpose.

Normally, a write subroutine can be satisfied immediately by GDLC by completing the data link headers and sending the transmit packet down to the device handler. In some cases, however, transmit packets can be blocked by the particular protocol's flow control or a resource outage. GDLC reacts to this differently, based on the system blocked/nonblocked file status flags (set by the file system and based on the O_NDELAY and O_NONBLOCKED values passed on the fp_open kernel service). Nonblocked write subroutines that cannot get enough resources to queue the communications memory buffer (mbuf) return an error indication. Blocked write subroutines put the calling process to sleep until the resources free up or an error occurs.

Return Values

0 Indicates a successful operation.
EAGAIN Indicates that transmit is temporarily blocked, and the calling process cannot be put to sleep.
EINTR Indicates that a signal interrupted the kernel service before it could complete successfully.
EINVAL Indicates an invalid argument, such as too much data for a single packet.
ENXIO Indicates an invalid file pointer.

These return values are defined in the /usr/include/sys/errno.h file.

Implementation Specifics

Each GDLC supports the fp_write kernel service via its dlcwrite entry point. The fp_write kernel service may be called from the process environment only.

Related Information

The fp_open kernel service, fp_write kernel service.

The uiomove subroutine.

Generic Data Link Control (GDLC) Environment Overview in AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts.

Parameter Blocks by ioctl Operation for DLC.

read Subroutine Extended Parameters for DLC.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]