Re: About mounting the sysfs

From: Jan Engelhardt
Date: Tue Dec 18 2007 - 07:39:40 EST



On Dec 18 2007 15:10, wit wrote:
>
>1. What is the d_alloc_root used for? Actually, the question should
>be: why we have to call d_alloc_root.

>I think the root already has its dentry,

It does not.

>why we have to allocate another while we mounting a file
>system?
>
>2. Why we call d_alloc_root to allocate a dentry for the mount point
>while the usual mount point of sysfs is defined by the user (something
>like /sysfs but not /).

/sys is a dentry that belongs to the / vfsmount, but we need a
/ that belongs to the <whatever you are going to mount> vfsmount.

> See below:
> root = d_alloc_root(inode);
> if (!root) {
> pr_debug("%s: could not get root dentry!\n",__FUNCTION__);
> iput(inode);
> return -ENOMEM;
> }
> root->d_fsdata = &sysfs_root;
> sb->s_root = root;
>
>does this means settting the sysfs' mount point to "/" but not "/sysfs".
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/