The branch, master has been updated
       via  534af20 smbd: Simplify new_break_message_smb1
       via  e7dab40 smbd: Replace a 0-timeout wakeup_send
      from  1808316 docs: Fix variable list in man vfs_crossrename.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 534af203e3e32789b673e6e029b3fb3fd5d40646
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Aug 19 12:28:24 2013 +0000

    smbd: Simplify new_break_message_smb1
    
    There's no point in allocating a fixed length array that we throw away
    immediately after use.
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>
    
    Autobuild-User(master): Michael Adam <ob...@samba.org>
    Autobuild-Date(master): Tue Aug 20 14:35:21 CEST 2013 on sn-devel-104

commit e7dab403c0ca6f64d0ffe5a61898cd642a16b078
Author: Volker Lendecke <v...@samba.org>
Date:   Fri Aug 16 11:40:38 2013 +0000

    smbd: Replace a 0-timeout wakeup_send
    
    A tevent_immediate is simpler and is what we want here.
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/oplock.c |   55 +++++++++++++++++-------------------------------
 1 files changed, 20 insertions(+), 35 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index e08a963..21792bd 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -223,16 +223,11 @@ bool should_notify_deferred_opens(struct 
smbd_server_connection *sconn)
  Set up an oplock break message.
 ****************************************************************************/
 
-static char *new_break_message_smb1(TALLOC_CTX *mem_ctx,
-                                  files_struct *fsp, int cmd)
-{
-       char *result = talloc_array(mem_ctx, char, smb_size + 8*2 + 0);
-
-       if (result == NULL) {
-               DEBUG(0, ("talloc failed\n"));
-               return NULL;
-       }
+#define SMB1_BREAK_MESSAGE_LENGTH (smb_size + 8*2)
 
+static void new_break_message_smb1(files_struct *fsp, int cmd,
+                                  char result[SMB1_BREAK_MESSAGE_LENGTH])
+{
        memset(result,'\0',smb_size);
        srv_set_message(result,8,0,true);
        SCVAL(result,smb_com,SMBlockingX);
@@ -244,7 +239,6 @@ static char *new_break_message_smb1(TALLOC_CTX *mem_ctx,
        SSVAL(result,smb_vwv2,fsp->fnum);
        SCVAL(result,smb_vwv3,LOCKING_ANDX_OPLOCK_RELEASE);
        SCVAL(result,smb_vwv3+1,cmd);
-       return result;
 }
 
 /****************************************************************************
@@ -369,12 +363,9 @@ static void add_oplock_timeout_handler(files_struct *fsp)
 
 static void send_break_message_smb1(files_struct *fsp, int level)
 {
-       char *break_msg = new_break_message_smb1(talloc_tos(),
-                                       fsp,
-                                       level);
-       if (break_msg == NULL) {
-               exit_server("Could not talloc break_msg\n");
-       }
+       char break_msg[SMB1_BREAK_MESSAGE_LENGTH];
+
+       new_break_message_smb1(fsp, level, break_msg);
 
        show_msg(break_msg);
        if (!srv_send_smb(fsp->conn->sconn,
@@ -384,8 +375,6 @@ static void send_break_message_smb1(files_struct *fsp, int 
level)
                exit_server_cleanly("send_break_message_smb1: "
                        "srv_send_smb failed.");
        }
-
-       TALLOC_FREE(break_msg);
 }
 
 static void break_level2_to_none_async(files_struct *fsp)
@@ -632,7 +621,9 @@ struct break_to_none_state {
        struct smbd_server_connection *sconn;
        struct file_id id;
 };
-static void do_break_to_none(struct tevent_req *req);
+static void do_break_to_none(struct tevent_context *ctx,
+                            struct tevent_immediate *im,
+                            void *private_data);
 
 /****************************************************************************
  This function is called on any file modification or lock request. If a file
@@ -644,7 +635,7 @@ static void 
contend_level2_oplocks_begin_default(files_struct *fsp,
                                              enum level2_contention_type type)
 {
        struct smbd_server_connection *sconn = fsp->conn->sconn;
-       struct tevent_req *req;
+       struct tevent_immediate *im;
        struct break_to_none_state *state;
 
        /*
@@ -673,31 +664,25 @@ static void 
contend_level2_oplocks_begin_default(files_struct *fsp,
        state->sconn = sconn;
        state->id = fsp->file_id;
 
-       req = tevent_wakeup_send(state, sconn->ev_ctx, timeval_set(0, 0));
-       if (req == NULL) {
-               DEBUG(1, ("tevent_wakeup_send failed\n"));
+       im = tevent_create_immediate(state);
+       if (im == NULL) {
+               DEBUG(1, ("tevent_create_immediate failed\n"));
                TALLOC_FREE(state);
                return;
        }
-       tevent_req_set_callback(req, do_break_to_none, state);
-       return;
+       tevent_schedule_immediate(im, sconn->ev_ctx, do_break_to_none, state);
 }
 
-static void do_break_to_none(struct tevent_req *req)
+static void do_break_to_none(struct tevent_context *ctx,
+                            struct tevent_immediate *im,
+                            void *private_data)
 {
-       struct break_to_none_state *state = tevent_req_callback_data(
-               req, struct break_to_none_state);
+       struct break_to_none_state *state = talloc_get_type_abort(
+               private_data, struct break_to_none_state);
        struct server_id self = messaging_server_id(state->sconn->msg_ctx);
-       bool ret;
        int i;
        struct share_mode_lock *lck;
 
-       ret = tevent_wakeup_recv(req);
-       TALLOC_FREE(req);
-       if (!ret) {
-               DEBUG(1, ("tevent_wakeup_recv failed\n"));
-               goto done;
-       }
        lck = get_existing_share_mode_lock(talloc_tos(), state->id);
        if (lck == NULL) {
                DEBUG(1, ("release_level_2_oplocks_on_change: failed to lock "


-- 
Samba Shared Repository

Reply via email to