| 341 | */ |
| 342 | |
| 343 | struct dfs_file *fdt_fd_get(struct dfs_fdtable* fdt, int fd) |
| 344 | { |
| 345 | struct dfs_file *d; |
| 346 | |
| 347 | if (fd < 0 || fd >= (int)fdt->maxfd) |
| 348 | { |
| 349 | return NULL; |
| 350 | } |
| 351 | |
| 352 | dfs_file_lock(); |
| 353 | d = fdt->fds[fd]; |
| 354 | |
| 355 | /* check dfs_file valid or not */ |
| 356 | if ((d == NULL) || (d->magic != DFS_FD_MAGIC)) |
| 357 | { |
| 358 | dfs_file_unlock(); |
| 359 | return NULL; |
| 360 | } |
| 361 | |
| 362 | dfs_file_unlock(); |
| 363 | |
| 364 | return d; |
| 365 | } |
| 366 | |
| 367 | struct dfs_file *fd_get(int fd) |
| 368 | { |
no test coverage detected