Monitor mountinfo changes

Monitor mountinfo changes — monitor changes in the list of the mounted filesystems

Synopsis

struct              libmnt_tabdiff;
struct libmnt_tabdiff * mnt_new_tabdiff                 (void);
void                mnt_free_tabdiff                    (struct libmnt_tabdiff *df);
int                 mnt_tabdiff_next_change             (struct libmnt_tabdiff *df,
                                                         struct libmnt_iter *itr,
                                                         struct libmnt_fs **old_fs,
                                                         struct libmnt_fs **new_fs,
                                                         int *oper);
int                 mnt_diff_tables                     (struct libmnt_tabdiff *df,
                                                         struct libmnt_table *old_tab,
                                                         struct libmnt_table *new_tab);

Description

Details

struct libmnt_tabdiff

struct libmnt_tabdiff;

Stores mountinfo state


mnt_new_tabdiff ()

struct libmnt_tabdiff * mnt_new_tabdiff                 (void);

Allocates a new table diff struct.

Returns :

new diff handler or NULL.

mnt_free_tabdiff ()

void                mnt_free_tabdiff                    (struct libmnt_tabdiff *df);

Deallocates tab diff struct and all entries.

df :

tab diff

mnt_tabdiff_next_change ()

int                 mnt_tabdiff_next_change             (struct libmnt_tabdiff *df,
                                                         struct libmnt_iter *itr,
                                                         struct libmnt_fs **old_fs,
                                                         struct libmnt_fs **new_fs,
                                                         int *oper);

The options old_fs, new_fs and oper are optional.

df :

tabdiff pointer

itr :

iterator

old_fs :

returns the old entry or NULL if new entry added

new_fs :

returns the new entry or NULL if old entry removed

oper :

MNT_TABDIFF_{MOVE,UMOUNT,REMOUNT,MOUNT} flags

Returns :

0 on success, negative number in case of error or 1 at end of list.

mnt_diff_tables ()

int                 mnt_diff_tables                     (struct libmnt_tabdiff *df,
                                                         struct libmnt_table *old_tab,
                                                         struct libmnt_table *new_tab);

Compares old_tab and new_tab, the result is stored in df and accessible by mnt_tabdiff_next_change().

df :

diff handler

old_tab :

old table

new_tab :

new table

Returns :

number of changes, negative number in case of error.