[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Fri Jun 5 12:40:03 MDT 2015


The branch, master has been updated
       via  7266c68 ctdb: Change use of 'which' to 'type' in scripts.
       via  a4db3b3 messaging: Move parsing of ctdb_req_message to ctdbd_conn.c
      from  fc5aadb winbind: Lookup groupmem via primaryGroupID

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


- Log -----------------------------------------------------------------
commit 7266c68856fab27113aaab5e622d19a76f56ac52
Author: Jose A. Rivera <jarrpa at samba.org>
Date:   Fri Jun 5 09:20:59 2015 -0500

    ctdb: Change use of 'which' to 'type' in scripts.
    
    While 'which' is a very common tool, on many distros it is not a requirement
    that it be installed. 'type' is a shell built-in specified by the Open Group,
    and is found in shells like bash, dash, and ksh across multiple OSes.
    
    Signed-off-by: Jose A. Rivera <jarrpa at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Fri Jun  5 20:39:47 CEST 2015 on sn-devel-104

commit a4db3b30c5a8533943766486f72422a5eb072a62
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jun 2 20:30:06 2015 +0000

    messaging: Move parsing of ctdb_req_message to ctdbd_conn.c
    
    This way we can remove the ctdb-specific includes from messages_ctdbd.c
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

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

Summary of changes:
 ctdb/config/events.d/00.ctdb    |  4 ++--
 ctdb/config/events.d/60.ganesha |  2 +-
 ctdb/config/functions           |  4 ++--
 source3/include/ctdbd_conn.h    |  4 +++-
 source3/lib/ctdb_dummy.c        |  4 +++-
 source3/lib/ctdbd_conn.c        | 28 +++++++++++++++++++++++++---
 source3/lib/messages_ctdbd.c    | 34 ++++++++--------------------------
 source3/smbd/server.c           |  7 ++++---
 8 files changed, 48 insertions(+), 39 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/config/events.d/00.ctdb b/ctdb/config/events.d/00.ctdb
index 21ca77b..0e25e50 100755
--- a/ctdb/config/events.d/00.ctdb
+++ b/ctdb/config/events.d/00.ctdb
@@ -17,8 +17,8 @@ select_tdb_checker ()
 {
     # Find the best TDB consistency check available.
     use_tdb_tool_check=false
-    which tdbtool >/dev/null 2>&1 && found_tdbtool=true
-    which tdbdump >/dev/null 2>&1 && found_tdbdump=true
+    type tdbtool >/dev/null 2>&1 && found_tdbtool=true
+    type tdbdump >/dev/null 2>&1 && found_tdbdump=true
 
     if $found_tdbtool && echo "help" | tdbtool | grep -q check ; then
 	    use_tdb_tool_check=true
diff --git a/ctdb/config/events.d/60.ganesha b/ctdb/config/events.d/60.ganesha
index fc17098..cd735be 100755
--- a/ctdb/config/events.d/60.ganesha
+++ b/ctdb/config/events.d/60.ganesha
@@ -229,7 +229,7 @@ case "$1" in
 	# For platforms where rpc.statd does not exist, we skip
         # the check completely
 	p="rpc.statd"
-	which $p >/dev/null 2>/dev/null && \
+	type $p >/dev/null 2>/dev/null && \
 	    nfs_check_rpc_service "statd" \
 		%  10 "verbose restart:b unhealthy" \
 		-ge 6 "verbose unhealthy" \
diff --git a/ctdb/config/functions b/ctdb/config/functions
index 340b1e5..ec69583 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -337,7 +337,7 @@ _nfs_check_rpc_common ()
     # Some platforms don't have separate programs for all services.
     case "$_prog_name" in
 	statd)
-	    which "rpc.${_prog_name}" >/dev/null 2>&1 || return 0
+	    type "rpc.${_prog_name}" >/dev/null 2>&1 || return 0
     esac
 
     case "$_prog_name" in
@@ -1430,7 +1430,7 @@ iptables_wrapper ()
 }
 
 # AIX (and perhaps others?) doesn't have mktemp
-if ! which mktemp >/dev/null 2>&1 ; then
+if ! type mktemp >/dev/null 2>&1 ; then
     mktemp ()
     {
 	_dir=false
diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h
index a404724..6cf123f 100644
--- a/source3/include/ctdbd_conn.h
+++ b/source3/include/ctdbd_conn.h
@@ -89,7 +89,9 @@ NTSTATUS ctdb_unwatch(struct ctdbd_connection *conn);
 struct ctdb_req_message;
 
 NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
-			     void (*cb)(struct ctdb_req_message *msg,
+			     void (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
+					uint64_t dst_srvid,
+					const uint8_t *msg, size_t msglen,
 					void *private_data),
 			     void *private_data);
 NTSTATUS ctdbd_probe(void);
diff --git a/source3/lib/ctdb_dummy.c b/source3/lib/ctdb_dummy.c
index bea707d..2df6c28 100644
--- a/source3/lib/ctdb_dummy.c
+++ b/source3/lib/ctdb_dummy.c
@@ -38,7 +38,9 @@ NTSTATUS ctdbd_messaging_send_iov(struct ctdbd_connection *conn,
 }
 
 NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
-			     void (*cb)(struct ctdb_req_message *msg,
+			     void (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
+					uint64_t dst_srvid,
+					const uint8_t *msg, size_t msglen,
 					void *private_data),
 			     void *private_data)
 {
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 3aa5ced..9ad58fe 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -35,7 +35,10 @@
 
 struct ctdbd_srvid_cb {
 	uint64_t srvid;
-	void (*cb)(struct ctdb_req_message *msg, void *private_data);
+	void (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
+		   uint64_t dst_srvid,
+		   const uint8_t *msg, size_t msglen,
+		   void *private_data);
 	void *private_data;
 };
 
@@ -98,7 +101,9 @@ static void ctdb_packet_dump(struct ctdb_req_header *hdr)
  * Register a srvid with ctdbd
  */
 NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
-			     void (*cb)(struct ctdb_req_message *msg,
+			     void (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
+					uint64_t dst_srvid,
+					const uint8_t *msg, size_t msglen,
 					void *private_data),
 			     void *private_data)
 {
@@ -134,15 +139,32 @@ NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
 static void ctdbd_msg_call_back(struct ctdbd_connection *conn,
 				struct ctdb_req_message *msg)
 {
+	size_t msg_len;
 	size_t i, num_callbacks;
 
+	msg_len = msg->hdr.length;
+	if (msg_len < offsetof(struct ctdb_req_message, data)) {
+		DEBUG(10, ("%s: len %u too small\n", __func__,
+			   (unsigned)msg_len));
+		return;
+	}
+	msg_len -= offsetof(struct ctdb_req_message, data);
+
+	if (msg_len < msg->datalen) {
+		DEBUG(10, ("%s: msg_len=%u < msg->datalen=%u\n", __func__,
+			   (unsigned)msg_len, (unsigned)msg->datalen));
+		return;
+	}
+
 	num_callbacks = talloc_array_length(conn->callbacks);
 
 	for (i=0; i<num_callbacks; i++) {
 		struct ctdbd_srvid_cb *cb = &conn->callbacks[i];
 
 		if ((cb->srvid == msg->srvid) && (cb->cb != NULL)) {
-			cb->cb(msg, cb->private_data);
+			cb->cb(msg->hdr.srcnode, msg->hdr.destnode,
+			       msg->srvid, msg->data, msg->datalen,
+			       cb->private_data);
 		}
 	}
 }
diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c
index 0ce4da7..b4f4d63 100644
--- a/source3/lib/messages_ctdbd.c
+++ b/source3/lib/messages_ctdbd.c
@@ -22,9 +22,6 @@
 #include "util_tdb.h"
 #include "lib/util/iov_buf.h"
 #include "lib/messages_util.h"
-
-#include "ctdb.h"
-#include "ctdb_private.h"
 #include "ctdbd_conn.h"
 
 
@@ -111,44 +108,31 @@ static int messaging_ctdbd_destructor(struct messaging_ctdbd_context *ctx)
 	return 0;
 }
 
-static void messaging_ctdb_recv(struct ctdb_req_message *msg,
-				void *private_data)
+static void messaging_ctdb_recv(
+	uint32_t src_vnn, uint32_t dst_vnn, uint64_t dst_srvid,
+	const uint8_t *msg, size_t msg_len, void *private_data)
 {
 	struct messaging_context *msg_ctx = talloc_get_type_abort(
 		private_data, struct messaging_context);
 	struct server_id me = messaging_server_id(msg_ctx);
 	NTSTATUS status;
 	struct iovec iov;
-	size_t msg_len;
-	uint8_t *msg_buf;
 	struct server_id src, dst;
 	enum messaging_type msg_type;
 	struct server_id_buf idbuf;
 
-	msg_len = msg->hdr.length;
-	if (msg_len < offsetof(struct ctdb_req_message, data)) {
-		DEBUG(10, ("%s: len %u too small\n", __func__,
-			   (unsigned)msg_len));
-		return;
-	}
-	msg_len -= offsetof(struct ctdb_req_message, data);
-
-	if (msg_len < msg->datalen) {
-		DEBUG(10, ("%s: msg_len=%u < msg->datalen=%u\n", __func__,
-			   (unsigned)msg_len, (unsigned)msg->datalen));
-		return;
-	}
-
 	if (msg_len < MESSAGE_HDR_LENGTH) {
 		DEBUG(1, ("%s: message too short: %u\n", __func__,
 			  (unsigned)msg_len));
 		return;
 	}
 
-	message_hdr_get(&msg_type, &src, &dst, msg->data);
+	message_hdr_get(&msg_type, &src, &dst, msg);
 
-	msg_len -= MESSAGE_HDR_LENGTH;
-	msg_buf = msg->data + MESSAGE_HDR_LENGTH;
+	iov = (struct iovec) {
+		.iov_base = discard_const_p(uint8_t, msg) + MESSAGE_HDR_LENGTH,
+		.iov_len = msg_len - MESSAGE_HDR_LENGTH
+	};
 
 	DEBUG(10, ("%s: Received message 0x%x len %u from %s\n",
 		   __func__, (unsigned)msg_type, (unsigned)msg_len,
@@ -163,8 +147,6 @@ static void messaging_ctdb_recv(struct ctdb_req_message *msg,
 		return;
 	}
 
-	iov = (struct iovec) { .iov_base = msg_buf, .iov_len = msg_len };
-
 	/*
 	 * Go through the event loop
 	 */
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 9746d84..20aed16 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -261,13 +261,14 @@ static void smbd_parent_id_cache_delete(struct messaging_context *ctx,
 	messaging_send_to_children(ctx, msg_type, msg_data);
 }
 
-static void smbd_parent_ctdb_reconfigured(struct ctdb_req_message *msg,
-					  void *private_data)
+static void smbd_parent_ctdb_reconfigured(
+	uint32_t src_vnn, uint32_t dst_vnn, uint64_t dst_srvid,
+	const uint8_t *msg, size_t msglen, void *private_data)
 {
 	struct messaging_context *msg_ctx = talloc_get_type_abort(
 		private_data, struct messaging_context);
 
-	DEBUG(10, ("Got %s message\n", (msg->srvid == CTDB_SRVID_RECONFIGURE)
+	DEBUG(10, ("Got %s message\n", (dst_srvid == CTDB_SRVID_RECONFIGURE)
 		   ? "cluster reconfigure" : "SAMBA_NOTIFY"));
 
 	/*


-- 
Samba Shared Repository


More information about the samba-cvs mailing list