%patch Index: 2.4.x-xfs/Documentation/Configure.help =================================================================== --- 2.4.x-xfs.orig/Documentation/Configure.help 2006-08-15 16:57:24.170685826 +1000 +++ 2.4.x-xfs/Documentation/Configure.help 2006-08-15 16:59:55.151199985 +1000 @@ -17639,6 +17639,16 @@ If unsure, say N. +POSIX ACL support +CONFIG_XFS_POSIX_ACL + POSIX Access Control Lists (ACLs) support permissions for users and + groups beyond the owner/group/world scheme. + + To learn more about Access Control Lists, visit the POSIX ACLs for + Linux website . + + If you don't know what Access Control Lists are, say N. + Tracing support (EXPERIMENTAL) CONFIG_XFS_TRACE Say Y here to get an XFS build with activity tracing enabled. Index: 2.4.x-xfs/fs/Config.in =================================================================== --- 2.4.x-xfs.orig/fs/Config.in 2004-11-22 12:29:08.000000000 +1100 +++ 2.4.x-xfs/fs/Config.in 2006-08-15 16:59:55.151199985 +1000 @@ -102,6 +102,7 @@ dep_mbool ' UFS file system write support (DANGEROUS)' CONFIG_UFS_FS_WRITE $CONFIG_UFS_FS $CONFIG_EXPERIMENTAL tristate 'XFS filesystem support' CONFIG_XFS_FS +dep_mbool ' POSIX ACL support' CONFIG_XFS_POSIX_ACL $CONFIG_XFS_FS dep_mbool ' Quota support' CONFIG_XFS_QUOTA $CONFIG_XFS_FS dep_mbool ' Realtime support (EXPERIMENTAL)' CONFIG_XFS_RT $CONFIG_XFS_FS $CONFIG_EXPERIMENTAL dep_mbool ' Tracing support (EXPERIMENTAL)' CONFIG_XFS_TRACE $CONFIG_XFS_FS $CONFIG_EXPERIMENTAL Index: 2.4.x-xfs/fs/namei.c =================================================================== --- 2.4.x-xfs.orig/fs/namei.c 2006-08-15 16:50:47.442098611 +1000 +++ 2.4.x-xfs/fs/namei.c 2006-08-15 16:59:55.155199470 +1000 @@ -1053,8 +1053,9 @@ /* Negative dentry, just create the file */ if (!dentry->d_inode) { - error = vfs_create(dir->d_inode, dentry, - mode & ~current->fs->umask); + if (!IS_POSIXACL(dir->d_inode)) + mode &= ~current->fs->umask; + error = vfs_create(dir->d_inode, dentry, mode); up(&dir->d_inode->i_sem); dput(nd->dentry); nd->dentry = dentry; @@ -1287,7 +1288,8 @@ dentry = lookup_create(&nd, 0); error = PTR_ERR(dentry); - mode &= ~current->fs->umask; + if (!IS_POSIXACL(nd.dentry->d_inode)) + mode &= ~current->fs->umask; if (!IS_ERR(dentry)) { switch (mode & S_IFMT) { case 0: case S_IFREG: @@ -1355,8 +1357,9 @@ dentry = lookup_create(&nd, 1); error = PTR_ERR(dentry); if (!IS_ERR(dentry)) { - error = vfs_mkdir(nd.dentry->d_inode, dentry, - mode & ~current->fs->umask); + if (!IS_POSIXACL(nd.dentry->d_inode)) + mode &= ~current->fs->umask; + error = vfs_mkdir(nd.dentry->d_inode, dentry, mode); dput(dentry); } up(&nd.dentry->d_inode->i_sem); Index: 2.4.x-xfs/include/linux/fs.h =================================================================== --- 2.4.x-xfs.orig/include/linux/fs.h 2005-04-13 11:44:38.000000000 +1000 +++ 2.4.x-xfs/include/linux/fs.h 2006-08-15 16:59:55.155199470 +1000 @@ -111,6 +111,7 @@ #define MS_MOVE 8192 #define MS_REC 16384 #define MS_VERBOSE 32768 +#define MS_POSIXACL 65536 /* VFS does not apply the umask */ #define MS_ACTIVE (1<<30) #define MS_NOUSER (1<<31) @@ -161,6 +162,7 @@ #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) #define IS_NOATIME(inode) (__IS_FLG(inode, MS_NOATIME) || ((inode)->i_flags & S_NOATIME)) #define IS_NODIRATIME(inode) __IS_FLG(inode, MS_NODIRATIME) +#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) Index: 2.4.x-xfs/include/linux/posix_acl_xattr.h =================================================================== --- 2.4.x-xfs.orig/include/linux/posix_acl_xattr.h 2006-06-17 00:58:24.000000000 +1000 +++ 2.4.x-xfs/include/linux/posix_acl_xattr.h 2006-08-15 16:59:55.155199470 +1000 @@ -0,0 +1,67 @@ +/* + File: linux/posix_acl_xattr.h + + Extended attribute system call representation of Access Control Lists. + + Copyright (C) 2000 by Andreas Gruenbacher + Copyright (C) 2002 SGI - Silicon Graphics, Inc + */ +#ifndef _POSIX_ACL_XATTR_H +#define _POSIX_ACL_XATTR_H + +/* Extended attribute names */ +#define POSIX_ACL_XATTR_ACCESS "system.posix_acl_access" +#define POSIX_ACL_XATTR_DEFAULT "system.posix_acl_default" + +/* Supported ACL a_version fields */ +#define POSIX_ACL_XATTR_VERSION 0x0002 + + +/* An undefined entry e_id value */ +#define ACL_UNDEFINED_ID (-1) + +/* ACL entry e_tag field values */ +#define ACL_USER_OBJ (0x01) +#define ACL_USER (0x02) +#define ACL_GROUP_OBJ (0x04) +#define ACL_GROUP (0x08) +#define ACL_MASK (0x10) +#define ACL_OTHER (0x20) + +/* ACL entry e_perm bitfield values */ +#define ACL_READ (0x04) +#define ACL_WRITE (0x02) +#define ACL_EXECUTE (0x01) + + +typedef struct { + __u16 e_tag; + __u16 e_perm; + __u32 e_id; +} posix_acl_xattr_entry; + +typedef struct { + __u32 a_version; + posix_acl_xattr_entry a_entries[0]; +} posix_acl_xattr_header; + + +static inline size_t +posix_acl_xattr_size(int count) +{ + return (sizeof(posix_acl_xattr_header) + + (count * sizeof(posix_acl_xattr_entry))); +} + +static inline int +posix_acl_xattr_count(size_t size) +{ + if (size < sizeof(posix_acl_xattr_header)) + return -1; + size -= sizeof(posix_acl_xattr_header); + if (size % sizeof(posix_acl_xattr_entry)) + return -1; + return size / sizeof(posix_acl_xattr_entry); +} + +#endif /* _POSIX_ACL_XATTR_H */ %diffstat Documentation/Configure.help | 10 +++++ fs/Config.in | 1 fs/namei.c | 13 ++++--- include/linux/fs.h | 2 + include/linux/posix_acl_xattr.h | 67 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 88 insertions(+), 5 deletions(-)