summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGabriel Dalimonte <gabriel.dalimonte@gmail.com>2025-02-17 13:26:44 -0500
committerTom Rini <trini@konsulko.com>2025-03-07 11:50:22 -0600
commit06159a1465fc97d8d7b72b9bea39a396f6e7057c (patch)
tree71a27cbcbc587d8157021fb1d8a7cca37ec9c8fc /include
parentd9c149664fa7a0c2eabfc046dcf89637f655364b (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/fat.h1
-rw-r--r--include/fs.h2
2 files changed, 3 insertions, 0 deletions
diff --git a/include/fat.h b/include/fat.h
index 3dce99a23cf..ca97880de12 100644
--- a/include/fat.h
+++ b/include/fat.h
@@ -206,6 +206,7 @@ int fat_opendir(const char *filename, struct fs_dir_stream **dirsp);
int fat_readdir(struct fs_dir_stream *dirs, struct fs_dirent **dentp);
void fat_closedir(struct fs_dir_stream *dirs);
int fat_unlink(const char *filename);
+int fat_rename(const char *old_path, const char *new_path);
int fat_mkdir(const char *dirname);
void fat_close(void);
void *fat_next_cluster(fat_itr *itr, unsigned int *nbytes);
diff --git a/include/fs.h b/include/fs.h
index 5b272eb9f5e..54449faf2e5 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -302,6 +302,8 @@ int do_mkdir(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
int fstype);
int do_ln(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
int fstype);
+int do_mv(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
+ int fstype);
/*
* Determine the UUID of the specified filesystem and print it. Optionally it is