From: Ian Campbell <ian.campbell@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: <xen-devel@lists.xen.org>, <netdev@vger.kernel.org>,
<david.vrabel@citrix.com>
Subject: Re: [PATCH net] xen: netback: read hotplug script once at start of day.
Date: Mon, 1 Jun 2015 09:52:45 +0100 [thread overview]
Message-ID: <1433148765.15036.79.camel@citrix.com> (raw)
In-Reply-To: <20150529173850.GI30474@zion.uk.xensource.com>
On Fri, 2015-05-29 at 18:38 +0100, Wei Liu wrote:
> On Fri, May 29, 2015 at 05:24:53PM +0100, Ian Campbell wrote:
> [...]
> > if (be->vif != NULL)
> > return 0;
> > @@ -417,12 +409,23 @@ static int backend_create_xenvif(struct backend_info *be)
> > return (err < 0) ? err : -EINVAL;
> > }
> >
> > + script = xenbus_read(XBT_NIL, dev->nodename, "script", NULL);
> > + if (IS_ERR(script)) {
> > + int err = PTR_ERR(script);
> > + xenbus_dev_fatal(dev, err, "reading script");
> > + return err;
> > + }
> > +
> > vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle);
> > if (IS_ERR(vif)) {
> > err = PTR_ERR(vif);
> > xenbus_dev_fatal(dev, err, "creating interface");
> > + kfree(script);
> > return err;
> > }
> > +
> > + vif->hotplug_script = script;
> > +
>
> IMO it's better we make xenvif_alloc accept a new parameter called
> "script" then allocate vif->hotplug_script there. Then free
> vif->hotplug_script in xenvif_free. This way it's less error prone
> because all memory allocated for vif is managed in proper place -
> xenvif_alloc and xenvif_free.
Well, except the allocation is still in xenbus_read via
backend_create_xenvif, but yes I think that refactoring would be an
improvement.
What about storing it in struct backend_info and setting/restoring in
netback_{probe,remove}? That might be best of all?
Ian.
next prev parent reply other threads:[~2015-06-01 8:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-29 16:24 [PATCH net] xen: netback: read hotplug script once at start of day Ian Campbell
2015-05-29 16:28 ` David Vrabel
2015-05-29 16:28 ` David Vrabel
2015-05-29 17:38 ` Wei Liu
2015-05-29 17:38 ` Wei Liu
2015-06-01 8:52 ` Ian Campbell
2015-06-01 8:52 ` Ian Campbell [this message]
2015-06-01 9:07 ` Wei Liu
2015-06-01 9:07 ` Wei Liu
-- strict thread matches above, loose matches on Subject: below --
2015-05-29 16:24 Ian Campbell
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=1433148765.15036.79.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=david.vrabel@citrix.com \
--cc=netdev@vger.kernel.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.