[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240620032335.147136-1-youling.tang@linux.dev>
Date: Thu, 20 Jun 2024 11:23:33 +0800
From: Youling Tang <youling.tang@...ux.dev>
To: Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>,
Jaegeuk Kim <jaegeuk@...nel.org>,
Chao Yu <chao@...nel.org>,
Miklos Szeredi <miklos@...redi.hu>
Cc: Jan Kara <jack@...e.cz>,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net,
youling.tang@...ux.dev,
Youling Tang <tangyouling@...inos.cn>
Subject: [PATCH 1/3] fs: Export in_group_or_capable()
From: Youling Tang <tangyouling@...inos.cn>
Export in_group_or_capable() as a VFS helper function.
Signed-off-by: Youling Tang <tangyouling@...inos.cn>
---
fs/attr.c | 2 --
fs/inode.c | 1 +
include/linux/fs.h | 2 ++
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/attr.c b/fs/attr.c
index 960a310581eb..825007d5cda4 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -17,8 +17,6 @@
#include <linux/filelock.h>
#include <linux/security.h>
-#include "internal.h"
-
/**
* setattr_should_drop_sgid - determine whether the setgid bit needs to be
* removed
diff --git a/fs/inode.c b/fs/inode.c
index 3a41f83a4ba5..e0815acc5abb 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -2538,6 +2538,7 @@ bool in_group_or_capable(struct mnt_idmap *idmap,
return true;
return false;
}
+EXPORT_SYMBOL(in_group_or_capable);
/**
* mode_strip_sgid - handle the sgid bit for non-directories
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 0283cf366c2a..c375a4af7b11 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1926,6 +1926,8 @@ void inode_init_owner(struct mnt_idmap *idmap, struct inode *inode,
extern bool may_open_dev(const struct path *path);
umode_t mode_strip_sgid(struct mnt_idmap *idmap,
const struct inode *dir, umode_t mode);
+bool in_group_or_capable(struct mnt_idmap *idmap,
+ const struct inode *inode, vfsgid_t vfsgid);
/*
* This is the "filldir" function type, used by readdir() to let
--
2.34.1
Powered by blists - more mailing lists