r1279: rename struct tcon_context to smbsrv_tcon
[jelmer/samba4-debian.git] / source / ntvfs / ntvfs_base.c
index e4009fd1f0144ca6ffc33450aa402bb7ce73aa80..bb751bae015df3c4f6fd78901294bcb33b718fd5 100644 (file)
@@ -30,7 +30,7 @@
  * can be more than one backend with the same name, as long as they
  * have different typesx */
 static struct {
-       struct ntvfs_ops *ops;
+       const struct ntvfs_ops *ops;
 } *backends = NULL;
 static int num_backends;
 
@@ -44,11 +44,12 @@ static int num_backends;
 */
 static NTSTATUS ntvfs_register(void *_ops)
 {
-       struct ntvfs_ops *ops = _ops;
+       const struct ntvfs_ops *ops = _ops;
+       struct ntvfs_ops *new_ops;
        
        if (ntvfs_backend_byname(ops->name, ops->type) != NULL) {
                /* its already registered! */
-               DEBUG(2,("NTVFS backend '%s' for type %d already registered\n", 
+               DEBUG(0,("NTVFS backend '%s' for type %d already registered\n", 
                         ops->name, (int)ops->type));
                return NT_STATUS_OBJECT_NAME_COLLISION;
        }
@@ -58,11 +59,16 @@ static NTSTATUS ntvfs_register(void *_ops)
                smb_panic("out of memory in ntvfs_register");
        }
 
-       backends[num_backends].ops = smb_xmemdup(ops, sizeof(*ops));
-       backends[num_backends].ops->name = smb_xstrdup(ops->name);
+       new_ops = smb_xmemdup(ops, sizeof(*ops));
+       new_ops->name = smb_xstrdup(ops->name);
+
+       backends[num_backends].ops = new_ops;
 
        num_backends++;
 
+       DEBUG(3,("NTVFS backend '%s' for type %d registered\n", 
+                ops->name,ops->type));
+
        return NT_STATUS_OK;
 }
 
@@ -70,7 +76,7 @@ static NTSTATUS ntvfs_register(void *_ops)
 /*
   return the operations structure for a named backend of the specified type
 */
-struct ntvfs_ops *ntvfs_backend_byname(const char *name, enum ntvfs_type type)
+const struct ntvfs_ops *ntvfs_backend_byname(const char *name, enum ntvfs_type type)
 {
        int i;
 
@@ -96,7 +102,7 @@ const struct ntvfs_critical_sizes *ntvfs_interface_version(void)
                NTVFS_INTERFACE_VERSION,
                sizeof(struct ntvfs_ops),
                sizeof(SMB_OFF_T),
-               sizeof(struct tcon_context),
+               sizeof(struct smbsrv_tcon),
                sizeof(struct request_context),
        };
 
@@ -129,15 +135,12 @@ BOOL ntvfs_init(void)
 */
 NTSTATUS ntvfs_init_connection(struct request_context *req)
 {
-       const char *handler = lp_ntvfs_handler(req->conn->service);
-       
-       if (strequal(handler, "default"))
-               handler = "ipc";
+       const char *handler = lp_ntvfs_handler(req->tcon->service);
 
-       req->conn->ntvfs_ops = ntvfs_backend_byname(handler, req->conn->type);
+       req->tcon->ntvfs_ops = ntvfs_backend_byname(handler, req->tcon->type);
 
-       if (!req->conn->ntvfs_ops) {
-               DEBUG(1,("ntvfs_init_connection: failed to find backend=%s, type=%d\n", handler, req->conn->type));
+       if (!req->tcon->ntvfs_ops) {
+               DEBUG(1,("ntvfs_init_connection: failed to find backend=%s, type=%d\n", handler, req->tcon->type));
                return NT_STATUS_UNSUCCESSFUL;
        }