xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Yang Hongyang <yanghy@cn.fujitsu.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: wei.liu2@citrix.com, wency@cn.fujitsu.com,
	andrew.cooper3@citrix.com, yunhong.jiang@intel.com,
	xen-devel@lists.xen.org, rshriram@cs.ubc.ca
Subject: Re: [PATCH v1 1/5] libxl/save: Refactor libxl__domain_suspend_state
Date: Wed, 3 Jun 2015 10:24:03 +0100	[thread overview]
Message-ID: <1433323443.7108.31.camel@citrix.com> (raw)
In-Reply-To: <556DD55B.1070606@cn.fujitsu.com>

On Wed, 2015-06-03 at 00:10 +0800, Yang Hongyang wrote:
> On 06/02/2015 10:40 PM, Ian Campbell wrote:
> > On Wed, 2015-05-20 at 18:01 +0800, Yang Hongyang wrote:
> >> @@ -1762,16 +1762,18 @@ static void libxl__domain_suspend_callback(void *data)
> >>   {
> >>       libxl__save_helper_state *shs = data;
> >>       libxl__egc *egc = shs->egc;
> >> -    libxl__domain_suspend_state *dss = CONTAINER_OF(shs, *dss, shs);
> >> +    libxl__domain_save_state *dss = CONTAINER_OF(shs, *dss, shs);
> >> +    libxl__domain_suspend_state *dss2 = &dss->dss;
> >
> > With dss now being ambiguously save vs suspend I don't think adding a 2
> > suffix to one of the usages is the right answer.
> >
> > I think in contexts where you are dealing with both that *save_state and
> > *suspend_state are the way to go for the local variables. I'm afraid
> > this will make the change noisier, sorry.
> >
> > I'm afraid I think that the dss member of struct
> > libxl__domain_save_state will therefore also need to be called
> > suspend_state too.
> >
> > I think we can tolerate using dss in contexts where there is only one of
> > the two structs in active use, just to avoid even more noise.
> >
> > Alternatively if there is another name for either "save" or "suspend"
> > which doesn't start with an s (or conflict with some other type) perhaps
> > we could go with that. I can't think of one off hand.
> >
> > Another name might also help because the semantic difference between
> > suspend and save is something I have to think about every time. Is there
> > a split along live/dead lines which we could use here perhaps?
> >
> >
> >>   static void domain_suspend_callback_common_done(libxl__egc *egc,
> >>                                   libxl__domain_suspend_state *dss, int ok)
> >>   {
> >> -    libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, ok);
> >> +    libxl__domain_save_state *dsvs = CONTAINER_OF(dss, *dsvs, dss);
> >
> > I suppose dsvs is a bit better then dss2. Maybe that's the answer, if
> > used consistently.
> 
> If use dsvs to represent save_state consistently, the modification of the
> code will be too much. I'm thinking of using "dsps" stands for
> domain_suspend_state, is it ok?

So in some contexts you would have "dss" (existing save state) and
"dsps" (new suspend state), which is potentially confusing so I think it
would be worth renaming dss to dsvs in at least those places, it's
mechanical so although noisy it's not too bad.

Ian (J) is the main author if this code (and therefore chose the
existing names), it might be worth giving him a chance to object or
suggest an alternative.

Ian.

  reply	other threads:[~2015-06-03  9:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-20 10:01 [PATCH v1 0/5] Misc cleanups for libxl Yang Hongyang
2015-05-20 10:01 ` [PATCH v1 1/5] libxl/save: Refactor libxl__domain_suspend_state Yang Hongyang
2015-06-02 14:40   ` Ian Campbell
2015-06-02 16:10     ` Yang Hongyang
2015-06-03  9:24       ` Ian Campbell [this message]
2015-06-03  9:50         ` Yang Hongyang
2015-06-03 10:03         ` Yang Hongyang
2015-05-20 10:01 ` [PATCH v1 2/5] tools/libxl: move domain suspend codes into a separate file Yang Hongyang
2015-06-02 14:44   ` Ian Campbell
2015-06-02 14:45   ` Ian Campbell
2015-06-02 16:10     ` Yang Hongyang
2015-05-20 10:01 ` [PATCH v1 3/5] tools/libxl: move remus codes into libxl_remus.c Yang Hongyang
2015-06-02 14:46   ` Ian Campbell
2015-06-02 16:13     ` Yang Hongyang
2015-05-20 10:01 ` [PATCH v1 4/5] tools/libxl: move toolstack code into libxl_toolstack.c Yang Hongyang
2015-06-02 14:48   ` Ian Campbell
2015-06-02 16:22     ` Yang Hongyang
2015-06-03  2:52       ` Yang Hongyang
2015-06-03  9:24         ` Ian Campbell
2015-05-20 10:01 ` [PATCH v1 5/5] tools/libxl: move domain save codes into libxl_dom_save.c Yang Hongyang
2015-05-27  8:30 ` [PATCH v1 0/5] Misc cleanups for libxl Yang Hongyang
2015-06-02 14:53 ` Ian Campbell
2015-06-02 16:25   ` Yang Hongyang

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=1433323443.7108.31.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=rshriram@cs.ubc.ca \
    --cc=wei.liu2@citrix.com \
    --cc=wency@cn.fujitsu.com \
    --cc=xen-devel@lists.xen.org \
    --cc=yanghy@cn.fujitsu.com \
    --cc=yunhong.jiang@intel.com \
    /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).