From: Ian Kent <raven@themaw.net>
To: Stef Bon <stef@bononline.nl>
Cc: autofs@linux.kernel.org
Subject: Re: How to determine a path is a mountpoint.
Date: Tue, 16 Feb 2010 11:04:17 +0800 [thread overview]
Message-ID: <4B7A0B31.30200@themaw.net> (raw)
In-Reply-To: <201002152253.46863.stef@bononline.nl>
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
next prev parent reply other threads:[~2010-02-16 3:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-15 21:53 How to determine a path is a mountpoint Stef Bon
2010-02-16 3:04 ` Ian Kent [this message]
2010-02-16 13:20 ` Stef Bon
2010-02-16 17:29 ` Ian Kent
2010-02-17 12:43 ` Stef Bon
2010-02-17 14:25 ` Ian Kent
2010-02-18 23:18 ` Stef Bon
2010-02-19 3:57 ` Ian Kent
2010-02-19 14:11 ` Stef Bon
[not found] ` <201002211428.39077.stef@bononline.nl>
2010-02-22 3:54 ` Ian Kent
2010-02-22 16:30 ` Stef Bon
2010-02-22 16:38 ` Ian Kent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B7A0B31.30200@themaw.net \
--to=raven@themaw.net \
--cc=autofs@linux.kernel.org \
--cc=stef@bononline.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.