util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Edward Diener <eldlistmailingz@tropicsoft.com>
Cc: util-linux@vger.kernel.org
Subject: Re: Using libmount to track mount/umount
Date: Wed, 15 Aug 2018 09:03:45 +0200	[thread overview]
Message-ID: <20180815070345.qeazo2cqktwu6xyi@ws.net.home> (raw)
In-Reply-To: <62d391f1-3fd7-1acc-b57e-103a4bbd5244@tropicsoft.com>

On Tue, Aug 14, 2018 at 09:18:26AM -0400, Edward Diener wrote:
> I would like to use the libmount library to track end-user mount/umount
> commands. My first question regards the use of the monitor. What is the
> difference between userspace monitoring and kernel VFS monitoring ?

The userspace handler also monitor writes to /run/mount/utab, it's
important for options like user= or some NFS options maintained in
userspace only. Anyway, if do you not care about options than it's
probably enough to monitor VFS.

The userspace monitor has been mostly implemented for systemd where is
required to have information about all options, for more details see
https://github.com/systemd/systemd/blob/master/src/core/mount.c#L1701

See also test program in the code:
https://github.com/karelzak/util-linux/blob/master/libmount/src/monitor.c#L823


The another possibility to monitor VFS is to use directly poll() for 
/proc/self/mountinfo and than mnt_new_tabdiff(), see findmnt --poll:
https://github.com/karelzak/util-linux/blob/master/misc-utils/findmnt.c#L1071
In this case you do not need the mnt_new_monitor(), but libmnt_monitor
is probably better for complex things and epoll().


    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

      reply	other threads:[~2018-08-15  9:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-14 13:18 Using libmount to track mount/umount Edward Diener
2018-08-15  7:03 ` Karel Zak [this message]

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=20180815070345.qeazo2cqktwu6xyi@ws.net.home \
    --to=kzak@redhat.com \
    --cc=eldlistmailingz@tropicsoft.com \
    --cc=util-linux@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).