git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15264 27425a3e-05d8-49a3-a47f-9c15f0e5edd8

This commit is contained in:
Giovanni Di Sirio 2021-12-27 08:53:27 +00:00
parent 2d0cbb43b5
commit 28a49af314
2 changed files with 73 additions and 4 deletions

View File

@ -121,6 +121,75 @@ extern "C" {
/* Module inline functions. */
/*===========================================================================*/
/**
* @brief Changes the current VFS directory.
*
* @param[in] drvp Pointer to the @p vfs_driver_c object.
* @param[in] path Path of the new current directory.
* @return The operation result.
*
* @api
*/
static inline msg_t vfsDrvChangeCurrentDirectory(vfs_driver_c *drvp,
const char *path) {
return drvp->vmt->set_cwd(drvp, path);
}
/**
* @brief Returns the current VFS directory.
*
* @param[in] drvp Pointer to the @p vfs_driver_c object.
* @param[out] buf Buffer for the path string.
* @param[in] size Size of the buffer.
* @return The operation result.
*
* @api
*/
static inline msg_t vfsDrvGetCurrentDirectory(vfs_driver_c *drvp,
char *buf, size_t size) {
return drvp->vmt->get_cwd(drvp, buf, size);
}
/**
* @brief Opens a VFS directory.
*
* @param[in] drvp Pointer to the @p vfs_driver_c object.
* @param[in] path Absolute path of the directory to be opened.
* @param[out] vdnpp Pointer to the pointer to the instantiated.
* @p vfs_directory_node_c object
* @return The operation result.
*
* @api
*/
static inline msg_t vfsDrvOpenDirectory(vfs_driver_c *drvp,
const char *path,
vfs_directory_node_c **vdnpp) {
return drvp->vmt->open_dir(drvp, path, vdnpp);
}
/**
* @brief Opens a VFS file.
*
* @param[in] drvp Pointer to the @p vfs_driver_c object.
* @param[in] path Path of the file to be opened.
* @param[in] mode File open mode.
* @param[out] vdnpp Pointer to the pointer to the instantiated
* @p vfs_file_node_c object.
* @return The operation result.
*
* @api
*/
static inline msg_t vfsDrvOpenFile(vfs_driver_c *drvp,
const char *path,
unsigned mode,
vfs_file_node_c **vfnpp) {
return drvp->vmt->open_file(drvp, path, mode, vfnpp);
}
#endif /* VFSDRIVERS_H */
/** @} */

View File

@ -84,7 +84,7 @@ void vfsInit(void) {
*/
msg_t vfsChangeCurrentDirectory(const char *path) {
return vfs_root->vmt->set_cwd(vfs_root, path);
return vfsDrvChangeCurrentDirectory(vfs_root, path);
}
/**
@ -98,7 +98,7 @@ msg_t vfsChangeCurrentDirectory(const char *path) {
*/
msg_t vfsGetCurrentDirectory(char *buf, size_t size) {
return vfs_root->vmt->get_cwd(vfs_root, buf, size);
return vfsDrvGetCurrentDirectory(vfs_root, buf, size);
}
/**
@ -114,7 +114,7 @@ msg_t vfsGetCurrentDirectory(char *buf, size_t size) {
msg_t vfsOpenDirectory(const char *path,
vfs_directory_node_c **vdnpp) {
return vfs_root->vmt->open_dir(vfs_root, path, vdnpp);
return vfsDrvOpenDirectory(vfs_root, path, vdnpp);
}
/**
@ -179,7 +179,7 @@ msg_t vfsOpenFile(const char *path,
unsigned mode,
vfs_file_node_c **vfnpp) {
return vfs_root->vmt->open_file(vfs_root, path, mode, vfnpp);
return vfsDrvOpenFile(vfs_root, path, mode, vfnpp);
}
/**