[PATCH 2/2] nvme: identify-namespace without CAP_SYS_ADMIN

Chaitanya Kulkarni chaitanyak at nvidia.com
Mon Oct 31 22:20:52 PDT 2022


> Do you think that'll give better looking code?
> I did not write that because it did not seem good fit for the
> situtation. It involved aligning more curly braces:
> -       /* admin commands are not allowed */
> -       if (!ns)
> +       if (!ns) {
> +               switch (opcode) {
> +               case nvme_admin_identify: {
> +                       switch (c->identify.cns) {
> +                       case NVME_ID_CNS_NS:
> +                       case NVME_ID_CNS_CS_NS:
> +                       case NVME_ID_CNS_NS_CS_INDEP:
> +                               return true;
> +                       }
> +               }
> +               }
>                 return false;
> +       }
> 

this is exact pattern we have used in the target when it comes to
nvme_admin_identify handling, so it makes sense to keep the same,
unless there is any strong objection..

> Above is without default. And with two defaults, it just gets more
> wordy.
> And future growth in above admin opcodes is not expected too.
> 

-ck



More information about the Linux-nvme mailing list