[lkml]   [1999]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC] change of lookup() method.

On 12 Apr 1999, Magnus Ahltorp wrote:

> > Folks, right now we have ->lookup() returning 0 in case of success
> > (in which case the argument gets hashed and becomes either positive or
> > negative) or a negative integer in case of error (too long name, etc.).
> > Proposed change: make it return a pointer to struct dentry.
> > Semantics:
> > NULL - old one would return 0.
> > ERR_PTR(-foo) - old one would return foo.
> > normal pointer - we got an alias dentry; act as if you've passed
> > it to ->lookup() and it returned 0.
> > (notice that it is binary compatible with the current variant, i.e. it
> > doesn't break existing modules).
> This would be very good for Arla too, since right now, I'm doing some
> magic just to make it install the inode into the passed dentry.
> I'm not quite sure what semantics you are proposing, though. If
> real_lookup receives a normal pointer from ->lookup, what does it do
> with the passed dentry? Just dput() and use the new value?

Relevant piece of new real_lookup():

result = ERR_PTR(-ENOMEM);
if (dentry) {
result = dir->i_op->lookup(dir, dentry);
if (result)
dput(dentry); /* covers both aliases and errors */
result = dentry;

IOW: if you are returning an alias - leave the argument as is,
real_lookup() will take care of it.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:51    [W:0.051 / U:1.244 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site