Lines Matching refs:de

395 tmpfs_dirent_cookie(struct tmpfs_dirent *de)  in tmpfs_dirent_cookie()  argument
397 if (de == NULL) in tmpfs_dirent_cookie()
400 MPASS(de->td_cookie >= TMPFS_DIRCOOKIE_MIN); in tmpfs_dirent_cookie()
402 return (de->td_cookie); in tmpfs_dirent_cookie()
406 tmpfs_dirent_dup(struct tmpfs_dirent *de) in tmpfs_dirent_dup() argument
408 return ((de->td_cookie & TMPFS_DIRCOOKIE_DUP) != 0); in tmpfs_dirent_dup()
412 tmpfs_dirent_duphead(struct tmpfs_dirent *de) in tmpfs_dirent_duphead() argument
414 return ((de->td_cookie & TMPFS_DIRCOOKIE_DUPHEAD) != 0); in tmpfs_dirent_duphead()
418 tmpfs_dirent_init(struct tmpfs_dirent *de, const char *name, u_int namelen) in tmpfs_dirent_init() argument
420 de->td_hash = de->td_cookie = tmpfs_dirent_hash(name, namelen); in tmpfs_dirent_init()
421 memcpy(de->ud.td_name, name, namelen); in tmpfs_dirent_init()
422 de->td_namelen = namelen; in tmpfs_dirent_init()
436 const char *name, u_int len, struct tmpfs_dirent **de) in tmpfs_alloc_dirent() argument
450 *de = nde; in tmpfs_alloc_dirent()
465 tmpfs_free_dirent(struct tmpfs_mount *tmp, struct tmpfs_dirent *de) in tmpfs_free_dirent() argument
469 node = de->td_node; in tmpfs_free_dirent()
474 if (!tmpfs_dirent_duphead(de) && de->ud.td_name != NULL) in tmpfs_free_dirent()
475 free(de->ud.td_name, M_TMPFSNAME); in tmpfs_free_dirent()
476 uma_zfree(tmp->tm_dirent_pool, de); in tmpfs_free_dirent()
720 struct tmpfs_dirent *de; in tmpfs_alloc_file() local
758 &de); in tmpfs_alloc_file()
767 tmpfs_free_dirent(tmp, de); in tmpfs_alloc_file()
777 tmpfs_dir_attach(dvp, de); in tmpfs_alloc_file()
784 struct tmpfs_dirent *de; in tmpfs_dir_first() local
786 de = RB_MIN(tmpfs_dir, &dnode->tn_dir.tn_dirhead); in tmpfs_dir_first()
787 dc->tdc_tree = de; in tmpfs_dir_first()
788 if (de != NULL && tmpfs_dirent_duphead(de)) in tmpfs_dir_first()
789 de = LIST_FIRST(&de->ud.td_duphead); in tmpfs_dir_first()
790 dc->tdc_current = de; in tmpfs_dir_first()
798 struct tmpfs_dirent *de; in tmpfs_dir_next() local
808 if ((de = dc->tdc_current) != NULL && tmpfs_dirent_duphead(de)) { in tmpfs_dir_next()
809 dc->tdc_current = LIST_FIRST(&de->ud.td_duphead); in tmpfs_dir_next()
820 struct tmpfs_dirent *de, dekey; in tmpfs_dir_xlookup_hash() local
823 de = RB_FIND(tmpfs_dir, &dnode->tn_dir.tn_dirhead, &dekey); in tmpfs_dir_xlookup_hash()
824 return (de); in tmpfs_dir_xlookup_hash()
833 struct tmpfs_dirent *de, dekey; in tmpfs_dir_lookup_cookie() local
838 (de = node->tn_dir.tn_readdir_lastp) != NULL) { in tmpfs_dir_lookup_cookie()
841 if (cookie == tmpfs_dirent_cookie(de)) in tmpfs_dir_lookup_cookie()
846 LIST_FOREACH(de, &node->tn_dir.tn_dupindex, in tmpfs_dir_lookup_cookie()
848 MPASS(tmpfs_dirent_dup(de)); in tmpfs_dir_lookup_cookie()
849 if (de->td_cookie == cookie) in tmpfs_dir_lookup_cookie()
852 if (de->td_cookie < cookie) { in tmpfs_dir_lookup_cookie()
853 de = NULL; in tmpfs_dir_lookup_cookie()
857 MPASS(de == NULL); in tmpfs_dir_lookup_cookie()
862 de = NULL; in tmpfs_dir_lookup_cookie()
866 de = RB_NFIND(tmpfs_dir, dirhead, &dekey); in tmpfs_dir_lookup_cookie()
868 dc->tdc_tree = de; in tmpfs_dir_lookup_cookie()
869 dc->tdc_current = de; in tmpfs_dir_lookup_cookie()
870 if (de != NULL && tmpfs_dirent_duphead(de)) { in tmpfs_dir_lookup_cookie()
871 dc->tdc_current = LIST_FIRST(&de->ud.td_duphead); in tmpfs_dir_lookup_cookie()
877 dc->tdc_tree = de; in tmpfs_dir_lookup_cookie()
878 dc->tdc_current = de; in tmpfs_dir_lookup_cookie()
879 if (de != NULL && tmpfs_dirent_dup(de)) in tmpfs_dir_lookup_cookie()
881 de->td_hash); in tmpfs_dir_lookup_cookie()
898 struct tmpfs_dirent *de; in tmpfs_dir_lookup() local
907 de = tmpfs_dir_xlookup_hash(node, hash); in tmpfs_dir_lookup()
908 if (de != NULL && tmpfs_dirent_duphead(de)) { in tmpfs_dir_lookup()
909 duphead = &de->ud.td_duphead; in tmpfs_dir_lookup()
910 LIST_FOREACH(de, duphead, uh.td_dup.entries) { in tmpfs_dir_lookup()
911 if (TMPFS_DIRENT_MATCHES(de, cnp->cn_nameptr, in tmpfs_dir_lookup()
915 } else if (de != NULL) { in tmpfs_dir_lookup()
916 if (!TMPFS_DIRENT_MATCHES(de, cnp->cn_nameptr, in tmpfs_dir_lookup()
918 de = NULL; in tmpfs_dir_lookup()
920 if (de != NULL && f != NULL && de->td_node != f) in tmpfs_dir_lookup()
921 de = NULL; in tmpfs_dir_lookup()
923 return (de); in tmpfs_dir_lookup()
935 struct tmpfs_dirent *de, *pde; in tmpfs_dir_attach_dup() local
938 de = LIST_FIRST(dupindex); in tmpfs_dir_attach_dup()
939 if (de == NULL || de->td_cookie < TMPFS_DIRCOOKIE_DUP_MAX) { in tmpfs_dir_attach_dup()
940 if (de == NULL) in tmpfs_dir_attach_dup()
943 nde->td_cookie = de->td_cookie + 1; in tmpfs_dir_attach_dup()
956 pde = de; in tmpfs_dir_attach_dup()
957 de = LIST_NEXT(de, uh.td_dup.index_entries); in tmpfs_dir_attach_dup()
958 if (de == NULL && pde->td_cookie != TMPFS_DIRCOOKIE_DUP_MIN) { in tmpfs_dir_attach_dup()
967 } else if (de == NULL) { in tmpfs_dir_attach_dup()
980 if (de->td_cookie + 1 == pde->td_cookie || in tmpfs_dir_attach_dup()
981 de->td_cookie >= TMPFS_DIRCOOKIE_DUP_MAX) in tmpfs_dir_attach_dup()
983 nde->td_cookie = de->td_cookie + 1; in tmpfs_dir_attach_dup()
986 MPASS(nde->td_cookie > de->td_cookie); in tmpfs_dir_attach_dup()
987 LIST_INSERT_BEFORE(de, nde, uh.td_dup.index_entries); in tmpfs_dir_attach_dup()
999 tmpfs_dir_attach(struct vnode *vp, struct tmpfs_dirent *de) in tmpfs_dir_attach() argument
1005 MPASS(de->td_namelen > 0); in tmpfs_dir_attach()
1006 MPASS(de->td_hash >= TMPFS_DIRCOOKIE_MIN); in tmpfs_dir_attach()
1007 MPASS(de->td_cookie == de->td_hash); in tmpfs_dir_attach()
1013 MPASS(!tmpfs_dirent_dup(de)); in tmpfs_dir_attach()
1014 xde = RB_INSERT(tmpfs_dir, &dnode->tn_dir.tn_dirhead, de); in tmpfs_dir_attach()
1016 tmpfs_dir_attach_dup(dnode, &xde->ud.td_duphead, de); in tmpfs_dir_attach()
1032 tmpfs_dir_attach_dup(dnode, &xde->ud.td_duphead, de); in tmpfs_dir_attach()
1046 tmpfs_dir_detach(struct vnode *vp, struct tmpfs_dirent *de) in tmpfs_dir_detach() argument
1060 if (tmpfs_dirent_dup(de)) { in tmpfs_dir_detach()
1062 if (LIST_NEXT(de, uh.td_dup.entries) == NULL) { in tmpfs_dir_detach()
1063 xde = tmpfs_dir_xlookup_hash(dnode, de->td_hash); in tmpfs_dir_detach()
1067 LIST_REMOVE(de, uh.td_dup.entries); in tmpfs_dir_detach()
1068 LIST_REMOVE(de, uh.td_dup.index_entries); in tmpfs_dir_detach()
1077 de->td_cookie = de->td_hash; in tmpfs_dir_detach()
1079 RB_REMOVE(tmpfs_dir, head, de); in tmpfs_dir_detach()
1090 struct tmpfs_dirent *de, *dde, *nde; in tmpfs_dir_destroy() local
1092 RB_FOREACH_SAFE(de, tmpfs_dir, &dnode->tn_dir.tn_dirhead, nde) { in tmpfs_dir_destroy()
1093 RB_REMOVE(tmpfs_dir, &dnode->tn_dir.tn_dirhead, de); in tmpfs_dir_destroy()
1095 de->td_node = NULL; in tmpfs_dir_destroy()
1096 if (tmpfs_dirent_duphead(de)) { in tmpfs_dir_destroy()
1097 while ((dde = LIST_FIRST(&de->ud.td_duphead)) != NULL) { in tmpfs_dir_destroy()
1103 tmpfs_free_dirent(tmp, de); in tmpfs_dir_destroy()
1202 struct tmpfs_dirent *de, *nde; in tmpfs_dir_getdents() local
1228 de = tmpfs_dir_first(node, &dc); in tmpfs_dir_getdents()
1229 off = tmpfs_dirent_cookie(de); in tmpfs_dir_getdents()
1237 if (de == NULL) in tmpfs_dir_getdents()
1243 de = tmpfs_dir_lookup_cookie(node, uio->uio_offset, &dc); in tmpfs_dir_getdents()
1244 if (de == NULL) in tmpfs_dir_getdents()
1247 off = tmpfs_dirent_cookie(de); in tmpfs_dir_getdents()
1261 if (de->td_node == NULL) { in tmpfs_dir_getdents()
1265 d.d_fileno = de->td_node->tn_id; in tmpfs_dir_getdents()
1266 switch (de->td_node->tn_type) { in tmpfs_dir_getdents()
1297 de->td_node, (int)de->td_node->tn_type); in tmpfs_dir_getdents()
1300 d.d_namlen = de->td_namelen; in tmpfs_dir_getdents()
1301 MPASS(de->td_namelen < sizeof(d.d_name)); in tmpfs_dir_getdents()
1302 (void)memcpy(d.d_name, de->ud.td_name, de->td_namelen); in tmpfs_dir_getdents()
1324 de = nde; in tmpfs_dir_getdents()
1326 off = tmpfs_dirent_cookie(de); in tmpfs_dir_getdents()
1331 } while (error == 0 && uio->uio_resid > 0 && de != NULL); in tmpfs_dir_getdents()
1335 off = tmpfs_dirent_cookie(de); in tmpfs_dir_getdents()
1340 node->tn_dir.tn_readdir_lastp = de; in tmpfs_dir_getdents()
1349 struct tmpfs_dirent *de; in tmpfs_dir_whiteout_add() local
1353 cnp->cn_nameptr, cnp->cn_namelen, &de); in tmpfs_dir_whiteout_add()
1356 tmpfs_dir_attach(dvp, de); in tmpfs_dir_whiteout_add()
1363 struct tmpfs_dirent *de; in tmpfs_dir_whiteout_remove() local
1365 de = tmpfs_dir_lookup(VP_TO_TMPFS_DIR(dvp), NULL, cnp); in tmpfs_dir_whiteout_remove()
1366 MPASS(de != NULL && de->td_node == NULL); in tmpfs_dir_whiteout_remove()
1367 tmpfs_dir_detach(dvp, de); in tmpfs_dir_whiteout_remove()
1368 tmpfs_free_dirent(VFS_TO_TMPFS(dvp->v_mount), de); in tmpfs_dir_whiteout_remove()