tech-kern archive

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

Re: Splitting <fs>_access to two internal routines



On Wed, Jun 24, 2009 at 01:13:22AM +0300, Elad Efrat wrote:
> Following up on myself:
> 
> Elad Efrat wrote:
> 
> >Are there any objections for such restructuring? if not, I'll follow-up
> >with a diff implementing the changes for review.
> 
> I've attached a diff implementing the proposed changes for ufs_access:
>   - Functions are named ufs_check_{possible,permitted} as we're
>     returning an error code rather than a boolean answer,

These sort of diffs are difficult to read - since the 'new' code
and 'old' code that diff compares end up being different functions!

So I can't see what ufs_check_possible() actually looks like.
However the other parts end up being:

> +ufs_check_permitted(struct vnode *vp, struct inode *ip, mode_t mode,
> +    kauth_cred_t cred)
> +{
> +
> +     return genfs_can_access(vp->v_type, ip->i_mode & ALLPERMS, ip->i_uid,
> +         ip->i_gid, mode, cred);
> +}
> +
> +int
> +ufs_access(void *v)
> +{
...
> +     error = ufs_check_possible(vp, ip, mode, ap->a_cred);
> +     if (error)
> +             return error;
> +
> +     return ufs_check_permitted(vp, ip, mode, ap->a_cred);
>  }

This looks like a complete waste of cpu cycles stacking arguments
to functions.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index