fs: fat: add rename
The implementation roughly follows the POSIX specification for rename() [1]. The ordering of operations attempting to minimize the chance for data loss in unexpected circumstances. The 'mv' command was implemented as a front end for the rename operation as that is what most users are likely familiar with in terms of behavior. The 'FAT_RENAME' Kconfig option was added to prevent code size increase on size-oriented builds like SPL. [1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/rename.html Signed-off-by: Gabriel Dalimonte <gabriel.dalimonte@gmail.com>
This commit is contained in:

committed by
Tom Rini

parent
d9c149664f
commit
06159a1465
14
cmd/fs.c
14
cmd/fs.c
@@ -110,3 +110,17 @@ U_BOOT_CMD(
|
||||
fstypes, 1, 1, do_fstypes_wrapper,
|
||||
"List supported filesystem types", ""
|
||||
);
|
||||
|
||||
static int do_mv_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
return do_mv(cmdtp, flag, argc, argv, FS_TYPE_ANY);
|
||||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
mv, 5, 1, do_mv_wrapper,
|
||||
"rename/move a file/directory",
|
||||
"<interface> [<dev[:part]>] <old_path> <new_path>\n"
|
||||
" - renames/moves a file/directory in 'dev' on 'interface' from\n"
|
||||
" 'old_path' to 'new_path'"
|
||||
);
|
||||
|
Reference in New Issue
Block a user