]> www.infradead.org Git - users/hch/nvme-cli.git/commit
{get,set}_feature: get nsid from device node
authorKlaus Jensen <k.jensen@samsung.com>
Tue, 1 Sep 2020 08:36:41 +0000 (10:36 +0200)
committerKeith Busch <kbusch@kernel.org>
Tue, 1 Sep 2020 15:38:07 +0000 (09:38 -0600)
commitfa2b91da7439b776a7eb01af9e2b23ac1373c027
treee775c666b249cb97be5d7eb8f56580d615fa678d
parent7ac86adc63023b47865da9d2db4ec1ce828c07c4
{get,set}_feature: get nsid from device node

If the given device is the controller device, set nsid to 0xFFFFFFFF.
This allows something like

  nvme set-feature /dev/nvme0 -f 0x5 -v $((1 << 16))

to work as expected.

Since we cannot use S_ISCHR/S_ISBLK to differentiate between controller
and namespace devices since commit e77046661509 ("remove block device
checking for namespace"), just try the NVME_IOCTL_ID ioctl and if it
fails with ENOTTY, assume that it is the controller device.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
nvme.c