On 02/16/2010 05:53 AM, Stef Bon wrote:
> Hello,
> 
> I'm working on a construction of the automounter in combination with a fuse 
> module.
> The automounter is the mounthelper.
> I'm looking for a way to determine in C a directory is a mountpoint, specially
> a autofs managed directory, so a virtual directory created by the automounter.
> 
> I can parse the /etc/mtab file or /proc/mounts, like in bash:
> 
> cat /proc/mounts | grep --word-regexp "$mountpoint"
> 
> but this is slow.. I have looked to the code of the program mountpoint,
> but this is not possible in an autofs maneged directory. This program
> does a cd to the directory and checks the filesystem changes. With autofs 
> this 
> makes the mountpoint always mounted, which is of course not what I'm looking 
> for.

Yes, checking /proc/mounts is slow but is the only way when using older
versions of the kernel module.

In a recent source tree, have a look at lib/mounts.c:is_mounted() and
lib/dev-ioctl-lib.c, and in particular dev_ioctl_ismountpoint().

Ian

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

Reply via email to