From: Lai Jiangshan Subject: [PATCH 5/7] netbuf: move dev_id from remus_state to netbuf_state Date: Thu, 3 Apr 2014 20:22:37 +0800 Message-ID: <1396527759-10186-5-git-send-email-laijs@cn.fujitsu.com> References: <1396436677-10872-9-git-send-email-yanghy@cn.fujitsu.com> <1396527759-10186-1-git-send-email-laijs@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1396527759-10186-1-git-send-email-laijs@cn.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Ian Campbell , FNST-Wen Congyang , Stefano Stabellini , Andrew Cooper , Jiang Yunhong , Ian Jackson , Lai Jiangshan , Dong Eddie , Shriram Rajagopalan , FNST-Yang Hongyang , Roger Pau Monne List-Id: xen-devel@lists.xenproject.org Signed-off-by: Lai Jiangshan Signed-off-by: Wen Congyang --- tools/libxl/libxl_internal.h | 1 - tools/libxl/libxl_netbuffer.c | 17 +++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index bf92975..4e07969 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2442,7 +2442,6 @@ typedef struct libxl__remus_state { /* private */ int saved_rc; - int dev_id; /* Opaque context containing network buffer related stuff */ void *netbuf_state; /* used for checkpoint */ diff --git a/tools/libxl/libxl_netbuffer.c b/tools/libxl/libxl_netbuffer.c index d996832..cd822f8 100644 --- a/tools/libxl/libxl_netbuffer.c +++ b/tools/libxl/libxl_netbuffer.c @@ -32,6 +32,7 @@ typedef struct libxl__remus_netbuf_state { const char **vif_list; const char **ifb_list; uint32_t num_netbufs; + int dev_id; libxl_async_exec async_exec; } libxl__remus_netbuf_state; @@ -254,8 +255,8 @@ static void setup_env(libxl_async_exec *async_exec, char *op, /* Convenience aliases */ char *const script = libxl__strdup(gc, remus_state->netbufscript); const uint32_t domid = remus_state->dss->domid; - const int devid = remus_state->dev_id; libxl__remus_netbuf_state *const netbuf_state = remus_state->netbuf_state; + const int devid = netbuf_state->dev_id; const char *const vif = netbuf_state->vif_list[devid]; const char *const ifb = netbuf_state->ifb_list[devid]; @@ -296,8 +297,8 @@ static void netbuf_setup_script_cb(void *opaque, int status) /* Convenience aliases */ const uint32_t domid = remus_state->dss->domid; - const int devid = remus_state->dev_id; libxl__remus_netbuf_state *const netbuf_state = remus_state->netbuf_state; + const int devid = netbuf_state->dev_id; const char *const vif = netbuf_state->vif_list[devid]; const char **const ifb = &netbuf_state->ifb_list[devid]; @@ -339,8 +340,8 @@ static void netbuf_setup_script_cb(void *opaque, int status) } LOG(DEBUG, "%s will buffer packets from vif %s", *ifb, vif); - remus_state->dev_id++; - if (remus_state->dev_id < netbuf_state->num_netbufs) { + netbuf_state->dev_id++; + if (netbuf_state->dev_id < netbuf_state->num_netbufs) { setup_env(&netbuf_state->async_exec, "setup", remus_state); if (libxl_async_exec_script(gc, &netbuf_state->async_exec)) goto out; @@ -386,7 +387,7 @@ void libxl__remus_netbuf_setup(libxl__egc *egc, GCNEW_ARRAY(netbuf_state->ifb_list, num_netbufs); netbuf_state->num_netbufs = num_netbufs; remus_state->netbuf_state = netbuf_state; - remus_state->dev_id = 0; + netbuf_state->dev_id = 0; netbuf_state->async_exec.timeout = LIBXL_HOTPLUG_TIMEOUT; netbuf_state->async_exec.opaque = remus_state; @@ -410,8 +411,8 @@ static void netbuf_teardown_script_cb(void *opaque, int status) STATE_AO_GC(remus_state->dss->ao); - remus_state->dev_id++; - if (remus_state->dev_id < netbuf_state->num_netbufs) { + netbuf_state->dev_id++; + if (netbuf_state->dev_id < netbuf_state->num_netbufs) { setup_env(&netbuf_state->async_exec, "teardown", remus_state); if (libxl_async_exec_script(gc, &netbuf_state->async_exec)) goto out; @@ -443,7 +444,7 @@ void libxl__remus_netbuf_teardown(libxl__egc *egc, netbuf_state->async_exec.opaque = remus_state; netbuf_state->async_exec.finish_cb = netbuf_teardown_script_cb; netbuf_state->async_exec.ao = ao; - remus_state->dev_id = 0; + netbuf_state->dev_id = 0; setup_env(&netbuf_state->async_exec, "teardown", remus_state); if (libxl_async_exec_script(gc, &netbuf_state->async_exec)) -- 1.7.4.4