Skip to content

Commit

Permalink
fs: add fs_get_type() for current filesystem type
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Heinrich Schuchardt <[email protected]>
  • Loading branch information
AKASHI Takahiro authored and xypron committed Oct 17, 2019
1 parent 185aed7 commit b7cd956
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
13 changes: 13 additions & 0 deletions fs/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
10 changes: 10 additions & 0 deletions include/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit b7cd956

Please sign in to comment.