+static void
+devfs_bulk_notify(devfs_event_log_t delp)
+{
+ uint32_t i;
+ for (i = 0; i < delp->del_used; i++) {
+ devfs_vnode_event_t dvep = &delp->del_entries[i];
+ if (vnode_getwithvid(dvep->dve_vp, dvep->dve_vid) == 0) {
+ vnode_notify(dvep->dve_vp, dvep->dve_events, NULL);
+ vnode_put(dvep->dve_vp);
+ }
+ }
+}
+
+static void
+devfs_record_event(devfs_event_log_t delp, devnode_t *dnp, uint32_t events)
+{
+ if (delp->del_used >= delp->del_max) {
+ panic("devfs event log overflowed.\n");
+ }
+
+ /* Can only notify for nodes that have an associated vnode */
+ if (dnp->dn_vn != NULLVP && vnode_ismonitored(dnp->dn_vn)) {
+ devfs_vnode_event_t dvep = &delp->del_entries[delp->del_used];
+ dvep->dve_vp = dnp->dn_vn;
+ dvep->dve_vid = vnode_vid(dnp->dn_vn);
+ dvep->dve_events = events;
+ delp->del_used++;
+ }
+}
+
+static int
+devfs_init_event_log(devfs_event_log_t delp, uint32_t count, devfs_vnode_event_t buf)
+{
+ devfs_vnode_event_t dvearr;
+
+ if (buf == NULL) {
+ MALLOC(dvearr, devfs_vnode_event_t, count * sizeof(struct devfs_vnode_event), M_TEMP, M_WAITOK | M_ZERO);
+ if (dvearr == NULL) {
+ return ENOMEM;
+ }
+ } else {
+ dvearr = buf;
+ }
+
+ delp->del_max = count;
+ delp->del_used = 0;
+ delp->del_entries = dvearr;
+ return 0;
+}
+
+static void
+devfs_release_event_log(devfs_event_log_t delp, int need_free)
+{
+ if (delp->del_entries == NULL) {
+ panic("Free of devfs notify info that has not been intialized.\n");
+ }
+
+ if (need_free) {
+ FREE(delp->del_entries, M_TEMP);
+ }
+
+ delp->del_entries = NULL;
+}