From 570b7ac44f10aa8ae18c433384fa493d734f2936 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Thu, 27 Apr 2006 01:46:36 +0000 Subject: [PATCH] Remove priority from aispoll since we now use the kernel scheduler for priorities for polling git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1013 fd59a12c-fef9-0310-b244-a6a79926bd2f --- exec/aispoll.c | 36 ++++++++++++------------------------ exec/aispoll.h | 14 ++++++++++---- exec/ipc.c | 5 ++--- exec/totemnet.c | 12 ++++-------- 4 files changed, 28 insertions(+), 39 deletions(-) diff --git a/exec/aispoll.c b/exec/aispoll.c index 0080cb9b..d4c380f6 100644 --- a/exec/aispoll.c +++ b/exec/aispoll.c @@ -43,10 +43,9 @@ #include "../include/hdb.h" #include "tlist.h" -typedef int (*dispatch_fn_t) (poll_handle poll_handle, int fd, int revents, void *data, unsigned int *prio); +typedef int (*dispatch_fn_t) (poll_handle poll_handle, int fd, int revents, void *data); struct poll_entry { - unsigned int prio; struct pollfd ufd; dispatch_fn_t dispatch_fn; void *data; @@ -134,8 +133,11 @@ int poll_dispatch_add ( int fd, int events, void *data, - int (*dispatch_fn) (poll_handle poll_handle, int fd, int revents, void *data, unsigned int *prio), - unsigned int prio) + int (*dispatch_fn) ( + poll_handle poll_handle, + int fd, + int revents, + void *data)) { struct poll_instance *poll_instance; struct poll_entry *poll_entries; @@ -187,7 +189,6 @@ int poll_dispatch_add ( /* * Install new dispatch handler */ - poll_instance->poll_entries[install_pos].prio = prio; poll_instance->poll_entries[install_pos].ufd.fd = fd; poll_instance->poll_entries[install_pos].ufd.events = events; poll_instance->poll_entries[install_pos].ufd.revents = 0; @@ -205,8 +206,11 @@ int poll_dispatch_modify ( poll_handle handle, int fd, int events, - int (*dispatch_fn) (poll_handle poll_handle, int fd, int revents, void *data, unsigned int *prio), - unsigned int prio) + int (*dispatch_fn) ( + poll_handle poll_handle, + int fd, + int revents, + void *data)) { struct poll_instance *poll_instance; int i; @@ -226,7 +230,6 @@ int poll_dispatch_modify ( if (poll_instance->poll_entries[i].ufd.fd == fd) { poll_instance->poll_entries[i].ufd.events = events; poll_instance->poll_entries[i].dispatch_fn = dispatch_fn; - poll_instance->poll_entries[i].prio = prio; goto error_put; } @@ -354,13 +357,6 @@ error_exit: } -int poll_entry_compare (const void *a, const void *b) { - struct poll_entry *poll_entry_a = (struct poll_entry *)a; - struct poll_entry *poll_entry_b = (struct poll_entry *)b; - - return (poll_entry_a->prio < poll_entry_b->prio); -} - int poll_run ( poll_handle handle) { @@ -377,12 +373,6 @@ int poll_run ( } for (;;) { - /* - * Sort the poll entries list highest priority to lowest priority - * Then build ufds structure for use with poll system call - */ - qsort (poll_instance->poll_entries, poll_instance->poll_entry_count, - sizeof (struct poll_entry), poll_entry_compare); for (i = 0; i < poll_instance->poll_entry_count; i++) { memcpy (&poll_instance->ufds[i], &poll_instance->poll_entries[i].ufd, @@ -411,8 +401,7 @@ retry_poll: res = poll_instance->poll_entries[i].dispatch_fn (handle, poll_instance->ufds[i].fd, poll_instance->ufds[i].revents, - poll_instance->poll_entries[i].data, - &poll_instance->poll_entries[i].prio); + poll_instance->poll_entries[i].data); /* * Remove dispatch functions that return -1 @@ -454,7 +443,6 @@ void poll_print_state ( printf ("fd %d\n", poll_instance->poll_entries[i].ufd.fd); printf ("events %d\n", poll_instance->poll_entries[i].ufd.events); printf ("dispatch_fn %p\n", poll_instance->poll_entries[i].dispatch_fn); - printf ("prio %d\n", poll_instance->poll_entries[i].prio); } } } diff --git a/exec/aispoll.h b/exec/aispoll.h index a8d48891..d205f1f7 100644 --- a/exec/aispoll.h +++ b/exec/aispoll.h @@ -46,15 +46,21 @@ int poll_dispatch_add ( int fd, int events, void *data, - int (*dispatch_fn) (poll_handle handle, int fd, int revents, void *data, unsigned int *prio), - unsigned int prio); + + int (*dispatch_fn) (poll_handle handle, + int fd, + int revents, + void *data)); int poll_dispatch_modify ( poll_handle handle, int fd, int events, - int (*dispatch_fn) (poll_handle poll_handle, int fd, int revents, void *data, unsigned int *prio), - unsigned int prio); + + int (*dispatch_fn) (poll_handle poll_handle, + int fd, + int revents, + void *data)); int poll_dispatch_delete ( diff --git a/exec/ipc.c b/exec/ipc.c index ea5faba6..3dc256d4 100644 --- a/exec/ipc.c +++ b/exec/ipc.c @@ -719,8 +719,7 @@ static int poll_handler_libais_accept ( poll_handle handle, int fd, int revent, - void *data, - unsigned int *prio) + void *data) { socklen_t addrlen; struct sockaddr_un un_addr; @@ -846,7 +845,7 @@ void openais_ipc_init ( * Setup libais connection dispatch routine */ poll_dispatch_add (aisexec_poll_handle, libais_server_fd, - POLLIN, 0, poll_handler_libais_accept, 0); + POLLIN, 0, poll_handler_libais_accept); g_gid_valid = gid_valid; diff --git a/exec/totemnet.c b/exec/totemnet.c index 8d6db8f6..a28f14d0 100644 --- a/exec/totemnet.c +++ b/exec/totemnet.c @@ -605,8 +605,7 @@ static int net_deliver_fn ( poll_handle handle, int fd, int revents, - void *data, - unsigned int *prio) + void *data) { struct totemnet_instance *instance = (struct totemnet_instance *)data; struct msghdr msg_recv; @@ -619,8 +618,6 @@ static int net_deliver_fn ( unsigned char *msg_offset; unsigned int size_delv; - *prio = UINT_MAX; - if (instance->flushing == 1) { iovec = &instance->totemnet_iov_recv_flush; } else { @@ -807,12 +804,12 @@ static void timer_function_netif_check_timeout ( poll_dispatch_add ( instance->totemnet_poll_handle, instance->totemnet_sockets.mcast_recv, - POLLIN, instance, net_deliver_fn, UINT_MAX); + POLLIN, instance, net_deliver_fn); poll_dispatch_add ( instance->totemnet_poll_handle, instance->totemnet_sockets.token, - POLLIN, instance, net_deliver_fn, UINT_MAX); + POLLIN, instance, net_deliver_fn); totemip_copy (&instance->my_id, &instance->totem_interface->boundto); @@ -1295,7 +1292,6 @@ int totemnet_recv_flush (totemnet_handle handle) struct pollfd ufd; int nfds; int res = 0; - unsigned int prio; res = hdb_handle_get (&totemnet_instance_database, handle, (void *)&instance); @@ -1312,7 +1308,7 @@ int totemnet_recv_flush (totemnet_handle handle) nfds = poll (&ufd, 1, 0); if (nfds == 1 && ufd.revents & POLLIN) { net_deliver_fn (0, instance->totemnet_sockets.mcast_recv, - ufd.revents, instance, &prio); + ufd.revents, instance); } } while (nfds == 1);