fs: add fs_get_type() for current filesystem type
authorAKASHI Takahiro <takahiro.akashi@linaro.org>
Mon, 7 Oct 2019 05:59:37 +0000 (14:59 +0900)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Thu, 17 Oct 2019 17:19:56 +0000 (19:19 +0200)
This function is a variant of fs_get_type_name() and returns a filesystem
type with which the current device is associated.
We don't want to export fs_type variable directly because we have to take
care of it consistently within fs.c.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
fs/fs.c
include/fs.h

diff --git a/fs/fs.c b/fs/fs.c
index b17b76a46ae0e7bd92148091d9fd537ff1d32c50..0c66d6047703c76402c3e838b9a2e625492b99d2 100644 (file)
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -307,6 +307,19 @@ static struct fstype_info *fs_get_info(int fstype)
        return info;
 }
 
+/**
+ * fs_get_type() - Get type of current filesystem
+ *
+ * Return: filesystem type
+ *
+ * Returns filesystem type representing the current filesystem, or
+ * FS_TYPE_ANY for any unrecognised filesystem.
+ */
+int fs_get_type(void)
+{
+       return fs_type;
+}
+
 /**
  * fs_get_type_name() - Get type of current filesystem
  *
index 247e9540536ca67b416ef831be6bf36f53da4c4b..742a535b5f010675256f4a855df0509d3449142a 100644 (file)
@@ -49,6 +49,16 @@ int fs_set_blk_dev_with_part(struct blk_desc *desc, int part);
  */
 void fs_close(void);
 
+/**
+ * fs_get_type() - Get type of current filesystem
+ *
+ * Return: filesystem type
+ *
+ * Returns filesystem type representing the current filesystem, or
+ * FS_TYPE_ANY for any unrecognised filesystem.
+ */
+int fs_get_type(void);
+
 /**
  * fs_get_type_name() - Get type of current filesystem
  *