xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Jim Fehlig <jfehlig@suse.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Ian Jackson <ijackson@chiark.greenend.org.uk>
Subject: [PATCH 17/18] libxl: timeouts: Break out time_occurs
Date: Mon, 3 Feb 2014 16:14:50 +0000	[thread overview]
Message-ID: <1391444091-22796-18-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1391444091-22796-1-git-send-email-ian.jackson@eu.citrix.com>

From: Ian Jackson <Ian.Jackson@eu.citrix.com>

Bring together the two places where etime->func() is called into a new
function time_occurs.  For one call site this is pure code motion.
For the other the only semantic change is the introduction of a new
debugging message.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Cc: Jim Fehlig <jfehlig@suse.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>
---
 tools/libxl/libxl_event.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c
index 93f8fdc..5a99932 100644
--- a/tools/libxl/libxl_event.c
+++ b/tools/libxl/libxl_event.c
@@ -381,6 +381,15 @@ void libxl__ev_time_deregister(libxl__gc *gc, libxl__ev_time *ev)
     return;
 }
 
+static void time_occurs(libxl__egc *egc, libxl__ev_time *etime)
+{
+    DBG("ev_time=%p occurs abs=%lu.%06lu",
+        etime, (unsigned long)etime->abs.tv_sec,
+        (unsigned long)etime->abs.tv_usec);
+
+    etime->func(egc, etime, &etime->abs);
+}
+
 
 /*
  * xenstore watches
@@ -1007,11 +1016,7 @@ static void afterpoll_internal(libxl__egc *egc, libxl__poller *poller,
 
         time_deregister(gc, etime);
 
-        DBG("ev_time=%p occurs abs=%lu.%06lu",
-            etime, (unsigned long)etime->abs.tv_sec,
-            (unsigned long)etime->abs.tv_usec);
-
-        etime->func(egc, etime, &etime->abs);
+        time_occurs(egc, etime);
     }
 }
 
@@ -1092,7 +1097,8 @@ void libxl_osevent_occurred_timeout(libxl_ctx *ctx, void *for_libxl)
     assert(!ev->infinite);
 
     LIBXL_TAILQ_REMOVE(&CTX->etimes, ev, entry);
-    ev->func(egc, ev, &ev->abs);
+
+    time_occurs(egc, ev);
 
  out:
     CTX_UNLOCK;
-- 
1.7.10.4

  parent reply	other threads:[~2014-02-03 16:14 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-03 16:14 [PATCH 00/18 v3] libxl: fork and event fixes for libvirt and 4.4 Ian Jackson
2014-02-03 16:14 ` [PATCH 01/18] libxl: fork: Break out checked_waitpid Ian Jackson
2014-02-03 16:14 ` [PATCH 02/18] libxl: fork: Break out childproc_reaped_ours Ian Jackson
2014-02-03 16:14 ` [PATCH 03/18] libxl: fork: Clarify docs for libxl_sigchld_owner Ian Jackson
2014-02-03 16:14 ` [PATCH 04/18] libxl: fork: Document libxl_sigchld_owner_libxl better Ian Jackson
2014-02-03 16:14 ` [PATCH 05/18] libxl: fork: assert that chldmode is right Ian Jackson
2014-02-03 16:14 ` [PATCH 06/18] libxl: fork: Provide libxl_childproc_sigchld_occurred Ian Jackson
2014-02-03 16:14 ` [PATCH 07/18] libxl: fork: Provide ..._always_selective_reap Ian Jackson
2014-02-03 16:14 ` [PATCH 08/18] libxl: fork: Provide LIBXL_HAVE_SIGCHLD_SELECTIVE_REAP Ian Jackson
2014-02-03 16:14 ` [PATCH 09/18] libxl: fork: Rename sigchld handler functions Ian Jackson
2014-02-03 16:14 ` [PATCH 10/18] libxl: fork: Break out sigchld_installhandler_core Ian Jackson
2014-02-03 16:14 ` [PATCH 11/18] libxl: fork: Break out sigchld_sethandler_raw Ian Jackson
2014-02-06 13:53   ` Ian Campbell
2014-02-03 16:14 ` [PATCH 12/18] libxl: fork: Share SIGCHLD handler amongst ctxs Ian Jackson
2014-02-03 16:14 ` [PATCH 13/18] libxl: events: Break out libxl__pipe_nonblock, _close Ian Jackson
2014-02-03 16:14 ` [PATCH 14/18] libxl: fork: Make SIGCHLD self-pipe nonblocking Ian Jackson
2014-02-03 16:14 ` [PATCH 15/18] libxl: events: Makefile builds internal unit tests Ian Jackson
2014-02-06 14:00   ` Ian Campbell
2014-02-03 16:14 ` [PATCH 16/18] libxl: events: timedereg internal unit test Ian Jackson
2014-02-06 14:01   ` Ian Campbell
2014-02-03 16:14 ` Ian Jackson [this message]
2014-02-06 14:02   ` [PATCH 17/18] libxl: timeouts: Break out time_occurs Ian Campbell
2014-02-03 16:14 ` [PATCH 18/18] libxl: timeouts: Record deregistration when one occurs Ian Jackson
2014-02-06 14:04   ` Ian Campbell
2014-02-06 14:24     ` Ian Jackson
2014-02-06 14:27       ` Ian Campbell
2014-02-03 16:16 ` [PATCH 00/18 v3] libxl: fork and event fixes for libvirt and 4.4 Ian Jackson
2014-02-05  5:46   ` Jim Fehlig
2014-02-05 11:21     ` Ian Jackson
2014-02-05 14:10 ` George Dunlap
2014-02-05 15:03   ` Ian Jackson
2014-02-06 10:52     ` George Dunlap
2014-02-06 12:35       ` Ian Jackson
2014-02-06 14:07         ` Ian Campbell
2014-02-06 14:33           ` Ian Jackson
2014-02-07  4:17       ` Jim Fehlig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391444091-22796-18-git-send-email-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ijackson@chiark.greenend.org.uk \
    --cc=jfehlig@suse.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).