Page MenuHomeFreeBSD

D34505.1775488747.diff
No OneTemporary

Size
10 KB
Referenced Files
None
Subscribers
None

D34505.1775488747.diff

diff --git a/sys/arm/ti/am335x/am335x_pmic.c b/sys/arm/ti/am335x/am335x_pmic.c
--- a/sys/arm/ti/am335x/am335x_pmic.c
+++ b/sys/arm/ti/am335x/am335x_pmic.c
@@ -90,7 +90,6 @@
struct tps65217_status_reg status_reg;
struct tps65217_int_reg int_reg;
int rv;
- char notify_buf[16];
THREAD_SLEEPING_OK();
rv = am335x_pmic_read(sc->sc_dev, TPS65217_INT_REG, (uint8_t *)&int_reg, 1);
@@ -110,9 +109,8 @@
if (int_reg.pbi && status_reg.pb)
shutdown_nice(RB_POWEROFF);
if (int_reg.aci) {
- snprintf(notify_buf, sizeof(notify_buf), "notify=0x%02x",
+ devctl_notifyf("ACPI", "ACAD", "power", "notify=0x%02x",
status_reg.acpwr);
- devctl_notify("ACPI", "ACAD", "power", notify_buf);
}
}
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -4278,7 +4278,6 @@
void
acpi_UserNotify(const char *subsystem, ACPI_HANDLE h, uint8_t notify)
{
- char notify_buf[16];
ACPI_BUFFER handle_buf;
ACPI_STATUS status;
@@ -4290,8 +4289,8 @@
status = AcpiNsHandleToPathname(h, &handle_buf, FALSE);
if (ACPI_FAILURE(status))
return;
- snprintf(notify_buf, sizeof(notify_buf), "notify=0x%02x", notify);
- devctl_notify("ACPI", subsystem, handle_buf.Pointer, notify_buf);
+ devctl_notifyf("ACPI", subsystem, handle_buf.Pointer, "notify=0x%02x",
+ notify);
AcpiOsFree(handle_buf.Pointer);
}
diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c
--- a/sys/dev/asmc/asmc.c
+++ b/sys/dev/asmc/asmc.c
@@ -1458,7 +1458,6 @@
asmc_sms_task(void *arg, int pending)
{
struct asmc_softc *sc = (struct asmc_softc *)arg;
- char notify[16];
int type;
switch (sc->sc_sms_intrtype) {
@@ -1475,8 +1474,7 @@
type = 255;
}
- snprintf(notify, sizeof(notify), " notify=0x%x", type);
- devctl_notify("ACPI", "asmc", "SMS", notify);
+ devctl_notifyf("ACPI", "asmc", "SMS", "notify=0x%x", type);
}
static int
diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c
--- a/sys/dev/usb/usb_device.c
+++ b/sys/dev/usb/usb_device.c
@@ -2698,12 +2698,10 @@
usb_notify_addq(const char *type, struct usb_device *udev)
{
struct usb_interface *iface;
- struct sbuf *sb;
int i;
/* announce the device */
- sb = sbuf_new_auto();
- sbuf_printf(sb,
+ devctl_notifyf("USB", "DEVICE", type,
#if USB_HAVE_UGEN
"ugen=%s "
"cdev=%s "
@@ -2738,9 +2736,6 @@
device_get_nameunit(device_get_parent(udev->bus->bdev))
#endif
);
- sbuf_finish(sb);
- devctl_notify("USB", "DEVICE", type, sbuf_data(sb));
- sbuf_delete(sb);
/* announce each interface */
for (i = 0; i < USB_IFACE_MAX; i++) {
@@ -2750,8 +2745,7 @@
if (iface->idesc == NULL)
continue; /* no interface descriptor */
- sb = sbuf_new_auto();
- sbuf_printf(sb,
+ devctl_notifyf("USB", "INTERFACE", type,
#if USB_HAVE_UGEN
"ugen=%s "
"cdev=%s "
@@ -2784,9 +2778,6 @@
iface->idesc->bInterfaceClass,
iface->idesc->bInterfaceSubClass,
iface->idesc->bInterfaceProtocol);
- sbuf_finish(sb);
- devctl_notify("USB", "INTERFACE", type, sbuf_data(sb));
- sbuf_delete(sb);
}
}
#endif
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -1095,25 +1095,14 @@
return (idx0);
}
-#define DEVCTL_LEN 64
static void
vtterm_devctl(bool enabled, bool hushed, int hz, sbintime_t duration)
{
- struct sbuf sb;
- char *buf;
- buf = malloc(DEVCTL_LEN, M_VT, M_NOWAIT);
- if (buf == NULL)
- return;
- sbuf_new(&sb, buf, DEVCTL_LEN, SBUF_FIXEDLEN);
- sbuf_printf(&sb, "enabled=%s hushed=%s hz=%d duration_ms=%d",
+ devctl_notifyf("VT", "BELL", "RING",
+ "enabled=%s hushed=%s hz=%d duration_ms=%d",
enabled ? "true" : "false", hushed ? "true" : "false",
hz, (int)(duration / SBT_1MS));
- sbuf_finish(&sb);
- if (sbuf_error(&sb) == 0)
- devctl_notify("VT", "BELL", "RING", sbuf_data(&sb));
- sbuf_delete(&sb);
- free(buf, M_VT);
}
static void
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c
--- a/sys/geom/geom_dev.c
+++ b/sys/geom/geom_dev.c
@@ -215,15 +215,13 @@
struct g_consumer *cp;
struct g_geom *gp;
struct g_dev_softc *sc;
- char buf[SPECNAMELEN + 6];
g_topology_assert();
cp = arg;
gp = cp->geom;
sc = cp->private;
g_trace(G_T_TOPOLOGY, "g_dev_destroy(%p(%s))", cp, gp->name);
- snprintf(buf, sizeof(buf), "cdev=%s", gp->name);
- devctl_notify("GEOM", "DEV", "DESTROY", buf);
+ devctl_notifyf("GEOM", "DEV", "DESTROY", "cdev=%s", gp->name);
knlist_clear(&sc->sc_selinfo.si_note, 0);
knlist_destroy(&sc->sc_selinfo.si_note);
if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
@@ -284,18 +282,17 @@
{
struct g_dev_softc *sc;
struct cdev *dev;
- char buf[SPECNAMELEN + 6];
sc = cp->private;
dev = sc->sc_dev;
- snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name);
- devctl_notify("DEVFS", "CDEV", "MEDIACHANGE", buf);
- devctl_notify("GEOM", "DEV", "MEDIACHANGE", buf);
+ devctl_notifyf("DEVFS", "CDEV", "MEDIACHANGE", "cdev=%s", dev->si_name);
+ devctl_notifyf("GEOM", "DEV", "MEDIACHANGE", "cdev=%s", dev->si_name);
dev = sc->sc_alias;
if (dev != NULL) {
- snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name);
- devctl_notify("DEVFS", "CDEV", "MEDIACHANGE", buf);
- devctl_notify("GEOM", "DEV", "MEDIACHANGE", buf);
+ devctl_notifyf("DEVFS", "CDEV", "MEDIACHANGE", "cdev=%s",
+ dev->si_name);
+ devctl_notifyf("GEOM", "DEV", "MEDIACHANGE", "cdev=%s",
+ dev->si_name);
}
}
@@ -318,13 +315,12 @@
g_dev_resize(struct g_consumer *cp)
{
struct g_dev_softc *sc;
- char buf[SPECNAMELEN + 6];
sc = cp->private;
KNOTE_UNLOCKED(&sc->sc_selinfo.si_note, NOTE_ATTRIB);
- snprintf(buf, sizeof(buf), "cdev=%s", cp->provider->name);
- devctl_notify("GEOM", "DEV", "SIZECHANGE", buf);
+ devctl_notifyf("GEOM", "DEV", "SIZECHANGE", "cdev=%s",
+ cp->provider->name);
}
struct g_provider *
@@ -350,7 +346,6 @@
struct g_dev_softc *sc;
int error;
struct cdev *dev, *adev;
- char buf[SPECNAMELEN + 6];
struct make_dev_args args;
g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name);
@@ -401,8 +396,7 @@
__func__, gp->name, error);
g_dev_attrchanged(cp, "GEOM::physpath");
- snprintf(buf, sizeof(buf), "cdev=%s", gp->name);
- devctl_notify("GEOM", "DEV", "CREATE", buf);
+ devctl_notifyf("GEOM", "DEV", "CREATE", "cdev=%s", gp->name);
/*
* Now add all the aliases for this drive
*/
@@ -414,8 +408,7 @@
__func__, gap->ga_alias, error);
continue;
}
- snprintf(buf, sizeof(buf), "cdev=%s", gap->ga_alias);
- devctl_notify("GEOM", "DEV", "CREATE", buf);
+ devctl_notifyf("GEOM", "DEV", "CREATE", "cdev=%s", gap->ga_alias);
}
return (gp);
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -1001,15 +1001,13 @@
{
struct g_geom *gp = dp->d_geom;
struct g_provider *pp;
- char devnamebuf[128];
if (gp == NULL)
return;
LIST_FOREACH(pp, &gp->provider, provider)
(void)g_attr_changed(pp, attr, flag);
- snprintf(devnamebuf, sizeof(devnamebuf), "devname=%s%d", dp->d_name,
+ devctl_notifyf("GEOM", "disk", attr, "devname=%s%d", dp->d_name,
dp->d_unit);
- devctl_notify("GEOM", "disk", attr, devnamebuf);
}
void
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -529,21 +529,10 @@
static void
notify(struct cdev *dev, const char *ev, int flags)
{
- static const char prefix[] = "cdev=";
- char *data;
- int namelen, mflags;
if (cold)
return;
- mflags = (flags & MAKEDEV_NOWAIT) ? M_NOWAIT : M_WAITOK;
- namelen = strlen(dev->si_name);
- data = malloc(namelen + sizeof(prefix), M_TEMP, mflags);
- if (data == NULL)
- return;
- memcpy(data, prefix, sizeof(prefix) - 1);
- memcpy(data + sizeof(prefix) - 1, dev->si_name, namelen + 1);
- devctl_notify("DEVFS", "CDEV", ev, data);
- free(data, M_TEMP);
+ devctl_notifyf("DEVFS", "CDEV", ev, "cdev=%s", dev->si_name);
}
static void
diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -3128,7 +3128,6 @@
struct sockaddr_dl *sdl;
size_t namelen, onamelen;
char old_name[IFNAMSIZ];
- char strbuf[IFNAMSIZ + 8];
if (new_name[0] == '\0')
return (EINVAL);
@@ -3177,8 +3176,7 @@
ifp->if_flags &= ~IFF_RENAMING;
- snprintf(strbuf, sizeof(strbuf), "name=%s", new_name);
- devctl_notify("IFNET", old_name, "RENAME", strbuf);
+ devctl_notifyf("IFNET", old_name, "RENAME", "name=%s", new_name);
return (0);
}
diff --git a/sys/net/route.c b/sys/net/route.c
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -624,23 +624,21 @@
#ifdef INET
if (sa->sa_family == AF_INET) {
char addrstr[INET_ADDRSTRLEN];
- char strbuf[INET_ADDRSTRLEN + 12];
inet_ntoa_r(((struct sockaddr_in *)sa)->sin_addr, addrstr);
- snprintf(strbuf, sizeof(strbuf), "address=%s", addrstr);
- devctl_notify("IFNET", ifp->if_xname,
- (cmd == RTM_ADD) ? "ADDR_ADD" : "ADDR_DEL", strbuf);
+ devctl_notifyf("IFNET", ifp->if_xname,
+ (cmd == RTM_ADD) ? "ADDR_ADD" : "ADDR_DEL",
+ "address=%s", addrstr);
}
#endif
#ifdef INET6
if (sa->sa_family == AF_INET6) {
char addrstr[INET6_ADDRSTRLEN];
- char strbuf[INET6_ADDRSTRLEN + 12];
ip6_sprintf(addrstr, IFA_IN6(ifa));
- snprintf(strbuf, sizeof(strbuf), "address=%s", addrstr);
- devctl_notify("IFNET", ifp->if_xname,
- (cmd == RTM_ADD) ? "ADDR_ADD" : "ADDR_DEL", strbuf);
+ devctl_notifyf("IFNET", ifp->if_xname,
+ (cmd == RTM_ADD) ? "ADDR_ADD" : "ADDR_DEL",
+ "address=%s", addrstr);
}
#endif
diff --git a/sys/powerpc/powermac/pmu.c b/sys/powerpc/powermac/pmu.c
--- a/sys/powerpc/powermac/pmu.c
+++ b/sys/powerpc/powermac/pmu.c
@@ -949,16 +949,14 @@
static void
pmu_battery_notify(struct pmu_battstate *batt, struct pmu_battstate *old)
{
- char notify_buf[16];
int new_acline, old_acline;
new_acline = (batt->state & PMU_PWR_AC_PRESENT) ? 1 : 0;
old_acline = (old->state & PMU_PWR_AC_PRESENT) ? 1 : 0;
if (new_acline != old_acline) {
- snprintf(notify_buf, sizeof(notify_buf),
- "notify=0x%02x", new_acline);
- devctl_notify("PMU", "POWER", "ACLINE", notify_buf);
+ devctl_notifyf("PMU", "POWER", "ACLINE", "notify=0x%02x",
+ new_acline);
}
}

File Metadata

Mime Type
text/plain
Expires
Mon, Apr 6, 3:19 PM (4 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28278055
Default Alt Text
D34505.1775488747.diff (10 KB)

Event Timeline