xfs
[Top] [All Lists]

RE: accessing the ACL of a file inside XFS kernel.

To: Eric Chen <echen@xxxxxxxxxxx>
Subject: RE: accessing the ACL of a file inside XFS kernel.
From: Steve Lord <lord@xxxxxxx>
Date: 09 May 2003 15:54:39 -0500
Cc: Tim Shimmin <tes@xxxxxxx>, linux-xfs@xxxxxxxxxxx
In-reply-to: <NFBBIGILIDAABCBKKGMLIEPNCFAA.echen@xxxxxxxxxxx>
Organization:
References: <NFBBIGILIDAABCBKKGMLIEPNCFAA.echen@xxxxxxxxxxx>
Sender: linux-xfs-bounce@xxxxxxxxxxx
On Fri, 2003-05-09 at 13:06, Eric Chen wrote:
> >>How about using:
> >>  _ACL_GET_ACCESS(pv,pa) for the XFS access ACL
> >>(which ends up calling xfs_acl_vtoacl()).
> >>This function will get the xfs_acl given the vnode.
> >
> >what is the argument 'pa' that is passed into the function _ACL_GET_ACCESS?
> >
> >so I can have
> >
> >xfs_acl_t *acl = _ACL_GET_ACCESS(pv, pa);
> >
> >where vnode_t *pv = LINVFS_GET_VP(dir);
> >
> 
> nevermind, I think I figured out the syntax. You call _ACL_GET_ACCESS with
> pv and pa, where pv is the pointer to the vnode_t and pa is the pointer to
> the xfs_acl_t. Is this right?
> 
> so if you call _ACL_GET_ACCESS(pv, pa);
> will the acl be then stored in 'pa'? I am getting a weird result, because
> when I printk pa->acl_cnt, I always get -1.
> 
> Here's some of the code:
> 
> STATIC int
> linvfs_unlink(
>       struct inode    *dir,
>       struct dentry   *dentry)
> {
>       int                     error = 0;
>       struct inode    *inode;
>       vnode_t         *dvp;   /* directory containing name to remove */
> 
>       // I added this
>       int             i;
>       vnode_t *vp;
>       xfs_acl_t       *acl;
>       // end of I added this
> 
>       inode = dentry->d_inode;
> 
>       dvp = LINVFS_GET_VP(dir);
> 
>       // I added this
>       vp = LINVFS_GET_VP(inode);
>       _ACL_GET_ACCESS(vp, acl);
> 
>       printk("acl_cnt: %d\n", acl->acl_cnt);
>       for (i=0;i<acl->acl_cnt;i++) {
>               printk("perm[%d]: %x\n", i, acl->acl_entry[i].ae_perm);
>       }
>       // end of I added this
> 
>       ..... resume the rest of the code
> }


I think you need to allocate and free your acl memory here, the function
is putting stuff in an uninitialized pointer in the above code.

Steve

-- 

Steve Lord                                      voice: +1-651-683-3511
Principal Engineer, Filesystem Software         email: lord@xxxxxxx


<Prev in Thread] Current Thread [Next in Thread>