Project

General

Profile

Actions

Bug #14550

closed

nvme_is_ignored_ns() needs less confusion

Added by Dan McDonald 4 months ago. Updated 21 days ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
cmd - userland programs
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

Because of its battle-tested nature, #14529 was RTI-approved. The aforementioned function in the subject, however, need a bit of cleaning.

boolean_t
nvme_is_ignored_ns(int fd)
{
    boolean_t ret;
    uint64_t res = 0;
    /*
     * The ioctl shouldn't fail. If it does, we treat it the same as if the
     * namespace was ignored.
     */
    ret = nvme_ioctl(fd, NVME_IOC_IS_IGNORED_NS, NULL, NULL, 0, &res);
    if (ret)
        ret = (res == 0) ? B_FALSE : B_TRUE;
    return (ret);
}

The comment inside it is well-wrtitten, but the variable names being so close ("res" and "ret") along with "ret" being a boolean, even though int-returning ioctl() is assigned to it, makes this an awful read.

IDEALLY the compiler would produce a same-binary output for a more readable fix, but I'm not 100% sure it will, so whomever fixes this needs to regression test if possible.

Actions #1

Updated by Electric Monk 4 months ago

  • Gerrit CR set to 2060
Actions #2

Updated by Hans Rosenfeld 21 days ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF