Commit 0c869ca0 authored by 's avatar
Browse files

Fixed compilation bug of DAG driver introduced in r1319.

Fixed int == void* unifications in pthread_create() calls -- illegal for 64bit.
 


git-svn-id: file:///home/svn/mapi/trunk@1341 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 4ff73f0d
...@@ -82,11 +82,12 @@ internal variable. ...@@ -82,11 +82,12 @@ internal variable.
.I disable_dsm .I disable_dsm
-- This debugging boolean variable disables the DSM code in mapid (value 1). -- This debugging boolean variable disables the DSM code in mapid (value 1).
The code from stdflib will be used for BPF_FILTER. The default is 0. The code from stdflib will be used for BPF_FILTER and PKT_COUNTER. The
default is 0.
.I disable_dsm_xml_remove .I disable_dsm_xml_remove
-- This debugging boolean variable instruct mapid to \fBnot\fR remote the XML -- This debugging boolean variable instructs mapid to \fBnot\fR remove the
definition file created in the /tmp directory after the successful run XML definition file created in the /tmp directory after the successful run
of dsm_loader. The default is 0. of dsm_loader. The default is 0.
The \fBBPF_FILTER\fR implementation is NEW & EXPERIMENTAL and more The \fBBPF_FILTER\fR implementation is NEW & EXPERIMENTAL and more
......
...@@ -106,7 +106,7 @@ int main(int argc, char **argv) ...@@ -106,7 +106,7 @@ int main(int argc, char **argv)
lineno++; lineno++;
if (!p) if (!p)
fatal("%s: Fatal error, the length of input line %d is above %d bytes.\n", argv[0], lineno, sizeof(inbuf)-1); fatal("%s: Fatal error, the length of input line %d is above %u bytes.\n", argv[0], lineno, sizeof(inbuf)-1);
*p = '\0'; *p = '\0';
if (inbuf[0] == '\0') if (inbuf[0] == '\0')
......
...@@ -116,8 +116,9 @@ int mapidrv_add_device(mapi_offline_device_status_t *olstatus,char *devname, int ...@@ -116,8 +116,9 @@ int mapidrv_add_device(mapi_offline_device_status_t *olstatus,char *devname, int
} }
static void static void
mapidrv_proc_loop (int devid) mapidrv_proc_loop (void *arg)
{ {
int devid = *(int *)arg;
unsigned char *dev_pkt; unsigned char *dev_pkt;
unsigned char *link_pkt; unsigned char *link_pkt;
mapid_pkthdr_t mhdr; mapid_pkthdr_t mhdr;
...@@ -216,7 +217,7 @@ mapidrv_create_flow (int devid, int fd, char **devtype) ...@@ -216,7 +217,7 @@ mapidrv_create_flow (int devid, int fd, char **devtype)
return COMBO6_PTHR_ERR; return COMBO6_PTHR_ERR;
} }
if (pthread_create if (pthread_create
(&i->th_proc, &i->th_attr, (void *) mapidrv_proc_loop, (void*)devid) != 0) (&i->th_proc, &i->th_attr, (void *) mapidrv_proc_loop, (void *) &devid) != 0)
{ {
fprintf (stderr, "pthread_create failed"); fprintf (stderr, "pthread_create failed");
return COMBO6_PTHR_ERR; return COMBO6_PTHR_ERR;
......
...@@ -320,8 +320,9 @@ process_pkts_offline(void *buf,unsigned len, dag_instance_t *i) ...@@ -320,8 +320,9 @@ process_pkts_offline(void *buf,unsigned len, dag_instance_t *i)
} }
static void static void
mapidrv_offline_proc_loop(int devid) mapidrv_offline_proc_loop(void *arg)
{ {
int devid = *(int *)arg;
char buf[BUFSIZE]; char buf[BUFSIZE];
char *b=buf; char *b=buf;
dag_record_t *rec; dag_record_t *rec;
...@@ -380,8 +381,9 @@ mapidrv_offline_proc_loop(int devid) ...@@ -380,8 +381,9 @@ mapidrv_offline_proc_loop(int devid)
} }
static void static void
mapidrv_proc_loop (int devid) mapidrv_proc_loop (void *arg)
{ {
int devid = *(int *)arg;
uint8_t *bottom = NULL; uint8_t *bottom = NULL;
uint8_t *top = NULL; uint8_t *top = NULL;
...@@ -602,7 +604,7 @@ mapidrv_create_flow (int devid, int fd, char **devtype) ...@@ -602,7 +604,7 @@ mapidrv_create_flow (int devid, int fd, char **devtype)
} }
if (pthread_create if (pthread_create
(&i->th_proc, &i->th_attr, (void *) mapidrv_proc_loop, (void*)devid) != 0) (&i->th_proc, &i->th_attr, (void *) mapidrv_proc_loop, (void *) &devid) != 0)
{ {
DEBUG_CMD(Debug_Message("ERROR: pthread_create failed")); DEBUG_CMD(Debug_Message("ERROR: pthread_create failed"));
return DAGDRV_PTHR_ERR; return DAGDRV_PTHR_ERR;
...@@ -727,7 +729,7 @@ mapidrv_connect (int devid,int fd) ...@@ -727,7 +729,7 @@ mapidrv_connect (int devid,int fd)
return NICDRV_PTHR_ERR; return NICDRV_PTHR_ERR;
} }
if (pthread_create if (pthread_create
(&i->th_proc, &i->th_attr, (void *) mapidrv_offline_proc_loop, (void *)i->id) != 0) (&i->th_proc, &i->th_attr, (void *) mapidrv_offline_proc_loop, (void *) &(i->id)) != 0)
{ {
DEBUG_CMD(Debug_Message("ERROR: pthread_create failed")); DEBUG_CMD(Debug_Message("ERROR: pthread_create failed"));
return NICDRV_PTHR_ERR; return NICDRV_PTHR_ERR;
...@@ -748,7 +750,7 @@ mapidrv_start_offline_device( int devid) ...@@ -748,7 +750,7 @@ mapidrv_start_offline_device( int devid)
return DAGDRV_PTHR_ERR; return DAGDRV_PTHR_ERR;
} }
if (pthread_create if (pthread_create
(&i->th_proc, &i->th_attr, (void *) mapidrv_offline_proc_loop, (void *)i->id) != 0) (&i->th_proc, &i->th_attr, (void *) mapidrv_offline_proc_loop, (void *) &(i->id)) != 0)
{ {
DEBUG_CMD(Debug_Message("ERROR: pthread_create failed")); DEBUG_CMD(Debug_Message("ERROR: pthread_create failed"));
return DAGDRV_PTHR_ERR; return DAGDRV_PTHR_ERR;
...@@ -837,7 +839,8 @@ int dagdsm_build_bpffilter(int check_for_flow_fd, char *new_filter_string, dag_i ...@@ -837,7 +839,8 @@ int dagdsm_build_bpffilter(int check_for_flow_fd, char *new_filter_string, dag_i
{ {
int index = 1, rc_err = 0, filter_count; int index = 1, rc_err = 0, filter_count;
char errbuf[BPF_ERRBUF_SIZE]; char errbuf[BPF_ERRBUF_SIZE];
flist_node_t *flow, *fnode; flist_node_t *flownode, *funcnode;
mapid_flow_info_t *fi;
flist_t *functions; flist_t *functions;
dag_adapterinfo_t *di = dag_instance->hwinfo.adapterinfo; dag_adapterinfo_t *di = dag_instance->hwinfo.adapterinfo;
dagdsm_bpf_filter_t *filter = NULL; /* compiled filter */ dagdsm_bpf_filter_t *filter = NULL; /* compiled filter */
...@@ -850,18 +853,17 @@ int dagdsm_build_bpffilter(int check_for_flow_fd, char *new_filter_string, dag_i ...@@ -850,18 +853,17 @@ int dagdsm_build_bpffilter(int check_for_flow_fd, char *new_filter_string, dag_i
/* iterate for each function in each flow. */ /* iterate for each function in each flow. */
pthread_spin_lock(&dag_instance->hwinfo.gflist->lock); pthread_spin_lock(&dag_instance->hwinfo.gflist->lock);
for (flow=flist_head(dag_instance->hwinfo.gflist->fflist); flow && !rc_err; flow=flist_next(flow)) { for (flownode=flist_head(dag_instance->hwinfo.gflist->fflist); flownode && !rc_err; flownode=flist_next(flownode)) {
fi = flist_data(flownode);
/* skip flows marked for deletion */ if (fi->status == FLOW_CLOSED) continue; /* skip flows marked for deletion */
if (flist_get(&dag_instance->mapidlib.close, flist_id(flow)))
continue;
if (NULL != (functions=((mapid_flow_info_t *)flist_data(flow))->flist)) { if (NULL != (functions=fi->flist)) {
u_int32_t preclassification_mask = 0; u_int32_t preclassification_mask = 0;
boolean_t filter_in_flow = FALSE; boolean_t filter_in_flow = FALSE;
for (fnode=flist_head(functions); fnode; fnode=flist_next(fnode)) { for (funcnode=flist_head(functions); funcnode; funcnode=flist_next(funcnode)) {
mapidflib_function_t *flibf = flist_data(fnode); mapidflib_function_t *flibf = flist_data(funcnode);
mapidflib_function_instance_t *funct=flibf->instance; mapidflib_function_instance_t *funct=flibf->instance;
if (strcmp(funct->def->devtype, MAPI_DEVICE_DAG)) { if (strcmp(funct->def->devtype, MAPI_DEVICE_DAG)) {
...@@ -914,7 +916,7 @@ int dagdsm_build_bpffilter(int check_for_flow_fd, char *new_filter_string, dag_i ...@@ -914,7 +916,7 @@ int dagdsm_build_bpffilter(int check_for_flow_fd, char *new_filter_string, dag_i
* implement AND'ing of hardware filters for two successive * implement AND'ing of hardware filters for two successive
* BPF_FILTERs. * BPF_FILTERs.
*/ */
if ((check_for_flow_fd == flist_id(flow)) && filter_in_flow) { if ((check_for_flow_fd == flist_id(flownode)) && filter_in_flow) {
DEBUG_CMD(Debug_Message("NOTICE: dagdsm_build_bpffilter: Refusing multiple dagflib:BPF_FILTER in one flow.")); DEBUG_CMD(Debug_Message("NOTICE: dagdsm_build_bpffilter: Refusing multiple dagflib:BPF_FILTER in one flow."));
rc_err = MFUNCT_COULD_NOT_APPLY_FUNCT; rc_err = MFUNCT_COULD_NOT_APPLY_FUNCT;
break; break;
......
...@@ -135,8 +135,9 @@ int mapidrv_delete_device(int devid) ...@@ -135,8 +135,9 @@ int mapidrv_delete_device(int devid)
} }
static void static void
mapidrv_proc_loop (int devid) mapidrv_proc_loop (void *arg)
{ {
int devid = *(int *)arg;
u_char *packet; u_char *packet;
struct pcap_pkthdr phdr; struct pcap_pkthdr phdr;
mapid_pkthdr_t mhdr; mapid_pkthdr_t mhdr;
...@@ -236,7 +237,7 @@ mapidrv_create_flow (int devid, int fd, char **devtype) ...@@ -236,7 +237,7 @@ mapidrv_create_flow (int devid, int fd, char **devtype)
return NICDRV_PTHR_ERR; return NICDRV_PTHR_ERR;
} }
if (pthread_create(&i->th_proc, &i->th_attr, (void *) mapidrv_proc_loop, (void*)devid) != 0) if (pthread_create(&i->th_proc, &i->th_attr, (void *) mapidrv_proc_loop, (void *) &devid) != 0)
{ {
DEBUG_CMD(Debug_Message("ERROR: pthread_create failed")); DEBUG_CMD(Debug_Message("ERROR: pthread_create failed"));
return DAGDRV_PTHR_ERR; return DAGDRV_PTHR_ERR;
......
...@@ -208,8 +208,9 @@ process_pkts(void *buf,unsigned len, nic_instance_t *i,MAPI_UNUSED int devid, in ...@@ -208,8 +208,9 @@ process_pkts(void *buf,unsigned len, nic_instance_t *i,MAPI_UNUSED int devid, in
} }
static void static void
mapidrv_offline_proc_loop(int devid) mapidrv_offline_proc_loop(void *arg)
{ {
int devid = *(int *)arg;
char buf[BUFSIZE]; char buf[BUFSIZE];
char *b=buf; char *b=buf;
int left=0,c; int left=0,c;
...@@ -317,8 +318,9 @@ callback(u_char *user, const struct pcap_pkthdr *phdr, ...@@ -317,8 +318,9 @@ callback(u_char *user, const struct pcap_pkthdr *phdr,
} }
static void static void
mapidrv_proc_loop (int devid) mapidrv_proc_loop (void *arg)
{ {
int devid = *(int *)arg;
nic_instance_t *i=flist_get(devlist,devid); nic_instance_t *i=flist_get(devlist,devid);
int err; int err;
...@@ -425,7 +427,7 @@ mapidrv_create_flow (int devid, int fd, char **devtype) ...@@ -425,7 +427,7 @@ mapidrv_create_flow (int devid, int fd, char **devtype)
return NICDRV_PTHR_ERR; return NICDRV_PTHR_ERR;
} }
if (pthread_create(&i->th_proc, &i->th_attr, (void *) mapidrv_proc_loop, (void*)devid) != 0) if (pthread_create(&i->th_proc, &i->th_attr, (void *) mapidrv_proc_loop, (void *) &devid) != 0)
{ {
DEBUG_CMD(Debug_Message("ERROR: pthread_create failed")); DEBUG_CMD(Debug_Message("ERROR: pthread_create failed"));
return DAGDRV_PTHR_ERR; return DAGDRV_PTHR_ERR;
...@@ -473,7 +475,7 @@ mapidrv_connect (int devid,int fd) ...@@ -473,7 +475,7 @@ mapidrv_connect (int devid,int fd)
DEBUG_CMD(Debug_Message("ERROR: pthread_attr_init failed")); DEBUG_CMD(Debug_Message("ERROR: pthread_attr_init failed"));
return NICDRV_PTHR_ERR; return NICDRV_PTHR_ERR;
} }
if (pthread_create(&i->th_proc, &i->th_attr, (void *) mapidrv_offline_proc_loop, (void *)i->id) != 0) if (pthread_create(&i->th_proc, &i->th_attr, (void *) mapidrv_offline_proc_loop, (void *) &(i->id)) != 0)
{ {
DEBUG_CMD(Debug_Message("ERROR: pthread_create failed")); DEBUG_CMD(Debug_Message("ERROR: pthread_create failed"));
return NICDRV_PTHR_ERR; return NICDRV_PTHR_ERR;
...@@ -497,7 +499,7 @@ mapidrv_start_offline_device( int devid) ...@@ -497,7 +499,7 @@ mapidrv_start_offline_device( int devid)
DEBUG_CMD(Debug_Message("ERROR: pthread_attr_init failed")); DEBUG_CMD(Debug_Message("ERROR: pthread_attr_init failed"));
return NICDRV_PTHR_ERR; return NICDRV_PTHR_ERR;
} }
if (pthread_create(&i->th_proc, &i->th_attr, (void *) mapidrv_offline_proc_loop, (void *)i->id) != 0) if (pthread_create(&i->th_proc, &i->th_attr, (void *) mapidrv_offline_proc_loop, (void *) &(i->id)) != 0)
{ {
DEBUG_CMD(Debug_Message("ERROR: pthread_create failed")); DEBUG_CMD(Debug_Message("ERROR: pthread_create failed"));
return NICDRV_PTHR_ERR; return NICDRV_PTHR_ERR;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
__attribute__ ((constructor)) void init (); __attribute__ ((constructor)) void init ();
__attribute__ ((destructor)) void fini (); __attribute__ ((destructor)) void fini ();
static void mapidrv_proc_loop(int devid); static void mapidrv_proc_loop(void *);
typedef struct vin_instance { typedef struct vin_instance {
pthread_t th_proc; pthread_t th_proc;
...@@ -207,8 +207,9 @@ static int process_dir(vin_instance_t *i, int devid, char *trace_dir) { ...@@ -207,8 +207,9 @@ static int process_dir(vin_instance_t *i, int devid, char *trace_dir) {
} }
static void static void
mapidrv_proc_loop(int devid) mapidrv_proc_loop(void *arg)
{ {
int devid = *(int *)arg;
int err; int err;
vin_instance_t *i=flist_get(devlist,devid); vin_instance_t *i=flist_get(devlist,devid);
...@@ -291,7 +292,7 @@ mapidrv_connect (int devid,int fd) ...@@ -291,7 +292,7 @@ mapidrv_connect (int devid,int fd)
if (i->th_proc == 0) { if (i->th_proc == 0) {
//Start processing thread //Start processing thread
if (pthread_create(&i->th_proc, NULL, (void *) mapidrv_proc_loop, (void*)devid) != 0) { if (pthread_create(&i->th_proc, NULL, (void *) mapidrv_proc_loop, (void *) &devid) != 0) {
DEBUG_CMD(Debug_Message("ERROR: pthread_create failed")); DEBUG_CMD(Debug_Message("ERROR: pthread_create failed"));
return VINDRV_PTHR_ERR; return VINDRV_PTHR_ERR;
} }
......
...@@ -282,12 +282,12 @@ int main (int argc, char *argv[]){ ...@@ -282,12 +282,12 @@ int main (int argc, char *argv[]){
inst->connection = con; inst->connection = con;
inst->sock = new_sock; inst->sock = new_sock;
if (pthread_create(&chld_thr, NULL, handle_request,(void *) inst) != 0){ if (pthread_create(&chld_thr, NULL, handle_request, (void *) inst) != 0){
die("pthread_create() failed"); die("pthread_create() failed");
continue; continue;
} }
#else #else
if (pthread_create(&chld_thr, NULL, handle_request, (void *)new_sock) != 0) { if (pthread_create(&chld_thr, NULL, handle_request, (void *) &new_sock) != 0) {
die("pthread_create() failed"); die("pthread_create() failed");
continue; continue;
} }
...@@ -302,7 +302,7 @@ void *handle_request(void *arg) { ...@@ -302,7 +302,7 @@ void *handle_request(void *arg) {
con = ((struct overload*)arg)->connection; con = ((struct overload*)arg)->connection;
int sock = ((struct overload*)arg)->sock; int sock = ((struct overload*)arg)->sock;
#else #else
int sock=(int)arg; int sock = *(int *)arg;
#endif #endif
int recv_bytes; int recv_bytes;
struct dmapiipcbuf *dbuf=NULL; struct dmapiipcbuf *dbuf=NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment