bool filesys_readdir (int fd, char *name) { struct file *file = file_find (fd); if (file == NULL) return false; struct inode *inode = file_get_inode (file); if (!inode_is_dir (inode)) return false; struct dir *dir = dir_open (inode); dir_set_pos (dir, file_tell (file)); bool success = dir_readdir (dir, name); file_seek (file, dir_get_pos (dir)); dir_close (dir); return success; }
static VALUE dir_seek(VALUE self, VALUE v_pos){ v_pos = dir_set_pos(self, v_pos); return self; }