void generate_file_priorities(struct dir_info *dir, int priority, struct stat *buf) { struct dir_ent *dir_ent = dir->list; priority = get_priority(dir->pathname, buf, priority); for(; dir_ent; dir_ent = dir_ent->next) { struct stat *buf = &dir_ent->inode->buf; if(dir_ent->inode->root_entry) continue; switch(buf->st_mode & S_IFMT) { case S_IFREG: add_priority_list(dir_ent, get_priority(pathname(dir_ent), buf, priority)); break; case S_IFDIR: generate_file_priorities(dir_ent->dir, priority, buf); break; } } }
void generate_file_priorities(struct dir_info *dir, int priority, struct stat *buf) { priority = get_priority(dir->pathname, buf, priority); while(dir->current_count < dir->count) { struct dir_ent *dir_ent = dir->list[dir->current_count++]; struct stat *buf = &dir_ent->inode->buf; if(dir_ent->data) continue; switch(buf->st_mode & S_IFMT) { case S_IFREG: add_priority_list(dir_ent, get_priority(dir_ent->pathname, buf, priority)); break; case S_IFDIR: generate_file_priorities(dir_ent->dir, priority, buf); break; } } dir->current_count = 0; }
int generate_file_priorities(struct dir_info *dir, int priority, struct stat *buf) { int res; priority = get_priority(dir->pathname, buf, priority); while(dir->current_count < dir->count) { struct dir_ent *dir_ent = dir->list[dir->current_count++]; struct stat *buf = &dir_ent->inode->buf; if(dir_ent->inode->root_entry) continue; switch(buf->st_mode & S_IFMT) { case S_IFREG: res = add_priority_list(dir_ent, get_priority(pathname(dir_ent), buf, priority)); if(res == FALSE) return FALSE; break; case S_IFDIR: res = generate_file_priorities(dir_ent->dir, priority, buf); if(res == FALSE) return FALSE; break; } } dir->current_count = 0; return TRUE; }