From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: [PATCH] Cleanup error paths in xen/common/dom0_ops.c Date: Wed, 09 Mar 2005 14:28:31 -0600 Message-ID: <422F5C6F.2080107@us.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010203050404040207030906" Sender: xen-devel-admin@lists.sourceforge.net Errors-To: xen-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------010203050404040207030906 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I've written an automated dom0_op generator in an effort to test the libxc rewrite. The tool is still awfully primative and the rewrite is not yet complete but I wanted to post fixes for some bugs the tool found so I wouldn't forget. The first makes sure that builddomain returns ESRCH when passed an invalid domain ID (this is what every other dom0_op returns). The second makes sure that unpausedomain returns EINVAL if you try to unpause yourself. This is the behavior of pausedomain and is a bit more sane than just returning 0. I've tested this on today's unstable (able to boot and create domains with Xend just as before). Regards, Anthony Liguori Signed-off-by: Anthony Liguori (aliguori@us.ibm.com) --------------010203050404040207030906 Content-Type: text/x-patch; name="dom0_op_error.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="dom0_op_error.diff" --- xen-unstable/xen/common/dom0_ops.c~ 2005-03-08 22:12:28.000000000 -0600 +++ xen-unstable/xen/common/dom0_ops.c 2005-03-09 14:03:05.000000000 -0600 @@ -114,7 +114,7 @@ case DOM0_BUILDDOMAIN: { struct domain *d = find_domain_by_id(op->u.builddomain.domain); - ret = -EINVAL; + ret = -ESRCH; if ( d != NULL ) { ret = final_setup_guest(d, &op->u.builddomain); @@ -147,10 +147,13 @@ if ( d != NULL ) { ret = -EINVAL; - if ( test_bit(DF_CONSTRUCTED, &d->d_flags) ) + if ( d != current->domain ) { - domain_unpause_by_systemcontroller(d); - ret = 0; + if ( test_bit(DF_CONSTRUCTED, &d->d_flags) ) + { + domain_unpause_by_systemcontroller(d); + ret = 0; + } } put_domain(d); } --------------010203050404040207030906-- ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click