Re: dentry equivalent in NetBSD
Jason Thorpe <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.kernel |
|---|---|
| Message-ID | <[email protected]> |
> On Jan 14, 2025, at 4:24 AM, tzsz <[email protected]> wrote: > > Hello everyone, > > I am currently wiring some code for university. In class we are working with Linux and are modifying the struct dentry. It is used for caching the relation between paths and inodes - after an resolution attempt that is. I was wondering how/if this is also implemented in NetBSD but I was not able to spot it in the source code. > > Could someone perhaps point me where to look? It works a bit differently in NetBSD (and in BSD systems in general). In the NetBSD kernel, you can find the code that manages the cache of parent+name -> vnode mappings here: https://github.com/NetBSD/src/blob/trunk/sys/kern/vfs_cache.c In addition to being used to speed up path lookups, it can also be used to reconstruct the (a) path for a vnode. Some examples of how that’s used: https://github.com/NetBSD/src/blob/trunk/sys/kern/vfs_getcwd.c In particular, vnode_to_path(), which is used in the exec code, but also the __getcwd() system call. -- thorpej