| 207 | } |
| 208 | |
| 209 | static bool |
| 210 | fsdev_find_sub_dir(char *path, const char *search, char *output) |
| 211 | { |
| 212 | DIR *dir; |
| 213 | struct dirent *entry; |
| 214 | |
| 215 | dir = opendir(path); |
| 216 | if (dir == NULL) { |
| 217 | BCMFS_LOG(ERR, "Unable to open directory"); |
| 218 | return -ENODEV; |
| 219 | } |
| 220 | |
| 221 | while ((entry = readdir(dir)) != NULL) { |
| 222 | if (!strcmp(entry->d_name, search)) { |
| 223 | strlcpy(output, entry->d_name, BCMFS_MAX_PATH_LEN); |
| 224 | closedir(dir); |
| 225 | return true; |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | closedir(dir); |
| 230 | |
| 231 | return false; |
| 232 | } |
| 233 | |
| 234 | |
| 235 | static int |