]> git.sur5r.net Git - u-boot/blobdiff - fs/fs.c
Makefile: drop unused cpp_cfg macro
[u-boot] / fs / fs.c
diff --git a/fs/fs.c b/fs/fs.c
index 3481229aa623bf80e0d26caf9cfc20a9d179ae0e..33808d549e0a5cd5e0a005dc5b00a3337aa4f0f8 100644 (file)
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1,7 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
- *
- * SPDX-License-Identifier:    GPL-2.0
  */
 
 #include <config.h>
@@ -14,6 +13,7 @@
 #include <fs.h>
 #include <sandboxfs.h>
 #include <ubifs_uboot.h>
+#include <btrfs.h>
 #include <asm/io.h>
 #include <div64.h>
 #include <linux/math64.h>
@@ -218,6 +218,22 @@ static struct fstype_info fstypes[] = {
                .uuid = fs_uuid_unsupported,
                .opendir = fs_opendir_unsupported,
        },
+#endif
+#ifdef CONFIG_FS_BTRFS
+       {
+               .fstype = FS_TYPE_BTRFS,
+               .name = "btrfs",
+               .null_dev_desc_ok = false,
+               .probe = btrfs_probe,
+               .close = btrfs_close,
+               .ls = btrfs_ls,
+               .exists = btrfs_exists,
+               .size = btrfs_size,
+               .read = btrfs_read,
+               .write = fs_write_unsupported,
+               .uuid = btrfs_uuid,
+               .opendir = fs_opendir_unsupported,
+       },
 #endif
        {
                .fstype = FS_TYPE_ANY,
@@ -249,6 +265,19 @@ static struct fstype_info *fs_get_info(int fstype)
        return info;
 }
 
+/**
+ * fs_get_type_name() - Get type of current filesystem
+ *
+ * Return: Pointer to filesystem name
+ *
+ * Returns a string describing the current filesystem, or the sentinel
+ * "unsupported" for any unrecognised filesystem.
+ */
+const char *fs_get_type_name(void)
+{
+       return fs_get_info(fs_type)->name;
+}
+
 int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
 {
        struct fstype_info *info;
@@ -390,7 +419,7 @@ int fs_read(const char *filename, ulong addr, loff_t offset, loff_t len,
 
        /* If we requested a specific number of bytes, check we got it */
        if (ret == 0 && len && *actread != len)
-               printf("** %s shorter than offset + len **\n", filename);
+               debug("** %s shorter than offset + len **\n", filename);
        fs_close();
 
        return ret;