we try to convert some basic function such as ibv_get_device_list to pascal, but I can't find the 'alloc_context' and 'free_context' functions. is there someone can help us?
There are lines from verbs.h :
struct ibv_device_ops {
struct ibv_context * (*alloc_context)(struct ibv_device *device, int cmd_fd);
void (*free_context)(struct ibv_context *context);
};
struct ibv_device {
struct ibv_device_ops ops;
enum ibv_node_type node_type;
enum ibv_transport_type transport_type;
/* Name of underlying kernel IB device, eg "mthca0" */
char name[IBV_SYSFS_NAME_MAX];
/* Name of uverbs device, eg "uverbs0" */
char dev_name[IBV_SYSFS_NAME_MAX];
/* Path to infiniband_verbs class device in sysfs */
char dev_path[IBV_SYSFS_PATH_MAX];
/* Path to infiniband class device in sysfs */
char ibdev_path[IBV_SYSFS_PATH_MAX];
};
struct ibv_device **ibv_get_device_list(int *num_devices);
and there are pascal lines we wrote:
const
IBV_LINK_LAYER_UNSPECIFIED=0;
IBV_LINK_LAYER_INFINIBAND=1;
IBV_LINK_LAYER_ETHERNET=2;
IBV_SYSFS_NAME_MAX = 64;
IBV_SYSFS_PATH_MAX = 256;
Type
plongint=^longint;
ibv_node_type = (IBV_NODE_UNKNOWN := -(1),IBV_NODE_CA := 1,
IBV_NODE_SWITCH,IBV_NODE_ROUTER,IBV_NODE_RNIC,
IBV_NODE_USNIC,IBV_NODE_USNIC_UDP);
ibv_transport_type = (IBV_TRANSPORT_UNKNOWN := -(1),IBV_TRANSPORT_IB := 0,
IBV_TRANSPORT_IWARP,IBV_TRANSPORT_USNIC, IBV_TRANSPORT_USNIC_UDP);
pibv_context=^ibv_context;
ibv_context= record
end;
ibv_device_ops =record
_pibv_context:pibv_context;
res: plongint;
end;
ppIBV_DEVICE= ^Pibv_device;
Pibv_device= ^ibv_device;
ibv_device = record
ops : ibv_device_ops;
node_type : ibv_node_type;
transport_type : ibv_transport_type;
name : array[0..(IBV_SYSFS_NAME_MAX)-1] of char;
dev_name : array[0..(IBV_SYSFS_NAME_MAX)-1] of char;
dev_path : array[0..(IBV_SYSFS_PATH_MAX)-1] of char;
ibdev_path : array[0..(IBV_SYSFS_PATH_MAX)-1] of char;
end;
function ibv_fork_init:longint;cdecl; external;
function ibv_get_device_list(num_devices:plongint):ppIBV_DEVICE;Cdecl;external;
procedure TForm1.Button2Click(Sender: TObject);
var
tmpdevice:ppIBV_DEVICE;
x:plongint;
begin
ibv_fork_init();
new(x);
tmpdevice:=ibv_get_device_list(x);
end;
as we do Button2Click, there are errros:
/lib64/libibverbs.a(src_libibverbs_la-neigh.o) in function of et_link_local_mac_ipv6 (.text+0xf) there is undefined reference to `func l_addr_get_binary_addr.