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

This commit is contained in:
Giovanni Di Sirio 2021-12-28 08:00:24 +00:00
parent 6247df5068
commit a75d6af9f5
7 changed files with 20 additions and 22 deletions

View File

@ -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 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 msg_t node_file_setpos(void *instance, vfs_offset_t offset);
static vfs_offset_t node_file_getpos(void *instance); 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 = { static const struct vfs_fatfs_file_node_vmt file_node_vmt = {
.release = node_file_release, .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); 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; vfs_fatfs_file_node_c *fffnp = (vfs_fatfs_file_node_c *)instance;
nsp->attr = (vfs_nodeattr_t)fffnp->file.obj.attr; fsp->attr = (vfs_nodeattr_t)fffnp->file.obj.attr;
nsp->size = (vfs_offset_t)fffnp->file.obj.objsize; fsp->size = (vfs_offset_t)fffnp->file.obj.objsize;
return VFS_RET_SUCCESS; return VFS_RET_SUCCESS;
} }

View File

@ -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 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 msg_t node_file_setpos(void *instance, vfs_offset_t offset);
static vfs_offset_t node_file_getpos(void *instance); 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 = { static const struct vfs_sfs_file_node_vmt file_node_vmt = {
.release = node_file_release, .release = node_file_release,
@ -289,10 +289,10 @@ static vfs_offset_t node_file_getpos(void *instance) {
return (vfs_offset_t)0; 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)instance;
(void)nsp; (void)fsp;
return VFS_RET_ENOSYS; return VFS_RET_ENOSYS;
} }

View File

@ -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 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 msg_t node_file_setpos(void *instance, vfs_offset_t offset);
static vfs_offset_t node_file_getpos(void *instance); 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 = { static const struct vfs_streams_file_node_vmt file_node_vmt = {
.release = node_file_release, .release = node_file_release,
@ -306,10 +306,10 @@ static vfs_offset_t node_file_getpos(void *instance) {
return 0U; 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)instance;
(void)nsp; (void)fsp;
return VFS_RET_ENOSYS; return VFS_RET_ENOSYS;
} }

View File

@ -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 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 msg_t node_file_setpos(void *instance, vfs_offset_t offset);
static vfs_offset_t node_file_getpos(void *instance); 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 = { static const struct vfs_template_file_node_vmt file_node_vmt = {
.release = node_file_release, .release = node_file_release,
@ -289,10 +289,10 @@ static vfs_offset_t node_file_getpos(void *instance) {
return (vfs_offset_t)0; 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)instance;
(void)nsp; (void)fsp;
return VFS_RET_ENOSYS; return VFS_RET_ENOSYS;
} }

View File

@ -145,7 +145,7 @@ extern "C" {
ssize_t vfsWriteFile(vfs_file_node_c *vfnp, const uint8_t *buf, size_t n); 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); msg_t vfsSetFilePosition(vfs_file_node_c *vfnp, vfs_offset_t offset);
vfs_offset_t vfsGetFilePosition(vfs_file_node_c *vfnp); 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); BaseSequentialStream *vfsGetFileStream(vfs_file_node_c *vfnp);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -91,7 +91,7 @@ typedef struct vfs_direntry_info {
* @brief Type of a node information structure. * @brief Type of a node information structure.
* @todo Add time, permissions etc. * @todo Add time, permissions etc.
*/ */
typedef struct vfs_node_stat { typedef struct vfs_file_stat {
/** /**
* @brief Size of the node. * @brief Size of the node.
*/ */
@ -100,7 +100,7 @@ typedef struct vfs_node_stat {
* @brief Size of the node. * @brief Size of the node.
*/ */
vfs_offset_t size; vfs_offset_t size;
} vfs_node_stat_t; } vfs_file_stat_t;
/** /**
* @brief Type of a generic VFS node class. * @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); \ ssize_t (*file_write)(void *instance, const uint8_t *buf, size_t n); \
msg_t (*file_setpos)(void *instance, vfs_offset_t offset); \ msg_t (*file_setpos)(void *instance, vfs_offset_t offset); \
vfs_offset_t (*file_getpos)(void *instance); \ vfs_offset_t (*file_getpos)(void *instance); \
msg_t (*file_getstat)(void *instance, vfs_node_stat_t *nsp); msg_t (*file_getstat)(void *instance, vfs_file_stat_t *fsp);
//msg_t (*file_stat)(void *instance, vfs_node_stat_t *nsp);
/** /**
* @brief @p vfs_file_node_c specific data. * @brief @p vfs_file_node_c specific data.

View File

@ -268,16 +268,16 @@ vfs_offset_t vfsGetFilePosition(vfs_file_node_c *vfnp) {
* @brief Returns the current file size. * @brief Returns the current file size.
*. *.
* @param[in] vfnp Pointer to the @p vfs_file_node_c object * @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. * @return The operation result.
* *
* @api * @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"); chDbgAssert(vfnp->references > 0U, "zero count");
return vfnp->vmt->file_getstat((void *)vfnp, nsp); return vfnp->vmt->file_getstat((void *)vfnp, fsp);
} }
/** /**