From 2e4c83c642b4fea9778c53db395795bd6f0f1a03 Mon Sep 17 00:00:00 2001 From: Yu Kuai Date: Mon, 23 Aug 2021 16:03:57 +0800 Subject: [PATCH] eulerfs: add inode_operations for symlink inode hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I40JRR CVE: NA -------------------------------------- Implement get_link, setattr and listxattr interfaces for symlink inode operations. Signed-off-by: Mingkai Dong Signed-off-by: Yu Kuai Reviewed-by: Hou Tao Signed-off-by: Zheng Zengkai --- fs/eulerfs/symlink.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 fs/eulerfs/symlink.c diff --git a/fs/eulerfs/symlink.c b/fs/eulerfs/symlink.c new file mode 100644 index 000000000000..831c5c8758ea --- /dev/null +++ b/fs/eulerfs/symlink.c @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include "euler.h" + +static const char *eufs_get_link(struct dentry *dentry, struct inode *inode, + struct delayed_call *call) +{ + struct eufs_inode *pi = EUFS_FRESH_PI(EUFS_PI(inode)); + + return ((char *)o2p(inode->i_sb, eufs_iread_root(pi))) + sizeof(u64); +} + +const struct inode_operations eufs_symlink_inode_operations = { + .get_link = eufs_get_link, + .setattr = eufs_notify_change, +}; -- GitLab