lookup function return value in inode_operations
Rajat Sharma
fs.rajat at gmail.com
Mon May 27 14:28:19 EDT 2013
returning NULL means you are fairly welcoming the supplied dentry and
attach it to your inode.
returning a dentry means it is a dentry which filesystem figured out was
already associated with its inode. When can this happen? lookup process
builds up a chain from parent to child dentry. In case of NFS export,
lookup is done from file handle which can result in dentries which are
disconnected from their parent, but are associated with inode. So, when you
return such dentries from this operation, VFS will change their
disconnected status.
-Rajat
On Mon, May 27, 2013 at 11:38 PM, Sankar P <sankar.curiosity at gmail.com>wrote:
> Hi,
>
> What is the return value of the lookup function under the
> inode_operations struct ? I see that the function gets a dentry as a
> parameter, which can be used to associate an inode. For example:
>
> If we have:
>
> struct dentry * somefs_lookup(struct inode *parent_inode,
> struct dentry *child_dentry, unsigned int flags)
> {
> d_add(child_dentry, inode);
> }
>
> so, what is the meaning of the return "struct dentry" in this lookup
> function ? In some simple filesystems that I saw, they return NULL
> here and it seem to work just fine. So what is that the lookup
> function should do if we are implementing our own filesystem ?
>
> Thanks.
>
> --
> Sankar P
> http://psankar.blogspot.com
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130527/489caa33/attachment-0001.html
More information about the Kernelnewbies
mailing list