summaryrefslogtreecommitdiff
path: root/source3/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
commit72ed7049d88e5296ebec362189e62a384385ad34 (patch)
tree4609523acc63ae3e14201b49a4b9c47d1ec8e4d6 /source3/rpc_server
parent69c6f1624d79e4cf4296856d66216cca90863286 (diff)
downloadsamba-72ed7049d88e5296ebec362189e62a384385ad34.tar.gz
samba-72ed7049d88e5296ebec362189e62a384385ad34.tar.bz2
samba-72ed7049d88e5296ebec362189e62a384385ad34.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) (This used to be commit 1eb9ae2996b5a243a147f485e7e353d54f820852)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_lsa_hnd.c17
-rw-r--r--source3/rpc_server/srv_pipe_hnd.c17
2 files changed, 4 insertions, 30 deletions
diff --git a/source3/rpc_server/srv_lsa_hnd.c b/source3/rpc_server/srv_lsa_hnd.c
index 2fc2c73ea3..d65116e646 100644
--- a/source3/rpc_server/srv_lsa_hnd.c
+++ b/source3/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/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index 368bf013a0..b030ee0e90 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/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));