[BACK]Return to acl-backport CVS log [TXT][DIR] Up to [Development] / linux-2.4-xfs / split-patches

File: [Development] / linux-2.4-xfs / split-patches / acl-backport (download)

Revision 1.6, Wed Dec 21 14:32:30 2005 UTC (11 years, 9 months ago) by nathans.longdrop.melbourne.sgi.com
Branch: MAIN
Changes since 1.5: +8 -8 lines

Merge up to 2.4.32.
Merge of 2.4.x-xfs-melb:linux:24898a by kenmcd.

%patch
Index: 2.4.x-xfs/Documentation/Configure.help
===================================================================
--- 2.4.x-xfs.orig/Documentation/Configure.help	2005-12-20 14:53:43.699654469 +1100
+++ 2.4.x-xfs/Documentation/Configure.help	2005-12-20 14:55:06.602224176 +1100
@@ -17621,6 +17621,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 <http://acl.bestbits.at/>.
+
+  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	2005-12-20 14:55:06.604177031 +1100
@@ -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	2005-04-13 11:44:38.000000000 +1000
+++ 2.4.x-xfs/fs/namei.c	2005-12-20 14:55:06.605153458 +1100
@@ -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	2005-12-20 14:55:06.606129885 +1100
@@ -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	2005-05-25 01:08:16.000000000 +1000
+++ 2.4.x-xfs/include/linux/posix_acl_xattr.h	2005-12-20 14:55:06.615894156 +1100
@@ -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 <a.gruenbacher@computer.org>
+  Copyright (C) 2002 SGI - Silicon Graphics, Inc <linux-xfs@oss.sgi.com>
+ */
+#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(-)