[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sun Jul 4 08:41:43 MDT 2010


The branch, master has been updated
       via  b3194be... s3: Fix some type-punned warnings
       via  eb50f77... s3: Fix some nested extern warnings
       via  b01958b... s3: Remove serverid_[de]register_self
      from  ba57d23... s3: ALWAYS run make test before checkin ....

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


- Log -----------------------------------------------------------------
commit b3194be286a6af28044375e893cfa0b095dba6e6
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jul 4 16:09:09 2010 +0200

    s3: Fix some type-punned warnings

commit eb50f77154e23b9dc231926d5a0af07dd7761bc4
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jul 4 16:08:59 2010 +0200

    s3: Fix some nested extern warnings

commit b01958b0bdb1a7115b82fc7029d8ffe630614cff
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jul 4 16:08:03 2010 +0200

    s3: Remove serverid_[de]register_self
    
    This removes some deep references to procid_self()

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

Summary of changes:
 source3/include/serverid.h  |   14 ++------------
 source3/lib/serverid.c      |   26 +++++---------------------
 source3/nmbd/nmbd.c         |   20 ++++++++++++--------
 source3/printing/printing.c |   10 ++++++----
 source3/smbd/negprot.c      |    5 +++--
 source3/smbd/server.c       |   16 +++++++++-------
 source3/smbd/server_exit.c  |    2 +-
 source3/winbindd/winbindd.c |    5 +++--
 8 files changed, 41 insertions(+), 57 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/serverid.h b/source3/include/serverid.h
index e60fc47..db2ce5a 100644
--- a/source3/include/serverid.h
+++ b/source3/include/serverid.h
@@ -25,22 +25,12 @@
 /*
  * Register a server with its unique id
  */
-bool serverid_register(const struct server_id *id, uint32_t msg_flags);
-
-/*
- * Register ourselves with a unique id
- */
-bool serverid_register_self(uint32_t msg_flags);
+bool serverid_register(const struct server_id id, uint32_t msg_flags);
 
 /*
  * De-register a server with its unique id
  */
-bool serverid_deregister(const struct server_id *id);
-
-/*
- * De-register ourself
- */
-bool serverid_deregister_self(void);
+bool serverid_deregister(const struct server_id id);
 
 /*
  * Check existence of a server id
diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c
index dc4834b..f92c8cf 100644
--- a/source3/lib/serverid.c
+++ b/source3/lib/serverid.c
@@ -76,7 +76,7 @@ static void serverid_fill_key(const struct server_id *id,
 #endif
 }
 
-bool serverid_register(const struct server_id *id, uint32_t msg_flags)
+bool serverid_register(const struct server_id id, uint32_t msg_flags)
 {
 	struct db_context *db;
 	struct serverid_key key;
@@ -91,7 +91,7 @@ bool serverid_register(const struct server_id *id, uint32_t msg_flags)
 		return false;
 	}
 
-	serverid_fill_key(id, &key);
+	serverid_fill_key(&id, &key);
 	tdbkey = make_tdb_data((uint8_t *)&key, sizeof(key));
 
 	rec = db->fetch_locked(db, talloc_tos(), tdbkey);
@@ -101,7 +101,7 @@ bool serverid_register(const struct server_id *id, uint32_t msg_flags)
 	}
 
 	ZERO_STRUCT(data);
-	data.unique_id = id->unique_id;
+	data.unique_id = id.unique_id;
 	data.msg_flags = msg_flags;
 
 	tdbdata = make_tdb_data((uint8_t *)&data, sizeof(data));
@@ -117,15 +117,7 @@ done:
 	return ret;
 }
 
-bool serverid_register_self(uint32_t msg_flags)
-{
-	struct server_id pid;
-
-	pid = procid_self();
-	return serverid_register(&pid, msg_flags);
-}
-
-bool serverid_deregister(const struct server_id *id)
+bool serverid_deregister(struct server_id id)
 {
 	struct db_context *db;
 	struct serverid_key key;
@@ -139,7 +131,7 @@ bool serverid_deregister(const struct server_id *id)
 		return false;
 	}
 
-	serverid_fill_key(id, &key);
+	serverid_fill_key(&id, &key);
 	tdbkey = make_tdb_data((uint8_t *)&key, sizeof(key));
 
 	rec = db->fetch_locked(db, talloc_tos(), tdbkey);
@@ -160,14 +152,6 @@ done:
 	return ret;
 }
 
-bool serverid_deregister_self(void)
-{
-	struct server_id pid;
-
-	pid = procid_self();
-	return serverid_deregister(&pid);
-}
-
 struct serverid_exists_state {
 	const struct server_id *id;
 	bool exists;
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index fa106a9..d13607b 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -84,7 +84,7 @@ static void terminate(void)
 	kill_async_dns_child();
 
 	gencache_stabilize();
-	serverid_deregister_self();
+	serverid_deregister(procid_self());
 
 	pidfile_unlink();
 
@@ -255,8 +255,9 @@ static void reload_interfaces(time_t t)
 			continue;
 		}
 
-		ip = ((struct sockaddr_in *)&iface->ip)->sin_addr;
-		nmask = ((struct sockaddr_in *)&iface->netmask)->sin_addr;
+		ip = ((struct sockaddr_in *)(void *)&iface->ip)->sin_addr;
+		nmask = ((struct sockaddr_in *)(void *)
+			 &iface->netmask)->sin_addr;
 
 		/*
 		 * We don't want to add a loopback interface, in case
@@ -264,7 +265,7 @@ static void reload_interfaces(time_t t)
 		 * ignore it here. JRA.
 		 */
 
-		if (is_loopback_addr((struct sockaddr *)&iface->ip)) {
+		if (is_loopback_addr((struct sockaddr *)(void *)&iface->ip)) {
 			DEBUG(2,("reload_interfaces: Ignoring loopback "
 				"interface %s\n",
 				print_sockaddr(str, sizeof(str), &iface->ip) ));
@@ -303,8 +304,10 @@ static void reload_interfaces(time_t t)
 					"ignoring non IPv4 interface.\n"));
 				continue;
 			}
-			ip = ((struct sockaddr_in *)&iface->ip)->sin_addr;
-			nmask = ((struct sockaddr_in *)&iface->netmask)->sin_addr;
+			ip = ((struct sockaddr_in *)(void *)
+			      &iface->ip)->sin_addr;
+			nmask = ((struct sockaddr_in *)(void *)
+				 &iface->netmask)->sin_addr;
 			if (ip_equal_v4(ip, subrec->myip) &&
 			    ip_equal_v4(nmask, subrec->mask_ip)) {
 				break;
@@ -434,7 +437,7 @@ static void msg_nmbd_send_packet(struct messaging_context *msg,
 	}
 
 	in_addr_to_sockaddr_storage(&ss, p->ip);
-	pss = iface_ip((struct sockaddr *)&ss);
+	pss = iface_ip((struct sockaddr *)(void *)&ss);
 
 	if (pss == NULL) {
 		DEBUG(2, ("Could not find ip for packet from %u\n",
@@ -933,7 +936,8 @@ static bool open_sockets(bool isdaemon, int port)
 
 	/* get broadcast messages */
 
-	if (!serverid_register_self(FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP)) {
+	if (!serverid_register(procid_self(),
+			       FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP)) {
 		DEBUG(1, ("Could not register myself in serverid.tdb\n"));
 		exit(1);
 	}
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 6bf037a..93624f0 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -1380,11 +1380,12 @@ static void printing_pause_fd_handler(struct tevent_context *ev,
 	exit_server_cleanly(NULL);
 }
 
+extern struct child_pid *children;
+extern int num_children;
+
 static void add_child_pid(pid_t pid)
 {
-	extern struct child_pid *children;
 	struct child_pid *child;
-	extern int num_children;
 
         child = SMB_MALLOC_P(struct child_pid);
         if (child == NULL) {
@@ -1446,8 +1447,9 @@ void start_background_queue(void)
 		smbd_setup_sig_term_handler();
 		smbd_setup_sig_hup_handler();
 
-		if (!serverid_register_self(FLAG_MSG_GENERAL|FLAG_MSG_SMBD
-					    |FLAG_MSG_PRINT_GENERAL)) {
+		if (!serverid_register(procid_self(),
+				       FLAG_MSG_GENERAL|FLAG_MSG_SMBD
+				       |FLAG_MSG_PRINT_GENERAL)) {
 			exit(1);
 		}
 
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index 0a928a2..e6fc23a 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -665,8 +665,9 @@ void reply_negprot(struct smb_request *req)
 	   when the client connects to port 445.  Of course there is a small
 	   window where we are listening to messages   -- jerry */
 
-	serverid_register_self(FLAG_MSG_GENERAL|FLAG_MSG_SMBD
-			       |FLAG_MSG_PRINT_GENERAL);
+	serverid_register(procid_self(),
+			  FLAG_MSG_GENERAL|FLAG_MSG_SMBD
+			  |FLAG_MSG_PRINT_GENERAL);
     
 	/* Check for protocols, most desirable first */
 	for (protocol = 0; supported_protocols[protocol].proto_name; protocol++) {
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 1b00f2c..a125079 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -242,7 +242,7 @@ static void remove_child_pid(pid_t pid, bool unclean_shutdown)
 	child_id = procid_self(); /* Just initialize pid and potentially vnn */
 	child_id.pid = pid;
 
-	if (!serverid_deregister(&child_id)) {
+	if (!serverid_deregister(child_id)) {
 		DEBUG(1, ("Could not remove pid %d from serverid.tdb\n",
 			  (int)pid));
 	}
@@ -355,7 +355,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
 	pid_t pid = 0;
 	uint64_t unique_id;
 
-	smbd_set_server_fd(accept(s->fd,(struct sockaddr *)&addr,&in_addrlen));
+	smbd_set_server_fd(accept(s->fd, (struct sockaddr *)(void *)&addr,&in_addrlen));
 
 	if (smbd_server_fd() == -1 && errno == EINTR)
 		return;
@@ -424,9 +424,10 @@ static void smbd_accept_connection(struct tevent_context *ev,
 		smbd_setup_sig_term_handler();
 		smbd_setup_sig_hup_handler();
 
-		if (!serverid_register_self(FLAG_MSG_GENERAL|FLAG_MSG_SMBD
-					    |FLAG_MSG_DBWRAP
-					    |FLAG_MSG_PRINT_GENERAL)) {
+		if (!serverid_register(procid_self(),
+				       FLAG_MSG_GENERAL|FLAG_MSG_SMBD
+				       |FLAG_MSG_DBWRAP
+				       |FLAG_MSG_PRINT_GENERAL)) {
 			exit_server_cleanly("Could not register myself in "
 					    "serverid.tdb");
 		}
@@ -662,8 +663,9 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
 	   operations until it has gone thru a full startup, which
 	   includes checking to see that smbd is listening. */
 
-	if (!serverid_register_self(FLAG_MSG_GENERAL|FLAG_MSG_SMBD
-				    |FLAG_MSG_DBWRAP)) {
+	if (!serverid_register(procid_self(),
+			       FLAG_MSG_GENERAL|FLAG_MSG_SMBD
+			       |FLAG_MSG_DBWRAP)) {
 		DEBUG(0, ("open_sockets_smbd: Failed to register "
 			  "myself in serverid.tdb\n"));
 		return false;
diff --git a/source3/smbd/server_exit.c b/source3/smbd/server_exit.c
index b69eb4a..6c46a52 100644
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -97,7 +97,7 @@ static void exit_server_common(enum server_exit_reason how,
 		/*
 		 * For children the parent takes care of cleaning up
 		 */
-		serverid_deregister_self();
+		serverid_deregister(procid_self());
 	}
 
 #ifdef WITH_DFS
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 87a8be6..34fd271 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -176,7 +176,7 @@ static void terminate(bool is_parent)
 #endif
 
 	if (is_parent) {
-		serverid_deregister_self();
+		serverid_deregister(procid_self());
 		pidfile_unlink();
 	}
 
@@ -1031,7 +1031,8 @@ void winbindd_register_handlers(void)
 
 	/* get broadcast messages */
 
-	if (!serverid_register_self(FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP)) {
+	if (!serverid_register(procid_self(),
+			       FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP)) {
 		DEBUG(1, ("Could not register myself in serverid.tdb\n"));
 		exit(1);
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list