Page MenuHomeFreeBSD

D44209.diff
No OneTemporary

D44209.diff

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
@@ -55,6 +55,24 @@
bus_barrier(ctrlr->resource, 0, rman_get_size(ctrlr->resource), flags);
}
+static void
+nvme_ctrlr_devctl_va(struct nvme_controller *ctrlr, const char *type,
+ const char *msg, va_list ap)
+{
+ struct sbuf sb;
+ int error;
+
+ if (sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND | SBUF_NOWAIT) == NULL)
+ return;
+ sbuf_printf(&sb, "name=\"%s\" reason=\"", device_get_nameunit(ctrlr->dev));
+ sbuf_vprintf(&sb, msg, ap);
+ sbuf_printf(&sb, "\"");
+ error = sbuf_finish(&sb);
+ if (error == 0)
+ devctl_notify("nvme", "controller", type, sbuf_data(&sb));
+ sbuf_delete(&sb);
+}
+
static void
nvme_ctrlr_devctl_log(struct nvme_controller *ctrlr, const char *type, const char *msg, ...)
{
@@ -71,17 +89,10 @@
error = sbuf_finish(&sb);
if (error == 0)
printf("%s\n", sbuf_data(&sb));
-
- sbuf_clear(&sb);
- sbuf_printf(&sb, "name=\"%s\" reason=\"", device_get_nameunit(ctrlr->dev));
+ sbuf_delete(&sb);
va_start(ap, msg);
- sbuf_vprintf(&sb, msg, ap);
+ nvme_ctrlr_devctl_va(ctrlr, type, msg, ap);
va_end(ap);
- sbuf_printf(&sb, "\"");
- error = sbuf_finish(&sb);
- if (error == 0)
- devctl_notify("nvme", "controller", type, sbuf_data(&sb));
- sbuf_delete(&sb);
}
static int

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 24, 6:13 PM (13 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16094969
Default Alt Text
D44209.diff (1 KB)

Event Timeline