Skip to content

Commit feda821

Browse files
Christoph HellwigAl Viro
authored andcommitted
fs: remove generic_acl
And instead convert tmpfs to use the new generic ACL code, with two stub methods provided for in-memory filesystems. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 013cdf1 commit feda821

File tree

7 files changed

+69
-238
lines changed

7 files changed

+69
-238
lines changed

fs/Kconfig

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ source "fs/quota/Kconfig"
6868
source "fs/autofs4/Kconfig"
6969
source "fs/fuse/Kconfig"
7070

71-
config GENERIC_ACL
72-
bool
73-
select FS_POSIX_ACL
74-
7571
menu "Caches"
7672

7773
source "fs/fscache/Kconfig"
@@ -119,7 +115,7 @@ config TMPFS_POSIX_ACL
119115
bool "Tmpfs POSIX Access Control Lists"
120116
depends on TMPFS
121117
select TMPFS_XATTR
122-
select GENERIC_ACL
118+
select FS_POSIX_ACL
123119
help
124120
POSIX Access Control Lists (ACLs) support additional access rights
125121
for users and groups beyond the standard owner/group/world scheme,

fs/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ obj-$(CONFIG_BINFMT_FLAT) += binfmt_flat.o
4444
obj-$(CONFIG_FS_MBCACHE) += mbcache.o
4545
obj-$(CONFIG_FS_POSIX_ACL) += posix_acl.o
4646
obj-$(CONFIG_NFS_COMMON) += nfs_common/
47-
obj-$(CONFIG_GENERIC_ACL) += generic_acl.o
4847
obj-$(CONFIG_COREDUMP) += coredump.o
4948
obj-$(CONFIG_SYSCTL) += drop_caches.o
5049

fs/generic_acl.c

Lines changed: 0 additions & 184 deletions
This file was deleted.

fs/posix_acl.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,3 +786,39 @@ const struct xattr_handler posix_acl_default_xattr_handler = {
786786
.set = posix_acl_xattr_set,
787787
};
788788
EXPORT_SYMBOL_GPL(posix_acl_default_xattr_handler);
789+
790+
int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type)
791+
{
792+
int error;
793+
794+
if (type == ACL_TYPE_ACCESS) {
795+
error = posix_acl_equiv_mode(acl, &inode->i_mode);
796+
if (error < 0)
797+
return 0;
798+
if (error == 0)
799+
acl = NULL;
800+
}
801+
802+
inode->i_ctime = CURRENT_TIME;
803+
set_cached_acl(inode, type, acl);
804+
return 0;
805+
}
806+
807+
int simple_acl_create(struct inode *dir, struct inode *inode)
808+
{
809+
struct posix_acl *default_acl, *acl;
810+
int error;
811+
812+
error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl);
813+
if (error)
814+
return error;
815+
816+
set_cached_acl(inode, ACL_TYPE_DEFAULT, default_acl);
817+
set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
818+
819+
if (default_acl)
820+
posix_acl_release(default_acl);
821+
if (acl)
822+
posix_acl_release(acl);
823+
return 0;
824+
}

include/linux/generic_acl.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

include/linux/posix_acl.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ extern int posix_acl_chmod(struct inode *, umode_t);
9999
extern int posix_acl_create(struct inode *, umode_t *, struct posix_acl **,
100100
struct posix_acl **);
101101

102+
extern int simple_set_acl(struct inode *, struct posix_acl *, int);
103+
extern int simple_acl_create(struct inode *, struct inode *);
104+
102105
static inline struct posix_acl **acl_by_type(struct inode *inode, int type)
103106
{
104107
switch (type) {
@@ -181,6 +184,12 @@ static inline int posix_acl_chmod(struct inode *inode, umode_t mode)
181184
return 0;
182185
}
183186

187+
#define simple_set_acl NULL
188+
189+
static inline int simple_acl_create(struct inode *dir, struct inode *inode)
190+
{
191+
return 0;
192+
}
184193
static inline void cache_no_acl(struct inode *inode)
185194
{
186195
}

0 commit comments

Comments
 (0)