int ptl_set_cfg_record_cb(cfg_record_cb_t cb);
/* l_ioctl.c */
+typedef int (ioc_handler_t)(int dev_id, int opc, void *buf);
+void set_ioc_handler(ioc_handler_t *handler);
int register_ioc_dev(int dev_id, const char * dev_name);
void unregister_ioc_dev(int dev_id);
int set_ioctl_dump(char * file);
int ptl_set_cfg_record_cb(cfg_record_cb_t cb);
/* l_ioctl.c */
+typedef int (ioc_handler_t)(int dev_id, int opc, void *buf);
+void set_ioc_handler(ioc_handler_t *handler);
int register_ioc_dev(int dev_id, const char * dev_name);
void unregister_ioc_dev(int dev_id);
int set_ioctl_dump(char * file);
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <portals/types.h>
#include <portals/list.h>
#include <portals/lib-types.h>
conn = hash_table_find(m->connections, id);
if (!conn) {
int fd;
+ int option;
ptl_nid_t peernid = PTL_NID_ANY;
bzero((char *) &addr, sizeof(addr));
perror("tcpnal connect");
return(0);
}
+
+#if 1
+ option = 1;
+ setsockopt(fd, SOL_TCP, TCP_NODELAY, &option, sizeof(option));
+ option = 1<<20;
+ setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &option, sizeof(option));
+ option = 1<<20;
+ setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &option, sizeof(option));
+#endif
+
/* say hello */
if (tcpnal_hello(fd, &peernid, SOCKNAL_CONN_ANY, 0))
exit(-1);
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <portals/types.h>
#include <portals/list.h>
#include <portals/lib-types.h>
conn = hash_table_find(m->connections, id);
if (!conn) {
int fd;
+ int option;
ptl_nid_t peernid = PTL_NID_ANY;
bzero((char *) &addr, sizeof(addr));
perror("tcpnal connect");
return(0);
}
+
+#if 1
+ option = 1;
+ setsockopt(fd, SOL_TCP, TCP_NODELAY, &option, sizeof(option));
+ option = 1<<20;
+ setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &option, sizeof(option));
+ option = 1<<20;
+ setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &option, sizeof(option));
+#endif
+
/* say hello */
if (tcpnal_hello(fd, &peernid, SOCKNAL_CONN_ANY, 0))
exit(-1);
#include <windef.h>
#endif
+static ioc_handler_t do_ioctl; /* forward ref */
+static ioc_handler_t *current_ioc_handler = &do_ioctl;
+
struct ioc_dev {
const char * dev_name;
int dev_fd;
int opc;
};
-char * dump_filename;
+char *dump_filename;
+
+void
+set_ioc_handler (ioc_handler_t *handler)
+{
+ if (handler == NULL)
+ current_ioc_handler = do_ioctl;
+ else
+ current_ioc_handler = handler;
+}
static int
open_ioc_dev(int dev_id)
strerror(errno));
return -EINVAL;
}
-
+
return 0;
}
free(dump_filename);
dump_filename = strdup(file);
+ if (dump_filename == NULL)
+ abort();
+
+ set_ioc_handler(&dump);
return 0;
}
int
l_ioctl(int dev_id, int opc, void *buf)
{
- if (dump_filename)
- return dump(dev_id, opc, buf);
- else
- return do_ioctl(dev_id, opc, buf);
+ return current_ioc_handler(dev_id, opc, buf);
}
/* Read an ioctl dump file, and call the ioc_func for each ioctl buffer
int ptl_set_cfg_record_cb(cfg_record_cb_t cb);
/* l_ioctl.c */
+typedef int (ioc_handler_t)(int dev_id, int opc, void *buf);
+void set_ioc_handler(ioc_handler_t *handler);
int register_ioc_dev(int dev_id, const char * dev_name);
void unregister_ioc_dev(int dev_id);
int set_ioctl_dump(char * file);
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <portals/types.h>
#include <portals/list.h>
#include <portals/lib-types.h>
conn = hash_table_find(m->connections, id);
if (!conn) {
int fd;
+ int option;
ptl_nid_t peernid = PTL_NID_ANY;
bzero((char *) &addr, sizeof(addr));
perror("tcpnal connect");
return(0);
}
+
+#if 1
+ option = 1;
+ setsockopt(fd, SOL_TCP, TCP_NODELAY, &option, sizeof(option));
+ option = 1<<20;
+ setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &option, sizeof(option));
+ option = 1<<20;
+ setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &option, sizeof(option));
+#endif
+
/* say hello */
if (tcpnal_hello(fd, &peernid, SOCKNAL_CONN_ANY, 0))
exit(-1);
#include <windef.h>
#endif
+static ioc_handler_t do_ioctl; /* forward ref */
+static ioc_handler_t *current_ioc_handler = &do_ioctl;
+
struct ioc_dev {
const char * dev_name;
int dev_fd;
int opc;
};
-char * dump_filename;
+char *dump_filename;
+
+void
+set_ioc_handler (ioc_handler_t *handler)
+{
+ if (handler == NULL)
+ current_ioc_handler = do_ioctl;
+ else
+ current_ioc_handler = handler;
+}
static int
open_ioc_dev(int dev_id)
strerror(errno));
return -EINVAL;
}
-
+
return 0;
}
free(dump_filename);
dump_filename = strdup(file);
+ if (dump_filename == NULL)
+ abort();
+
+ set_ioc_handler(&dump);
return 0;
}
int
l_ioctl(int dev_id, int opc, void *buf)
{
- if (dump_filename)
- return dump(dev_id, opc, buf);
- else
- return do_ioctl(dev_id, opc, buf);
+ return current_ioc_handler(dev_id, opc, buf);
}
/* Read an ioctl dump file, and call the ioc_func for each ioctl buffer