All of lore.kernel.org
 help / color / mirror / Atom feed
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: Wed, 17 Feb 2010 01:29:00 +0800	[thread overview]
Message-ID: <4B7AD5DC.3010307@themaw.net> (raw)
In-Reply-To: <201002161420.44885.stef@bononline.nl>

On 02/16/2010 09:20 PM, Stef Bon wrote:
> On Tuesday 16 February 2010 04:04:17 Ian Kent wrote:
>> On 02/16/2010 05:53 AM, Stef Bon wrote:
>>> Hello,
>>>
> 
>>
>> 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
> 
> Thanks for you fast answer.
> 
> I've checked the code and found the functions you're pointed, they are indeed 
> what I'm looking for.
> 
> The function is_mounted looks like an internal function. It makes use of a 
> struct ioctl_ops, which is initialised with get_ioctl_ops.  I do not 
> understand this, cause this function does not use any parameter (like path!) 
> so how does this function determine it's a mountpoint?

Read lib/dev-ioctl-lib.c, that's why I mentioned it, it's not that long.

It implements a set of functions for autofs control operations.

Many of them can't be called by just any process but the
dev_ioctl_ismountpoint() function can. It may not look that simple but
if you take some time to understand what it is doing you can take the
bits you need and that will end up being fairly simple.

The one problem you do have is that if the kernel doesn't have the new
device ioctl interface you will need to scan /proc/mounts, the same as
is done by the is_mounted() function if it sees the new functionality
isn't available.

Ian

  reply	other threads:[~2010-02-16 17:29 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
2010-02-16 13:20   ` Stef Bon
2010-02-16 17:29     ` Ian Kent [this message]
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=4B7AD5DC.3010307@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.