changed lstLib stuff to ellLib

This commit is contained in:
Janet B. Anderson
1993-08-05 05:31:30 +00:00
parent 21cea90564
commit 7a9fb23d58
8 changed files with 64 additions and 63 deletions
+19 -18
View File
@@ -55,6 +55,7 @@ static char *sccsId = "$Id$\t$Date$";
#include <tickLib.h>
#include <stdioLib.h>
#include <ellLib.h>
#include <db_access.h>
#include <task_params.h>
#include <server.h>
@@ -164,7 +165,7 @@ struct message_buffer *recv
FASTLOCK(&rsrv_free_eventq_lck);
pevext = (struct event_ext *)
lstGet(&rsrv_free_eventq);
ellGet(&rsrv_free_eventq);
FASTUNLOCK(&rsrv_free_eventq_lck);
if (!pevext) {
int size = db_sizeof_event_block()
@@ -207,7 +208,7 @@ struct message_buffer *recv
RECORD_NAME(MPTOPADDR(mp)));
UNLOCK_CLIENT(client);
FASTLOCK(&rsrv_free_eventq_lck);
lstAdd((LIST *)&rsrv_free_eventq, (NODE *)pevext);
ellAdd((ELLLIST *)&rsrv_free_eventq, (ELLNODE *)pevext);
FASTUNLOCK(&rsrv_free_eventq_lck);
break;
}
@@ -219,8 +220,8 @@ struct message_buffer *recv
* to be printed since it will not be found on
* the list.
*/
lstAdd( (LIST *)&((struct channel_in_use *)mp->m_pciu)->eventq,
(NODE *)pevext);
ellAdd( (ELLLIST *)&((struct channel_in_use *)mp->m_pciu)->eventq,
(ELLNODE *)pevext);
/*
* allways send it once at event add
@@ -367,11 +368,11 @@ struct message_buffer *recv
* timeout must reconnect
*/
LOCK_CLIENT(prsrv_cast_client);
status = lstFind(
status = ellFind(
&prsrv_cast_client->addrq,
mp->m_pciu);
if(status >= 0){
lstDelete(
ellDelete(
&prsrv_cast_client->addrq,
mp->m_pciu);
}
@@ -388,7 +389,7 @@ struct message_buffer *recv
exit(0);
}
LOCK_CLIENT(client);
lstAdd(&client->addrq, mp->m_pciu);
ellAdd(&client->addrq, mp->m_pciu);
UNLOCK_CLIENT(client);
break;
default:
@@ -454,7 +455,7 @@ struct client *client
*
*/
pciu = (struct channel_in_use *) mp->m_pciu;
status = lstFind(
status = ellFind(
&client->addrq,
mp->m_pciu);
if(status < 0){
@@ -468,14 +469,14 @@ struct client *client
return;
}
while (pevext = (struct event_ext *) lstGet(&pciu->eventq)) {
while (pevext = (struct event_ext *) ellGet(&pciu->eventq)) {
status = db_cancel_event((struct event_block *)(pevext+1));
if (status == ERROR){
taskSuspend(0);
}
FASTLOCK(&rsrv_free_eventq_lck);
lstAdd((LIST *)&rsrv_free_eventq, (NODE *)pevext);
ellAdd((ELLLIST *)&rsrv_free_eventq, (ELLNODE *)pevext);
FASTUNLOCK(&rsrv_free_eventq_lck);
}
@@ -492,11 +493,11 @@ struct client *client
*reply = *mp;
END_MSG(client);
lstDelete((LIST *)&client->addrq, (NODE *)pciu);
ellDelete((ELLLIST *)&client->addrq, (ELLNODE *)pciu);
UNLOCK_CLIENT(client);
FASTLOCK(&rsrv_free_addrq_lck);
lstAdd((LIST *)&rsrv_free_addrq, (NODE *)pciu);
ellAdd((ELLLIST *)&rsrv_free_addrq, (ELLNODE *)pciu);
FASTUNLOCK(&rsrv_free_addrq_lck);
return;
@@ -520,7 +521,7 @@ struct client *client
{
FAST struct extmsg *reply;
FAST struct event_ext *pevext;
LIST *peventq =
ELLLIST *peventq =
&((struct channel_in_use *) mp->m_pciu)->eventq;
FAST int status;
@@ -531,7 +532,7 @@ struct client *client
status = db_cancel_event((struct event_block *)(pevext+1));
if (status == ERROR)
taskSuspend(0);
lstDelete((LIST *)peventq, (NODE *)pevext);
ellDelete((ELLLIST *)peventq, (ELLNODE *)pevext);
/*
* send delete confirmed message
@@ -549,7 +550,7 @@ struct client *client
UNLOCK_CLIENT(client);
FASTLOCK(&rsrv_free_eventq_lck);
lstAdd((LIST *)&rsrv_free_eventq, (NODE *)pevext);
ellAdd((ELLLIST *)&rsrv_free_eventq, (ELLNODE *)pevext);
FASTUNLOCK(&rsrv_free_eventq_lck);
return;
@@ -682,7 +683,7 @@ struct extmsg *mp,
struct client *client
)
{
LIST *addrq = &client->addrq;
ELLLIST *addrq = &client->addrq;
FAST struct extmsg *search_reply;
FAST struct extmsg *get_reply;
FAST int status;
@@ -711,7 +712,7 @@ struct client *client
/* get block off free list if possible */
FASTLOCK(&rsrv_free_addrq_lck);
pchannel = (struct channel_in_use *) lstGet(&rsrv_free_addrq);
pchannel = (struct channel_in_use *) ellGet(&rsrv_free_addrq);
FASTUNLOCK(&rsrv_free_addrq_lck);
if (!pchannel) {
pchannel = (struct channel_in_use *) calloc(1, sizeof(*pchannel));
@@ -734,7 +735,7 @@ struct client *client
LOCK_CLIENT(client);
/* store the addr block in a Q so it can be deallocated */
lstAdd((LIST *)addrq, (NODE *)pchannel);
ellAdd((ELLLIST *)addrq, (ELLNODE *)pchannel);
if (mp->m_cmmd == IOC_BUILD) {
FAST short type = (mp + 1)->m_type;
+2 -2
View File
@@ -46,7 +46,7 @@
static char *sccsId = "@(#)camsgtask.c 1.13\t11/20/92";
#include <vxWorks.h>
#include <lstLib.h>
#include <ellLib.h>
#include <types.h>
#include <socket.h>
#include <sockLib.h>
@@ -240,7 +240,7 @@ FAST int sock;
}
LOCK_CLIENTQ;
lstAdd((LIST *)&clientQ, (NODE *)client);
ellAdd((ELLLIST *)&clientQ, (ELLNODE *)client);
UNLOCK_CLIENTQ;
client->evuser = (struct event_user *) db_init_events();
+1 -1
View File
@@ -38,7 +38,7 @@
static char *sccsId = "@(#)caserverio.c 1.10\t7/28/92";
#include <vxWorks.h>
#include <lstLib.h>
#include <ellLib.h>
#include <types.h>
#include <socket.h>
#include <ioLib.h>
+25 -25
View File
@@ -46,7 +46,7 @@
static char *sccsId = "@(#)caservertask.c 1.13\t7/28/92";
#include <vxWorks.h>
#include <lstLib.h>
#include <ellLib.h>
#include <taskLib.h>
#include <types.h>
#include <sockLib.h>
@@ -204,28 +204,28 @@ int free_client(struct client *client)
/* remove it from the list of clients */
/* list delete returns no status */
LOCK_CLIENTQ;
lstDelete((LIST *)&clientQ, (NODE *)client);
ellDelete((ELLLIST *)&clientQ, (ELLNODE *)client);
UNLOCK_CLIENTQ;
terminate_one_client(client);
LOCK_CLIENTQ;
lstAdd((LIST *)&rsrv_free_clientQ, (NODE *)client);
ellAdd((ELLLIST *)&rsrv_free_clientQ, (ELLNODE *)client);
UNLOCK_CLIENTQ;
} else {
LOCK_CLIENTQ;
while (client = (struct client *) lstGet(&clientQ))
while (client = (struct client *) ellGet(&clientQ))
terminate_one_client(client);
FASTLOCK(&rsrv_free_addrq_lck);
lstFree(&rsrv_free_addrq);
lstInit(&rsrv_free_addrq);
ellFree(&rsrv_free_addrq);
ellInit(&rsrv_free_addrq);
FASTUNLOCK(&rsrv_free_addrq_lck);
FASTLOCK(&rsrv_free_eventq_lck);
lstFree(&rsrv_free_eventq);
lstInit(&rsrv_free_eventq);
ellFree(&rsrv_free_eventq);
ellInit(&rsrv_free_eventq);
FASTUNLOCK(&rsrv_free_eventq_lck);
lstFree(&rsrv_free_clientQ);
ellFree(&rsrv_free_clientQ);
UNLOCK_CLIENTQ;
}
@@ -283,14 +283,14 @@ LOCAL int terminate_one_client(struct client *client)
pciu = (struct channel_in_use *) & client->addrq;
while (pciu = (struct channel_in_use *) pciu->node.next){
while (pevext = (struct event_ext *) lstGet((LIST *)&pciu->eventq)) {
while (pevext = (struct event_ext *) ellGet((ELLLIST *)&pciu->eventq)) {
status = db_cancel_event(
(struct event_block *)(pevext + 1));
if (status == ERROR)
taskSuspend(0);
FASTLOCK(&rsrv_free_eventq_lck);
lstAdd((LIST *)&rsrv_free_eventq, (NODE *)pevext);
ellAdd((ELLLIST *)&rsrv_free_eventq, (ELLNODE *)pevext);
FASTUNLOCK(&rsrv_free_eventq_lck);
}
}
@@ -311,7 +311,7 @@ LOCAL int terminate_one_client(struct client *client)
/* free dbaddr str */
FASTLOCK(&rsrv_free_addrq_lck);
lstConcat(
ellConcat(
&rsrv_free_addrq,
&client->addrq);
FASTUNLOCK(&rsrv_free_addrq_lck);
@@ -341,12 +341,12 @@ int client_stat(void)
LOCK_CLIENTQ;
client = (struct client *) lstNext((NODE *)&clientQ);
client = (struct client *) ellNext((ELLNODE *)&clientQ);
while (client) {
log_one_client(client);
client = (struct client *) lstNext((NODE *)client);
client = (struct client *) ellNext((ELLNODE *)client);
}
UNLOCK_CLIENTQ;
@@ -355,19 +355,19 @@ int client_stat(void)
bytes_reserved = 0;
bytes_reserved += sizeof(struct client)*
lstCount(&rsrv_free_clientQ);
ellCount(&rsrv_free_clientQ);
bytes_reserved += sizeof(struct channel_in_use)*
lstCount(&rsrv_free_addrq);
ellCount(&rsrv_free_addrq);
bytes_reserved += (sizeof(struct event_ext)+db_sizeof_event_block())*
lstCount(&rsrv_free_eventq);
ellCount(&rsrv_free_eventq);
printf( "There are currently %d bytes on the server's free list\n",
bytes_reserved);
printf( "{%d client(s), %d channel(s), and %d event(s) (monitors)}\n",
lstCount(&rsrv_free_clientQ),
lstCount(&rsrv_free_addrq),
lstCount(&rsrv_free_eventq));
ellCount(&rsrv_free_clientQ),
ellCount(&rsrv_free_addrq),
ellCount(&rsrv_free_eventq));
return lstCount(&clientQ);
return ellCount(&clientQ);
}
@@ -417,8 +417,8 @@ LOCAL void log_one_client(struct client *client)
bytes_reserved += sizeof(struct channel_in_use);
bytes_reserved +=
(sizeof(struct event_ext)+db_sizeof_event_block())*
lstCount((LIST *)&pciu->eventq);
pciu = (struct channel_in_use *) lstNext((NODE *)pciu);
ellCount((ELLLIST *)&pciu->eventq);
pciu = (struct channel_in_use *) ellNext((ELLNODE *)pciu);
}
@@ -431,7 +431,7 @@ LOCAL void log_one_client(struct client *client)
(psaddr->sin_addr.s_addr & 0x000000ff),
psaddr->sin_port,
state[client->disconnect?1:0]);
printf( "\tChannel count %d\n", lstCount(&client->addrq));
printf( "\tChannel count %d\n", ellCount(&client->addrq));
printf( "\t%d bytes allocated\n", bytes_reserved);
pciu = (struct channel_in_use *) client->addrq.node.next;
@@ -439,7 +439,7 @@ LOCAL void log_one_client(struct client *client)
printf( "\t%s(%d) ",
pciu->addr.precord,
pciu->eventq.count);
pciu = (struct channel_in_use *) lstNext((NODE *)pciu);
pciu = (struct channel_in_use *) ellNext((ELLNODE *)pciu);
}
printf("\n");
+5 -5
View File
@@ -59,7 +59,7 @@
static char *sccsId = "$Id$\t$Date$";
#include <vxWorks.h>
#include <lstLib.h>
#include <ellLib.h>
#include <taskLib.h>
#include <types.h>
#include <socket.h>
@@ -335,9 +335,9 @@ clean_addrq(struct client *pclient)
}
if (delay > timeout) {
lstDelete((LIST *)&pclient->addrq, (NODE *)pciu);
ellDelete((ELLLIST *)&pclient->addrq, (ELLNODE *)pciu);
FASTLOCK(&rsrv_free_addrq_lck);
lstAdd((LIST *)&rsrv_free_addrq, (NODE *)pciu);
ellAdd((ELLLIST *)&rsrv_free_addrq, (ELLNODE *)pciu);
FASTUNLOCK(&rsrv_free_addrq_lck);
ndelete++;
maxdelay = max(delay, maxdelay);
@@ -368,7 +368,7 @@ struct client *create_udp_client(unsigned sock)
struct client *client;
LOCK_CLIENTQ;
client = (struct client *)lstGet(&rsrv_free_clientQ);
client = (struct client *)ellGet(&rsrv_free_clientQ);
UNLOCK_CLIENTQ;
if(!client){
@@ -401,7 +401,7 @@ struct client *create_udp_client(unsigned sock)
* bfill(client, sizeof(*client), NULL);
*/
lstInit(&client->addrq);
ellInit(&client->addrq);
bfill((char *)&client->addr, sizeof(client->addr), 0);
client->tid = taskIdSelf();
client->send.stk = 0;
+1 -1
View File
@@ -33,7 +33,7 @@
static char *sccsId = "@(#)globalsource.c 1.5\t7/28/92";
#include <vxWorks.h>
#include <lstLib.h>
#include <ellLib.h>
#include <types.h>
#include <socket.h>
#include <in.h>
+1 -1
View File
@@ -33,7 +33,7 @@
static char *sccsId = "@(#)rsrv_init.c 1.7\t7/28/92";
#include <vxWorks.h>
#include <lstLib.h>
#include <ellLib.h>
#include <taskLib.h>
#include <types.h>
#include <socket.h>
+10 -10
View File
@@ -45,7 +45,7 @@
static char *serverhSccsId = "$Id$\t$Date$";
#include <vxLib.h>
#include <lstLib.h>
#include <ellLib.h>
#include <fast_lock.h>
#include <dbDefs.h>
@@ -61,11 +61,11 @@ struct message_buffer{
};
struct client{
NODE node;
ELLNODE node;
int sock;
int proto;
FAST_LOCK lock;
LIST addrq;
ELLLIST addrq;
struct message_buffer send;
struct message_buffer recv;
struct sockaddr_in addr;
@@ -82,9 +82,9 @@ struct client{
* (stored in addrq off of a client block)
*/
struct channel_in_use{
NODE node;
ELLNODE node;
struct db_addr addr;
LIST eventq;
ELLLIST eventq;
void *chid; /* the chid from the client saved here */
unsigned long ticks_at_creation; /* for UDP timeout */
};
@@ -95,7 +95,7 @@ struct channel_in_use{
* some things duplicated for speed
*/
struct event_ext{
NODE node;
ELLNODE node;
struct extmsg msg;
struct extmsg *mp; /* for speed (IOC_READ) */
struct client *client;
@@ -117,12 +117,12 @@ char get; /* T: get F: monitor */
GLBLTYPE int IOC_sock;
GLBLTYPE int IOC_cast_sock;
GLBLTYPE LIST clientQ; /* locked by clientQlock */
GLBLTYPE LIST rsrv_free_clientQ; /* locked by clientQlock */
GLBLTYPE ELLLIST clientQ; /* locked by clientQlock */
GLBLTYPE ELLLIST rsrv_free_clientQ; /* locked by clientQlock */
GLBLTYPE FAST_LOCK clientQlock;
GLBLTYPE int CASDEBUG;
GLBLTYPE LIST rsrv_free_addrq;
GLBLTYPE LIST rsrv_free_eventq;
GLBLTYPE ELLLIST rsrv_free_addrq;
GLBLTYPE ELLLIST rsrv_free_eventq;
GLBLTYPE FAST_LOCK rsrv_free_addrq_lck;
GLBLTYPE FAST_LOCK rsrv_free_eventq_lck;
GLBLTYPE struct client *prsrv_cast_client;