Mountpoints

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
tigerfish
Posts: 12
Joined: Wed Jan 17, 2007 7:26 am

Mountpoints

Post by tigerfish »

How does one handle the .. entry for a directory that is being used as a mountpoint? For example, how does one handle
/mountpoint/.. ?
Craze Frog
Member
Member
Posts: 368
Joined: Sun Sep 23, 2007 4:52 am

Post by Craze Frog »

Code: Select all

/mountpoint/.. = /
I think.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Most (I.e. ext2) filesystems handle ".." implicitly, that is each directory has an entry called "." and one called ".." that point to the respective inodes. They shouldn't need any special handling by the OS.
xyzzy
Member
Member
Posts: 391
Joined: Wed Jul 25, 2007 8:45 am
Libera.chat IRC: aejsmith
Location: London, UK
Contact:

Post by xyzzy »

Some filesystems might not though, so I handle . and .. in the VFS layer, and ignore . and .. entries that are stored on the filesystem. This makes it easier to handle them going over mountpoints, when the kernel encounters .. in a path, it simply goes to vnode->parent, which works over filesystems.
Post Reply