|  |  |  | libmount Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | ||||
struct libmnt_update; void mnt_free_update (struct libmnt_update *upd); struct libmnt_update * mnt_new_update (void); int mnt_update_force_rdonly (struct libmnt_update *upd,int rdonly); const char * mnt_update_get_filename (struct libmnt_update *upd); struct libmnt_fs * mnt_update_get_fs (struct libmnt_update *upd); unsigned long mnt_update_get_mflags (struct libmnt_update *upd); int mnt_update_is_ready (struct libmnt_update *upd); int mnt_update_set_fs (struct libmnt_update *upd,unsigned long mountflags,const char *target,struct libmnt_fs *fs); int mnt_update_table (struct libmnt_update *upd,struct libmnt_lock *lc);
The struct libmnt_update provides abstraction to manage mount options in userspace independently on system configuration. This low-level API works on system with and without /etc/mtab. On systems without the regular /etc/mtab file are userspace mount options (e.g. user=) stored to the /run/mount/utab file.
It's recommended to use high-level struct libmnt_context API.
void                mnt_free_update                     (struct libmnt_update *upd);
Deallocates struct libmnt_update handler.
| 
 | update | 
struct libmnt_update * mnt_new_update                   (void);
| Returns : | newly allocated update handler | 
int mnt_update_force_rdonly (struct libmnt_update *upd,int rdonly);
| 
 | update | 
| 
 | is read-only? | 
| Returns : | 0 on success and negative number in case of error. | 
const char *        mnt_update_get_filename             (struct libmnt_update *upd);
This function returns file name (e.g. /etc/mtab) for the up-dated file.
| 
 | update | 
| Returns : | pointer to filename that will be updated or NULL in case of error. | 
struct libmnt_fs *  mnt_update_get_fs                   (struct libmnt_update *upd);
| 
 | update | 
| Returns : | update filesystem entry or NULL | 
unsigned long       mnt_update_get_mflags               (struct libmnt_update *upd);
| 
 | update | 
| Returns : | mount flags as was set by mnt_update_set_fs() | 
int                 mnt_update_is_ready                 (struct libmnt_update *upd);
| 
 | update handler | 
| Returns : | 1 if entry described by updis successfully prepared and will be
written to mtab/utab file. | 
int mnt_update_set_fs (struct libmnt_update *upd,unsigned long mountflags,const char *target,struct libmnt_fs *fs);
| 
 | update handler | 
| 
 | MS_* flags | 
| 
 | umount target, must be NULL for mount | 
| 
 | mount filesystem description, must be NULL for umount | 
| Returns : | <0 in case on error, 0 on success, 1 if update is unnecessary. | 
int mnt_update_table (struct libmnt_update *upd,struct libmnt_lock *lc);
High-level API to update /etc/mtab (or private /run/mount/utab file).
The lc lock is optional and will be created if necessary. Note that
the automatically created lock blocks all signals.
See also mnt_lock_block_signals() and mnt_context_get_lock().
| 
 | update | 
| 
 | lock or NULL | 
| Returns : | 0 on success, negative number on error. |