geteblk Kernel Service

Purpose

Allocates a free buffer.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/buf.h>
struct buf *geteblk ( )

Description

Attention: The use of the geteblk service by character device drivers is strongly discouraged. As an alternative, character device drivers can use the xmalloc service to allocate the memory space directly, or the character I/O kernel services such as the getcb or getcf services.

The geteblk kernel service allocates a buffer and buffer header and returns the address of the buffer header. If no free buffers are available, then the geteblk service waits for one to become available. Block device drivers can retrieve buffers using the geteblk service.

In the header, the b_forw, b_back, b_flags, b_bcount, b_dev, and b_un fields are used by the system and cannot be modified by the driver. The av_forw and av_back fields are available to the user of the geteblk service for keeping a chain of buffers by the user of the geteblk service. (This user could be the kernel file system or a device driver.) The b_blkno and b_resid fields can be used for any purpose.

The brelse service is used to free this type of buffer.

The geteblk service has no parameters.

Execution Environment

The geteblk kernel service can be called from the process environment only.

Return Values

The geteblk service returns a pointer to the buffer header. There are no error codes because the geteblk service waits until a buffer header becomes available.

On a platform that supports storage keys, the buffer header is allocated from the storage protected by the KKEY_BLOCK_DEV kernel key.