X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=fs%2Ffs.c;h=13cd3626c6f811248553ef625b7f64e02e27dfc0;hb=390194d43fa4478ddb638164ddb114c979f3e57a;hp=483273fe20b8212075f74526cb86aa2ae3e36988;hpb=358b8bc204f365be28fed94f23e53e04183a8c7f;p=u-boot diff --git a/fs/fs.c b/fs/fs.c index 483273fe20..13cd3626c6 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -1,38 +1,30 @@ /* * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * SPDX-License-Identifier: GPL-2.0 */ #include #include #include +#include #include #include #include #include #include +#include #include #include #include DECLARE_GLOBAL_DATA_PTR; -static block_dev_desc_t *fs_dev_desc; +static struct blk_desc *fs_dev_desc; static disk_partition_t fs_partition; static int fs_type = FS_TYPE_ANY; -static inline int fs_probe_unsupported(block_dev_desc_t *fs_dev_desc, +static inline int fs_probe_unsupported(struct blk_desc *fs_dev_desc, disk_partition_t *fs_partition) { printf("** Unrecognized filesystem type **\n"); @@ -89,7 +81,7 @@ struct fstype_info { * filesystem. */ bool null_dev_desc_ok; - int (*probe)(block_dev_desc_t *fs_dev_desc, + int (*probe)(struct blk_desc *fs_dev_desc, disk_partition_t *fs_partition); int (*ls)(const char *dirname); int (*exists)(const char *filename); @@ -155,6 +147,21 @@ static struct fstype_info fstypes[] = { .write = fs_write_sandbox, .uuid = fs_uuid_unsupported, }, +#endif +#ifdef CONFIG_CMD_UBIFS + { + .fstype = FS_TYPE_UBIFS, + .name = "ubifs", + .null_dev_desc_ok = true, + .probe = ubifs_set_blk_dev, + .close = ubifs_close, + .ls = ubifs_ls, + .exists = ubifs_exists, + .size = ubifs_size, + .read = ubifs_read, + .write = fs_write_unsupported, + .uuid = fs_uuid_unsupported, + }, #endif { .fstype = FS_TYPE_ANY, @@ -206,7 +213,7 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype) } #endif - part = get_device_and_partition(ifname, dev_part_str, &fs_dev_desc, + part = blk_get_device_part_str(ifname, dev_part_str, &fs_dev_desc, &fs_partition, 1); if (part < 0) return -1; @@ -300,10 +307,8 @@ int fs_read(const char *filename, ulong addr, loff_t offset, loff_t len, unmap_sysmem(buf); /* If we requested a specific number of bytes, check we got it */ - if (ret == 0 && len && *actread != len) { - printf("** Unable to read file %s **\n", filename); - ret = -1; - } + if (ret == 0 && len && *actread != len) + printf("** %s shorter than offset + len **\n", filename); fs_close(); return ret; @@ -343,7 +348,7 @@ int do_size(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], if (fs_size(argv[3], &size) < 0) return CMD_RET_FAILURE; - setenv_hex("filesize", size); + env_set_hex("filesize", size); return 0; } @@ -374,7 +379,7 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], if (ep == argv[3] || *ep != '\0') return CMD_RET_USAGE; } else { - addr_str = getenv("loadaddr"); + addr_str = env_get("loadaddr"); if (addr_str != NULL) addr = simple_strtoul(addr_str, NULL, 16); else @@ -383,7 +388,7 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], if (argc >= 5) { filename = argv[4]; } else { - filename = getenv("bootfile"); + filename = env_get("bootfile"); if (!filename) { puts("** No boot file defined **\n"); return 1; @@ -412,7 +417,8 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], } puts("\n"); - setenv_hex("filesize", len_read); + env_set_hex("fileaddr", addr); + env_set_hex("filesize", len_read); return 0; } @@ -503,7 +509,7 @@ int do_fs_uuid(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], return CMD_RET_FAILURE; if (argc == 4) - setenv(argv[3], uuid); + env_set(argv[3], uuid); else printf("%s\n", uuid); @@ -523,7 +529,7 @@ int do_fs_type(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) info = fs_get_info(fs_type); if (argc == 4) - setenv(argv[3], info->name); + env_set(argv[3], info->name); else printf("%s\n", info->name);