Lines Matching refs:pfp

198  * it will attempt to discard an oldest inactive watch(pfp) at the time
337 portfop_t *pfp = (portfop_t *)arg;
349 if (pfp != NULL) {
350 pfp->pfop_flags &= ~PORT_FOP_KEV_ONQ;
360 port_pcache_insert(portfop_cache_t *pfcp, portfop_t *pfp)
365 bucket = PORT_FOP_BUCKET(pfcp, pfp->pfop_object);
366 pfp->pfop_hashnext = *bucket;
367 *bucket = pfp;
372 * Remove the pfp from the port source cache.
375 port_pcache_delete(portfop_cache_t *pfcp, portfop_t *pfp)
381 bucket = PORT_FOP_BUCKET(pfcp, pfp->pfop_object);
383 if (pfp == cpdp) {
384 *bucket = pfp->pfop_hashnext;
389 if (cpdp == pfp) {
391 lpdp->pfop_hashnext = pfp->pfop_hashnext;
400 * The vnode's(portfop_vp_t) pfp list management. The 'pvp_mutex' is held
404 * It is used to discard the oldtest inactive pfp if the number of entries
408 port_fop_listinsert(portfop_vp_t *pvp, portfop_t *pfp, int where)
411 list_insert_head(&pvp->pvp_pfoplist, (void *)pfp);
413 list_insert_tail(&pvp->pvp_pfoplist, (void *)pfp);
416 pvp->pvp_lpfop = pfp;
422 port_fop_listinsert_head(portfop_vp_t *pvp, portfop_t *pfp)
424 port_fop_listinsert(pvp, pfp, 1);
428 port_fop_listinsert_tail(portfop_vp_t *pvp, portfop_t *pfp)
432 * to an active one. Insert to the tail is done only when a pfp goes
436 pvp->pvp_lpfop = pfp;
438 port_fop_listinsert(pvp, pfp, 0);
442 port_fop_listremove(portfop_vp_t *pvp, portfop_t *pfp)
444 if (pvp->pvp_lpfop == pfp) {
445 pvp->pvp_lpfop = list_next(&pvp->pvp_pfoplist, (void *)pfp);
448 list_remove(&pvp->pvp_pfoplist, (void *)pfp);
466 * It is called only when pfp is not on the vnode's list. Otherwise,
470 port_pcache_remove_fop(portfop_cache_t *pfcp, portfop_t *pfp)
477 pkevp = pfp->pfop_pev;
478 pfp->pfop_pev = NULL;
485 port_pcache_delete(pfcp, pfp);
487 if (pfp->pfop_cname != NULL)
488 kmem_free(pfp->pfop_cname, pfp->pfop_clen + 1);
489 kmem_free(pfp, sizeof (portfop_t));
502 portfop_t *pfp = NULL;
513 pfp = pvp->pvp_lpfop;
514 pfcp = pfp->pfop_pcache;
521 if (pfp && !(pfp->pfop_flags & PORT_FOP_ACTIVE) &&
522 !(pfp->pfop_flags & PORT_FOP_KEV_ONQ)) {
523 port_fop_listremove(pvp, pfp);
524 pfp->pfop_flags |= PORT_FOP_REMOVING;
527 pfp = NULL;
530 pfp = NULL;
535 * discard pfp if any.
537 if (pfp != NULL) {
538 tdvp = pfp->pfop_dvp;
539 port_pcache_remove_fop(pfcp, pfp);
610 * Remove pfp from the vnode's watch list and the cache and discard it.
611 * If it is the last pfp on the vnode's list, the fem hooks get uninstalled.
612 * Returns 1 if pfp removed successfully.
614 * The *active is set to indicate if the pfp was still active(no events had
622 port_remove_fop(portfop_t *pfp, portfop_cache_t *pfcp, int cleanup,
630 vp = pfp->pfop_vp;
635 * if not cleanup, remove it only if the pfp is still active and
638 if (!cleanup && (!(pfp->pfop_flags & PORT_FOP_ACTIVE) ||
639 pfp->pfop_flags & PORT_FOP_REMOVING)) {
647 if (pfp->pfop_flags & PORT_FOP_ACTIVE) {
648 pfp->pfop_flags &= ~PORT_FOP_ACTIVE;
653 * Check if the pfp is still on the vnode's list. This can
655 * In case of cleanup, just mark this pfp as inactive so that no
658 * held, the pfp will not disappear, even though it is being
661 if (pfp->pfop_flags & PORT_FOP_REMOVING) {
663 if (!tactive && port_remove_done_event(pfp->pfop_pev)) {
664 pfp->pfop_flags &= ~PORT_FOP_KEV_ONQ;
677 if (!tactive && port_remove_done_event(pfp->pfop_pev)) {
678 pfp->pfop_flags &= ~PORT_FOP_KEV_ONQ;
688 * remove pfp from the vnode's list
690 port_fop_listremove(pvp, pfp);
698 *dvpp = pfp->pfop_dvp;
699 port_pcache_remove_fop(pfcp, pfp);
713 portfop_t *pfp = NULL;
718 pfp = *bucket;
719 while (pfp != NULL) {
720 if (pfp->pfop_object == obj && pfp->pfop_pid == pid)
722 pfp = pfp->pfop_hashnext;
724 return (pfp);
814 * the pfp is still the same before proceeding to deliver an event.
818 portfop_t *pfp, void *objptr, uintptr_t object)
866 * dealing with the same pfp and curthread is the one
873 if (tpfp == NULL || tpfp != pfp ||
874 pfp->pfop_vp != vp || pfp->pfop_dvp != dvp ||
875 pfp->pfop_callrid != curthread ||
876 !(pfp->pfop_flags & PORT_FOP_ACTIVE)) {
888 * The pfp cannot disappear as the port cache lock is held.
891 if (pfp->pfop_flags & PORT_FOP_ACTIVE &&
892 !(pfp->pfop_flags & PORT_FOP_REMOVING)) {
895 if (pfp->pfop_events & FILE_ACCESS &&
901 if (pfp->pfop_events & FILE_MODIFIED &&
907 if (pfp->pfop_events & FILE_ATTRIB &&
916 if (pfp->pfop_events & FILE_ACCESS &&
923 if (pfp->pfop_events & FILE_MODIFIED &&
930 if (pfp->pfop_events & FILE_ATTRIB &&
951 pkevp = pfp->pfop_pev;
952 pfp->pfop_flags &= ~PORT_FOP_ACTIVE;
958 port_fop_listremove(pvp, pfp);
959 port_fop_listinsert_tail(pvp, pfp);
961 pfp->pfop_flags |= PORT_FOP_KEV_ONQ;
1108 portfop_t *pfp = NULL;
1125 if (pfp == NULL) {
1130 pfp = kmem_zalloc(sizeof (portfop_t), KM_SLEEP);
1131 pfp->pfop_pev = pkevp;
1134 pfp->pfop_vp = vp;
1135 pfp->pfop_pid = curproc->p_pid;
1136 pfp->pfop_pcache = pfcp;
1137 pfp->pfop_pp = pp;
1138 pfp->pfop_flags |= PORT_FOP_ACTIVE;
1139 pfp->pfop_cname = cname;
1140 pfp->pfop_clen = clen;
1141 pfp->pfop_dvp = dvp;
1142 pfp->pfop_object = object;
1145 pkevp->portkev_arg = pfp;
1150 port_pcache_insert(pfcp, pfp);
1167 if (!(error = fem_install(pfp->pfop_vp, femp,
1194 pfp->pfop_cname = NULL;
1195 port_pcache_remove_fop(pfcp, pfp);
1201 * insert the pfp on the vnode's list. After this
1204 pfp->pfop_events = events;
1205 port_fop_listinsert_head(pvp, pfp);
1213 *pfpp = pfp;
1252 * Every reference(pfp) to the directory vnode will have a VN_HOLD to ensure
1261 portfop_t *pfp;
1350 pfp = port_cache_lookup_fop(pfcp, curproc->p_pid, object);
1357 if (pfp != NULL && (pfp->pfop_vp != vp || pfp->pfop_dvp != dvp)) {
1358 (void) port_remove_fop(pfp, pfcp, 1, NULL, &oldvp, &olddvp);
1359 pfp = NULL;
1362 if (pfp == NULL) {
1371 if (error = port_pfp_setup(&pfp, pp, vp, pfcp, object,
1377 pfp->pfop_callrid = curthread;
1414 * we are still dealing with the same pfp and this
1422 if (tpfp == NULL || tpfp != pfp ||
1423 pfp->pfop_vp != vp ||
1424 pfp->pfop_dvp != dvp ||
1425 pfp->pfop_callrid != curthread) {
1436 * remove the pfp and fem hooks, if pfp still
1444 if (port_remove_fop(pfp, pfcp, 0, NULL, &tvp, &tdvp)) {
1446 * The pfp was removed, means no
1470 if (port_remove_done_event(pfp->pfop_pev)) {
1471 pfp->pfop_flags &= ~PORT_FOP_KEV_ONQ;
1477 pfp->pfop_events = events;
1484 * in the beginning. If removing, the pfp will be on
1489 if (!(pfp->pfop_flags & PORT_FOP_ACTIVE)) {
1490 pfp->pfop_flags |= PORT_FOP_ACTIVE;
1491 if (!(pfp->pfop_flags & PORT_FOP_REMOVING)) {
1493 port_fop_listremove(pvp, pfp);
1494 port_fop_listinsert_head(pvp, pfp);
1497 pfp->pfop_callrid = curthread;
1506 port_check_timestamp(pfcp, vp, dvp, pfp, objptr, object);
1552 portfop_t *pfp;
1572 pfp = port_cache_lookup_fop(pfcp, curproc->p_pid, object);
1573 if (pfp == NULL) {
1581 * the the pfp is being removed due to an exception event
1587 (void) port_remove_fop(pfp, pfcp, 1, &active, &tvp, &tdvp);
1609 portfop_t *pfp;
1638 pfp = hashtbl[index];
1639 while (pfp != NULL && i < (PORTFOP_NVP - 1)) {
1640 pfpnext = pfp->pfop_hashnext;
1641 if (pid == pfp->pfop_pid) {
1642 (void) port_remove_fop(pfp, pfcp, 1, NULL,
1652 pfp = pfpnext;
1654 if (pfp == NULL)
1673 * trying to remove the pfp's from the port's cache, it is
1674 * possible that some pfp's are still in the process of being
1694 * separately because, the pfp needs to be removed from the port cache and
1696 * the pfp from the port's cache, we need to hold the cache lock (pfc_lock).
1703 portfop_t *pfp;
1710 while (pfp = (portfop_t *)list_head(tlist)) {
1715 * list_remove on this pfp.
1717 list_remove(tlist, pfp);
1719 pfcp = pfp->pfop_pcache;
1724 * No need to clear the PORT_FOP_KEV_ONQ flag as this pfp is
1727 if ((pfp->pfop_flags & PORT_FOP_KEV_ONQ)) {
1728 removed = port_remove_done_event(pfp->pfop_pev);
1735 if (pfp->pfop_flags & (PORT_FOP_ACTIVE) || removed) {
1736 pp = pfp->pfop_pp;
1741 * pfp anymore.
1743 pfp->pfop_flags &= ~PORT_FOP_ACTIVE;
1751 pfp->pfop_pev->portkev_object;
1753 pfp->pfop_pev->portkev_user;
1758 pfp->pfop_pev->portkev_pid;
1764 * At this point the pfp has been removed from the vnode's
1766 * Remove the pfp and free it from the cache.
1768 tdvp = pfp->pfop_dvp;
1769 port_pcache_remove_fop(pfcp, pfp);
1787 portfop_t *pfp, *npfp;
1833 for (pfp = (portfop_t *)list_tail(&pvp->pvp_pfoplist);
1834 pfp && !(pfp->pfop_flags & PORT_FOP_ACTIVE); pfp = npfp) {
1835 npfp = list_prev(&pvp->pvp_pfoplist, pfp);
1838 for (; pfp != NULL; pfp = npfp) {
1841 npfp = list_prev(&pvp->pvp_pfoplist, pfp);
1850 if (pfp->pfop_dvp == NULL ||
1851 (pfp->pfop_dvp == dvp &&
1852 (strcmp(cname, pfp->pfop_cname) == 0))) {
1856 * Note we don't set the pfp->pfop_vp
1862 * pfp gets removed and freed.
1864 port_fop_listremove(pvp, pfp);
1865 list_insert_tail(&tmplist, (void *)pfp);
1866 pfp->pfop_flags |= PORT_FOP_REMOVING;
1874 if (pfp->pfop_events & levents) {
1877 * If the pfp was active, it cannot be
1880 pfp->pfop_flags &= ~PORT_FOP_ACTIVE;
1881 port_fop_listremove(pvp, pfp);
1882 port_fop_listinsert_tail(pvp, pfp);
1884 pkevp = pfp->pfop_pev;
1886 (levents & pfp->pfop_events);
1888 pfp->pfop_flags |= PORT_FOP_KEV_ONQ;
1900 for (; pfp; pfp = npfp) {
1901 npfp = list_next(&pvp->pvp_pfoplist, pfp);
1903 pfp->pfop_dvp == NULL ||
1904 (pfp->pfop_dvp == dvp &&
1905 (strcmp(cname, pfp->pfop_cname) == 0))) {
1906 port_fop_listremove(pvp, pfp);
1907 list_insert_tail(&tmplist, (void *)pfp);
1908 pfp->pfop_flags |= PORT_FOP_REMOVING;
1919 for (pfp = (portfop_t *)list_head(&tmplist);
1920 pfp; pfp = list_next(&tmplist, pfp)) {
1921 pfp->pfop_flags |= PORT_FOP_REMOVING;