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

[xen master] tools/xenstore: replace literal domid 0 with dom0_domid



commit a401b48f378f7b29c7b1f4ea0dc4262aef42bd00
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Wed Jan 18 10:50:08 2023 +0100
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: replace literal domid 0 with dom0_domid
    
    There are some places left where dom0 is associated with domid 0.
    
    Use dom0_domid instead.
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
---
 tools/xenstore/xenstored_core.c   | 5 +++--
 tools/xenstore/xenstored_domain.c | 8 ++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 4582ee39e1..9cfde76898 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2297,9 +2297,10 @@ static void accept_connection(int sock)
                return;
 
        conn = new_connection(&socket_funcs);
-       if (conn)
+       if (conn) {
                conn->fd = fd;
-       else
+               conn->id = dom0_domid;
+       } else
                close(fd);
 }
 #endif
diff --git a/tools/xenstore/xenstored_domain.c 
b/tools/xenstore/xenstored_domain.c
index 703ddeec4e..a703c0ef47 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -326,7 +326,7 @@ static int destroy_domain(void *_domain)
        if (domain->interface) {
                /* Domain 0 was mapped by dom0_init, so it must be unmapped
                   using munmap() and not the grant unmap call. */
-               if (domain->domid == 0)
+               if (domain->domid == dom0_domid)
                        unmap_xenbus(domain->interface);
                else
                        unmap_interface(domain->interface);
@@ -410,7 +410,7 @@ void handle_event(void)
 
 static bool domid_is_unprivileged(unsigned int domid)
 {
-       return domid != 0 && domid != priv_domid;
+       return domid != dom0_domid && domid != priv_domid;
 }
 
 bool domain_is_unprivileged(struct connection *conn)
@@ -798,7 +798,7 @@ static struct domain *onearg_domain(struct connection *conn,
                return ERR_PTR(-EINVAL);
 
        domid = atoi(domid_str);
-       if (!domid)
+       if (domid == dom0_domid)
                return ERR_PTR(-EINVAL);
 
        return find_connected_domain(domid);
@@ -1004,7 +1004,7 @@ static int chk_domain_generation(unsigned int domid, 
uint64_t gen)
 {
        struct domain *d;
 
-       if (!xc_handle && domid == 0)
+       if (!xc_handle && domid == dom0_domid)
                return 1;
 
        d = find_domain_struct(domid);
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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