Commit 0d488e8f508e697e3b8fb4a3d8bd4f61ca8a225f
Committed by
Marek Vasut
1 parent
413b90777f
Exists in
smarc_8mq_lf_v2020.04
and in
12 other branches
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 <alex.kiernan@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Showing 2 changed files with 23 additions and 0 deletions Side-by-side Diff
fs/fs.c
... | ... | @@ -265,6 +265,19 @@ |
265 | 265 | return info; |
266 | 266 | } |
267 | 267 | |
268 | +/** | |
269 | + * fs_get_type_name() - Get type of current filesystem | |
270 | + * | |
271 | + * Return: Pointer to filesystem name | |
272 | + * | |
273 | + * Returns a string describing the current filesystem, or the sentinel | |
274 | + * "unsupported" for any unrecognised filesystem. | |
275 | + */ | |
276 | +const char *fs_get_type_name(void) | |
277 | +{ | |
278 | + return fs_get_info(fs_type)->name; | |
279 | +} | |
280 | + | |
268 | 281 | int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype) |
269 | 282 | { |
270 | 283 | struct fstype_info *info; |
include/fs.h
... | ... | @@ -37,6 +37,16 @@ |
37 | 37 | */ |
38 | 38 | int fs_set_blk_dev_with_part(struct blk_desc *desc, int part); |
39 | 39 | |
40 | +/** | |
41 | + * fs_get_type_name() - Get type of current filesystem | |
42 | + * | |
43 | + * Return: Pointer to filesystem name | |
44 | + * | |
45 | + * Returns a string describing the current filesystem, or the sentinel | |
46 | + * "unsupported" for any unrecognised filesystem. | |
47 | + */ | |
48 | +const char *fs_get_type_name(void); | |
49 | + | |
40 | 50 | /* |
41 | 51 | * Print the list of files on the partition previously set by fs_set_blk_dev(), |
42 | 52 | * in directory "dirname". |