linux/fs/xattr_acl.c
<<
>>
Prefs
   1/*
   2 * linux/fs/xattr_acl.c
   3 *
   4 * Almost all from linux/fs/ext2/acl.c:
   5 * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
   6 */
   7
   8#include <linux/export.h>
   9#include <linux/fs.h>
  10#include <linux/posix_acl_xattr.h>
  11#include <linux/gfp.h>
  12
  13
  14/*
  15 * Convert from extended attribute to in-memory representation.
  16 */
  17struct posix_acl *
  18posix_acl_from_xattr(const void *value, size_t size)
  19{
  20        posix_acl_xattr_header *header = (posix_acl_xattr_header *)value;
  21        posix_acl_xattr_entry *entry = (posix_acl_xattr_entry *)(header+1), *end;
  22        int count;
  23        struct posix_acl *acl;
  24        struct posix_acl_entry *acl_e;
  25
  26        if (!value)
  27                return NULL;
  28        if (size < sizeof(posix_acl_xattr_header))
  29                 return ERR_PTR(-EINVAL);
  30        if (header->a_version != cpu_to_le32(POSIX_ACL_XATTR_VERSION))
  31                return ERR_PTR(-EOPNOTSUPP);
  32
  33        count = posix_acl_xattr_count(size);
  34        if (count < 0)
  35                return ERR_PTR(-EINVAL);
  36        if (count == 0)
  37                return NULL;
  38        
  39        acl = posix_acl_alloc(count, GFP_NOFS);
  40        if (!acl)
  41                return ERR_PTR(-ENOMEM);
  42        acl_e = acl->a_entries;
  43        
  44        for (end = entry + count; entry != end; acl_e++, entry++) {
  45                acl_e->e_tag  = le16_to_cpu(entry->e_tag);
  46                acl_e->e_perm = le16_to_cpu(entry->e_perm);
  47
  48                switch(acl_e->e_tag) {
  49                        case ACL_USER_OBJ:
  50                        case ACL_OUP_OBJ" :

  v2.6.27.18
 Blass="sref">ACL_OUP_OBJlassa href="fs/xattr_acl.c#L51" id="L42" cla5s="line" name="L42">  45 52_acl.c#6.17
  v2.6.27.18
 BOTHEs="sref">ERR_PTR>
 BOTHEsa href="fs/xattr_acl.c#L51" id="L43" cla5s="line" name="L43">  45 53_acl.c#6.17








="+code=acl_e" class="sref">acl_e->end;lisACL_USER_OBJNDEFINED_IDa href="fs/xattr_acl.c#L43" id=5L44" cla5s="line" name="L44">  45 54_acl.c#6.17








breakef="fs/xattr_acl.c#L43" id=5L5" classs="line" name="L5">   5< 5a href="fs/xattr_acl.c#L26" id=5L46" cla5s="line" name="L46">  45 5              
  v2.6.27.18
 BJACL_USER_OBJ  45
5              return 7" 	  >
  v2.6.27.18
 B" ACL_OUP_OBJ"   45 5              switch(7" 	  >








="+code=acl_e" class="sref">acl_e->end;lisle16_to_centry->end;lis  45 5                      case   56 60 href="fs/xattr_acl.c#L26" id=6L
  v2.6616.17
defaultef="fs/xattr_acl.c#L51" id=6L42" cla6s="line" name="L42">  46 62_acl.c#6.17








gotof="+code=le16_tofais="sref">aclfaisa href="fs/xattr_acl.c#L43" id=6L43" cla6s="line" name="L43">  46 63_acl.c#6.17  46 64_acl.c#6.17<}f="fs/xattr_acl.c#L43" id=6L5" clas6s="line" name="L5">   56 6             acl;
   6< 66 href="fs/xattr_acl.c#L26" id=6L47" cla6s="line" name="L47">  46
6     ="+code=le16_tofais="sref">aclfaisa href="fs/xattr_acl.c#L51" id=6L48" cla6s="line" name="L48">  46 6             ="+code=posix_acl_alloc" rele v2="sref">posix_acl_allocacl)
  46 69            ERR_PTR(-EINVAL);
  57 70 hre}f="fs/xattr_acl.c#L43" id=7L
  v2.6716.17EINVALposix_acl_from_xattr(const ref="fs/xattr_acl.c#L36" id=7L42" cla7s="line" name="L42">  47 7a href="fs/xattr_acl.c#L33" id=7L43" cla7s="line" name="L43">  47 7pan class="comment"> *
  47 7pan class="comment"> * Almost  from extendery represetofd attribute to in-mntation.
   57 7pan class="comment"> * Conver>
   67 76 hreintf="fs/xattr_acl.c#L7" id="LL7" classs="line" name="L7">   7<
7     ="+code=le16_tocl_from_xa clclass="sref">posix_acl_from_xa clclassa hreoid *<posix_acl *acl;
headersize_t size)
  47 7     ef="fs/xattr_acl.c#L49" id=7L49" cla7s="line" name="L49">  47 7      posix_acl_xattr_header *posix_ad alassposix_acl_xattr_header *)header  58 8      posix_acl_xattr_entry *entryposix_ad alassa_entries;
sizea_versina href="fs/xattr_acl.c#L43" id=8L42" cla8s="line" name="L42">  48 8a href="fs/xattr_acl.c#L33" id=8L43" cla8s="line" name="L43">  48 8      sizesizeacl)
count(  48 8      if (header   58 8              return size   68 8      if (sizesize)
   78
8              return ERR_PTR   8< 8      
  48 8      posix_ad alassa_version != cpu_to_le32(POSIX_ACL_XATTR_VERSION))
  59 90 href="fs/xattr_acl.c#L26" id=9L
  v2.6916.17a_versina hr=0ff="+code=size" cs="sref">a_versina hr)
acl)
count(a_versina hrhref="+code=entry" c alclass="sref">entry  49 92_acl.c#6.17entrye_tag  = (span cf="+code=entry" ass="sref">acl)
a_entries;
a_versina hr].="+code=e_tag" class="sref">e_tag);
  49 93_acl.c#6.17entrye_perm = (span cf="+code=entry" ass="sref">acl)
a_entries;
a_versina hr].="+code=e_tag" cllass="sref">e_perm);
  49 94_acl.c#6.17entryend;liscpu_to_le32(acl)
a_entries;
a_versina hr].="+code=e_tag" clis="sref">end;lis   59 9             }f="fs/xattr_acl.c#L43" id=9L6" clas9s="line" name="L6">   69 9      if (size   79
97 hre}f="fs/xattr_acl.c#L43" id=9L8" clas9s="line" name="L8">   89 9 href="+code=posix_aEXPORT_SYMBOs="sref">EINVALposix_acl_from_xa clclassa hrref="fs/xattr_acl.c#L47" id=9L9" classs="line" name="L9">   9< 9     
The original LXR softwarereasth2.6.27.18LXR "> *unitya href> ex>);i* Coal !=reas6.27.18lxs@fp.h<.noa hr.
lxs.fp.h<.no kindly hostedreas6.27.18Redpill Lp.pro ASa hrefprovider of Lp.ux oid ulting and o>);/spans services since 1995.