From b7bc01908ab9f32d2bfe59190aa714bc5b02747c Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 13 Apr 2025 10:55:04 +0200 Subject: [PATCH] fs: exfat: Implement trivial 'rename' support Implement exfat_fs_rename() to rename or move files. This is used by the 'mv' generic FS interface command. The rename implementation for other filesystems was added recently and was not part of exfat porting layer due to merge issue, which made 'mv' command crash, fix this by adding the missing implementation. Fixes: b86a651b646c ("fs: exfat: Add U-Boot porting layer") Signed-off-by: Marek Vasut --- fs/exfat/io.c | 5 +++++ fs/fs.c | 1 + include/exfat.h | 1 + 3 files changed, 7 insertions(+) diff --git a/fs/exfat/io.c b/fs/exfat/io.c index 43c05713ed0..c56f5675987 100644 --- a/fs/exfat/io.c +++ b/fs/exfat/io.c @@ -1013,6 +1013,11 @@ exit: return err; } +int exfat_fs_rename(const char *old_path, const char *new_path) +{ + return exfat_rename(&ctxt.ef, old_path, new_path); +} + void exfat_fs_close(void) { exfat_unmount(&ctxt.ef); diff --git a/fs/fs.c b/fs/fs.c index a1c3561714c..7def8a9d65d 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -402,6 +402,7 @@ static struct fstype_info fstypes[] = { .ln = fs_ln_unsupported, .unlink = exfat_fs_unlink, .mkdir = exfat_fs_mkdir, + .rename = exfat_fs_rename, }, #endif { diff --git a/include/exfat.h b/include/exfat.h index 7e43beeb348..75fce5b6566 100644 --- a/include/exfat.h +++ b/include/exfat.h @@ -20,5 +20,6 @@ int exfat_fs_unlink(const char *filename); int exfat_fs_mkdir(const char *dirname); int exfat_fs_write(const char *filename, void *buf, loff_t offset, loff_t len, loff_t *actwrite); +int exfat_fs_rename(const char *old_path, const char *new_path); #endif /* _EXFAT_H */