summaryrefslogtreecommitdiffstats
path: root/source/rpc_server
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-08-17 06:47:53 +0000
committerAndrew Tridgell <tridge@samba.org>1998-08-17 06:47:53 +0000
commit1eb9ae2996b5a243a147f485e7e353d54f820852 (patch)
tree6f335f5f8d3a7530e25fb273c354c16ea419c543 /source/rpc_server
parent01b642a3793a1bea0517370a9a64945fd86ddf02 (diff)
downloadsamba-1eb9ae2996b5a243a147f485e7e353d54f820852.tar.gz
samba-1eb9ae2996b5a243a147f485e7e353d54f820852.tar.xz
samba-1eb9ae2996b5a243a147f485e7e353d54f820852.zip
added some optimisation for the case where the number of open files is
very large. files.c now promotes a files_struct to the top of the list if it is used when it is more than 10 elements from the top. also moved common linked list code for the 5 sets of linked lists that I've created over the past few days into dlinklist.h (I've explained to Chris why I didn't use the ubiqx code)
Diffstat (limited to 'source/rpc_server')
-rw-r--r--source/rpc_server/srv_lsa_hnd.c17
-rw-r--r--source/rpc_server/srv_pipe_hnd.c17
2 files changed, 4 insertions, 30 deletions
diff --git a/source/rpc_server/srv_lsa_hnd.c b/source/rpc_server/srv_lsa_hnd.c
index 2fc2c73ea32..d65116e6463 100644
--- a/source/rpc_server/srv_lsa_hnd.c
+++ b/source/rpc_server/srv_lsa_hnd.c
@@ -124,14 +124,7 @@ BOOL open_lsa_policy_hnd(POLICY_HND *hnd)
bitmap_set(bmap, i);
- /* hook into the front of the list */
- if (!Policy) {
- Policy = p;
- } else {
- Policy->prev = p;
- p->next = Policy;
- Policy = p;
- }
+ DLIST_ADD(Policy, p);
DEBUG(4,("Opened policy hnd[%x] ", i));
dump_data(4, (char *)hnd->data, sizeof(hnd->data));
@@ -303,13 +296,7 @@ BOOL close_lsa_policy_hnd(POLICY_HND *hnd)
DEBUG(3,("Closed policy name pnum=%x\n", p->pnum));
- if (p == Policy) {
- Policy = p->next;
- if (Policy) Policy->prev = NULL;
- } else {
- p->prev->next = p->next;
- if (p->next) p->next->prev = p->prev;
- }
+ DLIST_REMOVE(Policy, p);
bitmap_clear(bmap, p->pnum);
diff --git a/source/rpc_server/srv_pipe_hnd.c b/source/rpc_server/srv_pipe_hnd.c
index 368bf013a08..b030ee0e902 100644
--- a/source/rpc_server/srv_pipe_hnd.c
+++ b/source/rpc_server/srv_pipe_hnd.c
@@ -91,14 +91,7 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
p = (pipes_struct *)malloc(sizeof(*p));
if (!p) return NULL;
- /* hook into the front of the list */
- if (!Pipes) {
- Pipes = p;
- } else {
- Pipes->prev = p;
- p->next = Pipes;
- Pipes = p;
- }
+ DLIST_ADD(Pipes, p);
bitmap_set(bmap, i);
i += PIPE_HANDLE_OFFSET;
@@ -292,13 +285,7 @@ BOOL close_rpc_pipe_hnd(pipes_struct *p, connection_struct *conn)
DEBUG(4,("closed pipe name %s pnum=%x (pipes_open=%d)\n",
p->name, p->pnum, pipes_open));
- if (p == Pipes) {
- Pipes = p->next;
- if (Pipes) Pipes->prev = NULL;
- } else {
- p->prev->next = p->next;
- if (p->next) p->next->prev = p->prev;
- }
+ DLIST_REMOVE(Pipes, p);
memset(p, 0, sizeof(*p));