Scroll to navigation

CXL_ADAPTER_NEXT(3) CXL Programmer's Manual CXL_ADAPTER_NEXT(3)

NAME

cxl_adapter_next - iterate to the next CXL adapter

cxl_for_each_adapter - iteration macro

SYNOPSIS

#include <libcxl.h>

struct cxl_adapter_h *cxl_adapter_next(struct cxl_adapter_h *adapter);

DESCRIPTION

cxl_adapter_next() returns an adapter handle describing the next available CXL adapter.

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

When adapter is the last CXL adapter available, then the adapter handle is freed, errno is set to zero, and NULL is returned. Alternatively, the adapter handle can be freed explicitly with cxl_adapter_free().

RETURN VALUE

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

ERRORS

Unsupported kernel CXL API.
Insufficient memory.

EXAMPLE

The CXL library provides the following macro to enumerate all CXL adapters:


#define cxl_for_each_adapter(adapter) \
for (adapter = cxl_adapter_next(NULL); adapter; \
adapter = cxl_adapter_next(adapter))

SEE ALSO

cxl(3), cxl_adapter_afu_next(3), cxl_adapter_dev_name(3), cxl_adapter_free(3), cxl_afu_next(3), cxl_get_base_image(3), cxl_get_caia_version(3), cxl_get_image_loaded(3), cxl_get_psl_revision(3), cxl_get_psl_timebase_synced(3), cxl_get_tunneled_ops_supported(3)

2017-05-24 LIBCXL 1.5