summaryrefslogtreecommitdiff
path: root/source3/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
commite7c8c15888454043c73967635deb4d3419a489e9 (patch)
treef876b48b107b0f1c3b05445f1198d4858a46aa24 /source3/smbd/conn.c
parent03589cf994e91a06a44e528d5864f2c85bcf8bef (diff)
downloadsamba-e7c8c15888454043c73967635deb4d3419a489e9.tar.gz
samba-e7c8c15888454043c73967635deb4d3419a489e9.tar.bz2
samba-e7c8c15888454043c73967635deb4d3419a489e9.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 (This used to be commit 91984ef5caa2d13c5d52e1f535bd3bbbae1ec978)
Diffstat (limited to 'source3/smbd/conn.c')
-rw-r--r--source3/smbd/conn.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index b6c7aa1076..eb2d2bbcbf 100644
--- a/source3/smbd/conn.c
+++ b/source3/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);
}