xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Emil Condrea <emilcondrea@gmail.com>
To: qemu-devel@nongnu.org
Cc: xuquan8@huawei.com, sstabellini@kernel.org, wei.liu2@citrix.com,
	stefanb@linux.vnet.ibm.com, xen-devel@lists.xen.org,
	anthony.perard@citrix.com, dgdegra@tycho.nsa.gov,
	eblake@redhat.com, Emil Condrea <emilcondrea@gmail.com>
Subject: [PATCH 08/15] xen: Move xenstore cleanup and mkdir functions
Date: Tue,  4 Oct 2016 09:43:37 +0300	[thread overview]
Message-ID: <1475563424-6604-9-git-send-email-emilcondrea@gmail.com> (raw)
In-Reply-To: <1475563424-6604-1-git-send-email-emilcondrea@gmail.com>

The name of the functions moved to xen_pvdev.c:
 * xenstore_cleanup_dir
 * xen_config_cleanup
 * xenstore_mkdir

Signed-off-by: Emil Condrea <emilcondrea@gmail.com>
---
 hw/xen/xen_backend.c | 49 -------------------------------------------------
 hw/xen/xen_pvdev.c   | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 49 deletions(-)

diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
index d572cd0..3518aac 100644
--- a/hw/xen/xen_backend.c
+++ b/hw/xen/xen_backend.c
@@ -48,57 +48,8 @@ struct xs_handle *xenstore = NULL;
 const char *xen_protocol;
 
 /* private */
-struct xs_dirs {
-    char *xs_dir;
-    QTAILQ_ENTRY(xs_dirs) list;
-};
-static QTAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup =
-    QTAILQ_HEAD_INITIALIZER(xs_cleanup);
-
 static int debug;
 
-static void xenstore_cleanup_dir(char *dir)
-{
-    struct xs_dirs *d;
-
-    d = g_malloc(sizeof(*d));
-    d->xs_dir = dir;
-    QTAILQ_INSERT_TAIL(&xs_cleanup, d, list);
-}
-
-void xen_config_cleanup(void)
-{
-    struct xs_dirs *d;
-
-    QTAILQ_FOREACH(d, &xs_cleanup, list) {
-        xs_rm(xenstore, 0, d->xs_dir);
-    }
-}
-
-int xenstore_mkdir(char *path, int p)
-{
-    struct xs_permissions perms[2] = {
-        {
-            .id    = 0, /* set owner: dom0 */
-        }, {
-            .id    = xen_domid,
-            .perms = p,
-        }
-    };
-
-    if (!xs_mkdir(xenstore, 0, path)) {
-        xen_be_printf(NULL, 0, "xs_mkdir %s: failed\n", path);
-        return -1;
-    }
-    xenstore_cleanup_dir(g_strdup(path));
-
-    if (!xs_set_permissions(xenstore, 0, path, perms, 2)) {
-        xen_be_printf(NULL, 0, "xs_set_permissions %s: failed\n", path);
-        return -1;
-    }
-    return 0;
-}
-
 int xenstore_write_be_str(struct XenDevice *xendev, const char *node, const char *val)
 {
     return xenstore_write_str(xendev->be, node, val);
diff --git a/hw/xen/xen_pvdev.c b/hw/xen/xen_pvdev.c
index 72e2e79..6c92624 100644
--- a/hw/xen/xen_pvdev.c
+++ b/hw/xen/xen_pvdev.c
@@ -25,11 +25,62 @@
 
 /* private */
 static int debug;
+
+struct xs_dirs {
+    char *xs_dir;
+    QTAILQ_ENTRY(xs_dirs) list;
+};
+
+static QTAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup =
+    QTAILQ_HEAD_INITIALIZER(xs_cleanup);
+
 static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs =
     QTAILQ_HEAD_INITIALIZER(xendevs);
 
 /* ------------------------------------------------------------- */
 
+static void xenstore_cleanup_dir(char *dir)
+{
+    struct xs_dirs *d;
+
+    d = g_malloc(sizeof(*d));
+    d->xs_dir = dir;
+    QTAILQ_INSERT_TAIL(&xs_cleanup, d, list);
+}
+
+void xen_config_cleanup(void)
+{
+    struct xs_dirs *d;
+
+    QTAILQ_FOREACH(d, &xs_cleanup, list) {
+        xs_rm(xenstore, 0, d->xs_dir);
+    }
+}
+
+int xenstore_mkdir(char *path, int p)
+{
+    struct xs_permissions perms[2] = {
+        {
+            .id    = 0, /* set owner: dom0 */
+        }, {
+            .id    = xen_domid,
+            .perms = p,
+        }
+    };
+
+    if (!xs_mkdir(xenstore, 0, path)) {
+        xen_be_printf(NULL, 0, "xs_mkdir %s: failed\n", path);
+        return -1;
+    }
+    xenstore_cleanup_dir(g_strdup(path));
+
+    if (!xs_set_permissions(xenstore, 0, path, perms, 2)) {
+        xen_be_printf(NULL, 0, "xs_set_permissions %s: failed\n", path);
+        return -1;
+    }
+    return 0;
+}
+
 int xenstore_write_str(const char *base, const char *node, const char *val)
 {
     char abspath[XEN_BUFSIZE];
-- 
1.9.1


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

  parent reply	other threads:[~2016-10-04  6:43 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1475563424-6604-1-git-send-email-emilcondrea@gmail.com>
2016-10-04  6:43 ` [PATCH 01/15] xen: Fix coding style errors Emil Condrea
2016-10-11 13:56   ` Anthony PERARD
     [not found]   ` <20161011135613.GB1812@perard.uk.xensource.com>
2016-10-13  3:48     ` Emil Condrea
2016-10-04  6:43 ` [PATCH 02/15] xen: Fix coding style warnings Emil Condrea
2016-10-04  6:43 ` [PATCH 03/15] xen: Create a new file xen_pvdev.c Emil Condrea
2016-10-11 14:38   ` Anthony PERARD
2016-10-04  6:43 ` [PATCH 04/15] xen: Create a new file xen_frontend.c Emil Condrea
2016-10-12 13:30   ` Anthony PERARD
2016-10-04  6:43 ` [PATCH 05/15] xen: Move xenstore_update to xen_pvdev.c Emil Condrea
2016-10-04  6:43 ` [PATCH 06/15] xen: Move evtchn functions " Emil Condrea
2016-10-04  6:43 ` [PATCH 07/15] xen: Prepare xendev qtail to be shared with frontends Emil Condrea
2016-10-04  6:43 ` Emil Condrea [this message]
2016-10-12 13:30   ` [PATCH 08/15] xen: Move xenstore cleanup and mkdir functions Anthony PERARD
2016-10-04  6:43 ` [PATCH 09/15] xen: Rename xen_be_printf to xen_pv_printf Emil Condrea
2016-10-12 13:31   ` Anthony PERARD
2016-10-04  6:43 ` [PATCH 10/15] xen: Rename xen_be_unbind_evtchn Emil Condrea
2016-10-12 13:37   ` Anthony PERARD
     [not found]   ` <20161012133701.GH1812@perard.uk.xensource.com>
2016-10-13  1:44     ` Xuquan (Quan Xu)
2016-10-04  6:43 ` [PATCH 11/15] xen: Rename xen_be_send_notify Emil Condrea
2016-10-12 13:40   ` Anthony PERARD
     [not found]   ` <20161012134040.GI1812@perard.uk.xensource.com>
2016-10-13  1:45     ` Xuquan (Quan Xu)
2016-10-04  6:43 ` [PATCH 12/15] xen: Rename xen_be_evtchn_event Emil Condrea
2016-10-12 13:41   ` Anthony PERARD
2016-10-13  1:46     ` Xuquan (Quan Xu)
2016-10-04  6:43 ` [PATCH 13/15] xen: Rename xen_be_find_xendev Emil Condrea
2016-10-12 13:42   ` Anthony PERARD
2016-10-13  1:46     ` Xuquan (Quan Xu)
2016-10-04  6:43 ` [PATCH 14/15] xen: Rename xen_be_del_xendev Emil Condrea
2016-10-12 13:46   ` Anthony PERARD
2016-10-13  1:47     ` Xuquan (Quan Xu)
2016-10-04  6:43 ` [PATCH 15/15] xen: Rename xen_be_frontend_changed Emil Condrea
     [not found] ` <1475563424-6604-16-git-send-email-emilcondrea@gmail.com>
2016-10-04  8:06   ` Paolo Bonzini
2016-10-04  8:08     ` Paolo Bonzini
2016-10-09 19:50     ` Emil Condrea
     [not found]     ` <CAAULxKLoqBcRFpifM-vKuvbNu=RB-Fn84S-KB3-xumYq7KU4=g@mail.gmail.com>
2016-10-12 11:00       ` Paolo Bonzini
     [not found]       ` <1cfdf5a0-0595-dee9-6956-c64dc8dddd2f@redhat.com>
2016-10-13  6:08         ` Emil Condrea
2016-10-13  6:32           ` Xuquan (Quan Xu)
2016-10-13  8:27             ` Paolo Bonzini
     [not found] ` <1475563424-6604-3-git-send-email-emilcondrea@gmail.com>
2016-10-11 14:20   ` [PATCH 02/15] xen: Fix coding style warnings Anthony PERARD
2016-10-13  4:04     ` Emil Condrea
     [not found]     ` <CAAULxKKeEzg7cD+2s78R43YVH_m0W_yxUWep3-Ysecjv5YNZdA@mail.gmail.com>
2016-10-13 11:35       ` Anthony PERARD
2016-10-13 15:59         ` Emil Condrea

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=1475563424-6604-9-git-send-email-emilcondrea@gmail.com \
    --to=emilcondrea@gmail.com \
    --cc=anthony.perard@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sstabellini@kernel.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    --cc=xuquan8@huawei.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).