| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2005-11-02 14:58:39 +11:00
										 |  |  |  * Copyright (c) 2001-2005 Silicon Graphics, Inc. | 
					
						
							|  |  |  |  * All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2005-11-02 14:58:39 +11:00
										 |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Public License as | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  * published by the Free Software Foundation. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2005-11-02 14:58:39 +11:00
										 |  |  |  * This program is distributed in the hope that it would be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2005-11-02 14:58:39 +11:00
										 |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write the Free Software Foundation, | 
					
						
							|  |  |  |  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  */ | 
					
						
							|  |  |  | #ifndef __XFS_ACL_H__
 | 
					
						
							|  |  |  | #define __XFS_ACL_H__
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-10 17:07:47 +02:00
										 |  |  | struct inode; | 
					
						
							|  |  |  | struct posix_acl; | 
					
						
							|  |  |  | struct xfs_inode; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define XFS_ACL_NOT_PRESENT (-1)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-10 17:07:47 +02:00
										 |  |  | /* On-disk XFS access control list structure */ | 
					
						
							| 
									
										
										
										
											2013-06-05 12:09:10 +10:00
										 |  |  | struct xfs_acl_entry { | 
					
						
							|  |  |  | 	__be32	ae_tag; | 
					
						
							|  |  |  | 	__be32	ae_id; | 
					
						
							|  |  |  | 	__be16	ae_perm; | 
					
						
							|  |  |  | 	__be16	ae_pad;		/* fill the implicit hole in the structure */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-10 17:07:47 +02:00
										 |  |  | struct xfs_acl { | 
					
						
							| 
									
										
										
										
											2013-06-05 12:09:10 +10:00
										 |  |  | 	__be32			acl_cnt; | 
					
						
							|  |  |  | 	struct xfs_acl_entry	acl_entry[0]; | 
					
						
							| 
									
										
										
										
											2009-06-10 17:07:47 +02:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-05 12:09:10 +10:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * The number of ACL entries allowed is defined by the on-disk format. | 
					
						
							|  |  |  |  * For v4 superblocks, that is limited to 25 entries. For v5 superblocks, it is | 
					
						
							|  |  |  |  * limited only by the maximum size of the xattr that stores the information. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #define XFS_ACL_MAX_ENTRIES(mp)	\
 | 
					
						
							|  |  |  | 	(xfs_sb_version_hascrc(&mp->m_sb) \ | 
					
						
							|  |  |  | 		?  (XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \ | 
					
						
							|  |  |  | 						sizeof(struct xfs_acl_entry) \ | 
					
						
							|  |  |  | 		: 25) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define XFS_ACL_MAX_SIZE(mp) \
 | 
					
						
							|  |  |  | 	(sizeof(struct xfs_acl) + \ | 
					
						
							|  |  |  | 		sizeof(struct xfs_acl_entry) * XFS_ACL_MAX_ENTRIES((mp))) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /* On-disk XFS extended attribute names */ | 
					
						
							| 
									
										
										
										
											2010-01-20 10:47:48 +11:00
										 |  |  | #define SGI_ACL_FILE		(unsigned char *)"SGI_ACL_FILE"
 | 
					
						
							|  |  |  | #define SGI_ACL_DEFAULT		(unsigned char *)"SGI_ACL_DEFAULT"
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #define SGI_ACL_FILE_SIZE	(sizeof(SGI_ACL_FILE)-1)
 | 
					
						
							|  |  |  | #define SGI_ACL_DEFAULT_SIZE	(sizeof(SGI_ACL_DEFAULT)-1)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_XFS_POSIX_ACL
 | 
					
						
							| 
									
										
										
										
											2009-06-10 17:07:47 +02:00
										 |  |  | extern struct posix_acl *xfs_get_acl(struct inode *inode, int type); | 
					
						
							| 
									
										
										
										
											2013-12-20 05:16:50 -08:00
										 |  |  | extern int xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type); | 
					
						
							| 
									
										
										
										
											2009-06-10 17:07:47 +02:00
										 |  |  | extern int posix_acl_access_exists(struct inode *inode); | 
					
						
							|  |  |  | extern int posix_acl_default_exists(struct inode *inode); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2011-07-26 11:15:20 +02:00
										 |  |  | static inline struct posix_acl *xfs_get_acl(struct inode *inode, int type) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return NULL; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2013-12-20 05:16:50 -08:00
										 |  |  | # define xfs_set_acl					NULL
 | 
					
						
							| 
									
										
										
										
											2009-06-10 17:07:47 +02:00
										 |  |  | # define posix_acl_access_exists(inode)			0
 | 
					
						
							|  |  |  | # define posix_acl_default_exists(inode)		0
 | 
					
						
							|  |  |  | #endif /* CONFIG_XFS_POSIX_ACL */
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif	/* __XFS_ACL_H__ */
 |