Read the contents of a directory and add them to the population of the current node. This function honours the sort order each module has. Definition at line 71 of file vfs_regular.c. 00072 { 00073 GDir *dir; 00074 const char *sfn; 00075 struct vfsref *nvr, *svr; 00076 int hide_dotfiles; 00077 00078 hide_dotfiles = config_getopt_bool("vfs.dir.hide_dotfiles"); 00079 00080 if ((dir = g_dir_open(ve->filename, 0, NULL)) == NULL) 00081 return (-1); 00082 00083 while ((sfn = g_dir_read_name(dir)) != NULL) { 00084 /* Hide dotted files */ 00085 if (hide_dotfiles && sfn[0] == '.') 00086 continue; 00087 00088 if ((nvr = vfs_lookup(sfn, NULL, ve->filename, 1)) == NULL) 00089 continue; 00090 00091 /* 00092 * Add the items to the tailq in a sorted manner. 00093 */ 00094 VFS_LIST_FOREACH(&ve->population, svr) { 00095 /* Store the file if the sorting priority is lower */ 00096 if (nvr->ent->vmod->sortorder < svr->ent->vmod->sortorder || 00097 /* Or if they are the same and the filename is lower */ 00098 (nvr->ent->vmod->sortorder == svr->ent->vmod->sortorder && 00099 strcasecmp(vfs_name(nvr), vfs_name(svr)) < 0)) { 00100 vfs_list_insert_before(&ve->population, nvr, svr); 00101 break; 00102 } 00103 } 00104 00105 if (svr == NULL) 00106 vfs_list_insert_tail(&ve->population, nvr); 00107 } 00108 00109 g_dir_close(dir); 00110 00111 return (0); 00112 }
Here is the call graph for this function:
![]() |
1.6.3