CXL_AFU_NEXT(3)

NAME
cxl_afu_next - iterate to the next AFU

cxl_for_each_afu - iteration macro

SYNOPSIS
#include <libcxl.h>

struct cxl_afu_h *cxl_afu_next(struct cxl_afu_h *afu);

DESCRIPTION
cxl_afu_next() returns an AFU handle describing the next available AFU.

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

When afu is the last AFU available, 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
    Kernel does not support CXL devices.

ENOMEM
    Insufficient memory.

EXAMPLE
The CXL library provides the following macro to enumerate all AFUs:

    #define cxl_for_each_afu(afu) \
        for (afu = cxl_afu_next(NULL); afu; afu = cxl_afu_next(afu))

SEE ALSO
cxl(3), cxl_adapter_afu_next(3), cxl_adapter_next(3), cxl_afu_dev_name(3), cxl_afu_free(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)