From: Sasha Levin <levinsasha928@gmail.com>
To: Yang Bai <hamo.by@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>,
Pekka Enberg <penberg@kernel.org>,
kvm@vger.kernel.org, Asias He <asias.hejun@gmail.com>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] kvm tool: rewrite kvm__init
Date: Thu, 09 Feb 2012 23:17:17 -0500 [thread overview]
Message-ID: <1328847437.7150.1.camel@lappy> (raw)
In-Reply-To: <CAO_0yfO0uzsg5gL53pzRJBVjcYSmB9YXjXybCiM7aP5UbKA6zg@mail.gmail.com>
On Fri, 2012-02-10 at 11:03 +0800, Yang Bai wrote:
> On Fri, Feb 10, 2012 at 12:53 PM, Sasha Levin <levinsasha928@gmail.com> 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@openvz.org> 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@gmail.com> 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@gmail.com>
> >> >>
> >> >> 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.
next prev parent reply other threads:[~2012-02-10 4:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-09 5:40 [PATCH] kvm tool: rewrite kvm__init Yang Bai
2012-02-09 13:01 ` Pekka Enberg
2012-02-09 13:07 ` Cyrill Gorcunov
2012-02-10 2:34 ` Yang Bai
2012-02-10 4:53 ` Sasha Levin
2012-02-10 3:03 ` Yang Bai
2012-02-10 4:17 ` Sasha Levin [this message]
2012-02-10 5:04 ` Yang Bai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1328847437.7150.1.camel@lappy \
--to=levinsasha928@gmail.com \
--cc=asias.hejun@gmail.com \
--cc=gorcunov@openvz.org \
--cc=hamo.by@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=penberg@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).