Re: lookup function return value in inode_operations

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

 



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@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux