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.