/DragonOS-0.1.2/kernel/src/filesystem/rootfs/ ! |
D | rootfs.c | 41 static long rootfs_open(struct vfs_index_node_t *inode, struct vfs_file_t *file_ptr) in rootfs_open() argument 45 static long rootfs_close(struct vfs_index_node_t *inode, struct vfs_file_t *file_ptr) { return 0; } in rootfs_close() argument 46 static long rootfs_read(struct vfs_file_t *file_ptr, char *buf, int64_t count, long *position) { re… in rootfs_read() argument 47 static long rootfs_write(struct vfs_file_t *file_ptr, char *buf, int64_t count, long *position) { r… in rootfs_write() argument 48 static long rootfs_lseek(struct vfs_file_t *file_ptr, long offset, long origin) { return 0; } in rootfs_lseek() argument 49 static long rootfs_ioctl(struct vfs_index_node_t *inode, struct vfs_file_t *file_ptr, uint64_t cmd,… in rootfs_ioctl() argument 51 static long rootfs_readdir(struct vfs_file_t *file_ptr, void *dirent, vfs_filldir_t filler) in rootfs_readdir() argument 54 struct vfs_dir_entry_t *dentry = file_ptr->dEntry; in rootfs_readdir() 57 for (int i = 0; i <= file_ptr->position; ++i) in rootfs_readdir() 66 ++file_ptr->position; in rootfs_readdir() [all …]
|
/DragonOS-0.1.2/kernel/src/filesystem/procfs/ ! |
D | procfs.c | 105 static long procfs_open(struct vfs_index_node_t *inode, struct vfs_file_t *file_ptr) in procfs_open() argument 168 file_ptr->private_data = fdata; in procfs_open() 171 static long procfs_close(struct vfs_index_node_t *inode, struct vfs_file_t *file_ptr) in procfs_close() argument 175 static long procfs_read(struct vfs_file_t *file_ptr, char *buf, int64_t count, long *position) in procfs_read() argument 178 … struct procfs_file_private_data *priv = (struct procfs_file_private_data *)file_ptr->private_data; in procfs_read() 218 static long procfs_write(struct vfs_file_t *file_ptr, char *buf, int64_t count, long *position) in procfs_write() argument 230 static long procfs_lseek(struct vfs_file_t *file_ptr, long offset, long whence) in procfs_lseek() argument 232 struct vfs_index_node_t *inode = file_ptr->dEntry->dir_inode; in procfs_lseek() 241 pos = file_ptr->position + offset; in procfs_lseek() 244 pos = file_ptr->dEntry->dir_inode->file_size + offset; in procfs_lseek() [all …]
|
/DragonOS-0.1.2/kernel/src/syscall/ ! |
D | syscall.c | 175 struct vfs_file_t *file_ptr = current_pcb->fds[fd_num]; in sys_read() local 177 if (file_ptr->file_ops && file_ptr->file_ops->read) in sys_read() 178 ret = file_ptr->file_ops->read(file_ptr, (char *)buf, count, &(file_ptr->position)); in sys_read() 214 struct vfs_file_t *file_ptr = current_pcb->fds[fd_num]; in sys_write() local 216 if (file_ptr->file_ops && file_ptr->file_ops->write) in sys_write() 217 ret = file_ptr->file_ops->write(file_ptr, (char *)buf, count, &(file_ptr->position)); in sys_write() 247 struct vfs_file_t *file_ptr = current_pcb->fds[fd_num]; in sys_lseek() local 248 if (file_ptr->file_ops && file_ptr->file_ops->lseek) in sys_lseek() 249 retval = file_ptr->file_ops->lseek(file_ptr, offset, whence); in sys_lseek()
|
/DragonOS-0.1.2/kernel/src/filesystem/devfs/ ! |
D | devfs.c | 74 static long devfs_open(struct vfs_index_node_t *inode, struct vfs_file_t *file_ptr) in devfs_open() argument 78 static long devfs_close(struct vfs_index_node_t *inode, struct vfs_file_t *file_ptr) { return 0; } in devfs_close() argument 79 static long devfs_read(struct vfs_file_t *file_ptr, char *buf, int64_t count, long *position) { ret… in devfs_read() argument 80 static long devfs_write(struct vfs_file_t *file_ptr, char *buf, int64_t count, long *position) { re… in devfs_write() argument 81 static long devfs_lseek(struct vfs_file_t *file_ptr, long offset, long origin) { return 0; } in devfs_lseek() argument 82 static long devfs_ioctl(struct vfs_index_node_t *inode, struct vfs_file_t *file_ptr, uint64_t cmd, … in devfs_ioctl() argument 84 static long devfs_readdir(struct vfs_file_t *file_ptr, void *dirent, vfs_filldir_t filler) in devfs_readdir() argument 87 struct vfs_dir_entry_t *dentry = file_ptr->dEntry; in devfs_readdir() 90 for (int i = 0; i <= file_ptr->position; ++i) in devfs_readdir() 99 ++file_ptr->position; in devfs_readdir() [all …]
|
/DragonOS-0.1.2/kernel/src/filesystem/VFS/ ! |
D | VFS.c | 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() [all …]
|
D | VFS.h | 186 long (*open)(struct vfs_index_node_t *inode, struct vfs_file_t *file_ptr); 187 long (*close)(struct vfs_index_node_t *inode, struct vfs_file_t *file_ptr); 188 long (*read)(struct vfs_file_t *file_ptr, char *buf, int64_t count, long *position); 189 long (*write)(struct vfs_file_t *file_ptr, char *buf, int64_t count, long *position); 190 long (*lseek)(struct vfs_file_t *file_ptr, long offset, long origin); 191 …long (*ioctl)(struct vfs_index_node_t *inode, struct vfs_file_t *file_ptr, uint64_t cmd, uint64_t … 193 long (*readdir)(struct vfs_file_t *file_ptr, void *dirent, vfs_filldir_t filler); // 读取文件夹
|
/DragonOS-0.1.2/kernel/src/filesystem/fat32/ ! |
D | fat32.c | 553 long fat32_open(struct vfs_index_node_t *inode, struct vfs_file_t *file_ptr) in fat32_open() argument 559 long fat32_close(struct vfs_index_node_t *inode, struct vfs_file_t *file_ptr) in fat32_close() argument 573 long fat32_read(struct vfs_file_t *file_ptr, char *buf, int64_t count, long *position) in fat32_read() argument 576 …struct fat32_inode_info_t *finode = (struct fat32_inode_info_t *)(file_ptr->dEntry->dir_inode->pri… in fat32_read() 577 fat32_sb_info_t *fsbi = (fat32_sb_info_t *)(file_ptr->dEntry->dir_inode->sb->private_sb_info); in fat32_read() 578 struct block_device *blk = file_ptr->dEntry->dir_inode->sb->blk_device; in fat32_read() 600 if (*position + count > file_ptr->dEntry->dir_inode->file_size) in fat32_read() 601 count = file_ptr->dEntry->dir_inode->file_size - *position; in fat32_read() 662 long fat32_write(struct vfs_file_t *file_ptr, char *buf, int64_t count, long *position) in fat32_write() argument 664 …struct fat32_inode_info_t *finode = (struct fat32_inode_info_t *)file_ptr->dEntry->dir_inode->priv… in fat32_write() [all …]
|
D | fat32.h | 221 int64_t fat32_readdir(struct vfs_file_t *file_ptr, void *dirent, vfs_filldir_t filler);
|
/DragonOS-0.1.2/kernel/src/ipc/ ! |
D | pipe.c | 30 long pipe_read(struct vfs_file_t *file_ptr, char *buf, in pipe_read() argument 37 pipe_ptr = (struct pipe_t *)file_ptr->private_data; in pipe_read() 63 long pipe_write(struct vfs_file_t *file_ptr, char *buf, in pipe_write() argument 70 pipe_ptr = (struct pipe_t *)file_ptr->private_data; in pipe_write() 97 long pipe_close(struct vfs_index_node_t *inode, struct vfs_file_t *file_ptr) in pipe_close() argument
|