Lines Matching refs:ddv

285 sdev_nodeinit(struct sdev_node *ddv, char *nm, struct sdev_node **newdv,  in sdev_nodeinit()  argument
306 len = strlen(ddv->sdev_path) + strlen(nm) + 2; in sdev_nodeinit()
308 (void) snprintf(dv->sdev_path, len, "%s/%s", ddv->sdev_path, nm); in sdev_nodeinit()
315 vp->v_vfsp = SDEVTOV(ddv)->v_vfsp; in sdev_nodeinit()
323 vn_setops(vp, vn_getops(SDEVTOV(ddv))); in sdev_nodeinit()
336 dv->sdev_flags = ddv->sdev_flags; /* inherit from the parent first */ in sdev_nodeinit()
340 if (SDEV_IS_GLOBAL(ddv)) { in sdev_nodeinit()
670 sdev_mknode(struct sdev_node *ddv, char *nm, struct sdev_node **newdv, in sdev_mknode() argument
679 ASSERT(RW_WRITE_HELD(&ddv->sdev_contents)); in sdev_mknode()
685 if (ddv->sdev_state == SDEV_ZOMBIE) { in sdev_mknode()
687 ddv->sdev_path)); in sdev_mknode()
691 error = sdev_nodeinit(ddv, nm, &dv, vap); in sdev_mknode()
701 sdev_cache_update(ddv, &dv, nm, SDEV_CACHE_ADD); in sdev_mknode()
735 sdev_cache_update(ddv, &dv, nm, SDEV_CACHE_DELETE); in sdev_mknode()
840 sdev_findbyname(struct sdev_node *ddv, char *nm) in sdev_findbyname() argument
846 ASSERT(RW_LOCK_HELD(&ddv->sdev_contents)); in sdev_findbyname()
849 dv = avl_find(&ddv->sdev_entries, &dvtmp, &where); in sdev_findbyname()
851 ASSERT(dv->sdev_dotdot == ddv); in sdev_findbyname()
864 sdev_direnter(struct sdev_node *ddv, struct sdev_node *dv) in sdev_direnter() argument
868 ASSERT(RW_WRITE_HELD(&ddv->sdev_contents)); in sdev_direnter()
869 ASSERT(SDEVTOV(ddv)->v_type == VDIR); in sdev_direnter()
870 ASSERT(ddv->sdev_nlink >= 2); in sdev_direnter()
874 dv->sdev_dotdot = ddv; in sdev_direnter()
875 VERIFY(avl_find(&ddv->sdev_entries, dv, &where) == NULL); in sdev_direnter()
876 avl_insert(&ddv->sdev_entries, dv, where); in sdev_direnter()
877 ddv->sdev_nlink++; in sdev_direnter()
905 sdev_dirdelete(struct sdev_node *ddv, struct sdev_node *dv) in sdev_dirdelete() argument
910 ASSERT(RW_WRITE_HELD(&ddv->sdev_contents)); in sdev_dirdelete()
924 decr_link(ddv); in sdev_dirdelete()
925 avl_remove(&ddv->sdev_entries, dv); in sdev_dirdelete()
1284 devname_backstore_lookup(struct sdev_node *ddv, char *nm, struct vnode **rvp) in devname_backstore_lookup() argument
1286 struct vnode *rdvp = ddv->sdev_attrvp; in devname_backstore_lookup()
1297 sdev_filldir_from_store(struct sdev_node *ddv, int dlen, struct cred *cred) in sdev_filldir_from_store() argument
1313 if (ddv->sdev_attrvp == NULL) in sdev_filldir_from_store()
1315 if (!(ddv->sdev_flags & SDEV_BUILD)) in sdev_filldir_from_store()
1318 dirvp = ddv->sdev_attrvp; in sdev_filldir_from_store()
1344 if (!(ddv->sdev_flags & SDEV_BUILD)) in sdev_filldir_from_store()
1357 dv = sdev_cache_lookup(ddv, nm); in sdev_filldir_from_store()
1365 error = devname_backstore_lookup(ddv, nm, &vp); in sdev_filldir_from_store()
1382 if (!rw_tryupgrade(&ddv->sdev_contents)) { in sdev_filldir_from_store()
1383 rw_exit(&ddv->sdev_contents); in sdev_filldir_from_store()
1384 rw_enter(&ddv->sdev_contents, RW_WRITER); in sdev_filldir_from_store()
1386 error = sdev_mknode(ddv, nm, &dv, &vattr, vp, link, in sdev_filldir_from_store()
1388 rw_downgrade(&ddv->sdev_contents); in sdev_filldir_from_store()
1413 sdev_filldir_dynamic(struct sdev_node *ddv) in sdev_filldir_dynamic() argument
1422 ASSERT(RW_WRITE_HELD(&ddv->sdev_contents)); in sdev_filldir_dynamic()
1423 ASSERT((ddv->sdev_flags & SDEV_BUILD)); in sdev_filldir_dynamic()
1443 ASSERT(RW_WRITE_HELD(&ddv->sdev_contents)); in sdev_filldir_dynamic()
1445 error = sdev_mknode(ddv, nm, &dv, vap, NULL, in sdev_filldir_dynamic()
1449 ddv->sdev_name, nm, error); in sdev_filldir_dynamic()
1539 sdev_cache_add(struct sdev_node *ddv, struct sdev_node **dv, char *nm) in sdev_cache_add() argument
1543 ASSERT(RW_WRITE_HELD(&ddv->sdev_contents)); in sdev_cache_add()
1544 if ((dup = sdev_findbyname(ddv, nm)) == NULL) { in sdev_cache_add()
1545 sdev_direnter(ddv, *dv); in sdev_cache_add()
1555 sdev_cache_delete(struct sdev_node *ddv, struct sdev_node **dv) in sdev_cache_delete() argument
1557 ASSERT(RW_WRITE_HELD(&ddv->sdev_contents)); in sdev_cache_delete()
1558 sdev_dirdelete(ddv, *dv); in sdev_cache_delete()
1565 sdev_cache_update(struct sdev_node *ddv, struct sdev_node **dv, char *nm, in sdev_cache_update() argument
1570 ASSERT(RW_WRITE_HELD(&ddv->sdev_contents)); in sdev_cache_update()
1573 sdev_cache_add(ddv, dv, nm); in sdev_cache_update()
1576 sdev_cache_delete(ddv, dv); in sdev_cache_update()
1587 sdev_cache_lookup(struct sdev_node *ddv, char *nm) in sdev_cache_lookup() argument
1591 ASSERT(RW_LOCK_HELD(&ddv->sdev_contents)); in sdev_cache_lookup()
1592 dv = sdev_findbyname(ddv, nm); in sdev_cache_lookup()
1606 sdev_call_devfsadmd(struct sdev_node *ddv, struct sdev_node *dv, char *nm) in sdev_call_devfsadmd() argument
1612 ddv->sdev_name, nm, devfsadm_state)); in sdev_call_devfsadmd()
1619 ddv->sdev_name, nm, devfsadm_state)); in sdev_call_devfsadmd()
1621 sdev_devfsadmd_thread(ddv, dv, kcred); in sdev_call_devfsadmd()
1638 sdev_call_dircallback(struct sdev_node *ddv, struct sdev_node **dvp, char *nm, in sdev_call_dircallback() argument
1648 ASSERT(RW_WRITE_HELD(&ddv->sdev_contents)); in sdev_call_dircallback()
1651 rv = callback(ddv, nm, (void *)&physpath, kcred, NULL, in sdev_call_dircallback()
1664 rv = sdev_mknode(ddv, nm, &dv, vap, NULL, in sdev_call_dircallback()
1678 rv = callback(ddv, nm, (void *)&vattr, kcred, NULL, NULL); in sdev_call_dircallback()
1685 rv = sdev_mknode(ddv, nm, &dv, &vattr, NULL, NULL, in sdev_call_dircallback()
1693 SDEVTOV(ddv)->v_path, nm, curproc->p_user.u_comm, in sdev_call_dircallback()
1723 devname_lookup_func(struct sdev_node *ddv, char *nm, struct vnode **vpp, in devname_lookup_func() argument
1740 if (SDEVTOV(ddv)->v_type != VDIR) in devname_lookup_func()
1748 *vpp = SDEVTOV(ddv); in devname_lookup_func()
1757 *vpp = SDEVTOV(ddv->sdev_dotdot); in devname_lookup_func()
1762 rw_enter(&ddv->sdev_contents, RW_READER); in devname_lookup_func()
1763 if (ddv->sdev_flags & SDEV_VTOR) { in devname_lookup_func()
1764 vtor = (int (*)(struct sdev_node *))sdev_get_vtor(ddv); in devname_lookup_func()
1772 ASSERT(RW_READ_HELD(&ddv->sdev_contents)); in devname_lookup_func()
1773 parent_state = ddv->sdev_state; in devname_lookup_func()
1774 dv = sdev_cache_lookup(ddv, nm); in devname_lookup_func()
1784 SD_TRACE_FAILED_LOOKUP(ddv, nm, in devname_lookup_func()
1798 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
1801 rw_enter(&ddv->sdev_contents, RW_READER); in devname_lookup_func()
1804 SD_TRACE_FAILED_LOOKUP(ddv, nm, in devname_lookup_func()
1811 SD_TRACE_FAILED_LOOKUP(ddv, nm, in devname_lookup_func()
1817 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
1818 SD_TRACE_FAILED_LOOKUP(ddv, nm, in devname_lookup_func()
1830 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
1831 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
1835 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
1836 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
1837 sdev_lookup_failed(ddv, nm, failed_flags); in devname_lookup_func()
1842 ASSERT(RW_READ_HELD(&ddv->sdev_contents)); in devname_lookup_func()
1849 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
1851 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
1862 if (SDEV_IS_PERSIST(ddv)) { in devname_lookup_func()
1863 error = devname_backstore_lookup(ddv, nm, &rvp); in devname_lookup_func()
1870 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
1873 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
1874 sdev_lookup_failed(ddv, nm, failed_flags); in devname_lookup_func()
1882 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
1885 SD_TRACE_FAILED_LOOKUP(ddv, nm, in devname_lookup_func()
1887 sdev_lookup_failed(ddv, nm, in devname_lookup_func()
1895 if (!rw_tryupgrade(&ddv->sdev_contents)) { in devname_lookup_func()
1896 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
1897 rw_enter(&ddv->sdev_contents, RW_WRITER); in devname_lookup_func()
1899 error = sdev_mknode(ddv, nm, &dv, &vattr, in devname_lookup_func()
1901 rw_downgrade(&ddv->sdev_contents); in devname_lookup_func()
1909 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
1910 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
1918 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
1920 ddv->sdev_name, nm)); in devname_lookup_func()
1923 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
1924 sdev_lookup_failed(ddv, nm, failed_flags); in devname_lookup_func()
1934 if (!rw_tryupgrade(&ddv->sdev_contents)) { in devname_lookup_func()
1935 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
1936 rw_enter(&ddv->sdev_contents, RW_WRITER); in devname_lookup_func()
1938 error = sdev_call_dircallback(ddv, &dv, nm, callback, in devname_lookup_func()
1940 rw_downgrade(&ddv->sdev_contents); in devname_lookup_func()
1944 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
1945 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
1950 if (!rw_tryupgrade(&ddv->sdev_contents)) { in devname_lookup_func()
1951 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
1952 rw_enter(&ddv->sdev_contents, RW_WRITER); in devname_lookup_func()
1954 error = sdev_mknode(ddv, nm, &dv, NULL, NULL, NULL, in devname_lookup_func()
1957 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
1958 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
1959 sdev_lookup_failed(ddv, nm, failed_flags); in devname_lookup_func()
1963 rw_downgrade(&ddv->sdev_contents); in devname_lookup_func()
1974 SDEV_IS_DYNAMIC(ddv) || SDEV_IS_NO_NCACHE(dv) || in devname_lookup_func()
1977 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
1987 if (sdev_lookup_filter(ddv, nm)) { in devname_lookup_func()
1988 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
1994 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
1999 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
2003 error = sdev_call_devfsadmd(ddv, dv, nm); in devname_lookup_func()
2006 ddv->sdev_name, nm, curproc->p_user.u_comm)); in devname_lookup_func()
2010 ddv->sdev_name, nm, curproc->p_user.u_comm); in devname_lookup_func()
2018 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
2036 ASSERT(RW_READ_HELD(&ddv->sdev_contents)); in devname_lookup_func()
2037 if (rw_tryupgrade(&ddv->sdev_contents) == 0) { in devname_lookup_func()
2038 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
2039 rw_enter(&ddv->sdev_contents, RW_WRITER); in devname_lookup_func()
2041 sdev_cache_update(ddv, &dv, nm, SDEV_CACHE_DELETE); in devname_lookup_func()
2042 rw_downgrade(&ddv->sdev_contents); in devname_lookup_func()
2048 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
2055 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
2056 SD_TRACE_FAILED_LOOKUP(ddv, nm, retried); in devname_lookup_func()
2067 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
2080 ASSERT(RW_READ_HELD(&ddv->sdev_contents)); in devname_lookup_func()
2082 if (!rw_tryupgrade(&ddv->sdev_contents)) { in devname_lookup_func()
2083 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
2084 rw_enter(&ddv->sdev_contents, RW_WRITER); in devname_lookup_func()
2092 sdev_dirdelete(ddv, dv); in devname_lookup_func()
2093 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
2094 sdev_lookup_failed(ddv, nm, failed_flags); in devname_lookup_func()
2101 rw_exit(&ddv->sdev_contents); in devname_lookup_func()
2105 sdev_lookup_failed(ddv, nm, failed_flags); in devname_lookup_func()
2119 sdev_stale(struct sdev_node *ddv) in sdev_stale() argument
2124 ASSERT(SDEVTOV(ddv)->v_type == VDIR); in sdev_stale()
2126 rw_enter(&ddv->sdev_contents, RW_WRITER); in sdev_stale()
2127 while ((dv = SDEV_FIRST_ENTRY(ddv)) != NULL) { in sdev_stale()
2133 sdev_dirdelete(ddv, dv); in sdev_stale()
2136 ddv->sdev_flags |= SDEV_BUILD; in sdev_stale()
2137 rw_exit(&ddv->sdev_contents); in sdev_stale()
2147 sdev_cleandir(struct sdev_node *ddv, char *expr, uint_t flags) in sdev_cleandir() argument
2157 ASSERT(SDEVTOV(ddv)->v_type == VDIR); in sdev_cleandir()
2162 rw_enter(&ddv->sdev_contents, RW_WRITER); in sdev_cleandir()
2163 for (dv = SDEV_FIRST_ENTRY(ddv); dv != NULL; dv = next) { in sdev_cleandir()
2164 next = SDEV_NEXT_ENTRY(ddv, dv); in sdev_cleandir()
2201 sdev_dirdelete(ddv, dv); in sdev_cleandir()
2206 ASSERT(ddv->sdev_attrvp); in sdev_cleandir()
2209 error = VOP_REMOVE(ddv->sdev_attrvp, in sdev_cleandir()
2212 error = VOP_RMDIR(ddv->sdev_attrvp, in sdev_cleandir()
2213 bks_name, ddv->sdev_attrvp, kcred, NULL, 0); in sdev_cleandir()
2229 ddv->sdev_flags |= SDEV_BUILD; in sdev_cleandir()
2233 ddv->sdev_flags |= SDEV_BUILD; in sdev_cleandir()
2234 rw_exit(&ddv->sdev_contents); in sdev_cleandir()
2293 struct sdev_node *ddv = VTOSDEV(vp); in devname_readdir_func() local
2310 ASSERT(ddv->sdev_attr || ddv->sdev_attrvp); in devname_readdir_func()
2311 ASSERT(RW_READ_HELD(&ddv->sdev_contents)); in devname_readdir_func()
2325 if (ddv->sdev_flags & SDEV_VTOR) { in devname_readdir_func()
2326 vtor = (int (*)(struct sdev_node *))sdev_get_vtor(ddv); in devname_readdir_func()
2339 if (ddv->sdev_state == SDEV_ZOMBIE) in devname_readdir_func()
2342 if (SDEV_IS_GLOBAL(ddv)) { in devname_readdir_func()
2346 !SDEV_IS_DYNAMIC(ddv) && !SDEV_IS_NO_NCACHE(ddv) && in devname_readdir_func()
2354 mutex_enter(&ddv->sdev_lookup_lock); in devname_readdir_func()
2355 SDEV_BLOCK_OTHERS(ddv, in devname_readdir_func()
2357 mutex_exit(&ddv->sdev_lookup_lock); in devname_readdir_func()
2360 ddv->sdev_path, curproc->p_user.u_comm)); in devname_readdir_func()
2364 ddv->sdev_path, curproc->p_user.u_comm); in devname_readdir_func()
2367 sdev_devfsadmd_thread(ddv, NULL, kcred); in devname_readdir_func()
2372 mutex_enter(&ddv->sdev_lookup_lock); in devname_readdir_func()
2373 SDEV_BLOCK_OTHERS(ddv, (SDEV_READDIR|SDEV_LGWAITING)); in devname_readdir_func()
2374 mutex_exit(&ddv->sdev_lookup_lock); in devname_readdir_func()
2381 rw_exit(&ddv->sdev_contents); in devname_readdir_func()
2382 mutex_enter(&ddv->sdev_lookup_lock); in devname_readdir_func()
2383 if (SDEV_IS_READDIR(ddv)) in devname_readdir_func()
2384 (void) sdev_wait4lookup(ddv, SDEV_READDIR); in devname_readdir_func()
2385 mutex_exit(&ddv->sdev_lookup_lock); in devname_readdir_func()
2386 rw_enter(&ddv->sdev_contents, RW_READER); in devname_readdir_func()
2389 ddv->sdev_name, curproc->p_user.u_comm)); in devname_readdir_func()
2390 if (ddv->sdev_flags & SDEV_BUILD) { in devname_readdir_func()
2391 if (SDEV_IS_PERSIST(ddv)) { in devname_readdir_func()
2392 error = sdev_filldir_from_store(ddv, in devname_readdir_func()
2395 ddv->sdev_flags &= ~SDEV_BUILD; in devname_readdir_func()
2410 dp->d_ino = (ino64_t)ddv->sdev_ino; in devname_readdir_func()
2429 dp->d_ino = (ino64_t)ddv->sdev_dotdot->sdev_ino; in devname_readdir_func()
2442 for (dv = SDEV_FIRST_ENTRY(ddv); dv; in devname_readdir_func()
2443 dv = SDEV_NEXT_ENTRY(ddv, dv), diroff++) { in devname_readdir_func()
2515 if (ddv->sdev_attrvp) { in devname_readdir_func()
2521 (void) VOP_SETATTR(ddv->sdev_attrvp, &attr, 0, kcred, NULL); in devname_readdir_func()