Lines Matching refs:dir
58 } dir; member
142 rootfs_check_permissions(struct rootfs_vnode* dir, int accessMode) in rootfs_check_permissions() argument
144 return check_access_permissions(accessMode, dir->stream.type, (gid_t)dir->gid, (uid_t)dir->uid); in rootfs_check_permissions()
197 list_init(&vnode->stream.dir.cookies); in rootfs_create_vnode()
198 mutex_init(&vnode->stream.dir.cookie_lock, "rootfs dir cookies"); in rootfs_create_vnode()
210 if (!force_delete && (v->stream.dir.dir_head != NULL || v->dir_next != NULL)) in rootfs_delete_vnode()
217 mutex_destroy(&v->stream.dir.cookie_lock); in rootfs_delete_vnode()
228 update_dir_cookies(struct rootfs_vnode* dir, struct rootfs_vnode* vnode) in update_dir_cookies() argument
233 &dir->stream.dir.cookies, cookie)) != NULL) { in update_dir_cookies()
242 rootfs_find_in_dir(struct rootfs_vnode* dir, const char* path) in rootfs_find_in_dir() argument
247 return dir; in rootfs_find_in_dir()
249 return dir->parent; in rootfs_find_in_dir()
251 for (vnode = dir->stream.dir.dir_head; vnode; vnode = vnode->dir_next) { in rootfs_find_in_dir()
260 rootfs_insert_in_dir(struct rootfs* fs, struct rootfs_vnode* dir, in rootfs_insert_in_dir() argument
265 struct rootfs_vnode* node = dir->stream.dir.dir_head; in rootfs_insert_in_dir()
273 vnode->dir_next = dir->stream.dir.dir_head; in rootfs_insert_in_dir()
274 dir->stream.dir.dir_head = vnode; in rootfs_insert_in_dir()
281 vnode->parent = dir; in rootfs_insert_in_dir()
282 dir->modification_time = current_timespec(); in rootfs_insert_in_dir()
284 notify_stat_changed(fs->id, get_parent_id(dir), dir->id, in rootfs_insert_in_dir()
291 rootfs_remove_from_dir(struct rootfs* fs, struct rootfs_vnode* dir, in rootfs_remove_from_dir() argument
297 for (vnode = dir->stream.dir.dir_head, lastVnode = NULL; vnode != NULL; in rootfs_remove_from_dir()
301 update_dir_cookies(dir, vnode); in rootfs_remove_from_dir()
306 dir->stream.dir.dir_head = vnode->dir_next; in rootfs_remove_from_dir()
309 dir->modification_time = current_timespec(); in rootfs_remove_from_dir()
310 notify_stat_changed(fs->id, get_parent_id(dir), dir->id, in rootfs_remove_from_dir()
320 rootfs_is_dir_empty(struct rootfs_vnode* dir) in rootfs_is_dir_empty() argument
322 return !dir->stream.dir.dir_head; in rootfs_is_dir_empty()
352 rootfs_remove(struct rootfs* fs, struct rootfs_vnode* dir, const char* name, in rootfs_remove() argument
360 vnode = rootfs_find_in_dir(dir, name); in rootfs_remove()
373 entry_cache_remove(fs->volume->id, dir->id, name); in rootfs_remove()
375 return remove_node(fs, dir, vnode); in rootfs_remove()
476 struct rootfs_vnode* dir = (struct rootfs_vnode*)_dir->private_node; in rootfs_lookup() local
479 TRACE(("rootfs_lookup: entry dir %p, name '%s'\n", dir, name)); in rootfs_lookup()
480 if (!S_ISDIR(dir->stream.type)) in rootfs_lookup()
483 status_t status = rootfs_check_permissions(dir, X_OK); in rootfs_lookup()
490 vnode = rootfs_find_in_dir(dir, name); in rootfs_lookup()
498 entry_cache_add(fs->volume->id, dir->id, name, vnode->id); in rootfs_lookup()
665 struct rootfs_vnode* dir = (rootfs_vnode*)_dir->private_node; in rootfs_create_dir() local
668 TRACE(("rootfs_create_dir: dir %p, name = '%s', perms = %d\n", dir, name, in rootfs_create_dir()
671 status_t status = rootfs_check_permissions(dir, W_OK); in rootfs_create_dir()
677 vnode = rootfs_find_in_dir(dir, name); in rootfs_create_dir()
682 vnode = rootfs_create_vnode(fs, dir, name, S_IFDIR | (mode & S_IUMSK)); in rootfs_create_dir()
686 rootfs_insert_in_dir(fs, dir, vnode); in rootfs_create_dir()
689 entry_cache_add(fs->volume->id, dir->id, name, vnode->id); in rootfs_create_dir()
690 notify_entry_created(fs->id, dir->id, name, vnode->id); in rootfs_create_dir()
700 struct rootfs_vnode* dir = (rootfs_vnode*)_dir->private_node; in rootfs_remove_dir() local
702 status_t status = rootfs_check_permissions(dir, W_OK); in rootfs_remove_dir()
706 TRACE(("rootfs_remove_dir: dir %p (0x%Lx), name '%s'\n", dir, dir->id, in rootfs_remove_dir()
709 return rootfs_remove(fs, dir, name, true); in rootfs_remove_dir()
737 cookie->current = vnode->stream.dir.dir_head; in rootfs_open_dir()
740 mutex_lock(&vnode->stream.dir.cookie_lock); in rootfs_open_dir()
741 list_add_item(&vnode->stream.dir.cookies, cookie); in rootfs_open_dir()
742 mutex_unlock(&vnode->stream.dir.cookie_lock); in rootfs_open_dir()
759 mutex_lock(&vnode->stream.dir.cookie_lock); in rootfs_free_dir_cookie()
760 list_remove_item(&vnode->stream.dir.cookies, cookie); in rootfs_free_dir_cookie()
761 mutex_unlock(&vnode->stream.dir.cookie_lock); in rootfs_free_dir_cookie()
795 nextChildNode = vnode->stream.dir.dir_head; in rootfs_read_dir()
801 nextChildNode = vnode->stream.dir.dir_head; in rootfs_read_dir()
848 cookie->current = vnode->stream.dir.dir_head; in rootfs_rewind_dir()
912 struct rootfs_vnode* dir = (rootfs_vnode*)_dir->private_node; in rootfs_symlink() local
915 TRACE(("rootfs_symlink: dir %p, name = '%s', path = %s\n", dir, name, path)); in rootfs_symlink()
917 status_t status = rootfs_check_permissions(dir, W_OK); in rootfs_symlink()
923 vnode = rootfs_find_in_dir(dir, name); in rootfs_symlink()
928 vnode = rootfs_create_vnode(fs, dir, name, S_IFLNK | (mode & S_IUMSK)); in rootfs_symlink()
932 rootfs_insert_in_dir(fs, dir, vnode); in rootfs_symlink()
942 entry_cache_add(fs->volume->id, dir->id, name, vnode->id); in rootfs_symlink()
944 notify_entry_created(fs->id, dir->id, name, vnode->id); in rootfs_symlink()
954 struct rootfs_vnode* dir = (rootfs_vnode*)_dir->private_node; in rootfs_unlink() local
956 TRACE(("rootfs_unlink: dir %p (0x%Lx), name '%s'\n", dir, dir->id, name)); in rootfs_unlink()
958 status_t status = rootfs_check_permissions(dir, W_OK); in rootfs_unlink()
962 return rootfs_remove(fs, dir, name, false); in rootfs_unlink()
1156 struct rootfs_vnode* dir = (rootfs_vnode*)_dir->private_node; in rootfs_create_special_node() local
1162 vnode = rootfs_find_in_dir(dir, name); in rootfs_create_special_node()
1167 vnode = rootfs_create_vnode(fs, dir, name, mode); in rootfs_create_special_node()
1172 rootfs_insert_in_dir(fs, dir, vnode); in rootfs_create_special_node()
1189 rootfs_remove_from_dir(fs, dir, vnode); in rootfs_create_special_node()
1195 entry_cache_add(fs->volume->id, dir->id, name, vnode->id); in rootfs_create_special_node()
1196 notify_entry_created(fs->id, dir->id, name, vnode->id); in rootfs_create_special_node()