From a75d6af9f5c6374f1165ea49fddb38e9f010bb40 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 28 Dec 2021 08:00:24 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15271 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/vfs/drivers/fatfs/drvfatfs.c | 8 ++++---- os/vfs/drivers/sfs/drvsfs.c | 6 +++--- os/vfs/drivers/streams/drvstreams.c | 6 +++--- os/vfs/drivers/template/drvtemplate.c | 6 +++--- os/vfs/include/vfs.h | 2 +- os/vfs/include/vfsnodes.h | 8 +++----- os/vfs/src/vfs.c | 6 +++--- 7 files changed, 20 insertions(+), 22 deletions(-) diff --git a/os/vfs/drivers/fatfs/drvfatfs.c b/os/vfs/drivers/fatfs/drvfatfs.c index 479b1b5bf..ce7d5fae5 100644 --- a/os/vfs/drivers/fatfs/drvfatfs.c +++ b/os/vfs/drivers/fatfs/drvfatfs.c @@ -78,7 +78,7 @@ static ssize_t node_file_read(void *instance, uint8_t *buf, size_t n); static ssize_t node_file_write(void *instance, const uint8_t *buf, size_t n); static msg_t node_file_setpos(void *instance, vfs_offset_t offset); static vfs_offset_t node_file_getpos(void *instance); -static msg_t node_file_getstat(void *instance, vfs_node_stat_t *nsp); +static msg_t node_file_getstat(void *instance, vfs_file_stat_t *fsp); static const struct vfs_fatfs_file_node_vmt file_node_vmt = { .release = node_file_release, @@ -441,11 +441,11 @@ static vfs_offset_t node_file_getpos(void *instance) { return (vfs_offset_t)f_tell(&fffnp->file); } -static msg_t node_file_getstat(void *instance, vfs_node_stat_t *nsp) { +static msg_t node_file_getstat(void *instance, vfs_file_stat_t *fsp) { vfs_fatfs_file_node_c *fffnp = (vfs_fatfs_file_node_c *)instance; - nsp->attr = (vfs_nodeattr_t)fffnp->file.obj.attr; - nsp->size = (vfs_offset_t)fffnp->file.obj.objsize; + fsp->attr = (vfs_nodeattr_t)fffnp->file.obj.attr; + fsp->size = (vfs_offset_t)fffnp->file.obj.objsize; return VFS_RET_SUCCESS; } diff --git a/os/vfs/drivers/sfs/drvsfs.c b/os/vfs/drivers/sfs/drvsfs.c index df6deb217..6b464632d 100644 --- a/os/vfs/drivers/sfs/drvsfs.c +++ b/os/vfs/drivers/sfs/drvsfs.c @@ -78,7 +78,7 @@ static ssize_t node_file_read(void *instance, uint8_t *buf, size_t n); static ssize_t node_file_write(void *instance, const uint8_t *buf, size_t n); static msg_t node_file_setpos(void *instance, vfs_offset_t offset); static vfs_offset_t node_file_getpos(void *instance); -static msg_t node_file_getstat(void *instance, vfs_node_stat_t *nsp); +static msg_t node_file_getstat(void *instance, vfs_file_stat_t *fsp); static const struct vfs_sfs_file_node_vmt file_node_vmt = { .release = node_file_release, @@ -289,10 +289,10 @@ static vfs_offset_t node_file_getpos(void *instance) { return (vfs_offset_t)0; } -static msg_t node_file_getstat(void *instance, vfs_node_stat_t *nsp) { +static msg_t node_file_getstat(void *instance, vfs_file_stat_t *fsp) { (void)instance; - (void)nsp; + (void)fsp; return VFS_RET_ENOSYS; } diff --git a/os/vfs/drivers/streams/drvstreams.c b/os/vfs/drivers/streams/drvstreams.c index 8e0d84d88..50f0cc2c4 100644 --- a/os/vfs/drivers/streams/drvstreams.c +++ b/os/vfs/drivers/streams/drvstreams.c @@ -78,7 +78,7 @@ static ssize_t node_file_read(void *instance, uint8_t *buf, size_t n); static ssize_t node_file_write(void *instance, const uint8_t *buf, size_t n); static msg_t node_file_setpos(void *instance, vfs_offset_t offset); static vfs_offset_t node_file_getpos(void *instance); -static msg_t node_file_getstat(void *instance, vfs_node_stat_t *nsp); +static msg_t node_file_getstat(void *instance, vfs_file_stat_t *fsp); static const struct vfs_streams_file_node_vmt file_node_vmt = { .release = node_file_release, @@ -306,10 +306,10 @@ static vfs_offset_t node_file_getpos(void *instance) { return 0U; } -static msg_t node_file_getstat(void *instance, vfs_node_stat_t *nsp) { +static msg_t node_file_getstat(void *instance, vfs_file_stat_t *fsp) { (void)instance; - (void)nsp; + (void)fsp; return VFS_RET_ENOSYS; } diff --git a/os/vfs/drivers/template/drvtemplate.c b/os/vfs/drivers/template/drvtemplate.c index b3622d8e6..b3cb4945d 100644 --- a/os/vfs/drivers/template/drvtemplate.c +++ b/os/vfs/drivers/template/drvtemplate.c @@ -78,7 +78,7 @@ static ssize_t node_file_read(void *instance, uint8_t *buf, size_t n); static ssize_t node_file_write(void *instance, const uint8_t *buf, size_t n); static msg_t node_file_setpos(void *instance, vfs_offset_t offset); static vfs_offset_t node_file_getpos(void *instance); -static msg_t node_file_getstat(void *instance, vfs_node_stat_t *nsp); +static msg_t node_file_getstat(void *instance, vfs_file_stat_t *fsp); static const struct vfs_template_file_node_vmt file_node_vmt = { .release = node_file_release, @@ -289,10 +289,10 @@ static vfs_offset_t node_file_getpos(void *instance) { return (vfs_offset_t)0; } -static msg_t node_file_getstat(void *instance, vfs_node_stat_t *nsp) { +static msg_t node_file_getstat(void *instance, vfs_file_stat_t *fsp) { (void)instance; - (void)nsp; + (void)fsp; return VFS_RET_ENOSYS; } diff --git a/os/vfs/include/vfs.h b/os/vfs/include/vfs.h index 66ae25c2c..17348c198 100644 --- a/os/vfs/include/vfs.h +++ b/os/vfs/include/vfs.h @@ -145,7 +145,7 @@ extern "C" { ssize_t vfsWriteFile(vfs_file_node_c *vfnp, const uint8_t *buf, size_t n); msg_t vfsSetFilePosition(vfs_file_node_c *vfnp, vfs_offset_t offset); vfs_offset_t vfsGetFilePosition(vfs_file_node_c *vfnp); - msg_t vfsGetFileStat(vfs_file_node_c *vfnp, vfs_node_stat_t *nsp); + msg_t vfsGetFileStat(vfs_file_node_c *vfnp, vfs_file_stat_t *fsp); BaseSequentialStream *vfsGetFileStream(vfs_file_node_c *vfnp); #ifdef __cplusplus } diff --git a/os/vfs/include/vfsnodes.h b/os/vfs/include/vfsnodes.h index ebcfa755c..2f1cde331 100644 --- a/os/vfs/include/vfsnodes.h +++ b/os/vfs/include/vfsnodes.h @@ -91,7 +91,7 @@ typedef struct vfs_direntry_info { * @brief Type of a node information structure. * @todo Add time, permissions etc. */ -typedef struct vfs_node_stat { +typedef struct vfs_file_stat { /** * @brief Size of the node. */ @@ -100,7 +100,7 @@ typedef struct vfs_node_stat { * @brief Size of the node. */ vfs_offset_t size; -} vfs_node_stat_t; +} vfs_file_stat_t; /** * @brief Type of a generic VFS node class. @@ -191,9 +191,7 @@ typedef struct vfs_file_node vfs_file_node_c; ssize_t (*file_write)(void *instance, const uint8_t *buf, size_t n); \ msg_t (*file_setpos)(void *instance, vfs_offset_t offset); \ vfs_offset_t (*file_getpos)(void *instance); \ - msg_t (*file_getstat)(void *instance, vfs_node_stat_t *nsp); - -//msg_t (*file_stat)(void *instance, vfs_node_stat_t *nsp); + msg_t (*file_getstat)(void *instance, vfs_file_stat_t *fsp); /** * @brief @p vfs_file_node_c specific data. diff --git a/os/vfs/src/vfs.c b/os/vfs/src/vfs.c index c17d39938..e12784b0e 100644 --- a/os/vfs/src/vfs.c +++ b/os/vfs/src/vfs.c @@ -268,16 +268,16 @@ vfs_offset_t vfsGetFilePosition(vfs_file_node_c *vfnp) { * @brief Returns the current file size. *. * @param[in] vfnp Pointer to the @p vfs_file_node_c object - * @param[out] nsp Pointer to a @p vfs_node_stat_t structure. + * @param[out] fsp Pointer to a @p vfs_file_stat_t structure. * @return The operation result. * * @api */ -msg_t vfsGetFileStat(vfs_file_node_c *vfnp, vfs_node_stat_t *nsp) { +msg_t vfsGetFileStat(vfs_file_node_c *vfnp, vfs_file_stat_t *fsp) { chDbgAssert(vfnp->references > 0U, "zero count"); - return vfnp->vmt->file_getstat((void *)vfnp, nsp); + return vfnp->vmt->file_getstat((void *)vfnp, fsp); } /**