Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108307670
D44209.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D44209.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D44209: nvme: split devctl out to its own function
Attached
Detach File
Event Timeline
Log In to Comment