lnvm: minor clean-ups
v3 cover lnvm: minor clean-ups
Hi Keith,
This series has been reviewed by Matias and Javier. Please consider this series to be merged. The Github PR can be found at:
https://github.com/linux-nvme/nvme-cli/pull/527
This series is nothing but a clean-up patch series. I hope it's not a just code churns, but a good start to do something for lnvm.
The first one removed a redundant whitespace in the command description. The second one removed unnecessary print for the sizeof(dev) which will always be zero in case user does not give any argument for the device. The third patch removed temp variable instead casting the pinter directly. The last one just sync-up the kernel UAPI header file to the latest.
Please review.
Thanks,
Changes to V3:
- Drop the last commit which is about the re-sync for the UAPI header file from the kernel because it does not have any actual using code. (Matias)
- Added Reviewed-by tag from Javier. (Javier)
Changes to V2:
- Resend the series with the latest patch commits.
Minwoo Im (3):
lnvm: remove redundant whitespace in lnvm_init()
lnvm: do not print 0 when the arg is not given
lnvm: cast identity structure to (void *) directly
nvme-lightnvm.c | 5 ++--- plugins/lnvm/lnvm-nvme.c | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-)
Signature · 1 line
2.17.1
PATCH v3 1/3 lnvm: remove redundant whitespace in lnvm_init()
The description for lnvm-init subcommand has a redundant whitespace.
--- plugins/lnvm/lnvm-nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
plugins/lnvm/lnvm-nvme.c +1 -1
@@ -17,7 +17,7 @@static int lnvm_init (int argc,char **argv,struct command *cmd,struct plugin *plugin) {const char *desc ="Initialize LightNVM device. A LightNVM/Open-Channel SSD" \ -" must have a media manager associated before it can " \ +" must have a media manager associated before it can" \" be exposed to the user. The default is to initialize" " the general media manager on top of the device.\n\n" "Example:"
Signature · 1 line
2.17.1
PATCH v3 2/3 lnvm: do not print 0 when the arg is not given
In reply to Minwoo ImIf an argument is not given by the user, it just needs to show the situation, not a prominent 0 which indicates the size of the argument variable.
--- plugins/lnvm/lnvm-nvme.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
plugins/lnvm/lnvm-nvme.c +3 -3
@@ -48,7 +48,7 @@ static int lnvm_init(int argc, char **argv, struct command *cmd, struct plugin *return ret;if (!strlen (cfg.devname)) { -fprintf (stderr,"device name missing %d\n" , (int )strlen (cfg.devname)); +fprintf (stderr,"device name missing\n" );return -EINVAL ; }
@@ -179,7 +179,7 @@ static int lnvm_create_tgt(int argc, char **argv, struct command *cmd, struct plreturn ret;if (!strlen (cfg.devname)) { -fprintf (stderr,"device name missing %d\n" , (int )strlen (cfg.devname)); +fprintf (stderr,"device name missing\n" );return -EINVAL ; }if (!strlen (cfg.tgtname)) {
@@ -265,7 +265,7 @@ static int lnvm_factory_init(int argc, char **argv, struct command *cmd, structreturn ret;if (!strlen (cfg.devname)) { -fprintf (stderr,"device name missing %d\n" , (int )strlen (cfg.devname)); +fprintf (stderr,"device name missing\n" );return -EINVAL ; }
Signature · 1 line
2.17.1
PATCH v3 3/3 lnvm: cast identity structure to (void *) directly
In reply to Minwoo ImIf we use "tmp" or something like this, we can expect that it just stores the previous pointer and do something else with the previous pointer. But, in this function, it just to cast it out.
--- nvme-lightnvm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
nvme-lightnvm.c +2 -3
@@ -422,13 +422,12 @@ static void show_lnvm_id20_ns(struct nvme_nvm_id20 *id, unsigned int flags)static void show_lnvm_id_ns (struct nvme_nvm_id *id,unsigned int flags) { -void *tmp = id;switch (id->ver_id) {case 1 : -show_lnvm_id12_ns (tmp, flags); +show_lnvm_id12_ns ((void *) id, flags);break ;case 2 : -show_lnvm_id20_ns (tmp, flags); +show_lnvm_id20_ns ((void *) id, flags);break ;default : fprintf(stderr, "Version %d not supported.\n",
Signature · 1 line
2.17.1