From 118f3edd27f5adacc1da636ed05b33f04999584f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 29 Jun 2004 07:40:14 +0000 Subject: r1291: rename struct smbsrv_context to smbsrv_connection because this is the connection state per transport layer (tcp) connection I also moved the substructs directly into smbsrv_connection, because they don't need a struct name and we should allway pass the complete smbsrv_connection struct into functions metze (This used to be commit 60f823f201fcedf5473008e8453a6351e73a92c7) --- source4/smb_server/conn.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'source4/smb_server/conn.c') diff --git a/source4/smb_server/conn.c b/source4/smb_server/conn.c index e275854325..197d925f34 100644 --- a/source4/smb_server/conn.c +++ b/source4/smb_server/conn.c @@ -30,18 +30,18 @@ /**************************************************************************** init the tcon structures ****************************************************************************/ -void conn_init(struct smbsrv_context *smb_ctx) +void conn_init(struct smbsrv_connection *smb_conn) { - smb_ctx->tree.bmap = bitmap_allocate(MAX_CONNECTIONS); + smb_conn->tree.bmap = bitmap_allocate(MAX_CONNECTIONS); } /**************************************************************************** check if a snum is in use ****************************************************************************/ -BOOL conn_snum_used(struct smbsrv_context *smb_ctx, int snum) +BOOL conn_snum_used(struct smbsrv_connection *smb_conn, int snum) { struct smbsrv_tcon *tcon; - for (tcon=smb_ctx->tree.tcons;tcon;tcon=tcon->next) { + for (tcon=smb_conn->tree.tcons;tcon;tcon=tcon->next) { if (tcon->service == snum) { return(True); } @@ -53,15 +53,15 @@ BOOL conn_snum_used(struct smbsrv_context *smb_ctx, int snum) /**************************************************************************** find a tcon given a cnum ****************************************************************************/ -struct smbsrv_tcon *conn_find(struct smbsrv_context *smb_ctx, uint_t cnum) +struct smbsrv_tcon *conn_find(struct smbsrv_connection *smb_conn, uint_t cnum) { int count=0; struct smbsrv_tcon *tcon; - for (tcon=smb_ctx->tree.tcons;tcon;tcon=tcon->next,count++) { + for (tcon=smb_conn->tree.tcons;tcon;tcon=tcon->next,count++) { if (tcon->cnum == cnum) { if (count > 10) { - DLIST_PROMOTE(smb_ctx->tree.tcons, tcon); + DLIST_PROMOTE(smb_conn->tree.tcons, tcon); } return tcon; } @@ -76,13 +76,13 @@ struct smbsrv_tcon *conn_find(struct smbsrv_context *smb_ctx, uint_t cnum) The randomisation stops problems with the server dieing and clients thinking the server is still available. ****************************************************************************/ -struct smbsrv_tcon *conn_new(struct smbsrv_context *smb_ctx) +struct smbsrv_tcon *conn_new(struct smbsrv_connection *smb_conn) { TALLOC_CTX *mem_ctx; struct smbsrv_tcon *tcon; int i; - i = bitmap_find(smb_ctx->tree.bmap, 1); + i = bitmap_find(smb_conn->tree.bmap, 1); if (i == -1) { DEBUG(1,("ERROR! Out of connection structures\n")); @@ -98,13 +98,13 @@ struct smbsrv_tcon *conn_new(struct smbsrv_context *smb_ctx) tcon->mem_ctx = mem_ctx; tcon->cnum = i; - tcon->smb_ctx = smb_ctx; + tcon->smb_conn = smb_conn; - bitmap_set(smb_ctx->tree.bmap, i); + bitmap_set(smb_conn->tree.bmap, i); - smb_ctx->tree.num_open++; + smb_conn->tree.num_open++; - DLIST_ADD(smb_ctx->tree.tcons, tcon); + DLIST_ADD(smb_conn->tree.tcons, tcon); return tcon; } @@ -112,10 +112,10 @@ struct smbsrv_tcon *conn_new(struct smbsrv_context *smb_ctx) /**************************************************************************** close all tcon structures ****************************************************************************/ -void conn_close_all(struct smbsrv_context *smb_ctx) +void conn_close_all(struct smbsrv_connection *smb_conn) { struct smbsrv_tcon *tcon, *next; - for (tcon=smb_ctx->tree.tcons;tcon;tcon=next) { + for (tcon=smb_conn->tree.tcons;tcon;tcon=next) { next=tcon->next; close_cnum(tcon); } @@ -126,12 +126,12 @@ void conn_close_all(struct smbsrv_context *smb_ctx) /**************************************************************************** clear a vuid out of the validity cache, and as the 'owner' of a connection. ****************************************************************************/ -void conn_clear_vuid_cache(struct smbsrv_context *smb_ctx, uint16_t vuid) +void conn_clear_vuid_cache(struct smbsrv_connection *smb_conn, uint16_t vuid) { struct smbsrv_tcon *tcon; uint_t i; - for (tcon=smb_ctx->tree.tcons;tcon;tcon=tcon->next) { + for (tcon=smb_conn->tree.tcons;tcon;tcon=tcon->next) { for (i=0;ivuid_cache.entries && i< VUID_CACHE_SIZE;i++) { if (tcon->vuid_cache.list[i] == vuid) { tcon->vuid_cache.list[i] = UID_FIELD_INVALID; @@ -145,12 +145,12 @@ void conn_clear_vuid_cache(struct smbsrv_context *smb_ctx, uint16_t vuid) Free a tcon structure. ****************************************************************************/ -void conn_free(struct smbsrv_context *smb_ctx, struct smbsrv_tcon *tcon) +void conn_free(struct smbsrv_connection *smb_conn, struct smbsrv_tcon *tcon) { - DLIST_REMOVE(smb_ctx->tree.tcons, tcon); + DLIST_REMOVE(smb_conn->tree.tcons, tcon); - bitmap_clear(smb_ctx->tree.bmap, tcon->cnum); - smb_ctx->tree.num_open--; + bitmap_clear(smb_conn->tree.bmap, tcon->cnum); + smb_conn->tree.num_open--; talloc_destroy(tcon->mem_ctx); } -- cgit