Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* file-mmu.c: ramfs MMU-based file operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Resizable simple ram filesystem for Linux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (C) 2000 Linus Torvalds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *               2000 Transmeta Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  * Usage limits added by David Gibson, Linuxcare Australia.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  * This file is released under the GPL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  * NOTE! This filesystem is probably most useful
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  * not as a real filesystem, but as an example of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  * how virtual filesystems can be written.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  * It doesn't get much simpler than this. Consider
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  * that this file implements the full semantics of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)  * a POSIX-compliant read-write filesystem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)  * Note in particular how the filesystem does not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)  * need to implement any data structures of its own
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)  * to keep track of the virtual data: using the VFS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)  * caches is sufficient.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include <linux/ramfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #include "internal.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) static unsigned long ramfs_mmu_get_unmapped_area(struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 		unsigned long addr, unsigned long len, unsigned long pgoff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 		unsigned long flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	return current->mm->get_unmapped_area(file, addr, len, pgoff, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) const struct file_operations ramfs_file_operations = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	.read_iter	= generic_file_read_iter,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	.write_iter	= generic_file_write_iter,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	.mmap		= generic_file_mmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	.fsync		= noop_fsync,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	.splice_read	= generic_file_splice_read,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	.splice_write	= iter_file_splice_write,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	.llseek		= generic_file_llseek,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	.get_unmapped_area	= ramfs_mmu_get_unmapped_area,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) const struct inode_operations ramfs_file_inode_operations = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	.setattr	= simple_setattr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	.getattr	= simple_getattr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) };