ibv_open_device 和 ibv_close_device
打开和关闭远程设备内存访问 (RDMA) 设备上下文。
语法
#include <rdma/verbs.h>
struct ibv_context *ibv_open_device(struct ibv_device *device);
int ibv_close_device(struct ibv_context *context);描述
ibv_open_device () 函数打开设备device,并创建上下文以供进一步使用。
ibv_close_device () 函数关闭设备上下文context。
注: ibv_close_device () 函数不会释放使用参数 context分配的所有资源。 要避免资源泄漏,必须在关闭上下文之前释放所有关联的资源。
参数
| 项 | 描述 |
|---|---|
| 设备 | 指定所需设备的结构 ibv_device 。 |
返回值
ibv_open_device和 ibv_close_device 函数返回一个动词上下文,可在成功完成时用于设备上的未来操作。 如果设备为 NULL ,或者如果打开操作失败,那么此函数将返回 NULL。