git: 5438d2060676 - stable/14 - nvmecontrol: Use NVMEF macro to construct fields
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 Aug 2024 18:03:22 UTC
The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5438d20606769c8db690f1a2d92becb7a6b05426 commit 5438d20606769c8db690f1a2d92becb7a6b05426 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-01-29 19:01:46 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-08-26 17:27:14 +0000 nvmecontrol: Use NVMEF macro to construct fields Reviewed by: imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D43606 (cherry picked from commit c68ec278deb23fd90eb5506c9a6a4f7339784ff3) --- sbin/nvmecontrol/ns.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/sbin/nvmecontrol/ns.c b/sbin/nvmecontrol/ns.c index a77f37e0f468..24f4b6b3d043 100644 --- a/sbin/nvmecontrol/ns.c +++ b/sbin/nvmecontrol/ns.c @@ -580,14 +580,12 @@ nscreate(const struct cmd *f, int argc, char *argv[]) /* Default to the first format, whatever it is. */ nsdata.flbas = 0; if (create_opt.lbaf != NONE) { - nsdata.flbas |= (create_opt.lbaf & - NVME_NS_DATA_FLBAS_FORMAT_MASK) - << NVME_NS_DATA_FLBAS_FORMAT_SHIFT; + nsdata.flbas |= NVMEF(NVME_NS_DATA_FLBAS_FORMAT, + create_opt.lbaf); } if (create_opt.mset != NONE) { - nsdata.flbas |= (create_opt.mset & - NVME_NS_DATA_FLBAS_EXTENDED_MASK) - << NVME_NS_DATA_FLBAS_EXTENDED_SHIFT; + nsdata.flbas |= NVMEF(NVME_NS_DATA_FLBAS_EXTENDED, + create_opt.mset); } } if (create_opt.dps != NONE) { @@ -596,22 +594,19 @@ nscreate(const struct cmd *f, int argc, char *argv[]) /* Default to protection disabled. */ nsdata.dps = 0; if (create_opt.pi != NONE) { - nsdata.dps |= (create_opt.pi & - NVME_NS_DATA_DPS_MD_START_MASK) - << NVME_NS_DATA_DPS_MD_START_SHIFT; + nsdata.dps |= NVMEF(NVME_NS_DATA_DPS_MD_START, + create_opt.pi); } if (create_opt.pil != NONE) { - nsdata.dps |= (create_opt.pil & - NVME_NS_DATA_DPS_PIT_MASK) - << NVME_NS_DATA_DPS_PIT_SHIFT; + nsdata.dps |= NVMEF(NVME_NS_DATA_DPS_PIT, + create_opt.pil); } } if (create_opt.nmic != NONE) { nsdata.nmic = create_opt.nmic; } else { /* Allow namespaces sharing if Multi-Path I/O is supported. */ - nsdata.nmic = cd.mic ? (NVME_NS_DATA_NMIC_MAY_BE_SHARED_MASK << - NVME_NS_DATA_NMIC_MAY_BE_SHARED_SHIFT) : 0; + nsdata.nmic = NVMEF(NVME_NS_DATA_NMIC_MAY_BE_SHARED, !!cd.mic); } nvme_namespace_data_swapbytes(&nsdata);