From the stat(2)
man page on Linux:
The
st_dev
field describes the device on which this file resides. (Themajor(3)
andminor(3)
macros may be useful to decompose the device ID in this field.)
So what the code in question is doing is invoking the stat
system call on the directory and its parent and checking whether they reside on different devices. This can only be true if they are on different file systems, which would indicate that the directory in question is a mount point.