summaryrefslogtreecommitdiffstats
path: root/source/smbd/conn.c
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2003-05-11 23:34:18 +0000
committerAlexander Bokovoy <ab@samba.org>2003-05-11 23:34:18 +0000
commit91984ef5caa2d13c5d52e1f535bd3bbbae1ec978 (patch)
treed6381eba1fa7b3c1452ece871e6a4c90a65b99ff /source/smbd/conn.c
parent02244dac83623dabe927f79780cf4b7313022495 (diff)
downloadsamba-91984ef5caa2d13c5d52e1f535bd3bbbae1ec978.tar.gz
samba-91984ef5caa2d13c5d52e1f535bd3bbbae1ec978.tar.xz
samba-91984ef5caa2d13c5d52e1f535bd3bbbae1ec978.zip
Fix VFS layer:
1. Finally work with cascaded modules with private data storage per module 2. Convert VFS API to macro calls to simplify cascading 3. Add quota support to VFS layer (prepare to NT quota support) Patch by Stefan (metze) Metzemacher, with review of Jelmer and me Tested in past few weeks. Documentation to new VFS API for third-party developers to follow
Diffstat (limited to 'source/smbd/conn.c')
-rw-r--r--source/smbd/conn.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/source/smbd/conn.c b/source/smbd/conn.c
index b6c7aa1076e..eb2d2bbcbf2 100644
--- a/source/smbd/conn.c
+++ b/source/smbd/conn.c
@@ -93,6 +93,7 @@ thinking the server is still available.
****************************************************************************/
connection_struct *conn_new(void)
{
+ TALLOC_CTX *mem_ctx;
connection_struct *conn;
int i;
@@ -103,10 +104,16 @@ connection_struct *conn_new(void)
return NULL;
}
- conn = (connection_struct *)malloc(sizeof(*conn));
- if (!conn) return NULL;
+ if ((mem_ctx=talloc_init("connection_struct"))==NULL) {
+ DEBUG(0,("talloc_init(connection_struct) failed!\n"));
+ return NULL;
+ }
- ZERO_STRUCTP(conn);
+ if ((conn=(connection_struct *)talloc_zero(mem_ctx, sizeof(*conn)))==NULL) {
+ DEBUG(0,("talloc_zero() failed!\n"));
+ return NULL;
+ }
+ conn->mem_ctx = mem_ctx;
conn->cnum = i;
bitmap_set(bmap, i);
@@ -195,27 +202,16 @@ void conn_clear_vuid_cache(uint16 vuid)
void conn_free(connection_struct *conn)
{
- smb_vfs_handle_struct *handle, *thandle;
- void (*done_fptr)(connection_struct *the_conn);
+ vfs_handle_struct *handle = NULL, *thandle = NULL;
+ TALLOC_CTX *mem_ctx = NULL;
/* Free vfs_connection_struct */
- handle = conn->vfs_private;
+ handle = conn->vfs_handles;
while(handle) {
- /* Only call dlclose for the old modules */
- if (handle->handle) {
- /* Close dlopen() handle */
- done_fptr = (void (*)(connection_struct *))sys_dlsym(handle->handle, "vfs_done");
-
- if (done_fptr == NULL) {
- DEBUG(3, ("No vfs_done() symbol found in module with handle %p, ignoring\n", handle->handle));
- } else {
- done_fptr(conn);
- }
- sys_dlclose(handle->handle);
- }
- DLIST_REMOVE(conn->vfs_private, handle);
+ DLIST_REMOVE(conn->vfs_handles, handle);
thandle = handle->next;
- SAFE_FREE(handle);
+ if (handle->free_data)
+ handle->free_data(&handle->data);
handle = thandle;
}
@@ -238,8 +234,9 @@ void conn_free(connection_struct *conn)
bitmap_clear(bmap, conn->cnum);
num_open--;
+ mem_ctx = conn->mem_ctx;
ZERO_STRUCTP(conn);
- SAFE_FREE(conn);
+ talloc_destroy(mem_ctx);
}