Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F168051552
D34505.id103671.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D34505.id103671.diff
View Options
Index: sys/arm/ti/am335x/am335x_pmic.c
===================================================================
--- sys/arm/ti/am335x/am335x_pmic.c
+++ sys/arm/ti/am335x/am335x_pmic.c
@@ -91,7 +91,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);
@@ -111,9 +110,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);
}
}
Index: sys/dev/acpica/acpi.c
===================================================================
--- sys/dev/acpica/acpi.c
+++ sys/dev/acpica/acpi.c
@@ -4219,7 +4219,6 @@
void
acpi_UserNotify(const char *subsystem, ACPI_HANDLE h, uint8_t notify)
{
- char notify_buf[16];
ACPI_BUFFER handle_buf;
ACPI_STATUS status;
@@ -4231,8 +4230,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);
}
Index: sys/dev/asmc/asmc.c
===================================================================
--- sys/dev/asmc/asmc.c
+++ sys/dev/asmc/asmc.c
@@ -1338,7 +1338,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) {
@@ -1355,8 +1354,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
Index: sys/dev/usb/usb_device.c
===================================================================
--- sys/dev/usb/usb_device.c
+++ sys/dev/usb/usb_device.c
@@ -2681,12 +2681,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 "
@@ -2721,9 +2719,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++) {
@@ -2733,8 +2728,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 "
@@ -2767,9 +2761,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
Index: sys/geom/geom_dev.c
===================================================================
--- sys/geom/geom_dev.c
+++ sys/geom/geom_dev.c
@@ -218,15 +218,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)
@@ -287,18 +285,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);
}
}
@@ -321,13 +318,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 *
@@ -353,7 +349,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);
@@ -404,8 +399,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
*/
@@ -417,8 +411,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);
Index: sys/geom/geom_disk.c
===================================================================
--- sys/geom/geom_disk.c
+++ sys/geom/geom_disk.c
@@ -981,15 +981,13 @@
{
struct g_geom *gp;
struct g_provider *pp;
- char devnamebuf[128];
gp = dp->d_geom;
if (gp != NULL)
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
Index: sys/kern/kern_conf.c
===================================================================
--- sys/kern/kern_conf.c
+++ sys/kern/kern_conf.c
@@ -533,21 +533,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
Index: sys/net/if.c
===================================================================
--- sys/net/if.c
+++ sys/net/if.c
@@ -2386,7 +2386,7 @@
size_t descrlen;
char *descrbuf, *odescrbuf;
char new_name[IFNAMSIZ];
- char old_name[IFNAMSIZ], strbuf[IFNAMSIZ + 8];
+ char old_name[IFNAMSIZ];
struct ifaddr *ifa;
struct sockaddr_dl *sdl;
@@ -2621,8 +2621,8 @@
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);
break;
#ifdef VIMAGE
Index: sys/powerpc/powermac/pmu.c
===================================================================
--- sys/powerpc/powermac/pmu.c
+++ sys/powerpc/powermac/pmu.c
@@ -950,16 +950,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
Details
Attached
Mime Type
text/plain
Expires
Thu, Aug 27, 3:46 AM (1 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37348539
Default Alt Text
D34505.id103671.diff (8 KB)
Attached To
Mode
D34505: kern: switch various devfs_notify() callers to devfs_notifyf()
Attached
Detach File
Event Timeline
Log In to Comment