Lines Matching refs:file_ptr
494 struct vfs_file_t *file_ptr = (struct vfs_file_t *)kzalloc(sizeof(struct vfs_file_t), 0); in do_open() local
498 file_ptr->dEntry = dentry; in do_open()
499 file_ptr->mode = flags; in do_open()
501 file_ptr->file_ops = dentry->dir_inode->file_ops; in do_open()
504 if (file_ptr->file_ops && file_ptr->file_ops->open) in do_open()
505 errcode = file_ptr->file_ops->open(dentry->dir_inode, file_ptr); in do_open()
509 kfree(file_ptr); in do_open()
514 if (file_ptr->mode & O_TRUNC) // 清空文件 in do_open()
515 file_ptr->dEntry->dir_inode->file_size = 0; in do_open()
517 if (file_ptr->mode & O_APPEND) in do_open()
518 file_ptr->position = file_ptr->dEntry->dir_inode->file_size; in do_open()
520 file_ptr->position = 0; in do_open()
522 int fd_num = process_fd_alloc(file_ptr); in do_open()
527 kfree(file_ptr); in do_open()
556 struct vfs_file_t *file_ptr = current_pcb->fds[fd_num]; in vfs_close() local
559 if (file_ptr->file_ops && file_ptr->file_ops->close) in vfs_close()
560 ret = file_ptr->file_ops->close(file_ptr->dEntry->dir_inode, file_ptr); in vfs_close()
562 kfree(file_ptr); in vfs_close()