From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: [PATCH 2/2] small cleanup for domain_create() Date: Fri, 07 May 2010 16:52:46 +0800 Message-ID: <4BE3D4DE.4060500@cn.fujitsu.com> References: <4BE3D48E.3010803@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4BE3D48E.3010803@cn.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org '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 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");