Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Aug 2020 04:30:06 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r364945 - in head/sys: arm/ti/am335x geom kern sys
Message-ID:  <202008290430.07T4U6ZC007871@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Sat Aug 29 04:30:06 2020
New Revision: 364945
URL: https://svnweb.freebsd.org/changeset/base/364945

Log:
  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

Modified:
  head/sys/arm/ti/am335x/am335x_pmic.c
  head/sys/geom/geom_dev.c
  head/sys/kern/kern_conf.c
  head/sys/kern/kern_rctl.c
  head/sys/kern/subr_bus.c
  head/sys/sys/devctl.h

Modified: head/sys/arm/ti/am335x/am335x_pmic.c
==============================================================================
--- head/sys/arm/ti/am335x/am335x_pmic.c	Sat Aug 29 04:29:53 2020	(r364944)
+++ head/sys/arm/ti/am335x/am335x_pmic.c	Sat Aug 29 04:30:06 2020	(r364945)
@@ -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);
 	}
 }
 

Modified: head/sys/geom/geom_dev.c
==============================================================================
--- head/sys/geom/geom_dev.c	Sat Aug 29 04:29:53 2020	(r364944)
+++ head/sys/geom/geom_dev.c	Sat Aug 29 04:30:06 2020	(r364945)
@@ -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,
 
 	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,
 			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);

Modified: head/sys/kern/kern_conf.c
==============================================================================
--- head/sys/kern/kern_conf.c	Sat Aug 29 04:29:53 2020	(r364944)
+++ head/sys/kern/kern_conf.c	Sat Aug 29 04:30:06 2020	(r364945)
@@ -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);
 }
 

Modified: head/sys/kern/kern_rctl.c
==============================================================================
--- head/sys/kern/kern_rctl.c	Sat Aug 29 04:29:53 2020	(r364944)
+++ head/sys/kern/kern_rctl.c	Sat Aug 29 04:30:06 2020	(r364945)
@@ -591,8 +591,8 @@ rctl_enforce(struct proc *p, int resource, uint64_t am
 			    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;

Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c	Sat Aug 29 04:29:53 2020	(r364944)
+++ head/sys/kern/subr_bus.c	Sat Aug 29 04:30:06 2020	(r364945)
@@ -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;
@@ -677,13 +677,6 @@ devctl_notify_f(const char *system, const char *subsys
 		devctl_free_dei(dei);	/* overflow -> drop it */
 	else
 		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);
 }
 
 /*

Modified: head/sys/sys/devctl.h
==============================================================================
--- head/sys/sys/devctl.h	Sat Aug 29 04:29:53 2020	(r364944)
+++ head/sys/sys/devctl.h	Sat Aug 29 04:30:06 2020	(r364945)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008290430.07T4U6ZC007871>