Lines Matching refs:de

827 tmpfs_dirent_cookie(struct tmpfs_dirent *de)  in tmpfs_dirent_cookie()  argument
829 if (de == NULL) in tmpfs_dirent_cookie()
832 MPASS(de->td_cookie >= TMPFS_DIRCOOKIE_MIN); in tmpfs_dirent_cookie()
834 return (de->td_cookie); in tmpfs_dirent_cookie()
838 tmpfs_dirent_dup(struct tmpfs_dirent *de) in tmpfs_dirent_dup() argument
840 return ((de->td_cookie & TMPFS_DIRCOOKIE_DUP) != 0); in tmpfs_dirent_dup()
844 tmpfs_dirent_duphead(struct tmpfs_dirent *de) in tmpfs_dirent_duphead() argument
846 return ((de->td_cookie & TMPFS_DIRCOOKIE_DUPHEAD) != 0); in tmpfs_dirent_duphead()
850 tmpfs_dirent_init(struct tmpfs_dirent *de, const char *name, u_int namelen) in tmpfs_dirent_init() argument
852 de->td_hash = de->td_cookie = tmpfs_dirent_hash(name, namelen); in tmpfs_dirent_init()
853 memcpy(de->ud.td_name, name, namelen); in tmpfs_dirent_init()
854 de->td_namelen = namelen; in tmpfs_dirent_init()
868 const char *name, u_int len, struct tmpfs_dirent **de) in tmpfs_alloc_dirent() argument
882 *de = nde; in tmpfs_alloc_dirent()
897 tmpfs_free_dirent(struct tmpfs_mount *tmp, struct tmpfs_dirent *de) in tmpfs_free_dirent() argument
901 node = de->td_node; in tmpfs_free_dirent()
906 if (!tmpfs_dirent_duphead(de) && de->ud.td_name != NULL) in tmpfs_free_dirent()
907 free(de->ud.td_name, M_TMPFSNAME); in tmpfs_free_dirent()
908 free(de, M_TMPFSDIR); in tmpfs_free_dirent()
1170 struct tmpfs_dirent *de; in tmpfs_alloc_file() local
1207 &de); in tmpfs_alloc_file()
1216 tmpfs_free_dirent(tmp, de); in tmpfs_alloc_file()
1226 tmpfs_dir_attach(dvp, de); in tmpfs_alloc_file()
1233 struct tmpfs_dirent *de; in tmpfs_dir_first() local
1235 de = RB_MIN(tmpfs_dir, &dnode->tn_dir.tn_dirhead); in tmpfs_dir_first()
1236 dc->tdc_tree = de; in tmpfs_dir_first()
1237 if (de != NULL && tmpfs_dirent_duphead(de)) in tmpfs_dir_first()
1238 de = LIST_FIRST(&de->ud.td_duphead); in tmpfs_dir_first()
1239 dc->tdc_current = de; in tmpfs_dir_first()
1247 struct tmpfs_dirent *de; in tmpfs_dir_next() local
1257 if ((de = dc->tdc_current) != NULL && tmpfs_dirent_duphead(de)) { in tmpfs_dir_next()
1258 dc->tdc_current = LIST_FIRST(&de->ud.td_duphead); in tmpfs_dir_next()
1269 struct tmpfs_dirent *de, dekey; in tmpfs_dir_xlookup_hash() local
1272 de = RB_FIND(tmpfs_dir, &dnode->tn_dir.tn_dirhead, &dekey); in tmpfs_dir_xlookup_hash()
1273 return (de); in tmpfs_dir_xlookup_hash()
1282 struct tmpfs_dirent *de, dekey; in tmpfs_dir_lookup_cookie() local
1287 (de = node->tn_dir.tn_readdir_lastp) != NULL) { in tmpfs_dir_lookup_cookie()
1290 if (cookie == tmpfs_dirent_cookie(de)) in tmpfs_dir_lookup_cookie()
1295 LIST_FOREACH(de, &node->tn_dir.tn_dupindex, in tmpfs_dir_lookup_cookie()
1297 MPASS(tmpfs_dirent_dup(de)); in tmpfs_dir_lookup_cookie()
1298 if (de->td_cookie == cookie) in tmpfs_dir_lookup_cookie()
1301 if (de->td_cookie < cookie) { in tmpfs_dir_lookup_cookie()
1302 de = NULL; in tmpfs_dir_lookup_cookie()
1306 MPASS(de == NULL); in tmpfs_dir_lookup_cookie()
1311 de = NULL; in tmpfs_dir_lookup_cookie()
1315 de = RB_NFIND(tmpfs_dir, dirhead, &dekey); in tmpfs_dir_lookup_cookie()
1317 dc->tdc_tree = de; in tmpfs_dir_lookup_cookie()
1318 dc->tdc_current = de; in tmpfs_dir_lookup_cookie()
1319 if (de != NULL && tmpfs_dirent_duphead(de)) { in tmpfs_dir_lookup_cookie()
1320 dc->tdc_current = LIST_FIRST(&de->ud.td_duphead); in tmpfs_dir_lookup_cookie()
1326 dc->tdc_tree = de; in tmpfs_dir_lookup_cookie()
1327 dc->tdc_current = de; in tmpfs_dir_lookup_cookie()
1328 if (de != NULL && tmpfs_dirent_dup(de)) in tmpfs_dir_lookup_cookie()
1330 de->td_hash); in tmpfs_dir_lookup_cookie()
1347 struct tmpfs_dirent *de; in tmpfs_dir_lookup() local
1356 de = tmpfs_dir_xlookup_hash(node, hash); in tmpfs_dir_lookup()
1357 if (de != NULL && tmpfs_dirent_duphead(de)) { in tmpfs_dir_lookup()
1358 duphead = &de->ud.td_duphead; in tmpfs_dir_lookup()
1359 LIST_FOREACH(de, duphead, uh.td_dup.entries) { in tmpfs_dir_lookup()
1360 if (TMPFS_DIRENT_MATCHES(de, cnp->cn_nameptr, in tmpfs_dir_lookup()
1364 } else if (de != NULL) { in tmpfs_dir_lookup()
1365 if (!TMPFS_DIRENT_MATCHES(de, cnp->cn_nameptr, in tmpfs_dir_lookup()
1367 de = NULL; in tmpfs_dir_lookup()
1369 if (de != NULL && f != NULL && de->td_node != f) in tmpfs_dir_lookup()
1370 de = NULL; in tmpfs_dir_lookup()
1372 return (de); in tmpfs_dir_lookup()
1384 struct tmpfs_dirent *de, *pde; in tmpfs_dir_attach_dup() local
1387 de = LIST_FIRST(dupindex); in tmpfs_dir_attach_dup()
1388 if (de == NULL || de->td_cookie < TMPFS_DIRCOOKIE_DUP_MAX) { in tmpfs_dir_attach_dup()
1389 if (de == NULL) in tmpfs_dir_attach_dup()
1392 nde->td_cookie = de->td_cookie + 1; in tmpfs_dir_attach_dup()
1405 pde = de; in tmpfs_dir_attach_dup()
1406 de = LIST_NEXT(de, uh.td_dup.index_entries); in tmpfs_dir_attach_dup()
1407 if (de == NULL && pde->td_cookie != TMPFS_DIRCOOKIE_DUP_MIN) { in tmpfs_dir_attach_dup()
1416 } else if (de == NULL) { in tmpfs_dir_attach_dup()
1429 if (de->td_cookie + 1 == pde->td_cookie || in tmpfs_dir_attach_dup()
1430 de->td_cookie >= TMPFS_DIRCOOKIE_DUP_MAX) in tmpfs_dir_attach_dup()
1432 nde->td_cookie = de->td_cookie + 1; in tmpfs_dir_attach_dup()
1435 MPASS(nde->td_cookie > de->td_cookie); in tmpfs_dir_attach_dup()
1436 LIST_INSERT_BEFORE(de, nde, uh.td_dup.index_entries); in tmpfs_dir_attach_dup()
1448 tmpfs_dir_attach(struct vnode *vp, struct tmpfs_dirent *de) in tmpfs_dir_attach() argument
1454 MPASS(de->td_namelen > 0); in tmpfs_dir_attach()
1455 MPASS(de->td_hash >= TMPFS_DIRCOOKIE_MIN); in tmpfs_dir_attach()
1456 MPASS(de->td_cookie == de->td_hash); in tmpfs_dir_attach()
1462 MPASS(!tmpfs_dirent_dup(de)); in tmpfs_dir_attach()
1463 xde = RB_INSERT(tmpfs_dir, &dnode->tn_dir.tn_dirhead, de); in tmpfs_dir_attach()
1465 tmpfs_dir_attach_dup(dnode, &xde->ud.td_duphead, de); in tmpfs_dir_attach()
1481 tmpfs_dir_attach_dup(dnode, &xde->ud.td_duphead, de); in tmpfs_dir_attach()
1495 tmpfs_dir_detach(struct vnode *vp, struct tmpfs_dirent *de) in tmpfs_dir_detach() argument
1509 if (tmpfs_dirent_dup(de)) { in tmpfs_dir_detach()
1511 if (LIST_NEXT(de, uh.td_dup.entries) == NULL) { in tmpfs_dir_detach()
1512 xde = tmpfs_dir_xlookup_hash(dnode, de->td_hash); in tmpfs_dir_detach()
1516 LIST_REMOVE(de, uh.td_dup.entries); in tmpfs_dir_detach()
1517 LIST_REMOVE(de, uh.td_dup.index_entries); in tmpfs_dir_detach()
1526 de->td_cookie = de->td_hash; in tmpfs_dir_detach()
1528 RB_REMOVE(tmpfs_dir, head, de); in tmpfs_dir_detach()
1539 struct tmpfs_dirent *de, *dde, *nde; in tmpfs_dir_destroy() local
1541 RB_FOREACH_SAFE(de, tmpfs_dir, &dnode->tn_dir.tn_dirhead, nde) { in tmpfs_dir_destroy()
1542 RB_REMOVE(tmpfs_dir, &dnode->tn_dir.tn_dirhead, de); in tmpfs_dir_destroy()
1544 de->td_node = NULL; in tmpfs_dir_destroy()
1545 if (tmpfs_dirent_duphead(de)) { in tmpfs_dir_destroy()
1546 while ((dde = LIST_FIRST(&de->ud.td_duphead)) != NULL) { in tmpfs_dir_destroy()
1552 tmpfs_free_dirent(tmp, de); in tmpfs_dir_destroy()
1648 struct tmpfs_dirent *de, *nde; in tmpfs_dir_getdents() local
1674 de = tmpfs_dir_first(node, &dc); in tmpfs_dir_getdents()
1675 off = tmpfs_dirent_cookie(de); in tmpfs_dir_getdents()
1683 if (de == NULL) in tmpfs_dir_getdents()
1689 de = tmpfs_dir_lookup_cookie(node, uio->uio_offset, &dc); in tmpfs_dir_getdents()
1690 if (de == NULL) in tmpfs_dir_getdents()
1693 off = tmpfs_dirent_cookie(de); in tmpfs_dir_getdents()
1707 if (de->td_node == NULL) { in tmpfs_dir_getdents()
1711 d.d_fileno = de->td_node->tn_id; in tmpfs_dir_getdents()
1712 switch (de->td_node->tn_type) { in tmpfs_dir_getdents()
1743 de->td_node, (int)de->td_node->tn_type); in tmpfs_dir_getdents()
1746 d.d_namlen = de->td_namelen; in tmpfs_dir_getdents()
1747 MPASS(de->td_namelen < sizeof(d.d_name)); in tmpfs_dir_getdents()
1748 (void)memcpy(d.d_name, de->ud.td_name, de->td_namelen); in tmpfs_dir_getdents()
1770 de = nde; in tmpfs_dir_getdents()
1772 off = tmpfs_dirent_cookie(de); in tmpfs_dir_getdents()
1777 } while (error == 0 && uio->uio_resid > 0 && de != NULL); in tmpfs_dir_getdents()
1781 off = tmpfs_dirent_cookie(de); in tmpfs_dir_getdents()
1786 node->tn_dir.tn_readdir_lastp = de; in tmpfs_dir_getdents()
1795 struct tmpfs_dirent *de; in tmpfs_dir_whiteout_add() local
1800 cnp->cn_nameptr, cnp->cn_namelen, &de); in tmpfs_dir_whiteout_add()
1804 tmpfs_dir_attach(dvp, de); in tmpfs_dir_whiteout_add()
1805 dnode->tn_dir.tn_wht_size += sizeof(*de); in tmpfs_dir_whiteout_add()
1812 struct tmpfs_dirent *de; in tmpfs_dir_whiteout_remove() local
1816 de = tmpfs_dir_lookup(dnode, NULL, cnp); in tmpfs_dir_whiteout_remove()
1817 MPASS(de != NULL && de->td_node == NULL); in tmpfs_dir_whiteout_remove()
1818 MPASS(dnode->tn_dir.tn_wht_size >= sizeof(*de)); in tmpfs_dir_whiteout_remove()
1819 dnode->tn_dir.tn_wht_size -= sizeof(*de); in tmpfs_dir_whiteout_remove()
1820 tmpfs_dir_detach(dvp, de); in tmpfs_dir_whiteout_remove()
1821 tmpfs_free_dirent(VFS_TO_TMPFS(dvp->v_mount), de); in tmpfs_dir_whiteout_remove()
1834 struct tmpfs_dirent *de; in tmpfs_dir_clear_whiteouts() local
1839 while ((de = tmpfs_dir_first(dnode, &dc)) != NULL) { in tmpfs_dir_clear_whiteouts()
1840 KASSERT(de->td_node == NULL, ("%s: non-whiteout dirent %p", in tmpfs_dir_clear_whiteouts()
1841 __func__, de)); in tmpfs_dir_clear_whiteouts()
1842 dnode->tn_dir.tn_wht_size -= sizeof(*de); in tmpfs_dir_clear_whiteouts()
1843 tmpfs_dir_detach(dvp, de); in tmpfs_dir_clear_whiteouts()
1844 tmpfs_free_dirent(VFS_TO_TMPFS(dvp->v_mount), de); in tmpfs_dir_clear_whiteouts()