mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 21:24:08 +08:00
079da62938
The current way of setting and getting posix acls through the generic xattr interface is error prone and type unsafe. The vfs needs to interpret and fixup posix acls before storing or reporting it to userspace. Various hacks exist to make this work. The code is hard to understand and difficult to maintain in it's current form. Instead of making this work by hacking posix acls through xattr handlers we are building a dedicated posix acl api around the get and set inode operations. This removes a lot of hackiness and makes the codepaths easier to maintain. A lot of background can be found in [1]. In order to build a type safe posix api around get and set acl we need all filesystem to implement get and set acl. So far 9p implemented a ->get_inode_acl() operation that didn't require access to the dentry in order to allow (limited) permission checking via posix acls in the vfs. Now that we have get and set acl inode operations that take a dentry argument we can give 9p get and set acl inode operations. This is mostly a light refactoring of the codepaths currently used in 9p posix acl xattr handler. After we have fully implemented the posix acl api and switched the vfs over to it, the 9p specific posix acl xattr handler and associated code will be removed. Note, until the vfs has been switched to the new posix acl api this patch is a non-functional change. Link: https://lore.kernel.org/all/20220801145520.1532837-1-brauner@kernel.org [1] Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
55 lines
1.6 KiB
C
55 lines
1.6 KiB
C
/* SPDX-License-Identifier: LGPL-2.1 */
|
|
/*
|
|
* Copyright IBM Corporation, 2010
|
|
* Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
|
|
*/
|
|
#ifndef FS_9P_ACL_H
|
|
#define FS_9P_ACL_H
|
|
|
|
#ifdef CONFIG_9P_FS_POSIX_ACL
|
|
int v9fs_get_acl(struct inode *inode, struct p9_fid *fid);
|
|
struct posix_acl *v9fs_iop_get_inode_acl(struct inode *inode, int type,
|
|
bool rcu);
|
|
struct posix_acl *v9fs_iop_get_acl(struct user_namespace *mnt_userns,
|
|
struct dentry *dentry, int type);
|
|
int v9fs_iop_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
|
|
struct posix_acl *acl, int type);
|
|
int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid);
|
|
int v9fs_set_create_acl(struct inode *inode, struct p9_fid *fid,
|
|
struct posix_acl *dacl, struct posix_acl *acl);
|
|
int v9fs_acl_mode(struct inode *dir, umode_t *modep,
|
|
struct posix_acl **dpacl, struct posix_acl **pacl);
|
|
void v9fs_put_acl(struct posix_acl *dacl, struct posix_acl *acl);
|
|
#else
|
|
#define v9fs_iop_get_inode_acl NULL
|
|
#define v9fs_iop_get_acl NULL
|
|
#define v9fs_iop_set_acl NULL
|
|
static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline int v9fs_set_create_acl(struct inode *inode,
|
|
struct p9_fid *fid,
|
|
struct posix_acl *dacl,
|
|
struct posix_acl *acl)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline void v9fs_put_acl(struct posix_acl *dacl,
|
|
struct posix_acl *acl)
|
|
{
|
|
}
|
|
static inline int v9fs_acl_mode(struct inode *dir, umode_t *modep,
|
|
struct posix_acl **dpacl,
|
|
struct posix_acl **pacl)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
#endif
|
|
#endif /* FS_9P_XATTR_H */
|