(root)/
acl-2.3.1/
include/
acl_ea.h
       1  /*
       2    File: acl_ea.h
       3  
       4    (extended attribute representation of access control lists)
       5  
       6    Copyright (C) 2002  Andreas Gruenbacher, <agruen@suse.de>
       7  
       8    This program is free software: you can redistribute it and/or modify it
       9    under the terms of the GNU Lesser General Public License as published by
      10    the Free Software Foundation, either version 2.1 of the License, or
      11    (at your option) any later version.
      12  
      13    This program is distributed in the hope that it will be useful,
      14    but WITHOUT ANY WARRANTY; without even the implied warranty of
      15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16    GNU Lesser General Public License for more details.
      17  
      18    You should have received a copy of the GNU Lesser General Public License
      19    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      20  */
      21  
      22  #define ACL_EA_ACCESS		"system.posix_acl_access"
      23  #define ACL_EA_DEFAULT		"system.posix_acl_default"
      24  
      25  #define ACL_EA_VERSION		0x0002
      26  
      27  typedef struct {
      28  	u_int16_t	e_tag;
      29  	u_int16_t	e_perm;
      30  	u_int32_t	e_id;
      31  } acl_ea_entry;
      32  
      33  typedef struct {
      34  	u_int32_t	a_version;
      35  	acl_ea_entry	a_entries[0];
      36  } acl_ea_header;
      37  
      38  static inline size_t acl_ea_size(int count)
      39  {
      40  	return sizeof(acl_ea_header) + count * sizeof(acl_ea_entry);
      41  }
      42  
      43  static inline int acl_ea_count(size_t size)
      44  {
      45  	if (size < sizeof(acl_ea_header))
      46  		return -1;
      47  	size -= sizeof(acl_ea_header);
      48  	if (size % sizeof(acl_ea_entry))
      49  		return -1;
      50  	return size / sizeof(acl_ea_entry);
      51  }
      52