mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-26 04:17:09 +00:00
fs: fat: Shrink the size of a few strings
To save a few bytes, replace Error with ** and try to use the same string for multiple messages where possible. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
e7595aa350
commit
78211de600
2 changed files with 15 additions and 19 deletions
16
fs/fat/fat.c
16
fs/fat/fat.c
|
@ -8,6 +8,8 @@
|
||||||
* 2003-03-10 - kharris@nexus-tech.net - ported to uboot
|
* 2003-03-10 - kharris@nexus-tech.net - ported to uboot
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define LOG_CATEGORY LOGC_FS
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <blk.h>
|
#include <blk.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -97,8 +99,8 @@ int fat_register_device(struct blk_desc *dev_desc, int part_no)
|
||||||
/* Read the partition table, if present */
|
/* Read the partition table, if present */
|
||||||
if (part_get_info(dev_desc, part_no, &info)) {
|
if (part_get_info(dev_desc, part_no, &info)) {
|
||||||
if (part_no != 0) {
|
if (part_no != 0) {
|
||||||
printf("** Partition %d not valid on device %d **\n",
|
log_err("Partition %d invalid on device %d\n", part_no,
|
||||||
part_no, dev_desc->devnum);
|
dev_desc->devnum);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +170,7 @@ static __u32 get_fatent(fsdata *mydata, __u32 entry)
|
||||||
__u32 ret = 0x00;
|
__u32 ret = 0x00;
|
||||||
|
|
||||||
if (CHECK_CLUST(entry, mydata->fatsize)) {
|
if (CHECK_CLUST(entry, mydata->fatsize)) {
|
||||||
printf("Error: Invalid FAT entry: 0x%08x\n", entry);
|
log_err("Invalid FAT entry: %#08x\n", entry);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,18 +588,18 @@ static int get_fs_info(fsdata *mydata)
|
||||||
mydata->sect_size = (bs.sector_size[1] << 8) + bs.sector_size[0];
|
mydata->sect_size = (bs.sector_size[1] << 8) + bs.sector_size[0];
|
||||||
mydata->clust_size = bs.cluster_size;
|
mydata->clust_size = bs.cluster_size;
|
||||||
if (mydata->sect_size != cur_part_info.blksz) {
|
if (mydata->sect_size != cur_part_info.blksz) {
|
||||||
printf("Error: FAT sector size mismatch (fs=%hu, dev=%lu)\n",
|
log_err("FAT sector size mismatch (fs=%u, dev=%lu)\n",
|
||||||
mydata->sect_size, cur_part_info.blksz);
|
mydata->sect_size, cur_part_info.blksz);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (mydata->clust_size == 0) {
|
if (mydata->clust_size == 0) {
|
||||||
printf("Error: FAT cluster size not set\n");
|
log_err("FAT cluster size not set\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((unsigned int)mydata->clust_size * mydata->sect_size >
|
if ((unsigned int)mydata->clust_size * mydata->sect_size >
|
||||||
MAX_CLUSTSIZE) {
|
MAX_CLUSTSIZE) {
|
||||||
printf("Error: FAT cluster size too big (cs=%u, max=%u)\n",
|
log_err("FAT cluster size too big (cs=%u, max=%u)\n",
|
||||||
(unsigned int)mydata->clust_size * mydata->sect_size,
|
(uint)mydata->clust_size * mydata->sect_size,
|
||||||
MAX_CLUSTSIZE);
|
MAX_CLUSTSIZE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1571,8 +1571,9 @@ int fat_unlink(const char *filename)
|
||||||
char *filename_copy, *dirname, *basename;
|
char *filename_copy, *dirname, *basename;
|
||||||
|
|
||||||
filename_copy = strdup(filename);
|
filename_copy = strdup(filename);
|
||||||
if (!filename_copy) {
|
itr = malloc_cache_aligned(sizeof(fat_itr));
|
||||||
printf("Error: allocating memory\n");
|
if (!itr || !filename_copy) {
|
||||||
|
printf("Error: out of memory\n");
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -1584,13 +1585,6 @@ int fat_unlink(const char *filename)
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
itr = malloc_cache_aligned(sizeof(fat_itr));
|
|
||||||
if (!itr) {
|
|
||||||
printf("Error: allocating memory\n");
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = fat_itr_root(itr, &fsdata);
|
ret = fat_itr_root(itr, &fsdata);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -1605,7 +1599,7 @@ int fat_unlink(const char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!find_directory_entry(itr, basename)) {
|
if (!find_directory_entry(itr, basename)) {
|
||||||
printf("%s: doesn't exist\n", basename);
|
log_err("%s: doesn't exist (%d)\n", basename, -ENOENT);
|
||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue