Skip to content

Commit aec85d9

Browse files
sc108-leeigaw
authored andcommitted
nvme: add error message for mmap_registers
To indicate that backward compatibility is not supported since we drop the block device fallback Signed-off-by: Steven Seungcheol Lee <[email protected]>
1 parent 62208bb commit aec85d9

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

Documentation/nvme-get-reg.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ DESCRIPTION
2222
-----------
2323
Read and show the defined NVMe controller register.
2424

25+
The <device> parameter is mandatory and must be the nvme admin character
26+
device (ex: /dev/nvme0).
27+
2528
OPTIONS
2629
-------
2730
-O <offset>::

Documentation/nvme-set-reg.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ DESCRIPTION
2222
-----------
2323
Writes and shows the defined NVMe controller register.
2424

25+
The <device> parameter is mandatory and must be the nvme admin character
26+
device (ex: /dev/nvme0).
27+
2528
OPTIONS
2629
-------
2730
-O <offset>::

nvme.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,10 @@ static int get_effects_log(int argc, char **argv, struct command *cmd, struct pl
11131113

11141114
if (cfg.csi < 0) {
11151115
__u64 cap;
1116-
1116+
if (is_blkdev(dev)) {
1117+
nvme_show_error("Block device isn't allowed without csi");
1118+
return -EINVAL;
1119+
}
11171120
bar = mmap_registers(dev, false);
11181121

11191122
if (bar) {
@@ -5611,6 +5614,11 @@ static int show_registers(int argc, char **argv, struct command *cmd, struct plu
56115614
if (err)
56125615
return err;
56135616

5617+
if (is_blkdev(dev)) {
5618+
nvme_show_error("Only character device is allowed");
5619+
return -EINVAL;
5620+
}
5621+
56145622
err = validate_output_format(nvme_cfg.output_format, &flags);
56155623
if (err < 0) {
56165624
nvme_show_error("Invalid output format");
@@ -5887,6 +5895,11 @@ static int get_register(int argc, char **argv, struct command *cmd, struct plugi
58875895
if (err)
58885896
return err;
58895897

5898+
if (is_blkdev(dev)) {
5899+
nvme_show_error("Only character device is allowed");
5900+
return -EINVAL;
5901+
}
5902+
58905903
err = validate_output_format(nvme_cfg.output_format, &flags);
58915904
if (err < 0) {
58925905
nvme_show_error("Invalid output format");
@@ -6191,6 +6204,11 @@ static int set_register(int argc, char **argv, struct command *cmd, struct plugi
61916204
if (err)
61926205
return err;
61936206

6207+
if (is_blkdev(dev)) {
6208+
nvme_show_error("Only character device is allowed");
6209+
return -EINVAL;
6210+
}
6211+
61946212
bar = mmap_registers(dev, true);
61956213

61966214
if (argconfig_parse_seen(opts, "offset"))

0 commit comments

Comments
 (0)