0

So, I can mount sysfs (the virtual filesystem for /sys) for example at multiple places, and I'll see the same contents each time. Similarly, I can mount the same block device (like /dev/sda1) at multiple mount points.

I'm writing a VFS for my kernel at the moment, and I'm struggling with the specifics of how mount-point dentries are attached to parts of the filesystem.

So my question is: Are the dentry structs used to represent a (for example) sysfs filesystem at (for example) /mnt the same structs used if I mount sysfs again at /mnt2? Or, alternatively, are these structs different?

If they are different, are the inodes shared?

SecretAgentMan
  • 2,856
  • 7
  • 21
  • 41
Keeley Hoek
  • 543
  • 4
  • 18

1 Answers1

0

The dentries are shared. Each filesystem root dentry is stored in the corresponding superblock struct, and these structs are linked to mountpoint dentries using vfsmount structs.

Have a look a fs/super.c for the details.

Keeley Hoek
  • 543
  • 4
  • 18