From 0d488e8f508e697e3b8fb4a3d8bd4f61ca8a225f Mon Sep 17 00:00:00 2001 From: Alex Kiernan Date: Tue, 29 May 2018 15:30:50 +0000 Subject: [PATCH] fs: Add fs_get_type_name to return current filesystem name Add fs_get_type_name so we can get the current filesystem type. Signed-off-by: Alex Kiernan Reviewed-by: Simon Glass Reviewed-by: Joe Hershberger --- fs/fs.c | 13 +++++++++++++ include/fs.h | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/fs/fs.c b/fs/fs.c index 94cdc37deb..33808d549e 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -265,6 +265,19 @@ static struct fstype_info *fs_get_info(int fstype) return info; } +/** + * fs_get_type_name() - Get type of current filesystem + * + * Return: Pointer to filesystem name + * + * Returns a string describing the current filesystem, or the sentinel + * "unsupported" for any unrecognised filesystem. + */ +const char *fs_get_type_name(void) +{ + return fs_get_info(fs_type)->name; +} + int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype) { struct fstype_info *info; diff --git a/include/fs.h b/include/fs.h index d703ed5027..163da103b4 100644 --- a/include/fs.h +++ b/include/fs.h @@ -37,6 +37,16 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype); */ int fs_set_blk_dev_with_part(struct blk_desc *desc, int part); +/** + * fs_get_type_name() - Get type of current filesystem + * + * Return: Pointer to filesystem name + * + * Returns a string describing the current filesystem, or the sentinel + * "unsupported" for any unrecognised filesystem. + */ +const char *fs_get_type_name(void); + /* * Print the list of files on the partition previously set by fs_set_blk_dev(), * in directory "dirname". -- 2.39.2