VFS problem

Juergen Hasch Hasch at t-online.de
Sun Jun 2 12:47:01 GMT 2002

Hi Jim,

Am Samstag, 1. Juni 2002 18:25 schrieb Jim Myers:
> I'm trying to write a VFS module that uses the conn->vfs_private problem.
> It appears this field is never referenced in existing Samba code and is NOT
> initialized in vfs.c:vfs_init_custom.
> It appears to me that this function needs the following line added:
>       conn->vfs_private = NULL;
> However there is a further design problem. There is no way for a custom VFS
> to properly initialize and cleanup as there is no first-time call that
> allows access to the conn structure, nor is there a cleanup call to free
> any memory pointed to by vfs_private.
> I would think it would be could to add the conn structure as a parameter to
> the custom VFS init function: vfs_init and and a new cleanup call as well
> so the associated memory could be freed.
> Jim Myers
> IBM Almaden Research Center
> B3-239, 408-927-2013

what's the problem with conn->vfs_private not being initialized ?
You can start using it on connect and don't have to worry about it's contents. 
And you clean it up on disconnect. 

In my recycle bin module for Samba 2_2 I'm using vfs_private like this:

static int recycle_connect(struct connection_struct *conn, const char 
*service, const char *user)
	if (!(ctx = talloc_init_named("recycle bin"))) {
		DEBUG(0, ("Failed to allocate memory in VFS module recycle_bin\n"));
		return 0;
	conn->vfs_private= (void *)ctx;
	return 0;

static void recycle_disconnect(struct connection_struct *conn)
	talloc_destroy((TALLOC_CTX *)conn->vfs_private);


More information about the samba-technical mailing list