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 b17b76a..0c66d60 100644 (file)
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -308,6 +308,19 @@ static struct fstype_info *fs_get_info(int fstype)
 }
 
 /**
+ * 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
  *
  * Return: Pointer to filesystem name
index 247e954..742a535 100644 (file)
@@ -50,6 +50,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
  *
  * Return: Pointer to filesystem name