Added missing methods.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15262 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-12-27 08:03:36 +00:00
parent 22e97bb323
commit 472e68054c
5 changed files with 91 additions and 10 deletions

View File

@ -45,6 +45,8 @@
/* Module local variables. */
/*===========================================================================*/
static msg_t drv_set_cwd(void *instance, const char *path);
static msg_t drv_get_cwd(void *instance, char *buf, size_t size);
static msg_t drv_open_dir(void *instance,
const char *path,
vfs_directory_node_c **vdnpp);
@ -54,6 +56,8 @@ static msg_t drv_open_file(void *instance,
vfs_file_node_c **vfnpp);
static const struct vfs_sfs_driver_vmt driver_vmt = {
.set_cwd = drv_set_cwd,
.get_cwd = drv_get_cwd,
.open_dir = drv_open_dir,
.open_file = drv_open_file
};
@ -133,6 +137,31 @@ static struct {
/* Module local functions. */
/*===========================================================================*/
static msg_t drv_set_cwd(void *instance, const char *path) {
(void)instance;
if (strcmp(path, "/") != 0) {
return VFS_RET_ENOENT;
}
return VFS_RET_SUCCESS;
}
static msg_t drv_get_cwd(void *instance, char *buf, size_t size) {
(void)instance;
if (size < 2) {
return VFS_RET_ERANGE;
}
buf[0] = '/';
buf[1] = '\0';
return VFS_RET_SUCCESS;
}
static msg_t drv_open_dir(void *instance,
const char *path,
vfs_directory_node_c **vdnpp) {
@ -362,11 +391,9 @@ void __drv_sfs_init(void) {
*
* @api
*/
vfs_driver_c *drvSFSObjectInit(vfs_sfs_driver_c *drvp,
const char *rootname) {
vfs_driver_c *drvSFSObjectInit(vfs_sfs_driver_c *drvp) {
__base_object_objinit_impl(drvp, &driver_vmt);
drvp->rootname = rootname;
return (vfs_driver_c *)drvp;
}

View File

@ -166,8 +166,7 @@ typedef struct vfs_sfs_driver {
extern "C" {
#endif
void __drv_sfs_init(void);
vfs_driver_c *drvSFSObjectInit(vfs_sfs_driver_c *drvp,
const char *rootname);
vfs_driver_c *drvSFSObjectInit(vfs_sfs_driver_c *drvp);
#ifdef __cplusplus
}
#endif

View File

@ -45,6 +45,8 @@
/* Module local variables. */
/*===========================================================================*/
static msg_t drv_set_cwd(void *instance, const char *path);
static msg_t drv_get_cwd(void *instance, char *buf, size_t size);
static msg_t drv_open_dir(void *instance,
const char *path,
vfs_directory_node_c **vdnpp);
@ -54,6 +56,8 @@ static msg_t drv_open_file(void *instance,
vfs_file_node_c **vfnpp);
static const struct vfs_streams_driver_vmt driver_vmt = {
.set_cwd = drv_set_cwd,
.get_cwd = drv_get_cwd,
.open_dir = drv_open_dir,
.open_file = drv_open_file
};
@ -112,6 +116,31 @@ static struct {
/* Module local functions. */
/*===========================================================================*/
static msg_t drv_set_cwd(void *instance, const char *path) {
(void)instance;
if (strcmp(path, "/") != 0) {
return VFS_RET_ENOENT;
}
return VFS_RET_SUCCESS;
}
static msg_t drv_get_cwd(void *instance, char *buf, size_t size) {
(void)instance;
if (size < 2) {
return VFS_RET_ERANGE;
}
buf[0] = '/';
buf[1] = '\0';
return VFS_RET_SUCCESS;
}
static msg_t drv_open_dir(void *instance,
const char *path,
vfs_directory_node_c **vdnpp) {

View File

@ -45,6 +45,8 @@
/* Module local variables. */
/*===========================================================================*/
static msg_t drv_set_cwd(void *instance, const char *path);
static msg_t drv_get_cwd(void *instance, char *buf, size_t size);
static msg_t drv_open_dir(void *instance,
const char *path,
vfs_directory_node_c **vdnpp);
@ -54,6 +56,8 @@ static msg_t drv_open_file(void *instance,
vfs_file_node_c **vfnpp);
static const struct vfs_template_driver_vmt driver_vmt = {
.set_cwd = drv_set_cwd,
.get_cwd = drv_get_cwd,
.open_dir = drv_open_dir,
.open_file = drv_open_file
};
@ -133,6 +137,31 @@ static struct {
/* Module local functions. */
/*===========================================================================*/
static msg_t drv_set_cwd(void *instance, const char *path) {
(void)instance;
if (strcmp(path, "/") != 0) {
return VFS_RET_ENOENT;
}
return VFS_RET_SUCCESS;
}
static msg_t drv_get_cwd(void *instance, char *buf, size_t size) {
(void)instance;
if (size < 2) {
return VFS_RET_ERANGE;
}
buf[0] = '/';
buf[1] = '\0';
return VFS_RET_SUCCESS;
}
static msg_t drv_open_dir(void *instance,
const char *path,
vfs_directory_node_c **vdnpp) {
@ -362,11 +391,9 @@ void __drv_template_init(void) {
*
* @api
*/
vfs_driver_c *drvTEMPLATEObjectInit(vfs_template_driver_c *drvp,
const char *rootname) {
vfs_driver_c *drvTEMPLATEObjectInit(vfs_template_driver_c *drvp) {
__base_object_objinit_impl(drvp, &driver_vmt);
drvp->rootname = rootname;
return (vfs_driver_c *)drvp;
}

View File

@ -166,8 +166,7 @@ typedef struct vfs_template_driver {
extern "C" {
#endif
void __drv_template_init(void);
vfs_driver_c *drvTEMPLATEObjectInit(vfs_template_driver_c *drvp,
const char *rootname);
vfs_driver_c *drvTEMPLATEObjectInit(vfs_template_driver_c *drvp);
#ifdef __cplusplus
}
#endif