Lines Matching refs:node

98 		 struct tmpfs_node **node)  in tmpfs_alloc_node()  argument
187 *node = nnode; in tmpfs_alloc_node()
213 tmpfs_free_node(struct tmpfs_mount *tmp, struct tmpfs_node *node) in tmpfs_free_node() argument
218 TMPFS_ASSERT_ELOCKED(node); in tmpfs_free_node()
219 KKASSERT(node->tn_vnode == NULL); in tmpfs_free_node()
222 LIST_REMOVE(node, tn_entries); in tmpfs_free_node()
225 TMPFS_NODE_UNLOCK(node); /* Caller has this lock */ in tmpfs_free_node()
227 switch (node->tn_type) { in tmpfs_free_node()
246 node->tn_size = 0; in tmpfs_free_node()
247 KKASSERT(node->tn_dir.tn_parent == NULL); in tmpfs_free_node()
253 if (node == tmp->tm_root) in tmpfs_free_node()
262 kfree(node->tn_link, tmp->tm_name_zone); in tmpfs_free_node()
263 node->tn_link = NULL; in tmpfs_free_node()
264 node->tn_size = 0; in tmpfs_free_node()
268 if (node->tn_reg.tn_aobj != NULL) in tmpfs_free_node()
269 vm_object_deallocate(node->tn_reg.tn_aobj); in tmpfs_free_node()
270 node->tn_reg.tn_aobj = NULL; in tmpfs_free_node()
271 pages = node->tn_reg.tn_aobj_pages; in tmpfs_free_node()
275 panic("tmpfs_free_node: type %p %d", node, (int)node->tn_type); in tmpfs_free_node()
281 tmpfs_node_uninit(node); in tmpfs_free_node()
282 kfree_obj(node, tmp->tm_node_zone); in tmpfs_free_node()
301 tmpfs_alloc_dirent(struct tmpfs_mount *tmp, struct tmpfs_node *node, in tmpfs_alloc_dirent() argument
318 nde->td_node = node; in tmpfs_alloc_dirent()
320 atomic_add_int(&node->tn_links, 1); in tmpfs_alloc_dirent()
341 struct tmpfs_node *node; in tmpfs_free_dirent() local
343 node = de->td_node; in tmpfs_free_dirent()
345 KKASSERT(node->tn_links > 0); in tmpfs_free_dirent()
346 atomic_add_int(&node->tn_links, -1); in tmpfs_free_dirent()
374 struct tmpfs_node *dnode, struct tmpfs_node *node, int lkflag, in tmpfs_alloc_vp() argument
382 if (node->tn_vnode == NULL) { in tmpfs_alloc_vp()
394 TMPFS_NODE_LOCK(node); in tmpfs_alloc_vp()
395 if (node->tn_vnode) { in tmpfs_alloc_vp()
400 vp = node->tn_vnode; in tmpfs_alloc_vp()
402 KKASSERT((node->tn_vpstate & TMPFS_VNODE_DOOMED) == 0); in tmpfs_alloc_vp()
404 TMPFS_NODE_UNLOCK(node); in tmpfs_alloc_vp()
437 if (node->tn_vnode != vp) { in tmpfs_alloc_vp()
451 TMPFS_NODE_UNLOCK(node); in tmpfs_alloc_vp()
458 if (node->tn_vpstate & TMPFS_VNODE_DOOMED) { in tmpfs_alloc_vp()
459 TMPFS_NODE_UNLOCK(node); in tmpfs_alloc_vp()
466 KKASSERT(node->tn_vnode == NULL); in tmpfs_alloc_vp()
468 vp->v_data = node; in tmpfs_alloc_vp()
469 vp->v_type = node->tn_type; in tmpfs_alloc_vp()
472 switch (node->tn_type) { in tmpfs_alloc_vp()
485 vinitvmio(vp, node->tn_size, node->tn_blksize, -1); in tmpfs_alloc_vp()
496 panic("tmpfs_alloc_vp: type %p %d", node, (int)node->tn_type); in tmpfs_alloc_vp()
499 node->tn_vnode = vp; in tmpfs_alloc_vp()
500 TMPFS_NODE_UNLOCK(node); in tmpfs_alloc_vp()
530 struct tmpfs_node *node; in tmpfs_alloc_file() local
560 vap->va_rmajor, vap->va_rminor, &node); in tmpfs_alloc_file()
565 TMPFS_NODE_LOCK(node); in tmpfs_alloc_file()
568 error = tmpfs_alloc_dirent(tmp, node, ncp->nc_name, ncp->nc_nlen, &de); in tmpfs_alloc_file()
571 tmpfs_free_node(tmp, node); in tmpfs_alloc_file()
577 error = tmpfs_alloc_vp(dvp->v_mount, NULL, node, LK_EXCLUSIVE, vpp); in tmpfs_alloc_file()
581 tmpfs_free_node(tmp, node); in tmpfs_alloc_file()
593 TMPFS_NODE_UNLOCK(node); in tmpfs_alloc_file()
610 struct tmpfs_node *node = de->td_node; in tmpfs_dir_attach_locked() local
613 if (node && node->tn_type == VDIR) { in tmpfs_dir_attach_locked()
614 TMPFS_NODE_LOCK(node); in tmpfs_dir_attach_locked()
615 atomic_add_int(&node->tn_links, 1); in tmpfs_dir_attach_locked()
616 node->tn_status |= TMPFS_NODE_CHANGED; in tmpfs_dir_attach_locked()
617 node->tn_dir.tn_parent = dnode; in tmpfs_dir_attach_locked()
619 TMPFS_NODE_UNLOCK(node); in tmpfs_dir_attach_locked()
646 struct tmpfs_node *node = de->td_node; in tmpfs_dir_detach_locked() local
665 if (node && node->tn_type == VDIR && node->tn_dir.tn_parent) { in tmpfs_dir_detach_locked()
666 TMPFS_NODE_LOCK(node); in tmpfs_dir_detach_locked()
667 KKASSERT(node->tn_dir.tn_parent == dnode); in tmpfs_dir_detach_locked()
669 atomic_add_int(&node->tn_links, -1); in tmpfs_dir_detach_locked()
670 node->tn_dir.tn_parent = NULL; in tmpfs_dir_detach_locked()
671 TMPFS_NODE_UNLOCK(node); in tmpfs_dir_detach_locked()
688 tmpfs_dir_lookup(struct tmpfs_node *node, struct tmpfs_node *f, in tmpfs_dir_lookup() argument
698 TMPFS_VALIDATE_DIR(node); in tmpfs_dir_lookup()
700 de = RB_FIND(tmpfs_dirtree, &node->tn_dir.tn_dirtree, &wanted); in tmpfs_dir_lookup()
719 tmpfs_dir_getdotdent(struct tmpfs_node *node, struct uio *uio) in tmpfs_dir_getdotdent() argument
723 TMPFS_VALIDATE_DIR(node); in tmpfs_dir_getdotdent()
726 if (vop_write_dirent(&error, uio, node->tn_id, DT_DIR, 1, ".")) in tmpfs_dir_getdotdent()
743 tmpfs_dir_getdotdotdent(struct tmpfs_mount *tmp, struct tmpfs_node *node, in tmpfs_dir_getdotdotdent() argument
749 TMPFS_VALIDATE_DIR(node); in tmpfs_dir_getdotdotdent()
752 if (node->tn_dir.tn_parent) { in tmpfs_dir_getdotdotdent()
753 TMPFS_NODE_LOCK(node); in tmpfs_dir_getdotdotdent()
754 if (node->tn_dir.tn_parent) in tmpfs_dir_getdotdotdent()
755 d_ino = node->tn_dir.tn_parent->tn_id; in tmpfs_dir_getdotdotdent()
758 TMPFS_NODE_UNLOCK(node); in tmpfs_dir_getdotdotdent()
767 de = RB_MIN(tmpfs_dirtree_cookie, &node->tn_dir.tn_cookietree); in tmpfs_dir_getdotdotdent()
822 tmpfs_dir_lookupbycookie(struct tmpfs_node *node, off_t cookie, int exact) in tmpfs_dir_lookupbycookie() argument
829 RB_SCAN(tmpfs_dirtree_cookie, &node->tn_dir.tn_cookietree, in tmpfs_dir_lookupbycookie()
838 tmp = RB_ROOT(&node->tn_dir.tn_cookietree); in tmpfs_dir_lookupbycookie()
864 tmpfs_dir_getdents(struct tmpfs_node *node, struct uio *uio, off_t *cntp) in tmpfs_dir_getdents() argument
870 TMPFS_VALIDATE_DIR(node); in tmpfs_dir_getdents()
891 de = tmpfs_dir_lookupbycookie(node, startcookie, 0); in tmpfs_dir_getdents()
951 node->tn_dir.tn_cookietree, de); in tmpfs_dir_getdents()
984 struct tmpfs_node *node; in tmpfs_reg_resize() local
993 node = VP_TO_TMPFS_NODE(vp); in tmpfs_reg_resize()
1002 oldsize = node->tn_size; in tmpfs_reg_resize()
1004 KKASSERT(oldpages == node->tn_reg.tn_aobj_pages); in tmpfs_reg_resize()
1012 node->tn_reg.tn_aobj_pages = newpages; in tmpfs_reg_resize()
1013 node->tn_size = newsize; in tmpfs_reg_resize()
1051 error = nvtruncbuf(vp, newsize, node->tn_blksize, in tmpfs_reg_resize()
1053 aobj = node->tn_reg.tn_aobj; in tmpfs_reg_resize()
1073 nblksize = node->tn_blksize; in tmpfs_reg_resize()
1083 node->tn_blksize, nblksize, in tmpfs_reg_resize()
1085 node->tn_blksize = nblksize; in tmpfs_reg_resize()
1086 aobj = node->tn_reg.tn_aobj; in tmpfs_reg_resize()
1106 struct tmpfs_node *node; in tmpfs_chflags() local
1111 node = VP_TO_TMPFS_NODE(vp); in tmpfs_chflags()
1112 flags = node->tn_flags; in tmpfs_chflags()
1117 error = vop_helper_setattr_flags(&flags, vaflags, node->tn_uid, cred); in tmpfs_chflags()
1121 TMPFS_NODE_LOCK(node); in tmpfs_chflags()
1122 node->tn_flags = flags; in tmpfs_chflags()
1123 node->tn_status |= TMPFS_NODE_CHANGED; in tmpfs_chflags()
1124 TMPFS_NODE_UNLOCK(node); in tmpfs_chflags()
1142 struct tmpfs_node *node; in tmpfs_chmod() local
1148 node = VP_TO_TMPFS_NODE(vp); in tmpfs_chmod()
1155 if (node->tn_flags & (IMMUTABLE | APPEND)) in tmpfs_chmod()
1158 cur_mode = node->tn_mode; in tmpfs_chmod()
1159 error = vop_helper_chmod(vp, vamode, cred, node->tn_uid, node->tn_gid, in tmpfs_chmod()
1163 (node->tn_mode & ALLPERMS) != (cur_mode & ALLPERMS)) { in tmpfs_chmod()
1164 TMPFS_NODE_LOCK(node); in tmpfs_chmod()
1165 node->tn_mode &= ~ALLPERMS; in tmpfs_chmod()
1166 node->tn_mode |= cur_mode & ALLPERMS; in tmpfs_chmod()
1168 node->tn_status |= TMPFS_NODE_CHANGED; in tmpfs_chmod()
1169 TMPFS_NODE_UNLOCK(node); in tmpfs_chmod()
1192 struct tmpfs_node *node; in tmpfs_chown() local
1196 node = VP_TO_TMPFS_NODE(vp); in tmpfs_chown()
1203 if (node->tn_flags & (IMMUTABLE | APPEND)) in tmpfs_chown()
1206 cur_uid = node->tn_uid; in tmpfs_chown()
1207 cur_gid = node->tn_gid; in tmpfs_chown()
1208 cur_mode = node->tn_mode; in tmpfs_chown()
1213 TMPFS_NODE_LOCK(node); in tmpfs_chown()
1214 if (cur_uid != node->tn_uid || in tmpfs_chown()
1215 cur_gid != node->tn_gid || in tmpfs_chown()
1216 cur_mode != node->tn_mode) { in tmpfs_chown()
1217 node->tn_uid = cur_uid; in tmpfs_chown()
1218 node->tn_gid = cur_gid; in tmpfs_chown()
1219 node->tn_mode = cur_mode; in tmpfs_chown()
1220 node->tn_status |= TMPFS_NODE_CHANGED; in tmpfs_chown()
1222 TMPFS_NODE_UNLOCK(node); in tmpfs_chown()
1239 struct tmpfs_node *node; in tmpfs_chsize() local
1243 node = VP_TO_TMPFS_NODE(vp); in tmpfs_chsize()
1272 if (node->tn_flags & (IMMUTABLE | APPEND)) in tmpfs_chsize()
1295 struct tmpfs_node *node; in tmpfs_chtimes() local
1299 node = VP_TO_TMPFS_NODE(vp); in tmpfs_chtimes()
1306 if (node->tn_flags & (IMMUTABLE | APPEND)) in tmpfs_chtimes()
1309 TMPFS_NODE_LOCK(node); in tmpfs_chtimes()
1311 node->tn_status |= TMPFS_NODE_ACCESSED; in tmpfs_chtimes()
1314 node->tn_status |= TMPFS_NODE_MODIFIED; in tmpfs_chtimes()
1318 TMPFS_NODE_UNLOCK(node); in tmpfs_chtimes()
1333 struct tmpfs_node *node; in tmpfs_itimes() local
1336 node = VP_TO_TMPFS_NODE(vp); in tmpfs_itimes()
1338 if ((node->tn_status & (TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | in tmpfs_itimes()
1345 TMPFS_NODE_LOCK(node); in tmpfs_itimes()
1346 if (node->tn_status & TMPFS_NODE_ACCESSED) { in tmpfs_itimes()
1349 node->tn_atime = acc->tv_sec; in tmpfs_itimes()
1350 node->tn_atimensec = acc->tv_nsec; in tmpfs_itimes()
1352 if (node->tn_status & TMPFS_NODE_MODIFIED) { in tmpfs_itimes()
1355 node->tn_mtime = mod->tv_sec; in tmpfs_itimes()
1356 node->tn_mtimensec = mod->tv_nsec; in tmpfs_itimes()
1358 if (node->tn_status & TMPFS_NODE_CHANGED) { in tmpfs_itimes()
1359 node->tn_ctime = now.tv_sec; in tmpfs_itimes()
1360 node->tn_ctimensec = now.tv_nsec; in tmpfs_itimes()
1363 node->tn_status &= ~(TMPFS_NODE_ACCESSED | in tmpfs_itimes()
1366 TMPFS_NODE_UNLOCK(node); in tmpfs_itimes()
1386 struct tmpfs_node *node; in tmpfs_truncate() local
1388 node = VP_TO_TMPFS_NODE(vp); in tmpfs_truncate()
1395 if (node->tn_size == length) { in tmpfs_truncate()
1407 node->tn_status |= TMPFS_NODE_CHANGED | TMPFS_NODE_MODIFIED; in tmpfs_truncate()