libmount: export mnt_guess_system_root() by API

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2018-12-10 11:39:08 +01:00
parent 0bd05f5ee4
commit 1dae161c83
5 changed files with 13 additions and 2 deletions

View File

@ -398,6 +398,7 @@ mnt_get_fstab_path
mnt_get_mountpoint
mnt_get_mtab_path
mnt_get_swaps_path
mnt_guess_system_root
mnt_has_regular_mtab
mnt_mangle
mnt_match_fstype

View File

@ -326,6 +326,8 @@ extern const char *mnt_get_mtab_path(void);
extern int mnt_has_regular_mtab(const char **mtab, int *writable);
extern char *mnt_get_mountpoint(const char *path)
__ul_attribute__((warn_unused_result));
extern int mnt_guess_system_root(dev_t devno, struct libmnt_cache *cache, char **path)
__ul_attribute__((nonnull(3)));
/* cache.c */
extern struct libmnt_cache *mnt_new_cache(void)

View File

@ -341,3 +341,7 @@ MOUNT_2.33 {
mnt_context_switch_origin_ns;
mnt_context_switch_target_ns;
} MOUNT_2.30;
MOUNT_2.34 {
mnt_guess_system_root;
} MOUNT_2.33;

View File

@ -120,7 +120,6 @@ extern int mnt_get_filesystems(char ***filesystems, const char *pattern);
extern void mnt_free_filesystems(char **filesystems);
extern char *mnt_get_kernel_cmdline_option(const char *name);
extern int mnt_guess_system_root(dev_t devno, struct libmnt_cache *cache, char **path);
extern int mnt_stat_mountpoint(const char *target, struct stat *st);
/* tab.c */

View File

@ -1037,7 +1037,12 @@ char *mnt_get_kernel_cmdline_option(const char *name)
return res;
}
/*
/**
* mnt_guess_system_root:
* @devno: device number or zero
* @cache: paths cache or NULL
* @path: returns allocated path
*
* Converts @devno to the real device name if devno major number is greater
* than zero, otherwise use root= kernel cmdline option to get device name.
*