VFS problem

Jim Myers myersjj at us.ibm.com
Sun Jun 2 14:08:02 GMT 2002


I was aware of that, but from the traces I took (with log level=10),
connect was sometimes NOT called!
I saw examples where after Samba was restarted and I tried to access a file
in the VFS share, the first call after vfs_init was an open.

So that strategy did not work (using Samba 3.0alpha17)

Jim Myers
IBM Almaden Research Center
B3-239, 408-927-2013


                                                                                                                                          
                      Hasch at t-online.de (Juergen                                                                                          
                      Hasch)                            To:       Jim Myers/Almaden/IBM at IBMUS, samba-technical at lists.samba.org            
                      Sent by:                          cc:                                                                               
                      samba-technical-admin at list        Subject:  Re: VFS problem                                                         
                      s.samba.org                                                                                                         
                                                                                                                                          
                                                                                                                                          
                      06/02/2002 12:39 PM                                                                                                 
                      Please respond to hasch                                                                                             
                                                                                                                                          
                                                                                                                                          



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)
{
             TALLOC_CTX *ctx=NULL;

             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);
             default_vfs_ops.disconnect(conn);
}

...Juergen











More information about the samba-technical mailing list