[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: plans for new release,update redate 2.4.18-5



hi,

On Wed, Jul 10, 2002 at 08:13:41AM -0500, Eric Sandeen wrote:
> On Wed, 10 Jul 2002, Knut J Bjuland wrote:
> > ...
> >  Have you started to
> > feed linux with xfs patch in small bits?
> 
> Steve is in good contact with the kernel folks; in some sense this has
> already started (witness the EA/ACL code).  The bulk of XFS is not available
> in "little bits" though, and will just have to go in in a chunk.

Just to clarify - there is no ACL code in the kernel yet.  So far we
have EA VFS and system call changes in and also some quota changes.

ACL support shouldn't be too hard to get, I think; Andreas and I just
need to iterate a few more times on exactly what it is we should send.
The attached patch is my current "small is beautiful" version of VFS
POSIX ACL support and is everything we need from an XFS point of view,
but is not quite what Andreas wants, IIRC.  I'm a bit sidetracked on
capabilities code to follow up on this right now though.

cheers.

-- 
Nathan
diff -Naur 2.5.24-pristine/fs/Config.help 2.5.24-posix_acl/fs/Config.help
--- 2.5.24-pristine/fs/Config.help	Thu May 30 09:18:38 2002
+++ 2.5.24-posix_acl/fs/Config.help	Wed Jun 26 13:28:28 2002
@@ -1,3 +1,13 @@
+POSIX Access Control Lists
+CONFIG_FS_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 wish to use ACLs
+  you will also need the getfacl(1) and setfacl(1) utilities, along
+  with some additional patches from the website.  If unsure, say N.
+
 CONFIG_QUOTA
   If you say Y here, you will be able to set per user limits for disk
   usage (also called disk quotas). Currently, it works for the
diff -Naur 2.5.24-pristine/fs/Config.in 2.5.24-posix_acl/fs/Config.in
--- 2.5.24-pristine/fs/Config.in	Fri Jun 21 10:00:47 2002
+++ 2.5.24-posix_acl/fs/Config.in	Wed Jun 26 13:22:58 2002
@@ -4,6 +4,8 @@
 mainmenu_option next_comment
 comment 'File systems'
 
+bool 'POSIX Access Control Lists' CONFIG_FS_POSIX_ACL
+
 bool 'Quota support' CONFIG_QUOTA
 dep_tristate '  Old quota format support' CONFIG_QFMT_V1 $CONFIG_QUOTA
 dep_tristate '  VFS v0 quota format support' CONFIG_QFMT_V2 $CONFIG_QUOTA
diff -Naur 2.5.24-pristine/fs/namei.c 2.5.24-posix_acl/fs/namei.c
--- 2.5.24-pristine/fs/namei.c	Wed Jun 19 13:55:28 2002
+++ 2.5.24-posix_acl/fs/namei.c	Wed Jun 26 13:22:58 2002
@@ -1251,6 +1251,8 @@
 
 	/* Negative dentry, just create the file */
 	if (!dentry->d_inode) {
+		if (!IS_POSIXACL(dir->d_inode))
+			mode &= ~current->fs->umask;
 		error = vfs_create(dir->d_inode, dentry,
 				   mode & ~current->fs->umask);
 		up(&dir->d_inode->i_sem);
@@ -1405,7 +1407,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:
@@ -1465,8 +1468,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);
diff -Naur 2.5.24-pristine/include/linux/fs.h 2.5.24-posix_acl/include/linux/fs.h
--- 2.5.24-pristine/include/linux/fs.h	Wed Jun 19 13:55:31 2002
+++ 2.5.24-posix_acl/include/linux/fs.h	Wed Jun 26 13:24:21 2002
@@ -134,6 +134,7 @@
 #define S_DEAD		32	/* removed, but still open directory */
 #define S_NOQUOTA	64	/* Inode is not counted to quota */
 #define S_DIRSYNC	128	/* Directory modifications are synchronous */
+#define S_POSIXACL	256	/* Defer application of the umask */
 
 /*
  * Note that nosuid etc flags are inode-specific: setting some file-system
@@ -165,6 +166,7 @@
 #define IS_NODIRATIME(inode)	__IS_FLG(inode, MS_NODIRATIME)
 
 #define IS_DEADDIR(inode)	((inode)->i_flags & S_DEAD)
+#define IS_POSIXACL(inode)	((inode)->i_flags & S_POSIXACL)
 
 /* the read-only stuff doesn't really belong here, but any other place is
    probably as bad and I don't want to create yet another include file. */
diff -Naur 2.5.24-pristine/include/linux/posix_acl_xattr.h 2.5.24-posix_acl/include/linux/posix_acl_xattr.h
--- 2.5.24-pristine/include/linux/posix_acl_xattr.h	Thu Jan  1 10:00:00 1970
+++ 2.5.24-posix_acl/include/linux/posix_acl_xattr.h	Wed Jun 26 13:22:58 2002
@@ -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>
+ */
+#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 */