]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: Add support for create-ns command endg-id option parameter
authorTokunori Ikegami <ikegami.t@gmail.com>
Tue, 11 Jul 2023 14:50:22 +0000 (23:50 +0900)
committerDaniel Wagner <wagi@monom.org>
Tue, 11 Jul 2023 18:52:46 +0000 (20:52 +0200)
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Documentation/nvme-create-ns.txt
completions/_nvme
completions/bash-nvme-completion.sh
nvme.c

index 5d1355d252a077ce9b6db5be0cda12413768be4e..28046b68e136aac451c139a0834167a0c9900692 100644 (file)
@@ -15,6 +15,7 @@ SYNOPSIS
                        [--nmic=<nmic> | -m <nmic>]
                        [--anagrp-id=<anagrpid> | -a <anagrpid>]
                        [--nvmset-id=<nvmsetid> | -i <nvmsetid>]
+                       [--endg-id=<endgid> | -e <endgid>]
                        [--csi=<command_set_identifier> | -y <command_set_identifier>]
                        [--lbstm=<lbstm> | -l <lbstm>]
                        [--nphndls=<nphndls> | -n <nphndls>]
@@ -69,6 +70,10 @@ OPTIONS
 --nvmset-id=<nvmsetid>::
        This field specifies the identifier of the NVM Set.
 
+-e <endgid>::
+--endg-id=<endgid>::
+       This field specifies the identifier of the endurance group.
+
 -y <command_set_identifier>::
 --csi=<command_set_identifier>::
        This field specifies the identifier of command set.
index 49736f587a76fa8a2ffeb3f0bfd5bfed226d6293..3c8dd47a7b5d35be8046a84b73adfa874eb82179 100644 (file)
@@ -525,6 +525,8 @@ _nvme () {
                        -a':alias of --anagrp-id'
                        --nvmset-id=':NVM Set Identifier'
                        -i':alias of --nvmset-id'
+                       --endg-id=':Endurance Group Identifier'
+                       -e':alias of --endg-id'
                        --block-size=':target block size'
                        -b':alias of --block-size'
                        --timeout=':value for timeout'
index 8f451ff944415741eedae761482edc2da28aa2a7..223f9b50a8e1ad7935d301f726841a262bd17f2b 100644 (file)
@@ -114,7 +114,7 @@ nvme_list_opts () {
                        --dps= -d --nmic= -m --anagrp-id= -a --nvmset-id= -i \
                        --block-size= -b --timeout= -t --csi= -y --lbstm= -l \
                        --nphndls= -n --nsze-si= -S --ncap-si= -C --azr -z --rar= -r \
-                       --ror= -o --rnumzrwa= -u --phndls= -p"
+                       --ror= -o --rnumzrwa= -u --phndls= -p --endg-id= -e"
                        ;;
                "delete-ns")
                opts+=" -namespace-id= -n --timeout= -t"
diff --git a/nvme.c b/nvme.c
index ee38ba76c7e27696bd6ef17a9d74c02681b41297..b35f9003b80d8f7e4363eda278d501c761b71768 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -3032,6 +3032,7 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin *
        const char *nmic = "multipath and sharing capabilities (NMIC)";
        const char *anagrpid = "ANA Group Identifier (ANAGRPID)";
        const char *nvmsetid = "NVM Set Identifier (NVMSETID)";
+       const char *endgid = "Endurance Group Identifier (ENDGID)";
        const char *csi = "command set identifier (CSI)";
        const char *lbstm = "logical block storage tag mask (LBSTM)";
        const char *nphndls = "Number of Placement Handles (NPHNDLS)";
@@ -3060,6 +3061,7 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin *
                __u8    nmic;
                __u32   anagrpid;
                __u16   nvmsetid;
+               __u16   endgid;
                __u64   bs;
                __u32   timeout;
                __u8    csi;
@@ -3082,7 +3084,8 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin *
                .nmic           = 0,
                .anagrpid       = 0,
                .nvmsetid       = 0,
-               .bs                     = 0x00,
+               .endgid         = 0,
+               .bs             = 0x00,
                .timeout        = 120000,
                .csi            = 0,
                .lbstm          = 0,
@@ -3102,20 +3105,21 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin *
                OPT_BYTE("flbas",        'f', &cfg.flbas,    flbas),
                OPT_BYTE("dps",          'd', &cfg.dps,      dps),
                OPT_BYTE("nmic",         'm', &cfg.nmic,     nmic),
-               OPT_UINT("anagrp-id",    'a', &cfg.anagrpid, anagrpid),
-               OPT_UINT("nvmset-id",    'i', &cfg.nvmsetid, nvmsetid),
+               OPT_UINT("anagrp-id",    'a', &cfg.anagrpid, anagrpid),
+               OPT_UINT("nvmset-id",    'i', &cfg.nvmsetid, nvmsetid),
+               OPT_UINT("endg-id",      'e', &cfg.endgid,   endgid),
                OPT_SUFFIX("block-size", 'b', &cfg.bs,       bs),
                OPT_UINT("timeout",      't', &cfg.timeout,  timeout),
                OPT_BYTE("csi",          'y', &cfg.csi,      csi),
                OPT_SUFFIX("lbstm",      'l', &cfg.lbstm,    lbstm),
-               OPT_SHRT("nphndls",          'n', &cfg.nphndls,  nphndls),
+               OPT_SHRT("nphndls",      'n', &cfg.nphndls,  nphndls),
                OPT_STR("nsze-si",       'S', &cfg.nsze_si,  nsze_si),
                OPT_STR("ncap-si",       'C', &cfg.ncap_si,  ncap_si),
                OPT_FLAG("azr",          'z', &cfg.azr,      azr),
                OPT_UINT("rar",          'r', &cfg.rar,      rar),
                OPT_UINT("ror",          'o', &cfg.ror,      ror),
                OPT_UINT("rnumzrwa",     'u', &cfg.rnumzrwa, rnumzrwa),
-               OPT_LIST("phndls",           'p', &cfg.phndls,   phndls),
+               OPT_LIST("phndls",       'p', &cfg.phndls,   phndls),
                OPT_END()
        };
 
@@ -3186,6 +3190,7 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin *
                .nmic = cfg.nmic,
                .anagrpid = cpu_to_le32(cfg.anagrpid),
                .nvmsetid = cpu_to_le16(cfg.nvmsetid),
+               .endgid = cpu_to_le16(cfg.endgid),
                .lbstm = cpu_to_le64(cfg.lbstm),
                .zns.znsco = cfg.azr,
                .zns.rar = cpu_to_le32(cfg.rar),