diff options
Diffstat (limited to 'source4/smb_server/conn.c')
-rw-r--r-- | source4/smb_server/conn.c | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/source4/smb_server/conn.c b/source4/smb_server/conn.c index 4a5a6a6ed0..e275854325 100644 --- a/source4/smb_server/conn.c +++ b/source4/smb_server/conn.c @@ -1,6 +1,6 @@ /* Unix SMB/CIFS implementation. - Manage connections_struct structures + Manage smbsrv_tcon structures Copyright (C) Andrew Tridgell 1998 Copyright (C) Alexander Bokovoy 2002 @@ -28,7 +28,7 @@ #define MAX_CONNECTIONS 128 /**************************************************************************** -init the conn structures +init the tcon structures ****************************************************************************/ void conn_init(struct smbsrv_context *smb_ctx) { @@ -40,9 +40,9 @@ check if a snum is in use ****************************************************************************/ BOOL conn_snum_used(struct smbsrv_context *smb_ctx, int snum) { - struct tcon_context *conn; - for (conn=smb_ctx->tree.connections;conn;conn=conn->next) { - if (conn->service == snum) { + struct smbsrv_tcon *tcon; + for (tcon=smb_ctx->tree.tcons;tcon;tcon=tcon->next) { + if (tcon->service == snum) { return(True); } } @@ -51,19 +51,19 @@ BOOL conn_snum_used(struct smbsrv_context *smb_ctx, int snum) /**************************************************************************** -find a conn given a cnum +find a tcon given a cnum ****************************************************************************/ -struct tcon_context *conn_find(struct smbsrv_context *smb_ctx, uint_t cnum) +struct smbsrv_tcon *conn_find(struct smbsrv_context *smb_ctx, uint_t cnum) { int count=0; - struct tcon_context *conn; + struct smbsrv_tcon *tcon; - for (conn=smb_ctx->tree.connections;conn;conn=conn->next,count++) { - if (conn->cnum == cnum) { + for (tcon=smb_ctx->tree.tcons;tcon;tcon=tcon->next,count++) { + if (tcon->cnum == cnum) { if (count > 10) { - DLIST_PROMOTE(smb_ctx->tree.connections, conn); + DLIST_PROMOTE(smb_ctx->tree.tcons, tcon); } - return conn; + return tcon; } } @@ -76,10 +76,10 @@ struct tcon_context *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 tcon_context *conn_new(struct smbsrv_context *smb_ctx) +struct smbsrv_tcon *conn_new(struct smbsrv_context *smb_ctx) { TALLOC_CTX *mem_ctx; - struct tcon_context *conn; + struct smbsrv_tcon *tcon; int i; i = bitmap_find(smb_ctx->tree.bmap, 1); @@ -89,35 +89,35 @@ struct tcon_context *conn_new(struct smbsrv_context *smb_ctx) return NULL; } - mem_ctx = talloc_init("tcon_context[%d]", i); + mem_ctx = talloc_init("smbsrv_tcon[%d]", i); - conn = (struct tcon_context *)talloc(mem_ctx, sizeof(*conn)); - if (!conn) return NULL; + tcon = talloc_p(mem_ctx, struct smbsrv_tcon); + if (!tcon) return NULL; - ZERO_STRUCTP(conn); + ZERO_STRUCTP(tcon); - conn->mem_ctx = mem_ctx; - conn->cnum = i; - conn->smb_ctx = smb_ctx; + tcon->mem_ctx = mem_ctx; + tcon->cnum = i; + tcon->smb_ctx = smb_ctx; bitmap_set(smb_ctx->tree.bmap, i); smb_ctx->tree.num_open++; - DLIST_ADD(smb_ctx->tree.connections, conn); + DLIST_ADD(smb_ctx->tree.tcons, tcon); - return conn; + return tcon; } /**************************************************************************** -close all conn structures +close all tcon structures ****************************************************************************/ void conn_close_all(struct smbsrv_context *smb_ctx) { - struct tcon_context *conn, *next; - for (conn=smb_ctx->tree.connections;conn;conn=next) { - next=conn->next; - close_cnum(conn); + struct smbsrv_tcon *tcon, *next; + for (tcon=smb_ctx->tree.tcons;tcon;tcon=next) { + next=tcon->next; + close_cnum(tcon); } } @@ -128,13 +128,13 @@ 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) { - struct tcon_context *conn; + struct smbsrv_tcon *tcon; uint_t i; - for (conn=smb_ctx->tree.connections;conn;conn=conn->next) { - for (i=0;i<conn->vuid_cache.entries && i< VUID_CACHE_SIZE;i++) { - if (conn->vuid_cache.list[i] == vuid) { - conn->vuid_cache.list[i] = UID_FIELD_INVALID; + for (tcon=smb_ctx->tree.tcons;tcon;tcon=tcon->next) { + for (i=0;i<tcon->vuid_cache.entries && i< VUID_CACHE_SIZE;i++) { + if (tcon->vuid_cache.list[i] == vuid) { + tcon->vuid_cache.list[i] = UID_FIELD_INVALID; } } } @@ -142,16 +142,16 @@ void conn_clear_vuid_cache(struct smbsrv_context *smb_ctx, uint16_t vuid) #endif /**************************************************************************** - Free a conn structure. + Free a tcon structure. ****************************************************************************/ -void conn_free(struct smbsrv_context *smb_ctx, struct tcon_context *conn) +void conn_free(struct smbsrv_context *smb_ctx, struct smbsrv_tcon *tcon) { - DLIST_REMOVE(smb_ctx->tree.connections, conn); + DLIST_REMOVE(smb_ctx->tree.tcons, tcon); - bitmap_clear(smb_ctx->tree.bmap, conn->cnum); + bitmap_clear(smb_ctx->tree.bmap, tcon->cnum); smb_ctx->tree.num_open--; - talloc_destroy(conn->mem_ctx); + talloc_destroy(tcon->mem_ctx); } |