| 2227 | }; |
| 2228 | |
| 2229 | static void kernel_load_cb(FSDevice *fs, FSQID *qid1, int err, |
| 2230 | void *opaque) |
| 2231 | { |
| 2232 | FSNetInitState *s = opaque; |
| 2233 | FSQID qid; |
| 2234 | |
| 2235 | #ifdef DUMP_CACHE_LOAD |
| 2236 | /* disable preloading if dumping cache load */ |
| 2237 | if (((FSDeviceMem *)fs)->dump_cache_load) |
| 2238 | return; |
| 2239 | #endif |
| 2240 | |
| 2241 | if (s->fd) { |
| 2242 | fs->fs_delete(fs, s->fd); |
| 2243 | s->fd = NULL; |
| 2244 | } |
| 2245 | |
| 2246 | if (s->file_index >= FILE_LOAD_COUNT) { |
| 2247 | /* all files are loaded */ |
| 2248 | if (preload_parse(fs, ".preload2/preload.txt", TRUE) < 0) { |
| 2249 | preload_parse(fs, ".preload", FALSE); |
| 2250 | } |
| 2251 | fs->fs_delete(fs, s->root_fd); |
| 2252 | if (s->start_cb) |
| 2253 | s->start_cb(s->start_opaque); |
| 2254 | free(s); |
| 2255 | } else { |
| 2256 | s->fd = fs_walk_path(fs, s->root_fd, kernel_file_list[s->file_index++]); |
| 2257 | if (!s->fd) |
| 2258 | goto done; |
| 2259 | err = fs->fs_open(fs, &qid, s->fd, P9_O_RDONLY, kernel_load_cb, s); |
| 2260 | if (err <= 0) { |
| 2261 | done: |
| 2262 | kernel_load_cb(fs, NULL, 0, s); |
| 2263 | } |
| 2264 | } |
| 2265 | } |
| 2266 | |
| 2267 | static void preload_parse_str_old(FSDevice *fs1, const char *p) |
| 2268 | { |
no test coverage detected