* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
*/
+#define LOG_CATEGORY LOGC_CORE
+
#include <command.h>
#include <config.h>
#include <errno.h>
#include <div64.h>
#include <linux/math64.h>
#include <efi_loader.h>
+#include <squashfs.h>
DECLARE_GLOBAL_DATA_PTR;
static inline int fs_probe_unsupported(struct blk_desc *fs_dev_desc,
struct disk_partition *fs_partition)
{
- printf("** Unrecognized filesystem type **\n");
+ log_err("** Unrecognized filesystem type **\n");
return -1;
}
if (dent->type == FS_DT_DIR) {
printf(" %s/\n", dent->name);
ndirs++;
+ } else if (dent->type == FS_DT_LNK) {
+ printf(" <SYM> %s\n", dent->name);
+ nfiles++;
} else {
printf(" %8lld %s\n", dent->size, dent->name);
nfiles++;
.ln = fs_ln_unsupported,
},
#endif
+#if IS_ENABLED(CONFIG_FS_SQUASHFS)
+ {
+ .fstype = FS_TYPE_SQUASHFS,
+ .name = "squashfs",
+ .null_dev_desc_ok = false,
+ .probe = sqfs_probe,
+ .opendir = sqfs_opendir,
+ .readdir = sqfs_readdir,
+ .ls = fs_ls_generic,
+ .read = sqfs_read,
+ .size = sqfs_size,
+ .close = sqfs_close,
+ .closedir = sqfs_closedir,
+ .exists = sqfs_exists,
+ .uuid = fs_uuid_unsupported,
+ .write = fs_write_unsupported,
+ .ln = fs_ln_unsupported,
+ .unlink = fs_unlink_unsupported,
+ .mkdir = fs_mkdir_unsupported,
+ },
+#endif
{
.fstype = FS_TYPE_ANY,
.name = "unsupported",
if (lmb_alloc_addr(&lmb, addr, read_len) == addr)
return 0;
- printf("** Reading file would overwrite reserved memory **\n");
+ log_err("** Reading file would overwrite reserved memory **\n");
return -ENOSPC;
}
#endif
/* If we requested a specific number of bytes, check we got it */
if (ret == 0 && len && *actread != len)
- debug("** %s shorter than offset + len **\n", filename);
+ log_debug("** %s shorter than offset + len **\n", filename);
fs_close();
return ret;
unmap_sysmem(buf);
if (ret < 0 && len != *actwrite) {
- printf("** Unable to write file %s **\n", filename);
+ log_err("** Unable to write file %s **\n", filename);
ret = -1;
}
fs_close();
ret = info->ln(fname, target);
if (ret < 0) {
- printf("** Unable to create link %s -> %s **\n", fname, target);
+ log_err("** Unable to create link %s -> %s **\n", fname, target);
ret = -1;
}
fs_close();
else
pos = 0;
-#ifdef CONFIG_CMD_BOOTEFI
- efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "",
- (argc > 4) ? argv[4] : "");
-#endif
time = get_timer(0);
ret = _fs_read(filename, addr, pos, bytes, 1, &len_read);
time = get_timer(time);
- if (ret < 0)
+ if (ret < 0) {
+ log_err("Failed to load '%s'\n", filename);
return 1;
+ }
+
+ if (IS_ENABLED(CONFIG_CMD_BOOTEFI))
+ efi_set_bootdev(argv[1], (argc > 2) ? argv[2] : "",
+ (argc > 4) ? argv[4] : "");
printf("%llu bytes read in %lu ms", len_read, time);
if (time > 0) {
ret = fs_mkdir(argv[3]);
if (ret) {
- printf("** Unable to create a directory \"%s\" **\n", argv[3]);
+ log_err("** Unable to create a directory \"%s\" **\n", argv[3]);
return 1;
}