VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
b24413180f560 (Greg Kroah-Hartman 2017-11-01 15:07:57 +0100  1) // SPDX-License-Identifier: GPL-2.0
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700  2) /*
617ba13b31fbf (Mingming Cao       2006-10-11 01:20:53 -0700  3)  *  linux/fs/ext4/symlink.c
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700  4)  *
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700  5)  * Only fast symlinks left here - the rest is done by generic code. AV, 1999
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700  6)  *
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700  7)  * Copyright (C) 1992, 1993, 1994, 1995
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700  8)  * Remy Card (card@masi.ibp.fr)
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700  9)  * Laboratoire MASI - Institut Blaise Pascal
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 10)  * Universite Pierre et Marie Curie (Paris VI)
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 11)  *
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 12)  *  from
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 13)  *
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 14)  *  linux/fs/minix/symlink.c
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 15)  *
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 16)  *  Copyright (C) 1991, 1992  Linus Torvalds
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 17)  *
617ba13b31fbf (Mingming Cao       2006-10-11 01:20:53 -0700 18)  *  ext4 symlink handling code
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 19)  */
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 20) 
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 21) #include <linux/fs.h>
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 22) #include <linux/namei.h>
3dcf54515aa49 (Christoph Hellwig  2008-04-29 18:13:32 -0400 23) #include "ext4.h"
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 24) #include "xattr.h"
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 25) 
6b2553918d8b4 (Al Viro            2015-11-17 10:20:54 -0500 26) static const char *ext4_encrypted_get_link(struct dentry *dentry,
fceef393a5381 (Al Viro            2015-12-29 15:58:39 -0500 27) 					   struct inode *inode,
fceef393a5381 (Al Viro            2015-12-29 15:58:39 -0500 28) 					   struct delayed_call *done)
f348c252320b9 (Theodore Ts'o      2015-04-16 01:55:00 -0400 29) {
f348c252320b9 (Theodore Ts'o      2015-04-16 01:55:00 -0400 30) 	struct page *cpage = NULL;
6a9269c838519 (Eric Biggers       2018-01-11 22:10:40 -0500 31) 	const void *caddr;
6a9269c838519 (Eric Biggers       2018-01-11 22:10:40 -0500 32) 	unsigned int max_size;
6a9269c838519 (Eric Biggers       2018-01-11 22:10:40 -0500 33) 	const char *paddr;
f348c252320b9 (Theodore Ts'o      2015-04-16 01:55:00 -0400 34) 
6b2553918d8b4 (Al Viro            2015-11-17 10:20:54 -0500 35) 	if (!dentry)
6b2553918d8b4 (Al Viro            2015-11-17 10:20:54 -0500 36) 		return ERR_PTR(-ECHILD);
6b2553918d8b4 (Al Viro            2015-11-17 10:20:54 -0500 37) 
f348c252320b9 (Theodore Ts'o      2015-04-16 01:55:00 -0400 38) 	if (ext4_inode_is_fast_symlink(inode)) {
6a9269c838519 (Eric Biggers       2018-01-11 22:10:40 -0500 39) 		caddr = EXT4_I(inode)->i_data;
9ec3a646fe099 (Linus Torvalds     2015-04-26 15:48:49 -0700 40) 		max_size = sizeof(EXT4_I(inode)->i_data);
f348c252320b9 (Theodore Ts'o      2015-04-16 01:55:00 -0400 41) 	} else {
f348c252320b9 (Theodore Ts'o      2015-04-16 01:55:00 -0400 42) 		cpage = read_mapping_page(inode->i_mapping, 0, NULL);
b7236e21d55ff (Theodore Ts'o      2015-05-18 13:17:47 -0400 43) 		if (IS_ERR(cpage))
680baacbca69d (Al Viro            2015-05-02 13:32:22 -0400 44) 			return ERR_CAST(cpage);
21fc61c73c390 (Al Viro            2015-11-17 01:07:57 -0500 45) 		caddr = page_address(cpage);
6a9269c838519 (Eric Biggers       2018-01-11 22:10:40 -0500 46) 		max_size = inode->i_sb->s_blocksize;
f348c252320b9 (Theodore Ts'o      2015-04-16 01:55:00 -0400 47) 	}
f348c252320b9 (Theodore Ts'o      2015-04-16 01:55:00 -0400 48) 
6a9269c838519 (Eric Biggers       2018-01-11 22:10:40 -0500 49) 	paddr = fscrypt_get_symlink(inode, caddr, max_size, done);
21fc61c73c390 (Al Viro            2015-11-17 01:07:57 -0500 50) 	if (cpage)
09cbfeaf1a5a6 (Kirill A. Shutemov 2016-04-01 15:29:47 +0300 51) 		put_page(cpage);
fceef393a5381 (Al Viro            2015-12-29 15:58:39 -0500 52) 	return paddr;
f348c252320b9 (Theodore Ts'o      2015-04-16 01:55:00 -0400 53) }
f348c252320b9 (Theodore Ts'o      2015-04-16 01:55:00 -0400 54) 
f04584399d1cf (Eric Biggers       2021-07-01 23:53:47 -0700 55) static int ext4_encrypted_symlink_getattr(struct user_namespace *mnt_userns,
f04584399d1cf (Eric Biggers       2021-07-01 23:53:47 -0700 56) 					  const struct path *path,
f04584399d1cf (Eric Biggers       2021-07-01 23:53:47 -0700 57) 					  struct kstat *stat, u32 request_mask,
f04584399d1cf (Eric Biggers       2021-07-01 23:53:47 -0700 58) 					  unsigned int query_flags)
f04584399d1cf (Eric Biggers       2021-07-01 23:53:47 -0700 59) {
f04584399d1cf (Eric Biggers       2021-07-01 23:53:47 -0700 60) 	ext4_getattr(mnt_userns, path, stat, request_mask, query_flags);
f04584399d1cf (Eric Biggers       2021-07-01 23:53:47 -0700 61) 
f04584399d1cf (Eric Biggers       2021-07-01 23:53:47 -0700 62) 	return fscrypt_symlink_getattr(path, stat);
f04584399d1cf (Eric Biggers       2021-07-01 23:53:47 -0700 63) }
f04584399d1cf (Eric Biggers       2021-07-01 23:53:47 -0700 64) 
a7a67e8a089e2 (Al Viro            2015-04-27 17:51:30 -0400 65) const struct inode_operations ext4_encrypted_symlink_inode_operations = {
6b2553918d8b4 (Al Viro            2015-11-17 10:20:54 -0500 66) 	.get_link	= ext4_encrypted_get_link,
a7a67e8a089e2 (Al Viro            2015-04-27 17:51:30 -0400 67) 	.setattr	= ext4_setattr,
f04584399d1cf (Eric Biggers       2021-07-01 23:53:47 -0700 68) 	.getattr	= ext4_encrypted_symlink_getattr,
a7a67e8a089e2 (Al Viro            2015-04-27 17:51:30 -0400 69) 	.listxattr	= ext4_listxattr,
a7a67e8a089e2 (Al Viro            2015-04-27 17:51:30 -0400 70) };
f348c252320b9 (Theodore Ts'o      2015-04-16 01:55:00 -0400 71) 
754661f143e70 (Arjan van de Ven   2007-02-12 00:55:38 -0800 72) const struct inode_operations ext4_symlink_inode_operations = {
6b2553918d8b4 (Al Viro            2015-11-17 10:20:54 -0500 73) 	.get_link	= page_get_link,
256a453546f1c (Dmitry Monakhov    2010-05-16 02:00:00 -0400 74) 	.setattr	= ext4_setattr,
99652ea56a418 (David Howells      2017-03-31 18:31:56 +0100 75) 	.getattr	= ext4_getattr,
617ba13b31fbf (Mingming Cao       2006-10-11 01:20:53 -0700 76) 	.listxattr	= ext4_listxattr,
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 77) };
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 78) 
754661f143e70 (Arjan van de Ven   2007-02-12 00:55:38 -0800 79) const struct inode_operations ext4_fast_symlink_inode_operations = {
6b2553918d8b4 (Al Viro            2015-11-17 10:20:54 -0500 80) 	.get_link	= simple_get_link,
256a453546f1c (Dmitry Monakhov    2010-05-16 02:00:00 -0400 81) 	.setattr	= ext4_setattr,
99652ea56a418 (David Howells      2017-03-31 18:31:56 +0100 82) 	.getattr	= ext4_getattr,
617ba13b31fbf (Mingming Cao       2006-10-11 01:20:53 -0700 83) 	.listxattr	= ext4_listxattr,
ac27a0ec112a0 (Dave Kleikamp      2006-10-11 01:20:50 -0700 84) };