38 #include <sys/types.h>
39 #include <sys/sysctl.h>
40 #include <sys/ioctl.h>
41 #include <sys/pciio.h>
57 #define OCS_DEV_TEMPLATE "/dev/ocs"
59 typedef struct elxu_bsd_command_s {
69 #define ELXU_BSD_COMMAND _IOWR('Q', 0, struct elxu_bsd_command_s)
73 struct pci_conf_io pc;
74 struct pci_conf conf[1024];
81 fd = open(
"/dev/pci", O_RDONLY);
87 bzero(&pc,
sizeof(
struct pci_conf_io));
88 pc.match_buf_len =
sizeof(conf);
94 ioctl(fd, PCIOCGETCONF, &pc);
95 for (i=0; i<pc.num_matches; i++) {
100 if (!((strcmp(conf[i].pd_name,
"ocs_fc_ramd") == 0) ||
101 (strcmp(conf[i].pd_name,
"ocs_fc_cam") == 0) ||
102 (strcmp(conf[i].pd_name,
"ocs_fc") == 0))) {
107 bzero(new_device,
sizeof(*new_device));
109 new_device->
next = list;
111 new_device->
vendor = conf[i].pc_vendor;
112 new_device->
device = conf[i].pc_device;
151 char path[FILENAME_MAX];
154 printf(
"%s: user space driver not supported for FreeBSD\n", __func__);
162 if (device == NULL) {
166 device->
fd = open(path, O_RDWR);
167 if (device->
fd < 0) {
213 unsigned long ul_req = (
unsigned long)req & 0xffffffff;
215 return ioctl(device->
fd, ul_req, arg);
232 printf(
"iSCSI connection info is not supported on BSD\n");
elxu_device_t * os_build_device_list(char *path)
#define PCI_VENDOR_ID_EMULEX
void os_close_device(elxu_device_t *device)
Close a device file.
int os_ioctl_device(elxu_device_t *device, int req, void *arg)
Send an ioctl to an open device.
struct elxu_device_struct * next
device name specifier This structure is used to describe the type and name of the device ioctl connec...
void elxu_get_connection_info(elxu_device_t *device)
Print iSCSI connection info for the given device.
elxu_device_t * elxu_device_by_index(int index)
Return a pointer to a device given an index.
elxu_device_t * os_open_device(elxu_device_name_t *devname)
Open a device file.
elxu_device_t * os_build_device_list_uspace(char *hostname)
elxu_device_driver_e driver
char device_file_name[1024]
int os_remove_device(elxu_device_t *device)