[PATCH] Remove source3/lib/events.c dependency in nmbd
Volker Lendecke
vl at samba.org
Fri Sep 23 23:44:55 UTC 2016
On Fri, Sep 23, 2016 at 12:46:28PM -0700, Jeremy Allison wrote:
> On Fri, Sep 23, 2016 at 11:55:11AM -0700, Jeremy Allison wrote:
> > Is attached. Dirty, but seems to work. Now to try
> > and figure out how to split it up.. :-).
>
> OK, here's the split-up micro-commit version.
>
> Passes make test here ! Please review and push
> if you're happy.
I've taken a look at the first one and found the attached cosmetic
ones. Ok if I squash them in?
Volker
-------------- next part --------------
>From e65f6c15268f990abd947bc7db40995025371cea Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 23 Sep 2016 12:30:56 -0700
Subject: [PATCH 1/3] remove unnecessary casts
---
source3/nmbd/nmbd_packets.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index 0f6538e..4dffa23 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -1861,7 +1861,7 @@ static void nmbd_timeout_handler(struct tevent_context *ev,
struct timeval current_time,
void *private_data)
{
- bool *got_timeout = (bool *)private_data;
+ bool *got_timeout = private_data;
*got_timeout = true;
}
@@ -1874,8 +1874,7 @@ static void nmbd_fd_handler(struct tevent_context *ev,
uint16_t flags,
void *private_data)
{
- struct socket_attributes *attr =
- (struct socket_attributes *)private_data;
+ struct socket_attributes *attr = private_data;
attr->triggered = true;
}
--
2.7.4
>From ee09dff032d682f3a4c565b32b9166ecdfc49b86 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 23 Sep 2016 12:34:54 -0700
Subject: [PATCH 2/3] simplify ???
---
source3/nmbd/nmbd_packets.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index 4dffa23..d5d1932 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -1890,13 +1890,13 @@ bool listen_for_packets(struct messaging_context *msg, bool run_election)
int num_sockets;
int i;
int loop_rtn;
+ int timeout_secs;
#ifndef SYNC_DNS
int dns_fd;
int dns_pollidx = -1;
#endif
struct processed_packet *processed_packet_list = NULL;
- struct timeval tv;
struct tevent_timer *te = NULL;
bool got_timeout = false;
TALLOC_CTX *frame = talloc_stackframe();
@@ -1957,16 +1957,14 @@ bool listen_for_packets(struct messaging_context *msg, bool run_election)
*/
if (run_election||num_response_packets) {
- /* One second. */
- tv = tevent_timeval_current_ofs(1, 0);
+ timeout_secs = 1;
} else {
- /* NMBD_SELECT_LOOP seconds. */
- tv = tevent_timeval_current_ofs(NMBD_SELECT_LOOP, 0);
+ timeout_secs = NMBD_SELECT_LOOP;
}
te = tevent_add_timer(nmbd_event_context(),
frame,
- tv,
+ tevent_timeval_current_ofs(timeout_secs, 0),
nmbd_timeout_handler,
&got_timeout);
if (te == NULL) {
--
2.7.4
>From ca91a263b974ae086eb3bde86aad7f76797bc1b3 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 23 Sep 2016 16:43:28 -0700
Subject: [PATCH 3/3] fix == false for a bool var
---
source3/nmbd/nmbd_packets.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index d5d1932..7c676f8 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -2000,7 +2000,7 @@ bool listen_for_packets(struct messaging_context *msg, bool run_election)
int client_fd;
int client_port;
- if (attrs[i].triggered == false) {
+ if (!attrs[i].triggered) {
continue;
}
--
2.7.4
More information about the samba-technical
mailing list