ntvfs: pass down the client capabilities into the ntvfs layer
authorStefan Metzmacher <metze@samba.org>
Thu, 6 Mar 2008 14:14:08 +0000 (15:14 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 6 Mar 2008 15:31:25 +0000 (16:31 +0100)
Note that we don't use any protocol specific values here.

For now only NTVFS_CLIENT_CAP_LEVEL_II_OPLOCKS is defined
others should be defined, when we find out that the ntvfs
layer needs to know about it.

metze
(This used to be commit cc42cd5f6753ca582677fa6f403f0419eec5ab10)

source4/ntvfs/ntvfs.h
source4/ntvfs/ntvfs_base.c
source4/ntvfs/ntvfs_util.c
source4/rpc_server/srvsvc/srvsvc_ntvfs.c
source4/smb_server/smb/service.c
source4/smb_server/smb2/tcon.c

index a708dbff51aad366864585b2950432d952ecbf4a..7a2edc7e2c2b5570bf3616b3e2120618d2d1141b 100644 (file)
@@ -181,6 +181,14 @@ struct ntvfs_context {
 
        enum protocol_types protocol;
 
+       /*
+        * client capabilities
+        * this field doesn't use protocol specific
+        * values!
+        */
+#define NTVFS_CLIENT_CAP_LEVEL_II_OPLOCKS      0x0000000000000001LLU
+       uint64_t client_caps;
+
        /* 
         * linked list of module contexts
         */
@@ -257,6 +265,14 @@ struct ntvfs_request {
        /* the smb pid is needed for locking contexts */
        uint16_t smbpid;
 
+       /*
+        * client capabilities
+        * this field doesn't use protocol specific
+        * values!
+        * see NTVFS_CLIENT_CAP_*
+        */
+       uint64_t client_caps;
+
        /* some statictics for the management tools */
        struct {
                /* the system time when the request arrived */
index f5a24f23a030ed9d66f590e3eb554007115c88cf..35becabcf9bb4f1a7f7c60da6f1b5ba067b1a93e 100644 (file)
@@ -153,6 +153,7 @@ _PUBLIC_ bool ntvfs_interface_differs(const struct ntvfs_critical_sizes *const i
 */
 NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, enum ntvfs_type type,
                               enum protocol_types protocol,
+                              uint64_t ntvfs_client_caps,
                               struct event_context *ev, struct messaging_context *msg,
                               struct loadparm_context *lp_ctx,
                               struct server_id server_id, struct ntvfs_context **_ctx)
@@ -168,6 +169,7 @@ NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, e
        ctx = talloc_zero(mem_ctx, struct ntvfs_context);
        NT_STATUS_HAVE_NO_MEMORY(ctx);
        ctx->protocol           = protocol;
+       ctx->client_caps        = ntvfs_client_caps;
        ctx->type               = type;
        ctx->config             = talloc_steal(ctx, scfg);
        ctx->event_ctx          = ev;
index 7432ac2c13dbacd2be2061f10397b9e88c734705..ebe8008edd05cd157e17f2d2f3e6d0657983e644 100644 (file)
@@ -42,6 +42,7 @@ _PUBLIC_ struct ntvfs_request *ntvfs_request_create(struct ntvfs_context *ctx, T
        req->async_states               = NULL;
        req->session_info               = session_info;
        req->smbpid                     = smbpid;
+       req->client_caps                = ctx->client_caps;
        req->statistics.request_time    = request_time;
 
        async = talloc(req, struct ntvfs_async_state);
index ccd6c4f74ebe094bfba2d35b8c6401c6bd91c693..43fb24c0c36cc64d8574ffba42ed3ed3ccd2eeb3 100644 (file)
@@ -98,6 +98,7 @@ NTSTATUS srvsvc_create_ntvfs_context(struct dcesrv_call_state *dce_call,
        /* init ntvfs function pointers */
        status = ntvfs_init_connection(c, scfg, type,
                                       PROTOCOL_NT1,
+                                      0,/* ntvfs_client_caps */
                                       dce_call->event_ctx,
                                       dce_call->conn->msg_ctx,
                                       dce_call->conn->dce_ctx->lp_ctx,
index 35b3653026190f4c2b83a632efd9d80d30171bd3..52471c09c99623ab0c69574a1bf856a18e449c1b 100644 (file)
@@ -36,6 +36,7 @@ static NTSTATUS make_connection_scfg(struct smbsrv_request *req,
 {
        struct smbsrv_tcon *tcon;
        NTSTATUS status;
+       uint64_t ntvfs_caps = 0;
 
        tcon = smbsrv_smb_tcon_new(req->smb_conn, scfg->name);
        if (!tcon) {
@@ -44,9 +45,14 @@ static NTSTATUS make_connection_scfg(struct smbsrv_request *req,
        }
        req->tcon = tcon;
 
+       if (req->smb_conn->negotiate.client_caps & CAP_LEVEL_II_OPLOCKS) {
+               ntvfs_caps |= NTVFS_CLIENT_CAP_LEVEL_II_OPLOCKS;
+       }
+
        /* init ntvfs function pointers */
        status = ntvfs_init_connection(tcon, scfg, type,
                                       req->smb_conn->negotiate.protocol,
+                                      ntvfs_caps,
                                       req->smb_conn->connection->event.ctx,
                                       req->smb_conn->connection->msg_ctx,
                                       req->smb_conn->lp_ctx,
index 7f7d558b1639f7285f5db30229c687454172d7f5..040947f84f3f7c784be796a6244728b60382d3d5 100644 (file)
@@ -245,6 +245,7 @@ static NTSTATUS smb2srv_tcon_backend(struct smb2srv_request *req, union smb_tcon
        const char *service = io->smb2.in.path;
        struct share_config *scfg;
        const char *sharetype;
+       uint64_t ntvfs_caps = 0;
 
        if (strncmp(service, "\\\\", 2) == 0) {
                const char *p = strchr(service+2, '\\');
@@ -283,9 +284,12 @@ static NTSTATUS smb2srv_tcon_backend(struct smb2srv_request *req, union smb_tcon
        }
        req->tcon = tcon;
 
+       ntvfs_caps = NTVFS_CLIENT_CAP_LEVEL_II_OPLOCKS;
+
        /* init ntvfs function pointers */
        status = ntvfs_init_connection(tcon, scfg, type,
                                       req->smb_conn->negotiate.protocol,
+                                      ntvfs_caps,
                                       req->smb_conn->connection->event.ctx,
                                       req->smb_conn->connection->msg_ctx,
                                       req->smb_conn->lp_ctx,