Linux block layer
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Ming Lei <ming.lei@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org,
	ZiyangZhang <ZiyangZhang@linux.alibaba.com>
Subject: Re: [PATCH V2 2/2] ublk_drv: make sure that correct flags(features) returned to userspace
Date: Fri, 22 Jul 2022 01:09:00 -0700	[thread overview]
Message-ID: <YtpbHPJDgwi3gMho@infradead.org> (raw)
In-Reply-To: <YtpSCX5ZC3cnWakM@T590>

On Fri, Jul 22, 2022 at 03:30:17PM +0800, Ming Lei wrote:
> > > +enum ublk_flag_bits {
> > > +	__UBLK_F_SUPPORT_ZERO_COPY,
> > > +	__UBLK_F_URING_CMD_COMP_IN_TASK,
> > > +	__UBLK_F_NR_BITS,
> > > +};
> > 
> > Please make these #defines so that userspace can detect if they
> > exist in a header using #ifdef.
> 
> userspace is supposed to only use UBLK_F_* instead of __UBLK_F_*, one
> benefit of using enum is that UBLK_F_NR_BITS can be figured out
> automatically, otherwise how can we figure out the max bits?

Oh, indeed.  But I don't think the automatic max index is really
that useful.  Just use a manually maintained in-kernel UBLK_F_ALL,
that is just as little overhead to maintain as the extra enum.
And if you forget to add a flag that code will never see it as it
gets cleared before the device is added.

  reply	other threads:[~2022-07-22  8:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22  5:09 [PATCH V2 0/2] ublk_drv: make sure that correct flags(features) returned to userspace Ming Lei
2022-07-22  5:09 ` [PATCH V2 1/2] ublk_drv: fix error handling of ublk_add_dev Ming Lei
2022-07-22  5:48   ` Christoph Hellwig
2022-07-22  6:17     ` Christoph Hellwig
2022-07-22  7:35       ` Ziyang Zhang
2022-07-22  5:58   ` Ziyang Zhang
2022-07-22  5:09 ` [PATCH V2 2/2] ublk_drv: make sure that correct flags(features) returned to userspace Ming Lei
2022-07-22  5:50   ` Christoph Hellwig
2022-07-22  7:30     ` Ming Lei
2022-07-22  8:09       ` Christoph Hellwig [this message]
2022-07-22  6:00   ` Ziyang Zhang

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=YtpbHPJDgwi3gMho@infradead.org \
    --to=hch@infradead.org \
    --cc=ZiyangZhang@linux.alibaba.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.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