Blame view
fs/ext4/symlink.c
1.73 KB
b24413180
|
1 |
// SPDX-License-Identifier: GPL-2.0 |
ac27a0ec1
|
2 |
/* |
617ba13b3
|
3 |
* linux/fs/ext4/symlink.c |
ac27a0ec1
|
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
* * Only fast symlinks left here - the rest is done by generic code. AV, 1999 * * Copyright (C) 1992, 1993, 1994, 1995 * Remy Card (card@masi.ibp.fr) * Laboratoire MASI - Institut Blaise Pascal * Universite Pierre et Marie Curie (Paris VI) * * from * * linux/fs/minix/symlink.c * * Copyright (C) 1991, 1992 Linus Torvalds * |
617ba13b3
|
18 |
* ext4 symlink handling code |
ac27a0ec1
|
19 20 21 |
*/ #include <linux/fs.h> |
ac27a0ec1
|
22 |
#include <linux/namei.h> |
3dcf54515
|
23 |
#include "ext4.h" |
ac27a0ec1
|
24 |
#include "xattr.h" |
6b2553918
|
25 |
static const char *ext4_encrypted_get_link(struct dentry *dentry, |
fceef393a
|
26 27 |
struct inode *inode, struct delayed_call *done) |
ac27a0ec1
|
28 |
{ |
f348c2523
|
29 |
struct page *cpage = NULL; |
6a9269c83
|
30 31 32 |
const void *caddr; unsigned int max_size; const char *paddr; |
f348c2523
|
33 |
|
6b2553918
|
34 35 |
if (!dentry) return ERR_PTR(-ECHILD); |
f348c2523
|
36 |
if (ext4_inode_is_fast_symlink(inode)) { |
6a9269c83
|
37 |
caddr = EXT4_I(inode)->i_data; |
9ec3a646f
|
38 |
max_size = sizeof(EXT4_I(inode)->i_data); |
f348c2523
|
39 40 |
} else { cpage = read_mapping_page(inode->i_mapping, 0, NULL); |
b7236e21d
|
41 |
if (IS_ERR(cpage)) |
680baacbc
|
42 |
return ERR_CAST(cpage); |
21fc61c73
|
43 |
caddr = page_address(cpage); |
6a9269c83
|
44 |
max_size = inode->i_sb->s_blocksize; |
f348c2523
|
45 |
} |
6a9269c83
|
46 |
paddr = fscrypt_get_symlink(inode, caddr, max_size, done); |
21fc61c73
|
47 |
if (cpage) |
09cbfeaf1
|
48 |
put_page(cpage); |
fceef393a
|
49 |
return paddr; |
f348c2523
|
50 |
} |
a7a67e8a0
|
51 |
const struct inode_operations ext4_encrypted_symlink_inode_operations = { |
6b2553918
|
52 |
.get_link = ext4_encrypted_get_link, |
a7a67e8a0
|
53 |
.setattr = ext4_setattr, |
99652ea56
|
54 |
.getattr = ext4_getattr, |
a7a67e8a0
|
55 |
.listxattr = ext4_listxattr, |
a7a67e8a0
|
56 |
}; |
f348c2523
|
57 |
|
754661f14
|
58 |
const struct inode_operations ext4_symlink_inode_operations = { |
6b2553918
|
59 |
.get_link = page_get_link, |
256a45354
|
60 |
.setattr = ext4_setattr, |
99652ea56
|
61 |
.getattr = ext4_getattr, |
617ba13b3
|
62 |
.listxattr = ext4_listxattr, |
ac27a0ec1
|
63 |
}; |
754661f14
|
64 |
const struct inode_operations ext4_fast_symlink_inode_operations = { |
6b2553918
|
65 |
.get_link = simple_get_link, |
256a45354
|
66 |
.setattr = ext4_setattr, |
99652ea56
|
67 |
.getattr = ext4_getattr, |
617ba13b3
|
68 |
.listxattr = ext4_listxattr, |
ac27a0ec1
|
69 |
}; |