Re: [PATCH] kvm tool: rewrite kvm__init

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

 



On Fri, 2012-02-10 at 11:03 +0800, Yang Bai wrote:
> On Fri, Feb 10, 2012 at 12:53 PM, Sasha Levin <levinsasha928@xxxxxxxxx> wrote:
> > On Fri, 2012-02-10 at 10:34 +0800, Yang Bai wrote:
> >> On Thu, Feb 9, 2012 at 9:07 PM, Cyrill Gorcunov <gorcunov@xxxxxxxxxx> wrote:
> >> > On Thu, Feb 09, 2012 at 03:01:26PM +0200, Pekka Enberg wrote:
> >> >> On Thu, Feb 9, 2012 at 7:40 AM, Yang Bai <hamo.by@xxxxxxxxx> wrote:
> >> >> > Since the different issues have been handled in the
> >> >> > internal of kvm__init, it can only return NULL if error
> >> >> > happened.
> >> >> >
> >> >> > Signed-off-by: Yang Bai <hamo.by@xxxxxxxxx>
> >> >>
> >> >> Sorry, I don't understand what this patch is attempting to fix? Why do
> >> >> you think it's better to drop the explicit error codes and always
> >> >> return NULL upon error?
> >> >>
> >>
> >> Ok. Since the different issues have been handled in the internal of
> >> this function and the caller does not care about the real error
> >> reasons. So just return NULL if error will simplify the error handle
> >> of the caller.
> >
> > Um... why doesn't the caller care about the real error? It's whats being
> > sent back to userspace and can help the caller determine whats going on.
> >
> Reading the source code, I found that the caller handle it as following:
> 
> static int kvm_cmd_run_init(int argc, const char **argv)
> {
> [snip]
> 	kvm = kvm__init(dev, hugetlbfs_path, ram_size, guest_name);
> 	if (IS_ERR(kvm)) {
> 		r = PTR_ERR(kvm);
> 		goto fail;
> 	}
> [snip]
> fail:
> 		return r;
> }
> 
> int kvm_cmd_run(int argc, const char **argv, const char *prefix)
> {
> [snip]
> 	r = kvm_cmd_run_init(argc, argv);
> 	if (r < 0)
> 		return r;
> [snip]
> }

>From what I gather from the code snippet you pasted is that we return
the error to the user, which can help him determine whats going on...

-- 

Sasha.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux