[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 5/7] netbuf: move dev_id from remus_state to netbuf_state



Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx>
---
 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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.