Re: dcache: d_compare prototype

Bill Hawes (whawes@star.net)
Wed, 17 Dec 1997 10:29:13 -0500


Peter J. Braam wrote:
> Coda is starting to use the dcache. During a lookup I need to know if I
> have credentials for an inode already, I need to use the d_compare
> operation.
>
> The current prototype is:
>
> int coda_d_compare(struct dentry *parent,
> struct qstr *de_name, struct qstr *name)
>
> Can we make it:
>
> int coda_d_compare(struct dentry *dentry, struct qstr *name)
>
> We can still get at the parent (dentry->d_parent) and at the name
> (dentry->d_name) and I won't have to do ugly things like
> dentry = list_entry( de_name, struct dentry *, d_name )

Hi Peter,

Perhaps your d_compare is trying to do too much? The original intent was
just to do a fs-specific name compare, and the parent dentry was passed
to allow for things like case-sensitivity on a per-directory basis.

In the present usage you shouldn't assume that one of the qstrs is
actually embedded in a dentry, as someone might just want to call the
operation to compare two non-dentry qstrs.

Could you explain a little more about what you need to do, and I may be
able to suggest an alternative. If the code is question is in your
lookup function, then the d_compare will already have been called to
determine that no dentry existed with the given name. (I.e. the fs
lookup isn't called unless we really do need a lookup.)

Regards,
Bill