Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151178673
D53338.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D53338.id.diff
View Options
diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h
--- a/sys/dev/nvme/nvme.h
+++ b/sys/dev/nvme/nvme.h
@@ -1910,6 +1910,7 @@
void nvme_strvis(uint8_t *dst, const uint8_t *src, int dstlen, int srclen);
#ifdef _KERNEL
+#include <sys/disk.h>
struct bio;
struct thread;
@@ -1995,6 +1996,24 @@
return (NVMEV(NVME_CTRLR_DATA_ONCS_DSM, cd->oncs) != 0);
}
+/*
+ * Copy the NVME device's serial number to the provided buffer, which must be
+ * at least DISK_IDENT_SIZE bytes large.
+ */
+static inline void
+nvme_cdata_get_disk_ident(const struct nvme_controller_data *cdata, uint8_t *sn)
+{
+ _Static_assert(NVME_SERIAL_NUMBER_LENGTH < DISK_IDENT_SIZE,
+ "NVME serial number too big for disk ident");
+
+ memmove(sn, cdata->sn, NVME_SERIAL_NUMBER_LENGTH);
+ sn[NVME_SERIAL_NUMBER_LENGTH] = '\0';
+ for (int i = 0; sn[i] != '\0'; i++) {
+ if (sn[i] < 0x20 || sn[i] >= 0x80)
+ sn[i] = ' ';
+ }
+}
+
/* Namespace helper functions */
uint32_t nvme_ns_get_max_io_xfer_size(struct nvme_namespace *ns);
uint32_t nvme_ns_get_sector_size(struct nvme_namespace *ns);
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -33,7 +33,6 @@
#include <sys/buf.h>
#include <sys/bus.h>
#include <sys/conf.h>
-#include <sys/disk.h>
#include <sys/ioccom.h>
#include <sys/proc.h>
#include <sys/smp.h>
@@ -1254,24 +1253,6 @@
nvme_qpair_process_completions(&ctrlr->ioq[i]);
}
-/*
- * Copy the NVME device's serial number to the provided buffer, which must be
- * at least DISK_IDENT_SIZE bytes large.
- */
-void
-nvme_ctrlr_get_ident(const struct nvme_controller *ctrlr, uint8_t *sn)
-{
- _Static_assert(NVME_SERIAL_NUMBER_LENGTH < DISK_IDENT_SIZE,
- "NVME serial number too big for disk ident");
-
- memmove(sn, ctrlr->cdata.sn, NVME_SERIAL_NUMBER_LENGTH);
- sn[NVME_SERIAL_NUMBER_LENGTH] = '\0';
- for (int i = 0; sn[i] != '\0'; i++) {
- if (sn[i] < 0x20 || sn[i] >= 0x80)
- sn[i] = ' ';
- }
-}
-
/*
* Poll the single-vector interrupt case: num_io_queues will be 1 and
* there's only a single vector. While we're polling, we mask further
@@ -1516,7 +1497,7 @@
break;
case DIOCGIDENT: {
uint8_t *sn = arg;
- nvme_ctrlr_get_ident(ctrlr, sn);
+ nvme_cdata_get_disk_ident(&ctrlr->cdata, sn);
break;
}
/* Linux Compatible (see nvme_linux.h) */
diff --git a/sys/dev/nvme/nvme_ns.c b/sys/dev/nvme/nvme_ns.c
--- a/sys/dev/nvme/nvme_ns.c
+++ b/sys/dev/nvme/nvme_ns.c
@@ -90,7 +90,7 @@
}
case DIOCGIDENT: {
uint8_t *sn = arg;
- nvme_ctrlr_get_ident(ctrlr, sn);
+ nvme_cdata_get_disk_ident(&ctrlr->cdata, sn);
break;
}
case DIOCGMEDIASIZE:
diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h
--- a/sys/dev/nvme/nvme_private.h
+++ b/sys/dev/nvme/nvme_private.h
@@ -565,7 +565,6 @@
void nvme_notify_ns(struct nvme_controller *ctrlr, int nsid);
void nvme_ctrlr_shared_handler(void *arg);
-void nvme_ctrlr_get_ident(const struct nvme_controller *ctrlr, uint8_t *sn);
void nvme_ctrlr_poll(struct nvme_controller *ctrlr);
int nvme_ctrlr_suspend(struct nvme_controller *ctrlr);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 7, 3:19 PM (21 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31039202
Default Alt Text
D53338.id.diff (3 KB)
Attached To
Mode
D53338: nvme: Abstract out function to obtain a disk ident string from cdata
Attached
Detach File
Event Timeline
Log In to Comment