MCPcopy Create free account
hub / github.com/apache/nuttx / tmpfs_alloc_file

Function tmpfs_alloc_file

fs/tmpfs/fs_tmpfs.c:562–591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

560 ****************************************************************************/
561
562static FAR struct tmpfs_file_s *
563tmpfs_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

Callers 1

tmpfs_create_fileFunction · 0.85

Calls 2

fs_heap_zallocFunction · 0.85
nxrmutex_initFunction · 0.85

Tested by

no test coverage detected