The branch, master has been updated via 5c9e10b smbd: Slightly simplify enum_file_close_fn via f9a7ea2 smbd: Slightly simplify do_break_to_none via 392889c smbd: Slightly simplify send_break_message via 4ecf8b4 smbd: Remove a silly "? true : false" via 051b912 smbd: Apply some const to message_to_share_mode_entry via f4e4049 lib: Apply some const to pull_file_id_24 via 451cde7 smbd: Fix a const warning via 1bf10ad smbd: Remove two confusing TALLOC_FREE calls via cdc99b3 smbd: Remove unused should_notify_deferred_opens via e654268 smbd: Apply some const to find_share_mode_entry via aee0f2c smbd: Apply some const to share_modes_identical via a7d7429 smbd: Simplify find_share_mode_entry from 196da59 smbd: Remove FORCE_OPLOCK_BREAK_TO_NONE
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 5c9e10b4b9fb9abe7af6058c0513115ddb325500 Author: Volker Lendecke <v...@samba.org> Date: Mon Sep 2 09:09:16 2013 +0000 smbd: Slightly simplify enum_file_close_fn 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): Fri Sep 6 15:29:55 CEST 2013 on sn-devel-104 commit f9a7ea2df2aaae8b22cfb209e26ceee3c8252ce0 Author: Volker Lendecke <v...@samba.org> Date: Mon Sep 2 09:08:04 2013 +0000 smbd: Slightly simplify do_break_to_none Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> commit 392889c8bcffd0f9eb25ad0586172f2b9476b0b4 Author: Volker Lendecke <v...@samba.org> Date: Mon Sep 2 09:06:13 2013 +0000 smbd: Slightly simplify send_break_message Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> commit 4ecf8b4db69e5a7d09c3d269145d7b04914efff3 Author: Volker Lendecke <v...@samba.org> Date: Mon Sep 2 09:40:46 2013 +0000 smbd: Remove a silly "? true : false" Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> commit 051b9121bc8e113239f7207a68860b6472d117d4 Author: Volker Lendecke <v...@samba.org> Date: Tue Sep 3 11:55:27 2013 +0000 smbd: Apply some const to message_to_share_mode_entry Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> commit f4e40494c07067838dd67f0614dc75fdb6291c41 Author: Volker Lendecke <v...@samba.org> Date: Tue Sep 3 11:51:48 2013 +0000 lib: Apply some const to pull_file_id_24 Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> commit 451cde7f2ab82ea500a69a6072b28991bf4e13a2 Author: Volker Lendecke <v...@samba.org> Date: Thu Aug 29 14:53:01 2013 +0000 smbd: Fix a const warning Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> commit 1bf10ad806512979521336391c627275ffeae040 Author: Volker Lendecke <v...@samba.org> Date: Tue Sep 3 09:23:39 2013 +0000 smbd: Remove two confusing TALLOC_FREE calls We don't have lck allocated yet at these points. Remove the TALLOC_FREE calls that triggered me looking for the get_share_mode_lock calls. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> commit cdc99b362f86cfab839076fba128699ae38d4039 Author: Volker Lendecke <v...@samba.org> Date: Tue Sep 3 14:44:45 2013 +0000 smbd: Remove unused should_notify_deferred_opens Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> commit e6542683ca6d65b99972d763ebb4df52826fca1e Author: Volker Lendecke <v...@samba.org> Date: Tue Sep 3 14:40:58 2013 +0000 smbd: Apply some const to find_share_mode_entry Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> commit aee0f2ccf7a10b5344b00711b0d294648f15bd10 Author: Volker Lendecke <v...@samba.org> Date: Tue Sep 3 14:40:35 2013 +0000 smbd: Apply some const to share_modes_identical Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> commit a7d742937644373e0e2e75003d04c118e34385ff Author: Volker Lendecke <v...@samba.org> Date: Tue Sep 3 14:38:47 2013 +0000 smbd: Simplify find_share_mode_entry There's no point checking the validity of the "entry" argument more than once Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Michael Adam <ob...@samba.org> ----------------------------------------------------------------------- Summary of changes: source3/lib/file_id.c | 2 +- source3/lib/file_id.h | 2 +- source3/locking/locking.c | 15 +++++++++------ source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 3 +-- source3/smbd/open.c | 7 ++----- source3/smbd/oplock.c | 15 ++------------- source3/smbd/proto.h | 3 +-- source3/smbd/trans2.c | 2 +- 8 files changed, 18 insertions(+), 31 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/lib/file_id.c b/source3/lib/file_id.c index ba4b3a3..f8295ce 100644 --- a/source3/lib/file_id.c +++ b/source3/lib/file_id.c @@ -80,7 +80,7 @@ void push_file_id_24(char *buf, const struct file_id *id) /* pull a 24 byte version of a file id from a buffer */ -void pull_file_id_24(char *buf, struct file_id *id) +void pull_file_id_24(const char *buf, struct file_id *id) { ZERO_STRUCTP(id); id->devid = IVAL(buf, 0); diff --git a/source3/lib/file_id.h b/source3/lib/file_id.h index 2ca8390..6fa9840 100644 --- a/source3/lib/file_id.h +++ b/source3/lib/file_id.h @@ -34,4 +34,4 @@ const char *file_id_string_tos(const struct file_id *id); const char *file_id_string(TALLOC_CTX *mem_ctx, const struct file_id *id); void push_file_id_16(char *buf, const struct file_id *id); void push_file_id_24(char *buf, const struct file_id *id); -void pull_file_id_24(char *buf, struct file_id *id); +void pull_file_id_24(const char *buf, struct file_id *id); diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 5090082..ad56cb1 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -733,8 +733,8 @@ void set_share_mode(struct share_mode_lock *lck, files_struct *fsp, not automatically a logic error if they are identical. JRA.) ********************************************************************/ -static bool share_modes_identical(struct share_mode_entry *e1, - struct share_mode_entry *e2) +static bool share_modes_identical(const struct share_mode_entry *e1, + const struct share_mode_entry *e2) { /* We used to check for e1->share_access == e2->share_access here as well as the other fields but 2 different DOS or FCB opens @@ -746,15 +746,18 @@ static bool share_modes_identical(struct share_mode_entry *e1, e1->share_file_id == e2->share_file_id ); } -static struct share_mode_entry *find_share_mode_entry(struct share_mode_data *d, - struct share_mode_entry *entry) +static struct share_mode_entry *find_share_mode_entry( + struct share_mode_data *d, const struct share_mode_entry *entry) { int i; + if (!is_valid_share_mode_entry(entry)) { + return NULL; + } + for (i=0; i<d->num_share_modes; i++) { struct share_mode_entry *e = &d->share_modes[i]; - if (is_valid_share_mode_entry(entry) && - is_valid_share_mode_entry(e) && + if (is_valid_share_mode_entry(e) && share_modes_identical(e, entry)) { return e; } diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 1af350a..8f3a4cf 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -2480,8 +2480,7 @@ static void enum_file_close_fn( const struct share_mode_entry *e, state->r->out.result = ntstatus_to_werror( messaging_send_buf(state->msg_ctx, e->pid, MSG_SMB_CLOSE_FILE, - (uint8 *)msg, - MSG_SMB_SHARE_MODE_ENTRY_SIZE)); + (uint8 *)msg, sizeof(msg))); } /******************************************************************** diff --git a/source3/smbd/open.c b/source3/smbd/open.c index f4210d7..e5ea715 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1186,8 +1186,7 @@ static NTSTATUS send_break_message(files_struct *fsp, status = messaging_send_buf(fsp->conn->sconn->msg_ctx, exclusive->pid, MSG_SMB_BREAK_REQUEST, - (uint8 *)msg, - MSG_SMB_SHARE_MODE_ENTRY_SIZE); + (uint8 *)msg, sizeof(msg)); if (!NT_STATUS_IS_OK(status)) { DEBUG(3, ("Could not send oplock break message: %s\n", nt_errstr(status))); @@ -1355,7 +1354,7 @@ static bool file_has_brlocks(files_struct *fsp) if (!br_lck) return false; - return br_lck->num_locks > 0 ? true : false; + return (br_lck->num_locks > 0); } static void grant_fsp_oplock_type(files_struct *fsp, @@ -2337,7 +2336,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, if (NT_STATUS_EQUAL(fsp_open, NT_STATUS_RETRY)) { schedule_async_open(request_time, req); } - TALLOC_FREE(lck); return fsp_open; } @@ -2351,7 +2349,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, * just fail the open to prevent creating any problems * in the open file db having the wrong dev/ino key. */ - TALLOC_FREE(lck); fd_close(fsp); DEBUG(1,("open_file_ntcreate: file %s - dev/ino mismatch. " "Old (dev=0x%llu, ino =0x%llu). " diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 4cdf68b..96c451c 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -211,16 +211,6 @@ bool downgrade_oplock(files_struct *fsp) return ret; } -/* - * Some kernel oplock implementations handle the notification themselves. - */ -bool should_notify_deferred_opens(struct smbd_server_connection *sconn) -{ - struct kernel_oplocks *koplocks = sconn->oplocks.kernel_ops; - return !(koplocks && - (koplocks->flags & KOPLOCKS_DEFERRED_OPEN_NOTIFICATION)); -} - /**************************************************************************** Set up an oplock break message. ****************************************************************************/ @@ -763,8 +753,7 @@ static void do_break_to_none(struct tevent_context *ctx, messaging_send_buf(state->sconn->msg_ctx, share_entry->pid, MSG_SMB_ASYNC_LEVEL2_BREAK, - (uint8 *)msg, - MSG_SMB_SHARE_MODE_ENTRY_SIZE); + (uint8 *)msg, sizeof(msg)); } } @@ -829,7 +818,7 @@ void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e) De-linearize an internal oplock break message to a share mode entry struct. ****************************************************************************/ -void message_to_share_mode_entry(struct share_mode_entry *e, char *msg) +void message_to_share_mode_entry(struct share_mode_entry *e, const char *msg) { e->pid.pid = (pid_t)IVAL(msg,OP_BREAK_MSG_PID_OFFSET); e->op_mid = BVAL(msg,OP_BREAK_MSG_MID_OFFSET); diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index f572c35..8b6987e 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -663,7 +663,6 @@ NTSTATUS set_file_oplock(files_struct *fsp, int oplock_type); void release_file_oplock(files_struct *fsp); bool remove_oplock(files_struct *fsp); bool downgrade_oplock(files_struct *fsp); -bool should_notify_deferred_opens(struct smbd_server_connection *sconn); void contend_level2_oplocks_begin(files_struct *fsp, enum level2_contention_type type); void contend_level2_oplocks_end(files_struct *fsp, @@ -673,7 +672,7 @@ void smbd_contend_level2_oplocks_begin(files_struct *fsp, void smbd_contend_level2_oplocks_end(files_struct *fsp, enum level2_contention_type type); void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e); -void message_to_share_mode_entry(struct share_mode_entry *e, char *msg); +void message_to_share_mode_entry(struct share_mode_entry *e, const char *msg); bool init_oplocks(struct smbd_server_connection *sconn); void init_kernel_oplocks(struct smbd_server_connection *sconn); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index e6bb12c..e02d646 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -3078,7 +3078,7 @@ NTSTATUS smbd_do_qfsinfo(connection_struct *conn, const char *vname = volume_label(talloc_tos(), SNUM(conn)); int snum = SNUM(conn); char *fstype = lp_fstype(talloc_tos(), SNUM(conn)); - char *filename = NULL; + const char *filename = NULL; uint32 additional_flags = 0; struct smb_filename smb_fname; SMB_STRUCT_STAT st; -- Samba Shared Repository