[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts

I/O Kernel Services

The I/O kernel services fall into the following categories: Block I/O services, Buffer Cache services, Character I/O services, Interrupt Management services, Memory Buffer (mbuf) services, DMA Management services.

Block I/O Kernel Services

The Block I/O kernel services are:

iodone Performs block I/O completion processing.
iowait Waits for block I/O completion.
uphysio Performs character I/O for a block device using a uio structure.

Buffer Cache Kernel Services

The Block I/O Buffer Cache Kernel Services: Overview describes how to manage the buffer cache with the Buffer Cache kernel services. The Buffer Cache kernel services are:

bawrite Writes the specified buffer's data without waiting for I/O to complete.
bdwrite Releases the specified buffer after marking it for delayed write.
bflush Flushes all write-behind blocks on the specified device from the buffer cache.
binval Invalidates all of the specified device's blocks in the buffer cache.
blkflush Flushes the specified block if it is in the buffer cache.
bread Reads the specified block's data into a buffer.
breada Reads in the specified block and then starts I/O on the read-ahead block.
brelse Frees the specified buffer.
bwrite Writes the specified buffer's data.
clrbuf Sets the memory for the specified buffer structure's buffer to all zeros.
getblk Assigns a buffer to the specified block.
geteblk Allocates a free buffer.
geterror Determines the completion status of the buffer.
purblk Purges the specified block from the buffer cache.

Character I/O Kernel Services

The Character I/O kernel services are:

getc Retrieves a character from a character list.
getcb Removes the first buffer from a character list and returns the address of the removed buffer.
getcbp Retrieves multiple characters from a character buffer and places them at a designated address.
getcf Retrieves a free character buffer.
getcx Returns the character at the end of a designated list.
pincf Manages the list of free character buffers.
putc Places a character at the end of a character list.
putcb Places a character buffer at the end of a character list.
putcbp Places several characters at the end of a character list.
putcf Frees a specified buffer.
putcfl Frees the specified list of buffers.
putcx Places a character on a character list.
waitcfree Checks the availability of a free character buffer.

Interrupt Management Services

The operating system provides the following set of kernel services for managing interrupts. See Understanding Interrupts for a description of these services:

i_clear Removes an interrupt handler from the system.
i_reset Resets the system's hardware interrupt latches.
i_sched Schedules off-level processing.
i_mask Disables an interrupt level.
i_unmask Enables an interrupt level.
i_disable Disables all of the interrupt levels at a particular interrupt priority and all interrupt levels at a less-favored interrupt priority.
i_enable Enables all of the interrupt levels at a particular interrupt priority and all interrupt levels at a more-favored interrupt priority.

Memory Buffer (mbuf) Kernel Services

The Memory Buffer (mbuf) kernel services provide functions to obtain, release, and manipulate memory buffers, or mbufs. These mbuf services provide the means to easily work with the mbuf data structure, which is defined in the /usr/include/sys/mbuf.h file. Data can be stored directly in an mbuf's data portion or in an attached external cluster. Mbufs can also be chained together by using the m_next field in the mbuf structure. This is particularly useful for communications protocols that need to add and remove protocol headers.

The Memory Buffer (mbuf) kernel services are:

m_adj Adjusts the size of an mbuf chain.
m_clattach Allocates an mbuf structure and attaches an external cluster.
m_cat Appends one mbuf chain to the end of another.
m_clgetm Allocates and attaches an external buffer.
m_collapse Guarantees that an mbuf chain contains no more than a given number of mbuf structures.
m_copydata Copies data from an mbuf chain to a specified buffer.
m_copym Creates a copy of all or part of a list of mbuf structures.
m_dereg Deregisters expected mbuf structure usage.
m_free Frees an mbuf structure and any associated external storage area.
m_freem Frees an entire mbuf chain.
m_get Allocates a memory buffer from the mbuf pool.
m_getclr Allocates and zeros a memory buffer from the mbuf pool.
m_getclustm Allocates an mbuf structure from the mbuf buffer pool and attaches a cluster of the specified size.
m_gethdr Allocates a header memory buffer from the mbuf pool.
m_pullup Adjusts an mbuf chain so that a given number of bytes is in contiguous memory in the data area of the head mbuf structure.
m_reg Registers expected mbuf usage.

In addition to the mbuf kernel services, the following macros are available for use with mbufs:

m_clget Allocates a page-sized mbuf structure cluster.
m_copy Creates a copy of all or part of a list of mbuf structures.
m_getclust Allocates an mbuf structure from the mbuf buffer pool and attaches a page-sized cluster.
M_HASCL Determines if an mbuf structure has an attached cluster.
DTOM Converts an address anywhere within an mbuf structure to the head of that mbuf structure.
MTOCL Converts a pointer to an mbuf structure to a pointer to the head of an attached cluster.
MTOD Converts a pointer to an mbuf structure to a pointer to the data stored in that mbuf structure.
M_XMEMD Returns the address of an mbuf cross-memory descriptor.

DMA Management Kernel Services

The operating system kernel provides several services for managing direct memory access DMA channels and performing DMA operations. Understanding DMA Transfers provides additional kernel services information.

The services provided are:

d_align Assists in the allocation of DMA buffers.
d_cflush Flushes the processor and I/O controller (IOCC) data caches when using the long term DMA_WRITE_ONLY mapping of direct memory access (DMA) buffers approach to the bus device DMA.
d_clear Frees a DMA channel.
d_complete Cleans up after a DMA transfer.
d_init Initializes a DMA channel.
d_map_init Allocates and initializes resources for performing DMA with PCI and ISA devices.
d_mask Disables a DMA channel.
d_master Initializes a block-mode DMA transfer for a DMA master.
d_move Provides consistent access to system memory accessed asynchronously by a device and the processor on the system.
d_roundup Assists in allocation of DMA buffers.
d_slave Initializes a block-mode DMA transfer for a DMA slave.
d_unmask Enables a DMA channel.

Related Information

Block I/O Buffer Cache Kernel Services Overview.

Understanding Interrupts.


[ Previous | Next | Contents | Home | Search ]