fs: add api to get the name of filesystem type

Let others to get the name of partition filesystem type which
is private member in fs/fs.c

Change-Id: Iae5c89c705fa65b5eedb4550963003b6e03e2820
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
This commit is contained in:
Jason Zhu 2018-03-05 22:15:55 +08:00 committed by Kever Yang
parent de78ceae23
commit e17ddcea32
2 changed files with 28 additions and 0 deletions

19
fs/fs.c
View File

@ -317,6 +317,25 @@ int fs_set_blk_dev_with_part(struct blk_desc *desc, int part)
return -1;
}
int fs_get_fstype(const char **fstype_name)
{
struct fstype_info *info;
if (fstype_name == NULL) {
printf("** parameter error **\n");
return -1;
}
info = fs_get_info(fs_type);
if (info->fstype == FS_TYPE_ANY) {
printf("** not match any filesystem type **\n");
return -1;
}
*fstype_name = info->name;
return 0;
}
static void fs_close(void)
{
struct fstype_info *info = fs_get_info(fs_type);

View File

@ -26,6 +26,15 @@
*/
int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype);
/*
* fs_get_fstype - Get filesystem type on the partition previously
* set by fs_set_blk_dev()
*
* @fstype_name: The return the name of filesystem type
* @return 0 if ok with valid *fstype_name, -1 on error conditions
*/
int fs_get_fstype(const char **fstype_name);
/*
* fs_set_blk_dev_with_part - Set current block device + partition
*