linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: jgross@suse.com, xen-devel@lists.xen.org,
	linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
	JBottomley@parallels.com, konrad.wilk@oracle.com,
	hch@infradead.org
Subject: Re: [PATCH V3 2/4] Introduce xen-scsifront module
Date: Mon, 4 Aug 2014 13:16:09 +0100	[thread overview]
Message-ID: <53DF7989.8040603@citrix.com> (raw)
In-Reply-To: <1407140870-542-3-git-send-email-jgross@suse.com>

On 04/08/14 09:27, jgross@suse.com wrote:
> 
> +
> +static void scsifront_backend_changed(struct xenbus_device *dev,
> +				      enum xenbus_state backend_state)
> +{
> +	struct vscsifrnt_info *info = dev_get_drvdata(&dev->dev);
> +
> +	DPRINTK("%p %u %u\n", dev, dev->state, backend_state);
> +
> +	switch (backend_state) {
> +	case XenbusStateUnknown:
> +	case XenbusStateInitialising:
> +	case XenbusStateInitWait:
> +	case XenbusStateInitialised:
> +		break;
> +
> +	case XenbusStateConnected:
> +		scsifront_read_backend_params(dev, info);
> +		if (xenbus_read_driver_state(dev->nodename) ==
> +			XenbusStateInitialised) {
> +			scsifront_do_lun_hotplug(info, VSCSIFRONT_OP_ADD_LUN);
> +		}
> +
> +		if (dev->state != XenbusStateConnected)
> +			xenbus_switch_state(dev, XenbusStateConnected);
> +		break;
> +
> +	case XenbusStateClosed:
> +		if (dev->state == XenbusStateClosed)
> +			break;
> +		/* Missed the backend's Closing state -- fallthrough */
> +	case XenbusStateClosing:
> +		scsifront_disconnect(info);
> +		break;
> +
> +	case XenbusStateReconfiguring:
> +		scsifront_do_lun_hotplug(info, VSCSIFRONT_OP_DEL_LUN);
> +		xenbus_switch_state(dev, XenbusStateReconfiguring);
> +		break;
> +
> +	case XenbusStateReconfigured:
> +		scsifront_do_lun_hotplug(info, VSCSIFRONT_OP_ADD_LUN);
> +		xenbus_switch_state(dev, XenbusStateConnected);
> +		break;
> +	}
> +}

I would like to see this state machine in common code but I'm not going
to insist on it since this is a existing driver.

Xen related parts:

Acked-by: David Vrabel <david.vrabel@citrix.com>

David

  reply	other threads:[~2014-08-04 12:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04  8:27 [PATCH V3 0/4] Add XEN pvSCSI support jgross
2014-08-04  8:27 ` [PATCH V3 1/4] Add XEN pvSCSI protocol description jgross
2014-08-04 10:10   ` [Xen-devel] " Jan Beulich
2014-08-04 10:39     ` Juergen Gross
2014-08-04  8:27 ` [PATCH V3 2/4] Introduce xen-scsifront module jgross
2014-08-04 12:16   ` David Vrabel [this message]
2014-08-04  8:27 ` [PATCH V3 3/4] Introduce XEN scsiback module jgross
2014-08-04 12:18   ` David Vrabel
2014-08-04  8:27 ` [PATCH V3 4/4] add xen pvscsi maintainer jgross

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=53DF7989.8040603@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=JBottomley@parallels.com \
    --cc=hch@infradead.org \
    --cc=jgross@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=target-devel@vger.kernel.org \
    --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 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).