I used to do some oo programming. now I am reading linux kernel code in C. I found :
struct super_block {
...
...
unsigned long s_flags; /* mount flags */
unsigned long s_magic; /* filesystem's magic number */
struct dentry *s_root; /* directory mount point */
struct rw_semaphore s_umount; /* unmount semaphore */
...
...
}
struct dentry {
...
...
struct dentry_operations *d_op; /* dentry operations table */
struct super_block *d_sb; /* superblock of file */
unsigned int d_flags; /* dentry flags */
int d_mounted; /* is this a mount point? */
void *d_fsdata; /* filesystem-specific data */
...
...
};
we can see the super_block struct has a struct dentry attribute and struct dentry has a super_block attribute. does it cause circular dependency? thanks a lot
if yes, how does the memory manage work? for example, if a dentry object was deleted, the super_block would point to a invalid location. I meant how to manage their life cycle.