Lines Matching refs:d_file
193 struct tmpfs_file *d_file; in dfs_tmpfs_ioctl() local
196 d_file = (struct tmpfs_file *)file->vnode->data; in dfs_tmpfs_ioctl()
197 RT_ASSERT(d_file != NULL); in dfs_tmpfs_ioctl()
199 superblock = d_file->sb; in dfs_tmpfs_ioctl()
216 LOG_D("tmpfile mmap ptr:%x , size:%d\n", d_file->data, mmap2->length); in dfs_tmpfs_ioctl()
217 mmap2->ret = lwp_map_user_phy(lwp_self(), RT_NULL, d_file->data, mmap2->length, 0); in dfs_tmpfs_ioctl()
292 struct tmpfs_file *d_file; in dfs_tmpfs_read() local
293 d_file = (struct tmpfs_file *)file->vnode->data; in dfs_tmpfs_read()
294 RT_ASSERT(d_file != NULL); in dfs_tmpfs_read()
304 memcpy(buf, &(d_file->data[*pos]), length); in dfs_tmpfs_read()
314 static ssize_t _dfs_tmpfs_write(struct tmpfs_file *d_file, const void *buf, size_t count, off_t *po… in _dfs_tmpfs_write() argument
318 RT_ASSERT(d_file != NULL); in _dfs_tmpfs_write()
320 superblock = d_file->sb; in _dfs_tmpfs_write()
323 if (count + *pos > d_file->size) in _dfs_tmpfs_write()
326 ptr = rt_realloc(d_file->data, *pos + count); in _dfs_tmpfs_write()
334 superblock->df_size += (*pos - d_file->size + count); in _dfs_tmpfs_write()
337 d_file->data = ptr; in _dfs_tmpfs_write()
338 d_file->size = *pos + count; in _dfs_tmpfs_write()
339 LOG_D("tmpfile ptr:%x, size:%d", ptr, d_file->size); in _dfs_tmpfs_write()
343 memcpy(d_file->data + *pos, buf, count); in _dfs_tmpfs_write()
353 struct tmpfs_file *d_file; in dfs_tmpfs_write() local
355 d_file = (struct tmpfs_file *)file->vnode->data; in dfs_tmpfs_write()
356 RT_ASSERT(d_file != NULL); in dfs_tmpfs_write()
360 count = _dfs_tmpfs_write(d_file, buf, count, pos); in dfs_tmpfs_write()
396 struct tmpfs_file *d_file; in dfs_tmpfs_close() local
403 d_file = (struct tmpfs_file *)file->vnode->data; in dfs_tmpfs_close()
405 if (d_file == NULL) in dfs_tmpfs_close()
408 if (d_file->fre_memory == RT_TRUE) in dfs_tmpfs_close()
410 if (d_file->data != NULL) in dfs_tmpfs_close()
412 rt_free(d_file->data); in dfs_tmpfs_close()
413 d_file->data = RT_NULL; in dfs_tmpfs_close()
416 rt_free(d_file); in dfs_tmpfs_close()
426 struct tmpfs_file *d_file; in dfs_tmpfs_open() local
428 d_file = (struct tmpfs_file *)file->vnode->data; in dfs_tmpfs_open()
429 RT_ASSERT(d_file != RT_NULL); in dfs_tmpfs_open()
435 d_file->size = 0; in dfs_tmpfs_open()
436 file->vnode->size = d_file->size; in dfs_tmpfs_open()
438 if (d_file->data != NULL) in dfs_tmpfs_open()
441 rt_free(d_file->data); in dfs_tmpfs_open()
442 d_file->data = NULL; in dfs_tmpfs_open()
467 struct tmpfs_file *d_file; in dfs_tmpfs_stat() local
471 d_file = dfs_tmpfs_lookup(superblock, dentry->pathname, &size); in dfs_tmpfs_stat()
473 if (d_file == NULL) in dfs_tmpfs_stat()
479 if (d_file->type == TMPFS_TYPE_DIR) in dfs_tmpfs_stat()
488 st->st_size = d_file->size; in dfs_tmpfs_stat()
500 struct tmpfs_file *d_file, *n_file, *tmp; in dfs_tmpfs_getdents() local
503 d_file = (struct tmpfs_file *)file->vnode->data; in dfs_tmpfs_getdents()
507 superblock = d_file->sb; in dfs_tmpfs_getdents()
523 dfs_vfs_for_each_subnode(n_file, tmp, d_file, node) in dfs_tmpfs_getdents()
528 if (d_file->type == TMPFS_TYPE_FILE) in dfs_tmpfs_getdents()
532 if (d_file->type == TMPFS_TYPE_DIR) in dfs_tmpfs_getdents()
558 struct tmpfs_file *d_file; in dfs_tmpfs_unlink() local
563 d_file = dfs_tmpfs_lookup(superblock, dentry->pathname, &size); in dfs_tmpfs_unlink()
564 if (d_file == NULL) in dfs_tmpfs_unlink()
568 dfs_vfs_remove_node(&d_file->node); in dfs_tmpfs_unlink()
573 if (d_file->data != NULL) in dfs_tmpfs_unlink()
575 rt_free(d_file->data); in dfs_tmpfs_unlink()
576 d_file->data = RT_NULL; in dfs_tmpfs_unlink()
579 rt_free(d_file); in dfs_tmpfs_unlink()
583 d_file->fre_memory = RT_TRUE; in dfs_tmpfs_unlink()
591 struct tmpfs_file *d_file, *p_file; in dfs_tmpfs_rename() local
600 d_file = dfs_tmpfs_lookup(superblock, new_dentry->pathname, &size); in dfs_tmpfs_rename()
601 if (d_file != NULL) in dfs_tmpfs_rename()
604 d_file = dfs_tmpfs_lookup(superblock, old_dentry->pathname, &size); in dfs_tmpfs_rename()
605 if (d_file == NULL) in dfs_tmpfs_rename()
626 dfs_vfs_remove_node(&d_file->node); in dfs_tmpfs_rename()
629 strncpy(d_file->name, file_name, TMPFS_NAME_MAX); in dfs_tmpfs_rename()
632 dfs_vfs_append_node(&p_file->node, &d_file->node); in dfs_tmpfs_rename()
645 struct tmpfs_file *d_file; in _dfs_tmpfs_lookup() local
654 d_file = dfs_tmpfs_lookup(superblock, dentry->pathname, &size); in _dfs_tmpfs_lookup()
655 if (d_file) in _dfs_tmpfs_lookup()
660 if (d_file->type == TMPFS_TYPE_DIR) in _dfs_tmpfs_lookup()
675 vnode->data = d_file; in _dfs_tmpfs_lookup()
676 vnode->size = d_file->size; in _dfs_tmpfs_lookup()
688 struct tmpfs_file *d_file, *p_file; in dfs_tmpfs_create_vnode() local
728 d_file = (struct tmpfs_file *)rt_calloc(1, sizeof(struct tmpfs_file)); in dfs_tmpfs_create_vnode()
729 if (d_file == NULL) in dfs_tmpfs_create_vnode()
738 strncpy(d_file->name, file_name, TMPFS_NAME_MAX); in dfs_tmpfs_create_vnode()
740 dfs_vfs_init_node(&d_file->node); in dfs_tmpfs_create_vnode()
741 d_file->data = NULL; in dfs_tmpfs_create_vnode()
742 d_file->size = 0; in dfs_tmpfs_create_vnode()
743 d_file->sb = superblock; in dfs_tmpfs_create_vnode()
744 d_file->fre_memory = RT_FALSE; in dfs_tmpfs_create_vnode()
747 d_file->type = TMPFS_TYPE_DIR; in dfs_tmpfs_create_vnode()
753 d_file->type = TMPFS_TYPE_FILE; in dfs_tmpfs_create_vnode()
761 dfs_vfs_append_node(&p_file->node, &d_file->node); in dfs_tmpfs_create_vnode()
765 vnode->data = d_file; in dfs_tmpfs_create_vnode()
766 vnode->size = d_file->size; in dfs_tmpfs_create_vnode()
803 struct tmpfs_file *d_file; in dfs_tmp_page_write() local
810 d_file = (struct tmpfs_file *)(page->aspace->vnode->data); in dfs_tmp_page_write()
811 RT_ASSERT(d_file != RT_NULL); in dfs_tmp_page_write()
817 count = _dfs_tmpfs_write(d_file, page->page, page->len, &pos); in dfs_tmp_page_write()
827 struct tmpfs_file *d_file = RT_NULL; in dfs_tmpfs_truncate() local
831 d_file = (struct tmpfs_file *)file->vnode->data; in dfs_tmpfs_truncate()
832 RT_ASSERT(d_file != RT_NULL); in dfs_tmpfs_truncate()
834 superblock = d_file->sb; in dfs_tmpfs_truncate()
837 ptr = rt_realloc(d_file->data, offset); in dfs_tmpfs_truncate()
849 d_file->data = ptr; in dfs_tmpfs_truncate()
850 d_file->size = offset; in dfs_tmpfs_truncate()
851 file->vnode->size = d_file->size; in dfs_tmpfs_truncate()
852 LOG_D("tmpfile ptr:%x, size:%d", ptr, d_file->size); in dfs_tmpfs_truncate()