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 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;
}

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 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;
}

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 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;
}

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 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;
}

View File

@ -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
}

View File

@ -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.

View File

@ -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);
}
/**