Retire devctl_notify_f()
devctl_notify_f isn't needed, so retire it. The flags argument is now unused, so rather than keep it around, retire it. Convert all old users of it to devctl_notify(). This path no longer sleeps, so is safe to call from any context. Since it doesn't sleep, it doesn't need to know if it is OK to sleep or not. Reviewed by: markj@ Differential Revision: https://reviews.freebsd.org/D26140
This commit is contained in:
parent
bca8f35f28
commit
887611b122
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364945
@ -113,7 +113,7 @@ am335x_pmic_intr(void *arg)
|
||||
if (int_reg.aci) {
|
||||
snprintf(notify_buf, sizeof(notify_buf), "notify=0x%02x",
|
||||
status_reg.acpwr);
|
||||
devctl_notify_f("ACPI", "ACAD", "power", notify_buf, M_NOWAIT);
|
||||
devctl_notify("ACPI", "ACAD", "power", notify_buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ g_dev_destroy(void *arg, int flags __unused)
|
||||
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_f("GEOM", "DEV", "DESTROY", buf, M_WAITOK);
|
||||
devctl_notify("GEOM", "DEV", "DESTROY", buf);
|
||||
if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
|
||||
g_access(cp, -cp->acr, -cp->acw, -cp->ace);
|
||||
g_detach(cp);
|
||||
@ -277,13 +277,13 @@ g_dev_set_media(struct g_consumer *cp)
|
||||
sc = cp->private;
|
||||
dev = sc->sc_dev;
|
||||
snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name);
|
||||
devctl_notify_f("DEVFS", "CDEV", "MEDIACHANGE", buf, M_WAITOK);
|
||||
devctl_notify_f("GEOM", "DEV", "MEDIACHANGE", buf, M_WAITOK);
|
||||
devctl_notify("DEVFS", "CDEV", "MEDIACHANGE", buf);
|
||||
devctl_notify("GEOM", "DEV", "MEDIACHANGE", buf);
|
||||
dev = sc->sc_alias;
|
||||
if (dev != NULL) {
|
||||
snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name);
|
||||
devctl_notify_f("DEVFS", "CDEV", "MEDIACHANGE", buf, M_WAITOK);
|
||||
devctl_notify_f("GEOM", "DEV", "MEDIACHANGE", buf, M_WAITOK);
|
||||
devctl_notify("DEVFS", "CDEV", "MEDIACHANGE", buf);
|
||||
devctl_notify("GEOM", "DEV", "MEDIACHANGE", buf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -308,7 +308,7 @@ g_dev_resize(struct g_consumer *cp)
|
||||
char buf[SPECNAMELEN + 6];
|
||||
|
||||
snprintf(buf, sizeof(buf), "cdev=%s", cp->provider->name);
|
||||
devctl_notify_f("GEOM", "DEV", "SIZECHANGE", buf, M_WAITOK);
|
||||
devctl_notify("GEOM", "DEV", "SIZECHANGE", buf);
|
||||
}
|
||||
|
||||
struct g_provider *
|
||||
@ -379,7 +379,7 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
|
||||
|
||||
g_dev_attrchanged(cp, "GEOM::physpath");
|
||||
snprintf(buf, sizeof(buf), "cdev=%s", gp->name);
|
||||
devctl_notify_f("GEOM", "DEV", "CREATE", buf, M_WAITOK);
|
||||
devctl_notify("GEOM", "DEV", "CREATE", buf);
|
||||
/*
|
||||
* Now add all the aliases for this drive
|
||||
*/
|
||||
@ -392,7 +392,7 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
|
||||
continue;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "cdev=%s", gap->ga_alias);
|
||||
devctl_notify_f("GEOM", "DEV", "CREATE", buf, M_WAITOK);
|
||||
devctl_notify("GEOM", "DEV", "CREATE", buf);
|
||||
}
|
||||
|
||||
return (gp);
|
||||
|
@ -546,7 +546,7 @@ notify(struct cdev *dev, const char *ev, int flags)
|
||||
return;
|
||||
memcpy(data, prefix, sizeof(prefix) - 1);
|
||||
memcpy(data + sizeof(prefix) - 1, dev->si_name, namelen + 1);
|
||||
devctl_notify_f("DEVFS", "CDEV", ev, data, mflags);
|
||||
devctl_notify("DEVFS", "CDEV", ev, data);
|
||||
free(data, M_TEMP);
|
||||
}
|
||||
|
||||
|
@ -591,8 +591,8 @@ rctl_enforce(struct proc *p, int resource, uint64_t amount)
|
||||
p->p_pid, p->p_ucred->cr_ruid,
|
||||
p->p_ucred->cr_prison->pr_prison_racct->prr_name);
|
||||
sbuf_finish(&sb);
|
||||
devctl_notify_f("RCTL", "rule", "matched",
|
||||
sbuf_data(&sb), M_NOWAIT);
|
||||
devctl_notify("RCTL", "rule", "matched",
|
||||
sbuf_data(&sb));
|
||||
sbuf_delete(&sb);
|
||||
free(buf, M_RCTL);
|
||||
link->rrl_exceeded = 1;
|
||||
|
@ -651,8 +651,8 @@ devctl_queue(struct dev_event_info *dei)
|
||||
* @brief Send a 'notification' to userland, using standard ways
|
||||
*/
|
||||
void
|
||||
devctl_notify_f(const char *system, const char *subsystem, const char *type,
|
||||
const char *data, int flags __unused)
|
||||
devctl_notify(const char *system, const char *subsystem, const char *type,
|
||||
const char *data)
|
||||
{
|
||||
struct dev_event_info *dei;
|
||||
struct sbuf sb;
|
||||
@ -679,13 +679,6 @@ devctl_notify_f(const char *system, const char *subsystem, const char *type,
|
||||
devctl_queue(dei);
|
||||
}
|
||||
|
||||
void
|
||||
devctl_notify(const char *system, const char *subsystem, const char *type,
|
||||
const char *data)
|
||||
{
|
||||
devctl_notify_f(system, subsystem, type, data, M_NOWAIT);
|
||||
}
|
||||
|
||||
/*
|
||||
* Common routine that tries to make sending messages as easy as possible.
|
||||
* We allocate memory for the data, copy strings into that, but do not
|
||||
|
@ -36,8 +36,6 @@
|
||||
* hook to send the message.
|
||||
*/
|
||||
boolean_t devctl_process_running(void);
|
||||
void devctl_notify_f(const char *__system, const char *__subsystem,
|
||||
const char *__type, const char *__data, int __flags);
|
||||
void devctl_notify(const char *__system, const char *__subsystem,
|
||||
const char *__type, const char *__data);
|
||||
struct sbuf;
|
||||
|
Loading…
Reference in New Issue
Block a user