]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
linmount: (monitor) refresh docs, headers and symbols table
authorKarel Zak <kzak@redhat.com>
Wed, 17 Dec 2014 12:09:29 +0000 (13:09 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 6 Jan 2015 15:19:02 +0000 (16:19 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/docs/libmount-sections.txt
libmount/src/libmount.h.in
libmount/src/libmount.sym
libmount/src/monitor.c

index 7f01067818c4875b0517b02acc06d521ebf40e34..4e3b9774d85aeca46018565ee4941be3e2703d82 100644 (file)
@@ -390,9 +390,10 @@ mnt_new_monitor
 mnt_ref_monitor
 mnt_unref_monitor
 mnt_monitor_enable_userspace
+mnt_monitor_enable_kernel
 mnt_monitor_get_fd
 mnt_monitor_close_fd
-mnt_monitor_is_changed
 mnt_monitor_next_changed
+mnt_monitor_event_cleanup
 mnt_monitor_wait
 </SECTION>
index c5fc516c4fbad7b4788232080e2be15811bdf693..789979c440a37b584aeedea196f29673e9e22dc4 100644 (file)
@@ -546,6 +546,7 @@ extern struct libmnt_monitor *mnt_new_monitor(void);
 extern void mnt_ref_monitor(struct libmnt_monitor *mn);
 extern void mnt_unref_monitor(struct libmnt_monitor *mn);
 
+extern int mnt_monitor_enable_kernel(struct libmnt_monitor *mn, int enable);
 extern int mnt_monitor_enable_userspace(struct libmnt_monitor *mn,
                                int enable, const char *filename);
 
@@ -555,6 +556,7 @@ extern int mnt_monitor_wait(struct libmnt_monitor *mn, int timeout);
 
 extern int mnt_monitor_next_changed(struct libmnt_monitor *mn,
                             const char **filename, int *type);
+extern int mnt_monitor_event_cleanup(struct libmnt_monitor *mn);
 
 
 /* context.c */
index fc8cc08f053327931527a0d3d0dca279660aa5b1..33f55a97e4c0c06b354b8f99877a81ca579f041b 100644 (file)
@@ -301,6 +301,8 @@ MOUNT_2.25 {
 MOUNT_2.26 {
        mnt_monitor_close_fd;
        mnt_monitor_enable_userspace;
+       mnt_monitor_enable_kernel;
+       mnt_monitor_event_cleanup;
        mnt_monitor_get_fd;
        mnt_monitor_next_changed;
        mnt_monitor_wait;
index cf91f32c3e23135f51196a37a011fa890a2d1c0d..2ec2510ed31b1e69a25f8be63d94f04a48432cab 100644 (file)
@@ -304,7 +304,11 @@ static const struct monitor_opers userspace_opers = {
  * or mnt_monitor_wait()) then it's updated according to @enable.
  *
  * The @filename is used only first time when you enable the monitor. It's
- * impossible to have more than one userspace monitor.
+ * impossible to have more than one userspace monitor. The recommended is to
+ * use NULL as filename.
+ *
+ * The userspace monitor is unsupported for systems with classic regular
+ * /etc/mtab file.
  *
  * Return: 0 on success and <0 on error
  */
@@ -329,8 +333,10 @@ int mnt_monitor_enable_userspace(struct libmnt_monitor *mn, int enable, const ch
        DBG(MONITOR, ul_debugobj(mn, "allocate new userspace monitor"));
 
        /* create a new entry */
-       if (!mnt_has_regular_mtab(&filename, NULL))     /* /etc/mtab */
-               filename = mnt_get_utab_path();         /* /run/mount/utab */
+       if (mnt_has_regular_mtab(NULL, NULL))
+               return -ENOSYS;
+
+       filename = mnt_get_utab_path();         /* /run/mount/utab */
        if (!filename) {
                DBG(MONITOR, ul_debugobj(mn, "failed to get userspace mount table path"));
                return -EINVAL;
@@ -412,8 +418,8 @@ static const struct monitor_opers kernel_opers = {
  * @mn: monitor
  * @enable: 0 or 1
  *
- * Enables or disables userspace monitoring. If the userspace monitor does not
- * exist and enable=1 then allocates new resources necessary for the monitor.
+ * Enables or disables kernel VFS monitoring. If the monitor does not exist and
+ * enable=1 then allocates new resources necessary for the monitor.
  *
  * If the top-level monitor has been already created (by mnt_monitor_get_fd()
  * or mnt_monitor_wait()) then it's updated according to @enable.
@@ -550,6 +556,11 @@ int mnt_monitor_close_fd(struct libmnt_monitor *mn)
  * The file descriptor is associated with all monitored files and it's usable
  * for example for epoll.
  *
+ * Note that if you want to use the @fd in your epoll then you will get only
+ * notification, but mnt_monitor_next_changed() does not work in this case. You
+ * have to call mnt_monitor_event_cleanup() after each event if you do not use
+ * mnt_monitor_next_changed().
+ *
  * Returns: >=0 on success, <0 on error
  */
 int mnt_monitor_get_fd(struct libmnt_monitor *mn)
@@ -653,8 +664,7 @@ static struct monitor_entry *get_changed(struct libmnt_monitor *mn)
  * @filename: returns changed file (optional argument)
  * @type: returns MNT_MONITOR_TYPE_* (optional argument)
  *
- * The function does not wait and it's designed to provide details and to avoid
- * false positives after detected activity on monitor file descriptor.
+ * The function does not wait and it's designed to provide details about chnages.
  *
  * Returns: 0 on success, 1 no change, <0 on error
  */