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

[Xen-devel] [PATCH 2/2] small cleanup for domain_create()



'struct domain' is always set to zero when it allocated, the only
exception is not defined 'CONFIG_IA64_PICKLE_DOMAIN' in ia64 architecture,
so we set it to zero in this case instead of in domain_create() function.

Signed-off-by: Xiao Guangrong <xiaoguangrong@xxxxxxxxxxxxxx>

diff -r ccae861f52f7 -r 632487ba7f63 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Thu May 06 11:59:55 2010 +0100
+++ b/xen/arch/ia64/xen/domain.c        Fri May 07 22:48:33 2010 +0800
@@ -407,20 +407,21 @@
 
 struct domain *alloc_domain_struct(void)
 {
+       struct domain *d;
 #ifdef CONFIG_IA64_PICKLE_DOMAIN
-       struct domain *d;
        /*
         * We pack the MFN of the domain structure into a 32-bit field within
         * the page_info structure. Hence the MEMF_bits() restriction.
         */
        d = alloc_xenheap_pages(get_order_from_bytes(sizeof(*d)),
                                MEMF_bits(32 + PAGE_SHIFT));
+#else
+       d = xmalloc(struct domain);
+#endif
+
        if ( d != NULL )
                memset(d, 0, sizeof(*d));
        return d;
-#else
-       return xmalloc(struct domain);
-#endif
 }
 
 void free_domain_struct(struct domain *d)
diff -r ccae861f52f7 -r 632487ba7f63 xen/common/domain.c
--- a/xen/common/domain.c       Thu May 06 11:59:55 2010 +0100
+++ b/xen/common/domain.c       Fri May 07 22:48:33 2010 +0800
@@ -223,7 +223,6 @@
     if ( (d = alloc_domain_struct()) == NULL )
         return NULL;
 
-    memset(d, 0, sizeof(*d));
     d->domain_id = domid;
 
     lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid, "Domain");


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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