All of lore.kernel.org
 help / color / mirror / Atom feed
From: "hch@lst.de" <hch@lst.de>
To: Kanchan Joshi <joshiiitr@gmail.com>
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
	Kanchan Joshi <joshi.k@samsung.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>, "hch@lst.de" <hch@lst.de>,
	"kbusch@kernel.org" <kbusch@kernel.org>,
	"io-uring@vger.kernel.org" <io-uring@vger.kernel.org>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"anuj20.g@samsung.com" <anuj20.g@samsung.com>,
	"javier.gonz@samsung.com" <javier.gonz@samsung.com>
Subject: Re: [RFC 3/3] nvme: wire up support for async passthrough
Date: Fri, 5 Mar 2021 14:22:20 +0100	[thread overview]
Message-ID: <20210305132220.GA10000@lst.de> (raw)
In-Reply-To: <CA+1E3rJZWkOw+ZfDGduQhdhTh+=JVe5CcFEZtfQ1Jmq6mKhbSA@mail.gmail.com>

On Thu, Mar 04, 2021 at 04:25:41PM +0530, Kanchan Joshi wrote:
> On Thu, Mar 4, 2021 at 12:22 AM Chaitanya Kulkarni
> <Chaitanya.Kulkarni@wdc.com> wrote:
> >
> > On 3/2/21 23:22, Kanchan Joshi wrote:
> > > +     switch (bcmd->ioctl_cmd) {
> > > +     case NVME_IOCTL_IO_CMD:
> > > +             ret = nvme_user_cmd(ns->ctrl, ns, argp, ioucmd);
> > > +             break;
> > > +     default:
> > > +             ret = -ENOTTY;
> > > +     }
> > Switch for one case ? why not use if else ?
> 
> Indeed, I should have used that. I had started off with more than one,
> and retracted later.

I have to say I really do like the switch for ioctl handlers, as they
are designed as a multiplexer, and nothing screams multiplexer more
than a switch statement.

WARNING: multiple messages have this Message-ID (diff)
From: "hch@lst.de" <hch@lst.de>
To: Kanchan Joshi <joshiiitr@gmail.com>
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
	Kanchan Joshi <joshi.k@samsung.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>, "hch@lst.de" <hch@lst.de>,
	"kbusch@kernel.org" <kbusch@kernel.org>,
	"io-uring@vger.kernel.org" <io-uring@vger.kernel.org>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"anuj20.g@samsung.com" <anuj20.g@samsung.com>,
	"javier.gonz@samsung.com" <javier.gonz@samsung.com>
Subject: Re: [RFC 3/3] nvme: wire up support for async passthrough
Date: Fri, 5 Mar 2021 14:22:20 +0100	[thread overview]
Message-ID: <20210305132220.GA10000@lst.de> (raw)
In-Reply-To: <CA+1E3rJZWkOw+ZfDGduQhdhTh+=JVe5CcFEZtfQ1Jmq6mKhbSA@mail.gmail.com>

On Thu, Mar 04, 2021 at 04:25:41PM +0530, Kanchan Joshi wrote:
> On Thu, Mar 4, 2021 at 12:22 AM Chaitanya Kulkarni
> <Chaitanya.Kulkarni@wdc.com> wrote:
> >
> > On 3/2/21 23:22, Kanchan Joshi wrote:
> > > +     switch (bcmd->ioctl_cmd) {
> > > +     case NVME_IOCTL_IO_CMD:
> > > +             ret = nvme_user_cmd(ns->ctrl, ns, argp, ioucmd);
> > > +             break;
> > > +     default:
> > > +             ret = -ENOTTY;
> > > +     }
> > Switch for one case ? why not use if else ?
> 
> Indeed, I should have used that. I had started off with more than one,
> and retracted later.

I have to say I really do like the switch for ioctl handlers, as they
are designed as a multiplexer, and nothing screams multiplexer more
than a switch statement.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2021-03-05 13:23 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210302160907epcas5p4d04ab7c4ef4d467302498f06ed656b24@epcas5p4.samsung.com>
2021-03-02 16:07 ` [RFC 0/3] Async nvme passthrough Kanchan Joshi
2021-03-02 16:07   ` Kanchan Joshi
     [not found]   ` <CGME20210302161000epcas5p3ec5c461a8eec593b6d83a9127c7fec4f@epcas5p3.samsung.com>
2021-03-02 16:07     ` [RFC 1/3] io_uring: add helper for uring_cmd completion in submitter-task Kanchan Joshi
2021-03-02 16:07       ` Kanchan Joshi
     [not found]   ` <CGME20210302161005epcas5p23f28fe21bab5a3e07b9b382dd2406fdc@epcas5p2.samsung.com>
2021-03-02 16:07     ` [RFC 2/3] nvme: passthrough helper with callback Kanchan Joshi
2021-03-02 16:07       ` Kanchan Joshi
2021-03-03  7:52       ` Chaitanya Kulkarni
2021-03-03  7:52         ` Chaitanya Kulkarni
2021-03-04 11:13         ` Kanchan Joshi
2021-03-04 11:13           ` Kanchan Joshi
2021-03-05  4:14           ` Chaitanya Kulkarni
2021-03-05  4:14             ` Chaitanya Kulkarni
2021-03-05 10:40             ` Kanchan Joshi
2021-03-05 10:40               ` Kanchan Joshi
     [not found]   ` <CGME20210302161010epcas5p4da13d3f866ff4ed45c04fb82929d1c83@epcas5p4.samsung.com>
2021-03-02 16:07     ` [RFC 3/3] nvme: wire up support for async passthrough Kanchan Joshi
2021-03-02 16:07       ` Kanchan Joshi
2021-03-03  7:34       ` Chaitanya Kulkarni
2021-03-03  7:34         ` Chaitanya Kulkarni
2021-03-04 11:01         ` Kanchan Joshi
2021-03-04 11:01           ` Kanchan Joshi
2021-03-04 22:59           ` Chaitanya Kulkarni
2021-03-04 22:59             ` Chaitanya Kulkarni
2021-03-05  1:46             ` Jens Axboe
2021-03-05  1:46               ` Jens Axboe
2021-03-05  2:41           ` Keith Busch
2021-03-05  2:41             ` Keith Busch
2021-03-05 10:44             ` Kanchan Joshi
2021-03-05 10:44               ` Kanchan Joshi
2021-03-05 13:17             ` hch
2021-03-05 13:17               ` hch
2021-03-03  7:35       ` Chaitanya Kulkarni
2021-03-03  7:35         ` Chaitanya Kulkarni
2021-03-04 10:55         ` Kanchan Joshi
2021-03-04 10:55           ` Kanchan Joshi
2021-03-05 13:22           ` hch [this message]
2021-03-05 13:22             ` hch
2021-03-03  7:37       ` Chaitanya Kulkarni
2021-03-03  7:37         ` Chaitanya Kulkarni

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=20210305132220.GA10000@lst.de \
    --to=hch@lst.de \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=anuj20.g@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=javier.gonz@samsung.com \
    --cc=joshi.k@samsung.com \
    --cc=joshiiitr@gmail.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.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.