CXL_ADAPTER_AFU_NEXT(3)

NAME
cxl_adapter_afu_next - iterate to the next AFU of a CXL adapter

cxl_for_each_adapter_afu - iteration macro

SYNOPSIS
#include <libcxl.h>

struct cxl_afu_h *cxl_adapter_afu_next(struct cxl_adapter_h *adapter, struct cxl_afu_h *afu);

DESCRIPTION
cxl_adapter_afu_next() returns an AFU handle describing the next AFU of the CXL adapter.

When afu is NULL, then an AFU handle is allocated, and the first available AFU of adapter is returned.

When afu is the last AFU of the current adapter, then the AFU handle is freed, errno is set to zero, and NULL is returned. Alternatively, the AFU handle can be freed explicitly with cxl_afu_free().

RETURN VALUE
On success, an AFU handle is returned, or NULL is returned and errno is set to zero. On error, NULL is returned, and errno is set appropriately.

ERRORS

ENODEV
    Unsupported kernel CXL API.

ENOMEM
    Insufficient memory.

EXAMPLE
The CXL library provides the following macro to enumerate the AFUs of a CXL adapter:

    #define cxl_for_each_adapter_afu(adapter, afu) \
        for (afu = cxl_adapter_afu_next(adapter, NULL); afu; \
             afu = cxl_adapter_afu_next(NULL, afu))

SEE ALSO
cxl(3), cxl_adapter_next(3), cxl_afu_dev_name(3), cxl_afu_free(3), cxl_afu_next(3), cxl_afu_sysfs_pci(3), cxl_get_mmio_size(3), cxl_get_mode(3), cxl_get_modes_supported(3), cxl_get_pp_mmio_len(3), cxl_get_pp_mmio_off(3), cxl_get_prefault_mode(3), cxl_set_mode(3), cxl_set_prefault_mode(3)