Skip to content

Commit a62c17b

Browse files
A-Fellow-Comradeigaw
authored andcommitted
Plugin: ScaleFlux Use NVME_NSID_ALL
Using NVME_NSID_ALL macro instead of 0xffffffff magic number Signed-off-by: Jayden Stenfort <[email protected]>
1 parent 4fa5ea4 commit a62c17b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

plugins/scaleflux/sfx-nvme.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd,
334334
int err;
335335

336336
struct config cfg = {
337-
.namespace_id = 0xffffffff,
337+
.namespace_id = NVME_NSID_ALL,
338338
};
339339

340340
OPT_ARGS(opts) = {
@@ -660,7 +660,7 @@ static int sfx_get_bad_block(int argc, char **argv, struct command *cmd, struct
660660
return -1;
661661
}
662662

663-
err = get_bb_table(dev_fd(dev), 0xffffffff, data_buf, buf_size);
663+
err = get_bb_table(dev_fd(dev), NVME_NSID_ALL, data_buf, buf_size);
664664
if (err < 0) {
665665
perror("get-bad-block");
666666
} else if (err) {
@@ -711,7 +711,7 @@ static int query_cap_info(int argc, char **argv, struct command *cmd, struct plu
711711
if (err)
712712
return err;
713713

714-
if (nvme_query_cap(dev_fd(dev), 0xffffffff, sizeof(ctx), &ctx)) {
714+
if (nvme_query_cap(dev_fd(dev), NVME_NSID_ALL, sizeof(ctx), &ctx)) {
715715
perror("sfx-query-cap");
716716
err = -1;
717717
}
@@ -735,7 +735,7 @@ static int change_sanity_check(int fd, __u64 trg_in_4k, int *shrink)
735735
__u64 provisioned_cap_4k = 0;
736736
int extend = 0;
737737

738-
if (nvme_query_cap(fd, 0xffffffff, sizeof(freespace_ctx), &freespace_ctx))
738+
if (nvme_query_cap(fd, NVME_NSID_ALL, sizeof(freespace_ctx), &freespace_ctx))
739739
return -1;
740740

741741
/*
@@ -861,7 +861,7 @@ static int change_cap(int argc, char **argv, struct command *cmd, struct plugin
861861
return 0;
862862
}
863863

864-
err = nvme_change_cap(dev_fd(dev), 0xffffffff, cap_in_4k);
864+
err = nvme_change_cap(dev_fd(dev), NVME_NSID_ALL, cap_in_4k);
865865
if (err < 0) {
866866
perror("sfx-change-cap");
867867
} else if (err) {
@@ -976,7 +976,7 @@ static int sfx_set_feature(int argc, char **argv, struct command *cmd, struct pl
976976
}
977977

978978
if (cfg.feature_id == SFX_FEAT_ATOMIC && cfg.value) {
979-
if (cfg.namespace_id != 0xffffffff) {
979+
if (cfg.namespace_id != NVME_NSID_ALL) {
980980
err = nvme_identify_ns(dev_fd(dev), cfg.namespace_id,
981981
&ns);
982982
if (err) {
@@ -1370,7 +1370,7 @@ static int sfx_dump_evtlog(int argc, char **argv, struct command *cmd, struct pl
13701370
};
13711371
struct config cfg = {
13721372
.file = NULL,
1373-
.namespace_id = 0xffffffff,
1373+
.namespace_id = NVME_NSID_ALL,
13741374
.storage_medium = 0,
13751375
.parse = false,
13761376
.output = NULL,
@@ -1498,7 +1498,7 @@ static int sfx_expand_cap(int argc, char **argv, struct command *cmd, struct plu
14981498
__u32 units;
14991499
};
15001500
struct config cfg = {
1501-
.namespace_id = 0xffffffff,
1501+
.namespace_id = NVME_NSID_ALL,
15021502
.lbaf = 0,
15031503
.units = 0,
15041504
};
@@ -1516,7 +1516,7 @@ static int sfx_expand_cap(int argc, char **argv, struct command *cmd, struct plu
15161516
if (err)
15171517
goto ret;
15181518

1519-
if (cfg.namespace_id == 0xffffffff) {
1519+
if (cfg.namespace_id == NVME_NSID_ALL) {
15201520
if (S_ISCHR(dev->direct.stat.st_mode)) {
15211521
fprintf(stderr, "namespace_id or blk device required\n");
15221522
err = EINVAL;

0 commit comments

Comments
 (0)