| 560 | ****************************************************************************/ |
| 561 | |
| 562 | static FAR struct tmpfs_file_s * |
| 563 | tmpfs_alloc_file(FAR struct tmpfs_directory_s *parent) |
| 564 | { |
| 565 | FAR struct tmpfs_file_s *tfo; |
| 566 | |
| 567 | /* Create a new zero length file object */ |
| 568 | |
| 569 | tfo = fs_heap_zalloc(sizeof(*tfo)); |
| 570 | if (tfo == NULL) |
| 571 | { |
| 572 | return NULL; |
| 573 | } |
| 574 | |
| 575 | /* Initialize the new file object. NOTE that the initial state is |
| 576 | * locked with one reference count. |
| 577 | */ |
| 578 | |
| 579 | tfo->tfo_alloc = 0; |
| 580 | tfo->tfo_type = TMPFS_REGULAR; |
| 581 | tfo->tfo_refs = 1; |
| 582 | tfo->tfo_parent = parent; |
| 583 | tfo->tfo_flags = 0; |
| 584 | tfo->tfo_size = 0; |
| 585 | tfo->tfo_data = NULL; |
| 586 | |
| 587 | nxrmutex_init(&tfo->tfo_lock); |
| 588 | tmpfs_lock_file(tfo); |
| 589 | |
| 590 | return tfo; |
| 591 | } |
| 592 | |
| 593 | /**************************************************************************** |
| 594 | * Name: tmpfs_create_file |
no test coverage detected