| 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_table_replace_file (struct libmnt_table *tb,const char *filename); int mnt_table_write_file (struct libmnt_table *tb,FILE *file); 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 an abstraction to manage mount options in userspace independently of system configuration. This low-level API works on systems both with and without /etc/mtab. On systems without the regular /etc/mtab file, the userspace mount options (e.g. user=) are stored in 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_table_replace_file (struct libmnt_table *tb,const char *filename);
This function replaces file by the new content from tb.
|
parsed file (e.g. fstab) |
|
target |
Returns : |
0 on success, negative number on error. |
int mnt_table_write_file (struct libmnt_table *tb,FILE *file);
This function writes tb to file.
|
parsed file (e.g. fstab) |
|
target |
Returns : |
0 on success, negative number on error. |
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 the file name (e.g. /etc/mtab) of 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 upd is successfully prepared and will be
written to the 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
an 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. |