This commit is contained in:
2026-02-26 15:44:43 +01:00
parent b8b3e6ea44
commit 5934bba4af
7 changed files with 159 additions and 16 deletions

View File

@@ -18,9 +18,54 @@ int fs_pm_flash_suspend(void);
*/
int fs_pm_flash_resume(void);
/**
* @brief Wrapper around fs_open that handles power management for the flash
* Resumes the flash before opening and suspends it if opening fails
* @param file Pointer to fs_file_t structure to be initialized
* @param path Path to the file to open
* @param mode Open flags (e.g. FS_O_READ, FS_O_WRITE)
* @return 0 on success, negative error code on failure
*/
int fs_pm_open(struct fs_file_t *file, const char *path, fs_mode_t mode);
/**
* @brief Wrapper around fs_close that handles power management for the flash
* Resumes the flash after closing and suspends it if closing fails
* @param file Pointer to fs_file_t structure to be closed
* @return 0 on success, negative error code on failure
*/
int fs_pm_close(struct fs_file_t *file);
/**
* @brief Wrapper around fs_opendir that handles power management for the flash
* Resumes the flash before opening and suspends it if opening fails
* @param dirp Pointer to fs_dir_t structure to be initialized
* @param path Path to the directory to open
* @return 0 on success, negative error code on failure
*/
int fs_pm_opendir(struct fs_dir_t *dirp, const char *path);
/**
* @brief Wrapper around fs_closedir that handles power management for the flash
* Resumes the flash after closing and suspends it if closing fails
* @param dirp Pointer to fs_dir_t structure to be closed
* @return 0 on success, negative error code on failure
*/
int fs_pm_closedir(struct fs_dir_t *dirp);
/**
* @brief Unlinks (deletes) a file, ensuring the flash is active during the operation
* @param path Path to the file to unlink
* @return 0 on success, negative error code on failure
*/
int fs_pm_unlink(const char *path);
/**
* @brief Wrapper around fs_statvfs that handles power management for the flash
* Resumes the flash before getting stats and suspends it afterwards
* @param path Path to the filesystem to get stats for
* @param stat Pointer to fs_statvfs structure to be filled with stats
* @return 0 on success, negative error code on failure
*/
int fs_pm_statvfs(const char *path, struct fs_statvfs *stat);
#endif // FS_H